1
0
Fork 0
mirror of synced 2024-11-23 01:05:34 -05:00
This commit is contained in:
bood 2013-08-18 00:28:20 +02:00
parent aaeea1b436
commit 59b5a8112b
6 changed files with 591 additions and 2 deletions

@ -1 +0,0 @@
Subproject commit 45d369eff6e2c5441ba21918825a8c215a44a951

View file

@ -0,0 +1,56 @@
# statline.vim : Improved status line for Vim
[https://github.com/millermedeiros/vim-statline](https://github.com/millermedeiros/vim-statline)
Add useful informations to the `statusline`.
Based on [gf3/.vimrc](https://github.com/gf3/dotfiles) and the statusline
from [factorylabs/vimfiles](https://github.com/factorylabs/vimfiles).
## Screenshots
### Details
![detail 01](https://github.com/millermedeiros/vim-statline/raw/dd9529564a/_assets/statline_details_01.png "statline description #1")
![detail 02](https://github.com/millermedeiros/vim-statline/raw/dd9529564a/_assets/statline_details_02.png "statline description #2")
### It automatically adapts to color schemes
#### molokai
![colorscheme example 1](https://github.com/millermedeiros/vim-statline/raw/dd9529564a/_assets/ss_01.png "colorscheme example 1")
#### solarized
![colorscheme example 2](https://github.com/millermedeiros/vim-statline/raw/dd9529564a/_assets/ss_02.png "colorscheme example 2")
#### darkblue
![mixed indenting](https://github.com/millermedeiros/vim-statline/raw/dd9529564a/_assets/ss_mi.png "mixed indenting example")
## Settings
Statline have a few settings to toggle the display of items, check
`help statline` for all the available options.
## Installation
If you don't have a preferred installation method, I recommend
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
then simply copy and paste:
cd ~/.vim/bundle
git clone git://github.com/millermedeiros/vim-statline.git
Once help tags have been generated, you can view the manual with
`:help statline`.
## License
Released under the [WTFPL](http://sam.zoy.org/wtfpl/).

View file

@ -0,0 +1,255 @@
*statline.txt* Improved status line for Vim
==============================================================================
CONTENTS *statline*
1.Intro........................................|statline-intro|
2.Options......................................|statline-options|
3.Credits......................................|statline-credits|
4.License......................................|statline-license|
5.Changelog....................................|statline-changelog|
==============================================================================
1. Introduction *statline-intro*
Statline is just a set of settings for the |statusline| to enhance the normal
functionality, providing useful information about the current file and buffer.
The latest dev versions are on github
https://github.com/millermedeiros/vim-statline
==============================================================================
2. Options *statline-options*
------------------------------------------------------------------------------
*'statline_syntastic'*
|syntastic| integration is enabled by default, to disable it: >
let g:statline_syntastic = 0
<
See |'syntastic_stl_format'| for customization info.
------------------------------------------------------------------------------
*'statline_fugitive'*
|fugitive| integration is disabled by default, to enable it: >
let g:statline_fugitive = 1
<
------------------------------------------------------------------------------
*'statline_rvm'*
|rvm| integration is disabled by default, to enable it: >
let g:statline_rvm = 1
<
------------------------------------------------------------------------------
*'statline_rbenv'*
|rbenv| integration is disabled by default, to enable it: >
let g:statline_rbenv = 1
<
------------------------------------------------------------------------------
*'statline_show_n_buffers'*
If it should show the number of active buffers before the buffer number
(default is on). Set the following to disable it: >
let g:statline_show_n_buffers = 0
<
------------------------------------------------------------------------------
*'statline_show_encoding'*
Whether or not to show the file format and encoding type (default is on)
Set the following to disable it: >
let g:statline_show_encoding = 0
<
------------------------------------------------------------------------------
*'statline_no_encoding_string'*
The text to show in the status line when the encoding is unknown (default is
'No Encoding').
Set it to your liking: >
let g:statline_no_encoding_string = 'NONE'
<
------------------------------------------------------------------------------
*'statline_filename_relative'*
If set, will show the relative path (from cwd) to the file, otherwise it will
only show the filename. Set the following to show by relative paths: >
let g:statline_filename_relative = 1
<
------------------------------------------------------------------------------
*'statline_trailing_space'*
Some languages are sensitive about trailing spaces, statline will check for
trailing spaces at the end of the lines during file save and also if buffer
becomes idle. To disable this feature set: >
let g:statline_trailing_space = 0
<
*statline-[\s]*
Trailing space errors:~
[\s] Warns that file contain trailing white spaces.
------------------------------------------------------------------------------
*'statline_mixed_indent'*
Some languages are sensitive about indenting, statline will check for mixed
indenting during file save and also if buffer becomes idle. To disable this
feature set: >
let g:statline_mixed_indent = 0
<
*statline-[&et]* *statline-[mix]*
Mixed indent errors:~
[&et] Warn if using different tab format than the one
specified by |expandtab| or |noet|.
[mix] Warn if mixed tabs & spaces are used for indenting on
the same line.
PS: it will ignore spaces just before `*` to avoid
marking JavaDoc style comments as mixed indent.
------------------------------------------------------------------------------
*'statline_mixed_indent_string'*
Message shown when file contains mixed tabs & spaces. Defaults to
'[mix]'. To edit it: >
let g:statline_mixed_indent_string = '[mixed-indenting]'
<
------------------------------------------------------------------------------
*'statline_show_charcode'*
If set, will show the code of the character currently under the cursor. It is
disabled by default. Set the following to enable it: >
let g:statline_show_charcode = 1
<
------------------------------------------------------------------------------
*statline-colors*
Statline adapts to your colorcheme without any extra settings but if you want
to customize it it's very simple.
The colors are set by |hl-User1..9| and linked to your colorcheme colors, here
are the default settings: >
" filename
hi link User1 Identifier
" flags
hi link User2 Statement
" errors
hi link User3 Error
" fugitive
hi link User4 Special
<
You can change these colors inside your .vimrc file, eg: >
hi link User2 Constant
hi User3 guifg=#FFFFFF guibg=#FF0000 gui=bold ctermfg=15 ctermbg=1
<
To check the existing Syntax highlighting groups and their colors use the
command >
:so $VIMRUNTIME/syntax/hitest.vim
<
If you want to disable all colors the easiest way is to link the |hl-User1..9|
groups to the |hl-StatusLine| group: >
hi link User1 StatusLine
hi link User2 StatusLine
hi link User3 StatusLine
hi link User4 StatusLine
<
The |hl-StatusLine| and |hl-StatusLineNC| groups usually set the colors with
`term=reverse` which means the foreground color will be used as background
color, you can change the colors like this: >
" greyscale statusline
hi StatusLine guifg=#000000 guibg=#FFFFFF ctermfg=0 ctermbg=15
hi StatusLineNC guifg=#808080 guibg=#000000 ctermfg=8 ctermbg=0
<
==============================================================================
3. Credits *statline-credits*
This plugin was originally assembled by @millermedeiros (Miller Medeiros).
It was heavily inspired by the Vim settings from @factorylabs, @gf3 (Gianni
Chiappetta) and @scrooloose whitespace flags (Martin Grengell).
Other contributors:
- Matthew Kitt (@mkitt)
- @Idx
- Nikola Knežević (@knl)
- Martin Grengell (@scrooloose)
==============================================================================
4. License *statline-license*
statline is released under the wtfpl http://sam.zoy.org/wtfpl/COPYING
==============================================================================
5. Changelog *statline-changelog*
Next
- Add |'statline_mixed_indent_string'| and change default string to
"[mix]" for brevity. [#19]
------------------------------------------------------------------------------
v0.3.0 (2011/12/27)
- Add |'statline_show_charcode'| (@knl)
- Add |'statline_no_encoding_string'| (@knl)
- Add |'statline_show_n_buffers'| [#2]
- Add |'statline_rbenv'| [#15]
- Fix problem with non-utf8 encoding. [#13]
- Create |augroup| to wrap all |autocmd| and make sure commands are cleared
before adding new ones, avoids setting same command multiple times.
- Add safe checks to all plugins to make sure they aren't called if they
don't exist, make it more portable since users may copy vimrc files that
enable plugin integration.
- Improve whitespace checks. (@scrooloose)
------------------------------------------------------------------------------
v0.2.1 (2011/10/17)
- Fix expand-tab RegExp [#8]
- Always display statusline. [#3]
- Check if syntastic exists before calling it. [#6]
------------------------------------------------------------------------------
v0.2.0 (2011/10/17)
- RVM integration |'statline_rvm'| (@mkitt)
- Toggle file format and encoding |'statline_show_encoding'| (@mkitt)
- Relative path on filename |'statline_filename_relative'| (@mkitt)
------------------------------------------------------------------------------
v0.1.0 (2011/10/06)
- initial release

View file

@ -0,0 +1,23 @@
'statline_filename_relative' statline.txt /*'statline_filename_relative'*
'statline_fugitive' statline.txt /*'statline_fugitive'*
'statline_mixed_indent' statline.txt /*'statline_mixed_indent'*
'statline_mixed_indent_string' statline.txt /*'statline_mixed_indent_string'*
'statline_no_encoding_string' statline.txt /*'statline_no_encoding_string'*
'statline_rbenv' statline.txt /*'statline_rbenv'*
'statline_rvm' statline.txt /*'statline_rvm'*
'statline_show_charcode' statline.txt /*'statline_show_charcode'*
'statline_show_encoding' statline.txt /*'statline_show_encoding'*
'statline_show_n_buffers' statline.txt /*'statline_show_n_buffers'*
'statline_syntastic' statline.txt /*'statline_syntastic'*
'statline_trailing_space' statline.txt /*'statline_trailing_space'*
statline statline.txt /*statline*
statline-[&et] statline.txt /*statline-[&et]*
statline-[\s] statline.txt /*statline-[\\s]*
statline-[mix] statline.txt /*statline-[mix]*
statline-changelog statline.txt /*statline-changelog*
statline-colors statline.txt /*statline-colors*
statline-credits statline.txt /*statline-credits*
statline-intro statline.txt /*statline-intro*
statline-license statline.txt /*statline-license*
statline-options statline.txt /*statline-options*
statline.txt statline.txt /*statline.txt*

View file

@ -0,0 +1,256 @@
" ============================================================================
" File: statline.vim
" Maintainer: Miller Medeiros <http://blog.millermedeiros.com/>
" Description: Add useful info to the statusline and basic error checking.
" Last Change: 2011-11-10
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
" ============================================================================
if exists("g:loaded_statline_plugin")
finish
endif
let g:loaded_statline_plugin = 1
" always display statusline (iss #3)
set laststatus=2
" ====== colors ======
" using link instead of named highlight group inside the statusline to make it
" easier to customize, reseting the User[n] highlight will remove the link.
" Another benefit is that colors will adapt to colorscheme.
"filename
hi default link User1 Identifier
" flags
hi default link User2 Statement
" errors
hi default link User3 Error
" fugitive
hi default link User4 Special
" ====== basic info ======
" ---- number of buffers : buffer number ----
function! StatlineBufCount()
if !exists("s:statline_n_buffers")
let s:statline_n_buffers = len(filter(range(1,bufnr('$')), 'buflisted(v:val)'))
endif
return s:statline_n_buffers
endfunction
if !exists('g:statline_show_n_buffers')
let g:statline_show_n_buffers = 1
endif
if g:statline_show_n_buffers
set statusline=[%{StatlineBufCount()}\:%n]\ %<
" only calculate buffers after adding/removing buffers
augroup statline_nbuf
autocmd!
autocmd BufAdd,BufDelete * unlet! s:statline_n_buffers
augroup END
else
set statusline=[%n]\ %<
endif
" ---- filename (relative or tail) ----
if exists('g:statline_filename_relative')
set statusline+=%1*[%f]%*
else
set statusline+=%1*[%t]%*
endif
" ---- flags ----
" (h:help:[help], w:window:[Preview], m:modified:[+][-], r:readonly:[RO])
set statusline+=%2*%h%w%m%r%*
" ---- filetype ----
set statusline+=\ %y
" ---- file format → file encoding ----
if &encoding == 'utf-8'
let g:statline_encoding_separator = '→'
else
let g:statline_encoding_separator = ':'
endif
if !exists('g:statline_show_encoding')
let g:statline_show_encoding = 1
endif
if !exists('g:statline_no_encoding_string')
let g:statline_no_encoding_string = 'No Encoding'
endif
if g:statline_show_encoding
set statusline+=[%{&ff}%{g:statline_encoding_separator}%{strlen(&fenc)?&fenc:g:statline_no_encoding_string}]
endif
" ---- separation between left/right aligned items ----
set statusline+=%=
" ---- current line and column ----
" (-:left align, 14:minwid, l:line, L:nLines, c:column)
set statusline+=%-14(\ L%l/%L:C%c\ %)
" ---- scroll percent ----
set statusline+=%P
" ---- code of character under cursor ----
if !exists('g:statline_show_charcode')
let g:statline_show_charcode = 0
endif
if g:statline_show_charcode
" (b:num, B:hex)
set statusline+=%9(\ \%b/0x\%B%)
endif
" ====== plugins ======
" ---- RVM ----
if !exists('g:statline_rvm')
let g:statline_rvm = 0
endif
if g:statline_rvm
set statusline+=%{exists('g:loaded_rvm')?rvm#statusline():''}
endif
" ---- rbenv ----
if !exists('g:statline_rbenv')
let g:statline_rbenv = 0
endif
if g:statline_rbenv
set statusline+=%{exists('g:loaded_rbenv')?rbenv#statusline():''}
endif
" ---- Fugitive ----
if !exists('g:statline_fugitive')
let g:statline_fugitive = 0
endif
if g:statline_fugitive
set statusline+=%4*%{exists('g:loaded_fugitive')?fugitive#statusline():''}%*
endif
" ---- Syntastic errors ----
if !exists('g:statline_syntastic')
let g:statline_syntastic = 1
endif
if g:statline_syntastic
set statusline+=\ %3*%{exists('g:loaded_syntastic_plugin')?SyntasticStatuslineFlag():''}%*
endif
" ====== custom errors ======
" based on @scrooloose whitespace flags
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
" ---- mixed indenting ----
if !exists('g:statline_mixed_indent')
let g:statline_mixed_indent = 1
endif
if !exists('g:statline_mixed_indent_string')
let g:statline_mixed_indent_string = '[mix]'
endif
"return '[&et]' if &et is set wrong
"return '[mixed-indenting]' if spaces and tabs are used to indent
"return an empty string if everything is fine
function! StatlineTabWarning()
if !exists("b:statline_indent_warning")
let b:statline_indent_warning = ''
if !&modifiable
return b:statline_indent_warning
endif
let tabs = search('^\t', 'nw') != 0
"find spaces that arent used as alignment in the first indent column
let spaces = search('^ \{' . &ts . ',}[^\t]', 'nw') != 0
if tabs && spaces
let b:statline_indent_warning = g:statline_mixed_indent_string
elseif (spaces && !&et) || (tabs && &et)
let b:statline_indent_warning = '[&et]'
endif
endif
return b:statline_indent_warning
endfunction
if g:statline_mixed_indent
set statusline+=%3*%{StatlineTabWarning()}%*
" recalculate when idle and after writing
augroup statline_indent
autocmd!
autocmd cursorhold,bufwritepost * unlet! b:statline_indent_warning
augroup END
endif
" --- trailing white space ---
if !exists('g:statline_trailing_space')
let g:statline_trailing_space = 1
endif
function! StatlineTrailingSpaceWarning()
if !exists("b:statline_trailing_space_warning")
if search('\s\+$', 'nw') != 0
let b:statline_trailing_space_warning = '[\s]'
else
let b:statline_trailing_space_warning = ''
endif
endif
return b:statline_trailing_space_warning
endfunction
if g:statline_trailing_space
set statusline+=%3*%{StatlineTrailingSpaceWarning()}%*
" recalculate when idle, and after saving
augroup statline_trail
autocmd!
autocmd cursorhold,bufwritepost * unlet! b:statline_trailing_space_warning
augroup END
endif

View file

@ -26,7 +26,7 @@ vim-markdown https://github.com/tpope/vim-markdown
vim-pyte https://github.com/therubymug/vim-pyte
vim-snipmate https://github.com/garbas/vim-snipmate
vim-snippets https://github.com/honza/vim-snippets
vim-statline https://github.com/millermedeiros/vim-statline
vim.statline https://github.com/millermedeiros/vim-statline
vim-surround https://github.com/tpope/vim-surround
vim-expand-region https://github.com/terryma/vim-expand-region
vim-multiple-cursors https://github.com/terryma/vim-multiple-cursors