commit
a66944a6c5
381 changed files with 22912 additions and 19677 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,8 +1,9 @@
|
|||
temp_dirs/undodir*
|
||||
temp_dirs/undodir/*
|
||||
sources_non_forked/ack.vim/.netrwhist
|
||||
temp_dirs/yankring_history_v2.txt
|
||||
sources_forked/yankring/doc/tags
|
||||
sources_non_forked/tlib/doc/tags
|
||||
sources_non_forked/ctrlp.vim/doc/tags*
|
||||
my_configs.vim
|
||||
tags
|
||||
.DS_Store
|
||||
|
|
45
README.md
45
README.md
|
@ -31,6 +31,10 @@ This is useful to install on remote servers where you don't need many plugins an
|
|||
Use [msysgit](http://msysgit.github.com/) to checkout the repository and run the installation instructions above. No special instructions needed ;-)
|
||||
|
||||
|
||||
## How to install on Linux
|
||||
|
||||
If you have vim aliased as `vi` instead of `vim`, make sure to either alias it: `alias vi=vim`. Otherwise, `apt-get install vim`
|
||||
|
||||
## How to update to latest version?
|
||||
|
||||
Simply just do a git rebase!
|
||||
|
@ -62,24 +66,24 @@ Distraction free mode using [goyo.vim](https://github.com/junegunn/goyo.vim) and
|
|||
I recommend reading the docs of these plugins to understand them better. Each of them provide a much better Vim experience!
|
||||
|
||||
* [pathogen.vim](https://github.com/tpope/vim-pathogen): Manages the runtime path of the plugins
|
||||
* [YankRing](https://github.com/vim-scripts/YankRing.vim): Maintains a history of previous yanks, changes and deletes
|
||||
* [snipMate.vim](https://github.com/garbas/vim-snipmate): snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim
|
||||
* [bufexplorer.zip](https://github.com/vim-scripts/bufexplorer.zip): Buffer Explorer / Browser. This plugin can be opened with `<leader+o>`
|
||||
* [NERD Tree](https://github.com/scrooloose/nerdtree): A tree explorer plugin for vim
|
||||
* [ack.vim](https://github.com/mileszs/ack.vim): Vim plugin for the Perl module / CLI script 'ack'
|
||||
* [ag.vim](https://github.com/rking/ag.vim): A much faster Ack
|
||||
* [ctrlp.vim](https://github.com/kien/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. In my config it's mapped to `<Ctrl+F>`, because `<Ctrl+P>` is used by YankRing
|
||||
* [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. In my config it's mapped to `<Ctrl+F>`, because `<Ctrl+P>` is used by YankRing
|
||||
* [mru.vim](https://github.com/vim-scripts/mru.vim): Plugin to manage Most Recently Used (MRU) files. Includes my own fork which adds syntax highlighting to MRU. This plugin can be opened with `<leader+f>`
|
||||
* [open_file_under_cursor.vim](https://github.com/amix/open_file_under_cursor.vim): Open file under cursor when pressing `gf`
|
||||
* [vim-indent-object](https://github.com/michaeljsmith/vim-indent-object): Defines a new text object representing lines of code at the same indent level. Useful for python/vim scripts
|
||||
* [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors): Sublime Text style multiple selections for Vim, CTRL+N is remapped to CTRL+S (due to YankRing)
|
||||
* [vim-expand-region](https://github.com/terryma/vim-expand-region): Allows you to visually select increasingly larger regions of text using the same key combination.
|
||||
* [vim-airline](https://github.com/bling/vim-airline): Lean & mean status/tabline for vim that's light as air (replacing powerline)
|
||||
* [vim-fugitive](https://github.com/tpope/vim-fugitive): A Git wrapper so awesome, it should be illegal
|
||||
* [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2):
|
||||
Remove all clutter and focus only on the essential. Similar to iA Writer or Write Room [Read more here](http://amix.dk/blog/post/19744)
|
||||
* [vim-commentary](https://github.com/tpope/vim-commentary): Comment stuff out. Use `gcc` to comment out a line (takes a count), `gc` to comment out the target of a motion. `gcu` uncomments a set of adjacent commented lines.
|
||||
* [syntastic](https://github.com/scrooloose/syntastic): Syntax checking hacks for vim
|
||||
* [vim-yankstack](https://github.com/maxbrunsfeld/vim-yankstack): Maintains a history of previous yanks, changes and deletes
|
||||
* [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim
|
||||
|
||||
|
||||
## Included color schemes
|
||||
|
@ -121,42 +125,33 @@ Now you have vim-rails installed ;-)
|
|||
|
||||
### Plugin related mappings
|
||||
|
||||
Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) and see and manage the current buffers:
|
||||
Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) and see and manage the current buffers (`<leader>o`):
|
||||
|
||||
map <leader>o :BufExplorer<cr>
|
||||
|
||||
Open [MRU.vim](https://github.com/vim-scripts/mru.vim) and see the recently open files:
|
||||
Open [MRU.vim](https://github.com/vim-scripts/mru.vim) and see the recently open files (`<leader>f`):
|
||||
|
||||
map <leader>f :MRU<CR>
|
||||
|
||||
Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin:
|
||||
Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin (`<leader>j` or `<ctrl>f`):
|
||||
|
||||
let g:ctrlp_map = '<c-f>'
|
||||
|
||||
Open [PeepOpen](http://topfunky.github.io/PeepOpen/) plugin:
|
||||
|
||||
map <leader>j :PeepOpen<cr>
|
||||
|
||||
Managing the [NERD Tree](https://github.com/scrooloose/nerdtree) plugin:
|
||||
|
||||
map <leader>nn :NERDTreeToggle<cr>
|
||||
map <leader>nb :NERDTreeFromBookmark
|
||||
map <leader>nf :NERDTreeFind<cr>
|
||||
|
||||
[goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2) lets you only focus on one thing at a time. It removes all the distractions and centers the content. It has a special look when editing Markdown, reStructuredText and textfiles. It only has one mapping.
|
||||
[goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2) lets you only focus on one thing at a time. It removes all the distractions and centers the content. It has a special look when editing Markdown, reStructuredText and textfiles. It only has one mapping. (`<leader>z`)
|
||||
|
||||
map <leader>z :Goyo<cr>
|
||||
|
||||
### Normal mode mappings
|
||||
|
||||
Fast saving of a buffer:
|
||||
Fast saving of a buffer (`<leader>w`):
|
||||
|
||||
nmap <leader>w :w!<cr>
|
||||
|
||||
Treat long lines as break lines (useful when moving around in them):
|
||||
|
||||
map j gj
|
||||
map k gk
|
||||
|
||||
Map `<Space>` to `/` (search) and `<Ctrl>+<Space>` to `?` (backwards search):
|
||||
|
||||
|
@ -168,14 +163,14 @@ Disable highlight when `<leader><cr>` is pressed:
|
|||
|
||||
map <silent> <leader><cr> :noh<cr>
|
||||
|
||||
Smart way to move between windows:
|
||||
Smart way to move between windows (`<ctrl>j` etc.):
|
||||
|
||||
map <C-j> <C-W>j
|
||||
map <C-k> <C-W>k
|
||||
map <C-h> <C-W>h
|
||||
map <C-l> <C-W>l
|
||||
|
||||
Closing of current buffer(s):
|
||||
Closing of current buffer(s) (`<leader>bd` and (`<leader>ba`)):
|
||||
|
||||
" Close current buffer
|
||||
map <leader>bd :Bclose<cr>
|
||||
|
@ -312,18 +307,6 @@ Vimscript mappings:
|
|||
map <leader>n :cn<cr>
|
||||
map <leader>p :cp<cr>
|
||||
|
||||
## Useful blog tips regarding my Vim setup
|
||||
|
||||
* [Vim: Annotate strings with gettext (the macro way)](http://amix.dk/blog/post/19678#Vim-Annotate-strings-with-gettext-the-macro-way)
|
||||
* [vimgrep: Searching through multiple file extensions](http://amix.dk/blog/post/19672#vimgrep-Searching-through-multiple-file-extensions)
|
||||
* [Filtering through vimgrep results using regular expressions](http://amix.dk/blog/post/19666#Filtering-through-vimgrep-results-using-regular-expressions)
|
||||
* [PeepOpen - File auto completion for Mac editors](http://amix.dk/blog/post/19601#PeepOpen-File-auto-completion-for-Mac-editors)
|
||||
* [Vim 7.3: Persistent undo and encryption!](http://amix.dk/blog/post/19548#Vim-7-3-Persistent-undo-and-encryption)
|
||||
* [Vim tips: Visual Search](http://amix.dk/blog/post/19334#Vim-tips-Visual-Search)
|
||||
* [Folding in Vim](http://amix.dk/blog/post/19132#Folding-in-Vim)
|
||||
* [
|
||||
Zen room for Vim: Focusing only on the essential](http://amix.dk/blog/post/19744#zenroom-for-Vim-Focsuing-only-on-the-essential)
|
||||
|
||||
## How to uninstall
|
||||
Do following:
|
||||
* Remove `~/.vim_runtime`
|
||||
|
|
|
@ -77,7 +77,7 @@ if &background=='light'
|
|||
hi WarningMsg guifg=#b02000 guibg=NONE gui=NONE
|
||||
hi WildMenu guifg=fg guibg=#d0d090 gui=NONE
|
||||
hi Folded guifg=NONE guibg=#b0e0b0 gui=NONE
|
||||
hi FoldColumn guifg=fg guibg=#90e090 gui=NONE
|
||||
hi FoldColumn guifg=fg guibg=NONE gui=NONE
|
||||
hi DiffAdd guifg=NONE guibg=#b0b0e0 gui=NONE
|
||||
hi DiffChange guifg=NONE guibg=#e0b0e0 gui=NONE
|
||||
hi DiffDelete guifg=#002090 guibg=#d0d0d0 gui=NONE
|
||||
|
@ -190,7 +190,7 @@ if &background=='light'
|
|||
hi WarningMsg ctermfg=124 ctermbg=NONE cterm=NONE
|
||||
hi WildMenu ctermfg=fg ctermbg=186 cterm=NONE
|
||||
hi Folded ctermfg=NONE ctermbg=151 cterm=NONE
|
||||
hi FoldColumn ctermfg=fg ctermbg=114 cterm=NONE
|
||||
hi FoldColumn ctermfg=fg ctermbg=NONE cterm=NONE
|
||||
hi DiffAdd ctermfg=NONE ctermbg=146 cterm=NONE
|
||||
hi DiffChange ctermfg=NONE ctermbg=182 cterm=NONE
|
||||
hi DiffDelete ctermfg=18 ctermbg=252 cterm=NONE
|
||||
|
@ -289,7 +289,7 @@ elseif &background=='dark'
|
|||
hi WarningMsg guifg=#f08060 guibg=NONE gui=NONE
|
||||
hi WildMenu guifg=#000000 guibg=#d0d090 gui=NONE
|
||||
hi Folded guifg=#aaaaaa guibg=#333333 gui=NONE
|
||||
hi FoldColumn guifg=#202020 guibg=#202020 gui=NONE
|
||||
hi FoldColumn guifg=#202020 guibg=NONE gui=NONE
|
||||
hi DiffAdd guifg=NONE guibg=#000080 gui=NONE
|
||||
hi DiffChange guifg=NONE guibg=#800080 gui=NONE
|
||||
hi DiffDelete guifg=#6080f0 guibg=#202020 gui=NONE
|
||||
|
@ -370,7 +370,7 @@ elseif &background=='dark'
|
|||
hi Question ctermfg=Black ctermbg=DarkYellow
|
||||
hi Todo ctermfg=DarkRed ctermbg=DarkYellow
|
||||
hi Folded ctermfg=DarkGrey ctermbg=DarkGrey
|
||||
hi FoldColumn ctermfg=DarkGrey ctermbg=DarkGrey
|
||||
hi FoldColumn ctermfg=DarkGrey ctermbg=NONE
|
||||
hi ModeMsg ctermfg=Grey ctermbg=DarkBlue
|
||||
hi VisualNOS ctermfg=Grey ctermbg=DarkBlue
|
||||
hi ErrorMsg ctermfg=DarkYellow ctermbg=DarkRed
|
||||
|
@ -525,7 +525,7 @@ elseif &background=='dark'
|
|||
hi WarningMsg ctermfg=209 ctermbg=NONE cterm=NONE
|
||||
hi WildMenu ctermfg=16 ctermbg=186 cterm=NONE
|
||||
hi Folded ctermfg=NONE ctermbg=DarkGrey cterm=NONE
|
||||
hi FoldColumn ctermfg=DarkGrey ctermbg=DarkGrey cterm=NONE
|
||||
hi FoldColumn ctermfg=DarkGrey ctermbg=NONE cterm=NONE
|
||||
hi DiffAdd ctermfg=NONE ctermbg=18 cterm=NONE
|
||||
hi DiffChange ctermfg=NONE ctermbg=90 cterm=NONE
|
||||
hi DiffDelete ctermfg=69 ctermbg=234 cterm=NONE
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -122,6 +122,19 @@ nice code clean-up (which ack.vim is now hopefully getting), and ack.vim picked
|
|||
up a few features that haven't made their way to ag.vim, like `:AckWindow`,
|
||||
optional background search execution with [vim-dispatch], and auto-previewing.
|
||||
|
||||
#### I don't want to jump to the first result automatically. ####
|
||||
|
||||
Use `:Ack!`, with bang. If you want this behavior most of the time, you might
|
||||
like an abbreviation or mapping in your personal config, something like these:
|
||||
|
||||
```vim
|
||||
cnoreabbrev Ack Ack!
|
||||
nnoremap <Leader>a :Ack!<Space>
|
||||
```
|
||||
|
||||
Most of the `:[L]Ack*` commands support this. Note that this behavior follows
|
||||
the convention of Vim's built-in `:grep` and `:make` commands.
|
||||
|
||||
[The Silver Searcher]: https://github.com/ggreer/the_silver_searcher
|
||||
[sadface]: https://github.com/mileszs/ack.vim/commit/d97090fb502d40229e6976dfec0e06636ba227d5#commitcomment-5771145
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
if exists('g:autoloaded_ack') || &cp
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists('g:ack_use_dispatch')
|
||||
if g:ack_use_dispatch && !exists(':Dispatch')
|
||||
call s:Warn('Dispatch not loaded! Falling back to g:ack_use_dispatch = 0.')
|
||||
|
@ -26,9 +30,23 @@ function! ack#Ack(cmd, args) "{{{
|
|||
let l:grepformat = '%f'
|
||||
endif
|
||||
|
||||
" Check user policy for blank searches
|
||||
if empty(a:args)
|
||||
if !g:ack_use_cword_for_empty_search
|
||||
echo "No regular expression found."
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
" If no pattern is provided, search for the word under the cursor
|
||||
let l:grepargs = empty(a:args) ? expand("<cword>") : a:args . join(a:000, ' ')
|
||||
|
||||
"Bypass search if cursor is on blank string
|
||||
if l:grepargs == ""
|
||||
echo "No regular expression found."
|
||||
return
|
||||
endif
|
||||
|
||||
" NOTE: we escape special chars, but not everything using shellescape to
|
||||
" allow for passing arguments etc
|
||||
let l:escaped_args = escape(l:grepargs, '|#%')
|
||||
|
@ -224,4 +242,5 @@ function! s:Warn(msg) "{{{
|
|||
echohl WarningMsg | echomsg 'Ack: ' . a:msg | echohl None
|
||||
endf "}}}
|
||||
|
||||
let g:autoloaded_ack = 1
|
||||
" vim:set et sw=2 ts=2 tw=78 fdm=marker
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
Author: Antoine Imbert <antoine.imbert+ackvim@gmail.com> *ack-author*
|
||||
License: Same terms as Vim itself (see |license|)
|
||||
|
||||
This plugin is only available if 'compatible' is not set.
|
||||
|
||||
{Vi does not have any of this}
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *ack*
|
||||
|
||||
|
@ -16,7 +20,7 @@ shows the results in a split window.
|
|||
Search recursively in {directory} (which defaults to the current
|
||||
directory) for the {pattern}. Behaves just like the |:grep| command, but
|
||||
will open the |Quickfix| window for you. If [!] is not given the first
|
||||
occurence is jumped to.
|
||||
occurrence is jumped to.
|
||||
|
||||
:AckAdd [options] {pattern} [{directory}] *:AckAdd*
|
||||
|
||||
|
@ -90,7 +94,6 @@ Example:
|
|||
>
|
||||
let g:ackprg = "ag --vimgrep"
|
||||
<
|
||||
|
||||
*g:ack_default_options*
|
||||
g:ack_default_options
|
||||
Default: " -s -H --nocolor --nogroup --column"
|
||||
|
@ -107,18 +110,17 @@ Example:
|
|||
let g:ack_default_options =
|
||||
\ " -s -H --nocolor --nogroup --column --smart-case --follow"
|
||||
<
|
||||
|
||||
*g:ack_apply_qmappings*
|
||||
g:ack_apply_qmappings
|
||||
Default: 1
|
||||
|
||||
This option enable mappings on quickview window.
|
||||
This option enables mappings on the |quickfix| window.
|
||||
|
||||
*g:ack_apply_lmappings*
|
||||
g:ack_apply_lmappings
|
||||
Default: 1
|
||||
|
||||
This option enable mappings on Location list window.
|
||||
This option enables mappings on |location-list| windows.
|
||||
|
||||
*g:ack_mappings*
|
||||
g:ack_mappings
|
||||
|
@ -139,7 +141,6 @@ Example, if you want to open the result in the middle of the screen:
|
|||
>
|
||||
let g:ack_mappings = { "o": "<CR>zz" }
|
||||
<
|
||||
|
||||
*g:ack_qhandler*
|
||||
g:ack_qhandler
|
||||
Default: "botright copen"
|
||||
|
@ -150,7 +151,6 @@ If you want to open a quickview window with 30 lines you can do:
|
|||
>
|
||||
let g:ack_qhandler = "botright copen 30"
|
||||
<
|
||||
|
||||
*g:ack_lhandler*
|
||||
g:ack_lhandler
|
||||
Default: "botright lopen"
|
||||
|
@ -161,9 +161,7 @@ If you want to open a Location list window with 30 lines you can do:
|
|||
>
|
||||
let g:ack_lhandler = "botright lopen 30"
|
||||
<
|
||||
|
||||
*g:ackhighlight*
|
||||
|
||||
g:ackhighlight
|
||||
Default: 0
|
||||
|
||||
|
@ -173,7 +171,6 @@ Example:
|
|||
>
|
||||
let g:ackhighlight = 1
|
||||
<
|
||||
|
||||
*g:ack_autoclose*
|
||||
g:ack_autoclose
|
||||
Default: 0
|
||||
|
@ -185,9 +182,7 @@ Example:
|
|||
>
|
||||
let g:ack_autoclose = 1
|
||||
<
|
||||
|
||||
*g:ack_autofold_results*
|
||||
|
||||
g:ack_autofold_results
|
||||
Default: 0
|
||||
|
||||
|
@ -200,9 +195,7 @@ Example:
|
|||
>
|
||||
let g:ack_autofold_results = 1
|
||||
<
|
||||
|
||||
*g:ackpreview*
|
||||
|
||||
g:ackpreview
|
||||
Default: 0
|
||||
|
||||
|
@ -212,9 +205,7 @@ Example:
|
|||
>
|
||||
let g:ackpreview = 1
|
||||
<
|
||||
|
||||
*g:ack_use_dispatch*
|
||||
|
||||
g:ack_use_dispatch
|
||||
Default: 0
|
||||
|
||||
|
@ -229,28 +220,96 @@ Example:
|
|||
>
|
||||
let g:ack_use_dispatch = 1
|
||||
<
|
||||
*g:ack_use_cword_for_empty_search*
|
||||
g:ack_use_cword_for_empty_search
|
||||
Default: 1
|
||||
|
||||
Use this option to enable blank searches to run against the word under the
|
||||
cursor. When this option is not set, blank searches will only output an error
|
||||
message.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:ack_use_cword_for_empty_search = 0
|
||||
<
|
||||
==============================================================================
|
||||
MAPPINGS *ack-mappings*
|
||||
|
||||
The following keyboard shortcuts are available in the quickfix window:
|
||||
The following keyboard shortcuts are available in the |quickfix| and
|
||||
|location-list| windows:
|
||||
|
||||
o open file (same as enter).
|
||||
? display a quick summary of these mappings.
|
||||
|
||||
O open file and close quickfix window.
|
||||
o open file (same as Enter).
|
||||
|
||||
O open file and close the quickfix window.
|
||||
|
||||
go preview file (open but maintain focus on ack.vim results).
|
||||
|
||||
t open in a new tab.
|
||||
|
||||
T open in new tab silently.
|
||||
T open in new tab without moving to it.
|
||||
|
||||
h open in horizontal split.
|
||||
|
||||
H open in horizontal split silently.
|
||||
H open in horizontal split, keeping focus on the results.
|
||||
|
||||
v open in vertical split.
|
||||
|
||||
gv open in vertical split silently.
|
||||
gv open in vertical split, keeping focus on the results.
|
||||
|
||||
q close the quickfix window.
|
||||
|
||||
To adjust these, see |g:ack_mappings|.
|
||||
|
||||
==============================================================================
|
||||
Ignoring files *ack-ignore*
|
||||
|
||||
If you're using this plugin with ag, The Silver Searcher, bear in mind that:
|
||||
|
||||
- It ignores file patterns from your .gitignore and .hgignore.
|
||||
|
||||
- If there are other files in your source repository you don't wish to
|
||||
search, you can add their patterns to an .agignore file.
|
||||
|
||||
==============================================================================
|
||||
ISSUES AND FAQ *ack-issues-and-faq*
|
||||
|
||||
I don't want to jump to the first result automatically.~
|
||||
|
||||
Use `:Ack!`, with bang. If you want this behavior most of the time, you
|
||||
might like an abbreviation or mapping in your personal config, something
|
||||
like these:
|
||||
>
|
||||
cnoreabbrev Ack Ack!
|
||||
nnoremap <Leader>a :Ack!<Space>
|
||||
<
|
||||
Most of the `:[L]Ack*` commands support this. Note that this behavior
|
||||
follows the convention of Vim's built-in |:grep| and |:make| commands.
|
||||
|
||||
I use NERDTree and opening ack.vim results in a vertical split displacing it.~
|
||||
|
||||
You are probably using NERDTree with its default alignment at the left
|
||||
side of the window. Set these custom mappings in your vimrc to work around
|
||||
this:
|
||||
>
|
||||
let g:ack_mappings = {
|
||||
\ 'v': '<C-W><CR><C-W>L<C-W>p<C-W>J<C-W>p',
|
||||
\ 'gv': '<C-W><CR><C-W>L<C-W>p<C-W>J' }
|
||||
<
|
||||
This solution will be improved in the future.
|
||||
|
||||
Results show a mix of relative and absolute paths, making them hard to read.~
|
||||
|
||||
This is a quirk of Vim that can happen with plain |:vimgrep| too. You can
|
||||
try this in your vimrc to work around it:
|
||||
>
|
||||
autocmd BufAdd * exe "cd" fnameescape(getcwd())
|
||||
<
|
||||
but for some users this may be disruptive to their Vim workflow. For more
|
||||
details, see:
|
||||
|
||||
http://vi.stackexchange.com/a/4816/7174
|
||||
https://github.com/mileszs/ack.vim/issues/143
|
||||
|
||||
vim:set et sw=4 ts=4 tw=78:
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
if exists('g:loaded_ack')
|
||||
if exists('g:loaded_ack') || &cp
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:ack_default_options")
|
||||
let g:ack_default_options = " -s -H --nocolor --nogroup --column"
|
||||
let g:ack_default_options = " -s -H --nopager --nocolor --nogroup --column"
|
||||
endif
|
||||
|
||||
" Location of the ack utility
|
||||
if !exists("g:ackprg")
|
||||
if executable('ack')
|
||||
let g:ackprg = "ack"
|
||||
elseif executable('ack-grep')
|
||||
if executable('ack-grep')
|
||||
let g:ackprg = "ack-grep"
|
||||
elseif executable('ack')
|
||||
let g:ackprg = "ack"
|
||||
else
|
||||
finish
|
||||
endif
|
||||
|
@ -63,6 +63,10 @@ if !exists("g:ack_autofold_results")
|
|||
let g:ack_autofold_results = 0
|
||||
endif
|
||||
|
||||
if !exists("g:ack_use_cword_for_empty_search")
|
||||
let g:ack_use_cword_for_empty_search = 1
|
||||
endif
|
||||
|
||||
command! -bang -nargs=* -complete=file Ack call ack#Ack('grep<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file AckAdd call ack#Ack('grepadd<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file AckFromSearch call ack#AckFromSearch('grep<bang>', <q-args>)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# ag.vim #
|
||||
|
||||
## Deprecated: See [this comment](https://github.com/rking/ag.vim/issues/124#issuecomment-227038003) for more info. Maybe try [ack.vim](https://github.com/mileszs/ack.vim#can-i-use-ag-the-silver-searcher-with-this) as an alternative. ##
|
||||
|
||||
This plugin is a front for ag, A.K.A.
|
||||
[the_silver_searcher](https://github.com/ggreer/the_silver_searcher). Ag can
|
||||
be used as a replacement for 153% of the uses of `ack`. This plugin will allow
|
||||
|
|
1
sources_non_forked/ctrlp.vim/.gitignore
vendored
1
sources_non_forked/ctrlp.vim/.gitignore
vendored
|
@ -2,5 +2,6 @@
|
|||
*.zip
|
||||
note.txt
|
||||
tags
|
||||
tags-cn
|
||||
.hg*
|
||||
tmp/*
|
||||
|
|
File diff suppressed because it is too large
Load diff
173
sources_non_forked/ctrlp.vim/autoload/ctrlp/autoignore.vim
Normal file
173
sources_non_forked/ctrlp.vim/autoload/ctrlp/autoignore.vim
Normal file
|
@ -0,0 +1,173 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/autoignore.vim
|
||||
" Description: Auto-ignore Extension
|
||||
" Author: Ludovic Chabant <github.com/ludovicchabant>
|
||||
" =============================================================================
|
||||
|
||||
|
||||
" Global Settings {{{
|
||||
|
||||
if exists('g:ctrlp_autoignore_loaded') && g:ctrlp_autoignore_loaded
|
||||
\ && !g:ctrlp_autoignore_debug
|
||||
finish
|
||||
endif
|
||||
let g:ctrlp_autoignore_loaded = 1
|
||||
|
||||
if !exists('g:ctrlp_autoignore_debug')
|
||||
let g:ctrlp_autoignore_debug = 0
|
||||
endif
|
||||
|
||||
if !exists('g:ctrlp_autoignore_trace')
|
||||
let g:ctrlp_autoignore_trace = 0
|
||||
endif
|
||||
|
||||
" }}}
|
||||
|
||||
" Initialization {{{
|
||||
|
||||
if !exists('g:ctrlp_custom_ignore')
|
||||
let g:ctrlp_custom_ignore = {}
|
||||
endif
|
||||
let g:ctrlp_custom_ignore['func'] = 'ctrlp#autoignore#ignore'
|
||||
let g:ctrlp_custom_ignore['func-init'] = 'ctrlp#autoignore#ignore_init'
|
||||
let g:ctrlp_custom_ignore['func-close'] = 'ctrlp#autoignore#ignore_close'
|
||||
|
||||
if !exists('g:ctrlp_root_markers')
|
||||
let g:ctrlp_root_markers = []
|
||||
endif
|
||||
call add(g:ctrlp_root_markers, '.ctrlpignore')
|
||||
|
||||
" }}}
|
||||
|
||||
" Internals {{{
|
||||
|
||||
function! s:trace(message) abort
|
||||
if g:ctrlp_autoignore_trace
|
||||
echom "ctrlp_autoignore: " . a:message
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:proj_cache = {}
|
||||
let s:active_cwd = ''
|
||||
let s:active_cwd_len = 0
|
||||
let s:active_patterns = []
|
||||
let s:changed_wildignore = 0
|
||||
let s:prev_wildignore = ''
|
||||
|
||||
function! s:load_project_patterns(root_dir) abort
|
||||
let l:ign_path = a:root_dir . '/.ctrlpignore'
|
||||
if !filereadable(l:ign_path)
|
||||
call s:trace("No pattern file at: " . l:ign_path)
|
||||
return []
|
||||
endif
|
||||
let l:cursyntax = 'regexp'
|
||||
let l:knownsyntaxes = ['regexp', 'wildignore']
|
||||
let l:patterns = []
|
||||
let l:lines = readfile(l:ign_path)
|
||||
for line in l:lines
|
||||
" Comment line?
|
||||
if match(line, '\v^\s*$') >= 0 || match(line, '\v^\s*#') >= 0
|
||||
continue
|
||||
endif
|
||||
" Syntax change?
|
||||
let l:matches = matchlist(line, '\v^syntax:\s?(\w+)\s*$')
|
||||
if len(l:matches) > 0
|
||||
let l:cursyntax = l:matches[1]
|
||||
if index(l:knownsyntaxes, l:cursyntax) < 0
|
||||
echoerr "ctrlp_autoignore: Unknown syntax '".l:cursyntax."' in: ".l:ign_path
|
||||
endif
|
||||
continue
|
||||
endif
|
||||
" Patterns!
|
||||
let l:matches = matchlist(line, '\v^((dir|file|link)\:)?(.*)')
|
||||
let l:mtype = l:matches[2]
|
||||
let l:mpat = l:matches[3]
|
||||
call add(l:patterns, {'syn': l:cursyntax, 'type': l:mtype, 'pat': l:mpat})
|
||||
endfor
|
||||
call s:trace("Loaded " . len(l:patterns) . " patterns from: " . l:ign_path)
|
||||
return l:patterns
|
||||
endfunction
|
||||
|
||||
function! s:get_project_patterns(root_dir) abort
|
||||
let l:ign_path = a:root_dir . '/.ctrlpignore'
|
||||
let l:ign_mtime = getftime(l:ign_path)
|
||||
let l:patterns = get(s:proj_cache, a:root_dir)
|
||||
if type(l:patterns) == type({})
|
||||
" Check that these patterns are still valid.
|
||||
if l:ign_mtime < 0
|
||||
" File got deleted! :(
|
||||
let l:patterns['pats'] = []
|
||||
return l:patterns['pats']
|
||||
elseif l:ign_mtime <= l:patterns['mtime']
|
||||
" File hasn't changed! :)
|
||||
return l:patterns['pats']
|
||||
endif
|
||||
endif
|
||||
|
||||
call s:trace("Loading patterns for project: " . a:root_dir)
|
||||
let l:loaded = s:load_project_patterns(a:root_dir)
|
||||
let s:proj_cache[a:root_dir] = {
|
||||
\'mtime': localtime(),
|
||||
\'pats': l:loaded}
|
||||
return l:loaded
|
||||
endfunction
|
||||
|
||||
" The custom ignore function that CtrlP will be using in addition to
|
||||
" normal pattern-based matching.
|
||||
function! ctrlp#autoignore#ignore(item, type) abort
|
||||
let l:cnv_item = tr(strpart(a:item, s:active_cwd_len), "\\", "/")
|
||||
for pat in s:active_patterns
|
||||
if pat['syn'] != 'regexp'
|
||||
continue
|
||||
endif
|
||||
if pat['type'] == '' || pat['type'] == a:type
|
||||
if match(l:cnv_item, pat['pat']) >= 0
|
||||
call s:trace("Ignoring ".l:cnv_item." because of ".pat['pat'])
|
||||
return 1
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! ctrlp#autoignore#ignore_init() abort
|
||||
let l:root = getcwd()
|
||||
let s:active_cwd = l:root
|
||||
" len+1 is for including the next separator after the root.
|
||||
let s:active_cwd_len = len(l:root) + 1
|
||||
let s:active_patterns = s:get_project_patterns(l:root)
|
||||
call s:trace("Got ".len(s:active_patterns)." patterns for ".l:root)
|
||||
|
||||
let s:changed_wildignore = 0
|
||||
let s:prev_wildignore = &wildignore
|
||||
for pat in s:active_patterns
|
||||
if pat['syn'] == 'wildignore'
|
||||
execute 'set wildignore+='.pat['pat']
|
||||
let s:changed_wildignore = 1
|
||||
endif
|
||||
endfor
|
||||
if s:changed_wildignore
|
||||
call s:trace("Set wildignore to ".&wildignore)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ctrlp#autoignore#ignore_close() abort
|
||||
if s:changed_wildignore
|
||||
execute 'set wildignore='.s:prev_wildignore
|
||||
let s:prev_wildignore = ''
|
||||
call s:trace("Set wildignore back to ".&wildignore)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" List patterns for a given project's root.
|
||||
function! ctrlp#autoignore#get_patterns(root_dir) abort
|
||||
let l:patterns = s:get_project_patterns(a:root_dir)
|
||||
for pat in l:patterns
|
||||
let l:prefix = pat['type'] == '' ? '(all)' : pat['type']
|
||||
echom l:prefix . ':' . pat['pat']
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" }}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -112,13 +112,20 @@ fu! ctrlp#bookmarkdir#accept(mode, str)
|
|||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#add(dir, ...)
|
||||
let str = 'Directory to bookmark: '
|
||||
let cwd = a:dir != '' ? a:dir : s:getinput(str, getcwd(), 'dir')
|
||||
if cwd == '' | retu | en
|
||||
let cwd = fnamemodify(cwd, ':p')
|
||||
let name = a:0 && a:1 != '' ? a:1 : s:getinput('Bookmark as: ', cwd)
|
||||
if name == '' | retu | en
|
||||
fu! ctrlp#bookmarkdir#add(bang, dir, ...)
|
||||
let ctrlp_tilde_homedir = get(g:, 'ctrlp_tilde_homedir', 0)
|
||||
let cwd = fnamemodify(getcwd(), ctrlp_tilde_homedir ? ':p:~' : ':p')
|
||||
let dir = fnamemodify(a:dir, ctrlp_tilde_homedir ? ':p:~' : ':p')
|
||||
if a:bang == '!'
|
||||
let cwd = dir != '' ? dir : cwd
|
||||
let name = a:0 && a:1 != '' ? a:1 : cwd
|
||||
el
|
||||
let str = 'Directory to bookmark: '
|
||||
let cwd = dir != '' ? dir : s:getinput(str, cwd, 'dir')
|
||||
if cwd == '' | retu | en
|
||||
let name = a:0 && a:1 != '' ? a:1 : s:getinput('Bookmark as: ', cwd)
|
||||
if name == '' | retu | en
|
||||
en
|
||||
let name = tr(name, ' ', ' ')
|
||||
cal s:savebookmark(name, cwd)
|
||||
cal s:msg(name, cwd)
|
||||
|
|
|
@ -43,6 +43,7 @@ let s:bins = [
|
|||
\ ]
|
||||
|
||||
let s:types = {
|
||||
\ 'ant' : '%sant%sant%spt',
|
||||
\ 'asm' : '%sasm%sasm%sdlmt',
|
||||
\ 'aspperl': '%sasp%sasp%sfsv',
|
||||
\ 'aspvbs' : '%sasp%sasp%sfsv',
|
||||
|
@ -52,16 +53,20 @@ let s:types = {
|
|||
\ 'cpp' : '%sc++%sc++%snvdtcgsuf',
|
||||
\ 'cs' : '%sc#%sc#%sdtncEgsipm',
|
||||
\ 'cobol' : '%scobol%scobol%sdfgpPs',
|
||||
\ 'delphi' : '%spascal%spascal%sfp',
|
||||
\ 'dosbatch': '%sdosbatch%sdosbatch%slv',
|
||||
\ 'eiffel' : '%seiffel%seiffel%scf',
|
||||
\ 'erlang' : '%serlang%serlang%sdrmf',
|
||||
\ 'expect' : '%stcl%stcl%scfp',
|
||||
\ 'fortran': '%sfortran%sfortran%spbceiklmntvfs',
|
||||
\ 'go' : '%sgo%sgo%sfctv',
|
||||
\ 'html' : '%shtml%shtml%saf',
|
||||
\ 'java' : '%sjava%sjava%spcifm',
|
||||
\ 'javascript': '%sjavascript%sjavascript%sf',
|
||||
\ 'lisp' : '%slisp%slisp%sf',
|
||||
\ 'lua' : '%slua%slua%sf',
|
||||
\ 'make' : '%smake%smake%sm',
|
||||
\ 'matlab' : '%smatlab%smatlab%sf',
|
||||
\ 'ocaml' : '%socaml%socaml%scmMvtfCre',
|
||||
\ 'pascal' : '%spascal%spascal%sfp',
|
||||
\ 'perl' : '%sperl%sperl%sclps',
|
||||
|
@ -69,16 +74,20 @@ let s:types = {
|
|||
\ 'python' : '%spython%spython%scmf',
|
||||
\ 'rexx' : '%srexx%srexx%ss',
|
||||
\ 'ruby' : '%sruby%sruby%scfFm',
|
||||
\ 'rust' : '%srust%srust%sfTgsmctid',
|
||||
\ 'scheme' : '%sscheme%sscheme%ssf',
|
||||
\ 'sh' : '%ssh%ssh%sf',
|
||||
\ 'csh' : '%ssh%ssh%sf',
|
||||
\ 'zsh' : '%ssh%ssh%sf',
|
||||
\ 'scala' : '%sscala%sscala%sctTmlp',
|
||||
\ 'slang' : '%sslang%sslang%snf',
|
||||
\ 'sml' : '%ssml%ssml%secsrtvf',
|
||||
\ 'sql' : '%ssql%ssql%scFPrstTvfp',
|
||||
\ 'tex' : '%stex%stex%sipcsubPGl',
|
||||
\ 'tcl' : '%stcl%stcl%scfmp',
|
||||
\ 'vera' : '%svera%svera%scdefgmpPtTvx',
|
||||
\ 'verilog': '%sverilog%sverilog%smcPertwpvf',
|
||||
\ 'vhdl' : '%svhdl%svhdl%sPctTrefp',
|
||||
\ 'vim' : '%svim%svim%savf',
|
||||
\ 'yacc' : '%syacc%syacc%sl',
|
||||
\ }
|
||||
|
@ -130,7 +139,7 @@ fu! s:exectags(cmd)
|
|||
endf
|
||||
|
||||
fu! s:exectagsonfile(fname, ftype)
|
||||
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs ', a:ftype]
|
||||
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs --extra= ', a:ftype]
|
||||
if type(s:types[ft]) == 1
|
||||
let ags .= s:types[ft]
|
||||
let bin = s:bin
|
||||
|
@ -151,7 +160,11 @@ fu! s:esctagscmd(bin, args, ...)
|
|||
let [ssl, &ssl] = [&ssl, 0]
|
||||
en
|
||||
let fname = a:0 ? shellescape(a:1) : ''
|
||||
let cmd = shellescape(a:bin).' '.a:args.' '.fname
|
||||
if (has('win32') || has('win64'))
|
||||
let cmd = a:bin.' '.a:args.' '.fname
|
||||
else
|
||||
let cmd = shellescape(a:bin).' '.a:args.' '.fname
|
||||
endif
|
||||
if &sh =~ 'cmd\.exe'
|
||||
let cmd = substitute(cmd, '[&()@^<>|]', '^\0', 'g')
|
||||
en
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
" Static variables {{{1
|
||||
let [s:mrbs, s:mrufs] = [[], []]
|
||||
let s:mruf_map_string = '!stridx(v:val, cwd) ? strpart(v:val, idx) : v:val'
|
||||
|
||||
fu! ctrlp#mrufiles#opts()
|
||||
let [pref, opts] = ['g:ctrlp_mruf_', {
|
||||
|
@ -15,6 +16,7 @@ fu! ctrlp#mrufiles#opts()
|
|||
\ 'case_sensitive': ['s:cseno', 1],
|
||||
\ 'relative': ['s:re', 0],
|
||||
\ 'save_on_update': ['s:soup', 1],
|
||||
\ 'map_string': ['g:ctrlp_mruf_map_string', s:mruf_map_string],
|
||||
\ }]
|
||||
for [ke, va] in items(opts)
|
||||
let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]]
|
||||
|
@ -51,7 +53,7 @@ fu! s:reformat(mrufs, ...)
|
|||
let cwd = tr(cwd, '\', '/')
|
||||
cal map(a:mrufs, 'tr(v:val, "\\", "/")')
|
||||
en
|
||||
retu map(a:mrufs, '!stridx(v:val, cwd) ? strpart(v:val, idx) : v:val')
|
||||
retu map(a:mrufs, g:ctrlp_mruf_map_string)
|
||||
endf
|
||||
|
||||
fu! s:record(bufnr)
|
||||
|
@ -66,10 +68,12 @@ fu! s:record(bufnr)
|
|||
endf
|
||||
|
||||
fu! s:addtomrufs(fname)
|
||||
let fn = fnamemodify(a:fname, ':p')
|
||||
let fn = fnamemodify(a:fname, get(g:, 'ctrlp_tilde_homedir', 0) ? ':p:~' : ':p')
|
||||
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
|
||||
let abs_fn = fnamemodify(fn,':p')
|
||||
if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )
|
||||
\ || !empty(getbufvar('^'.fn.'$', '&bt')) || !filereadable(fn) | retu
|
||||
\ || !empty(getbufvar('^' . abs_fn . '$', '&bt')) || !filereadable(abs_fn)
|
||||
retu
|
||||
en
|
||||
let idx = index(s:mrufs, fn, 0, !{s:cseno})
|
||||
if idx
|
||||
|
@ -143,7 +147,7 @@ fu! ctrlp#mrufiles#init()
|
|||
let s:locked = 0
|
||||
aug CtrlPMRUF
|
||||
au!
|
||||
au BufAdd,BufEnter,BufLeave,BufWritePost * cal s:record(expand('<abuf>', 1))
|
||||
au BufWinEnter,BufWinLeave,BufWritePost * cal s:record(expand('<abuf>', 1))
|
||||
au QuickFixCmdPre *vimgrep* let s:locked = 1
|
||||
au QuickFixCmdPost *vimgrep* let s:locked = 0
|
||||
au VimLeavePre * cal s:savetofile(s:mergelists())
|
||||
|
|
|
@ -21,7 +21,7 @@ cal add(g:ctrlp_ext_vars, {
|
|||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:findcount(str)
|
||||
fu! s:findcount(str, tgaddr)
|
||||
let [tg, ofname] = split(a:str, '\t\+\ze[^\t]\+$')
|
||||
let tgs = taglist('^'.tg.'$')
|
||||
if len(tgs) < 2
|
||||
|
@ -48,7 +48,13 @@ fu! s:findcount(str)
|
|||
for tgi in ntgs
|
||||
let cnt += 1
|
||||
if tgi["filename"] == ofname
|
||||
let [fnd, pos] = [0, cnt]
|
||||
if a:tgaddr != ""
|
||||
if a:tgaddr == tgi["cmd"]
|
||||
let [fnd, pos] = [0, cnt]
|
||||
en
|
||||
else
|
||||
let [fnd, pos] = [0, cnt]
|
||||
en
|
||||
en
|
||||
endfo
|
||||
retu [1, fnd, pos, len(ctgs)]
|
||||
|
@ -92,8 +98,9 @@ endf
|
|||
|
||||
fu! ctrlp#tag#accept(mode, str)
|
||||
cal ctrlp#exit()
|
||||
let tgaddr = matchstr(a:str, '^[^\t]\+\t\+[^\t]\+\t\zs[^\t]\{-1,}\ze\%(;"\)\?\t')
|
||||
let str = matchstr(a:str, '^[^\t]\+\t\+[^\t]\+\ze\t')
|
||||
let [tg, fdcnt] = [split(str, '^[^\t]\+\zs\t')[0], s:findcount(str)]
|
||||
let [tg, fdcnt] = [split(str, '^[^\t]\+\zs\t')[0], s:findcount(str, tgaddr)]
|
||||
let cmds = {
|
||||
\ 't': ['tab sp', 'tab stj'],
|
||||
\ 'h': ['sp', 'stj'],
|
||||
|
@ -121,6 +128,7 @@ fu! ctrlp#tag#accept(mode, str)
|
|||
en
|
||||
cal feedkeys(":".cmd." ".tg."\r".ext, 'nt')
|
||||
en
|
||||
cal feedkeys('zvzz', 'nt')
|
||||
cal ctrlp#setlcdir()
|
||||
endf
|
||||
|
||||
|
|
1570
sources_non_forked/ctrlp.vim/doc/ctrlp.cnx
Normal file
1570
sources_non_forked/ctrlp.vim/doc/ctrlp.cnx
Normal file
File diff suppressed because it is too large
Load diff
|
@ -63,18 +63,27 @@ Overview:~
|
|||
|ctrlp_default_input|.........Seed the prompt with an initial string.
|
||||
|ctrlp_abbrev|................Input abbreviations.
|
||||
|ctrlp_key_loop|..............Use input looping for multi-byte input.
|
||||
|ctrlp_use_migemo|............Use Migemo patterns for Japanese filenames.
|
||||
|ctrlp_prompt_mappings|.......Change the mappings inside the prompt.
|
||||
|ctrlp_line_prefix|...........Prefix for each line in ctrlp window.
|
||||
|ctrlp_open_single_match|.....Automatically accept when only one candidate.
|
||||
|ctrlp_brief_prompt|..........Exit CtrlP on empty prompt by <bs>.
|
||||
|ctrlp_match_current_file|....Include current file in match entries.
|
||||
|ctrlp_types|.................Names of builtin types.
|
||||
|
||||
MRU mode:
|
||||
|ctrlp_mruf_max|..............Max MRU entries to remember.
|
||||
|ctrlp_mruf_exclude|..........Files that shouldn't be remembered.
|
||||
|ctrlp_mruf_include|..........Files to be remembered.
|
||||
|ctrlp_mruf_relative|.........Show only MRU files in the working directory.
|
||||
|ctrlp_tilde_homedir|....Save MRU file paths in home dir as ~/.
|
||||
|ctrlp_mruf_default_order|....Disable sorting.
|
||||
|ctrlp_mruf_case_sensitive|...MRU files are case sensitive or not.
|
||||
|ctrlp_mruf_save_on_update|...Save to disk whenever a new entry is added.
|
||||
|
||||
Buffer mode:
|
||||
|ctrlp_bufname_mod|...........File name section modificator.
|
||||
|ctrlp_bufpath_mod|...........File path section modificator.
|
||||
|
||||
BufferTag mode: (to enable, see |ctrlp-extensions|)
|
||||
|g:ctrlp_buftag_ctags_bin|....The location of the ctags-compatible binary.
|
||||
|g:ctrlp_buftag_systemenc|....The encoding used for the ctags command.
|
||||
|
@ -118,7 +127,7 @@ Set this to 1 to set regexp search as the default: >
|
|||
Can be toggled on/off by pressing <c-r> inside the prompt.
|
||||
|
||||
*'g:ctrlp_match_window'*
|
||||
Change the postion, the listing order of results, the minimum and the maximum
|
||||
Change the position, the listing order of results, the minimum and the maximum
|
||||
heights of the match window: >
|
||||
let g:ctrlp_match_window = ''
|
||||
<
|
||||
|
@ -181,13 +190,12 @@ variable: >
|
|||
let g:ctrlp_working_path_mode = 'ra'
|
||||
<
|
||||
c - the directory of the current file.
|
||||
a - like "c", but only applies when the current working directory outside of
|
||||
CtrlP isn't a direct ancestor of the directory of the current file.
|
||||
r - the nearest ancestor that contains one of these directories or files:
|
||||
a - the directory of the current file, unless it is a subdirectory of the cwd
|
||||
r - the nearest ancestor of the current file that contains one of these
|
||||
directories or files:
|
||||
.git .hg .svn .bzr _darcs
|
||||
w - begin finding a root from the current working directory outside of CtrlP
|
||||
instead of from the directory of the current file (default). Only applies
|
||||
when "r" is also present.
|
||||
w - modifier to "r": start search from the cwd instead of the current file's
|
||||
directory
|
||||
0 or <empty> - disable this feature.
|
||||
|
||||
Note #1: if "a" or "c" is included with "r", use the behavior of "a" or "c" (as
|
||||
|
@ -261,6 +269,9 @@ Examples: >
|
|||
let g:ctrlp_custom_ignore = {
|
||||
\ 'file': '\v(\.cpp|\.h|\.hh|\.cxx)@<!$'
|
||||
\ }
|
||||
let g:ctrlp_custom_ignore = {
|
||||
\ 'func': 'some#custom#match_function'
|
||||
\ }
|
||||
<
|
||||
Note #1: by default, |wildignore| and |g:ctrlp_custom_ignore| only apply when
|
||||
|globpath()| is used to scan for files, thus these options do not apply when a
|
||||
|
@ -269,6 +280,12 @@ command defined with |g:ctrlp_user_command| is being used.
|
|||
Note #2: when changing the option's variable type, remember to |:unlet| it
|
||||
first or restart Vim to avoid the "E706: Variable type mismatch" error.
|
||||
|
||||
Note #3: when using the "func" ignore type, you must provide the full name of
|
||||
a function that can be called from CtrlP. An |autoload| function name is
|
||||
recommended here. The function must take 2 parameters, the item to match and
|
||||
its type. The type will be "dir", "file", or "link". The function must return
|
||||
1 if the item should be ignored, 0 otherwise.
|
||||
|
||||
*'g:ctrlp_max_files'*
|
||||
The maximum number of files to scan, set to 0 for no limit: >
|
||||
let g:ctrlp_max_files = 10000
|
||||
|
@ -327,7 +344,7 @@ Some examples: >
|
|||
|
||||
" Single VCS, listing command lists untracked files (slower):
|
||||
let g:ctrlp_user_command =
|
||||
\ ['.git', 'cd %s && git ls-files . -co --exclude-standard']
|
||||
\ ['.git', 'cd %s && git ls-files -co --exclude-standard']
|
||||
|
||||
let g:ctrlp_user_command =
|
||||
\ ['.hg', 'hg --cwd %s status -numac -I . $(hg root)'] " MacOSX/Linux
|
||||
|
@ -434,6 +451,23 @@ Instead of 1 or 0, if the value of the option is a string, it'll be used as-is
|
|||
as the default input: >
|
||||
let g:ctrlp_default_input = 'anystring'
|
||||
<
|
||||
This option works well together with |g:ctrlp_open_single_match|
|
||||
|
||||
|
||||
*'g:ctrlp_match_current_file'*
|
||||
Includes the current file in the match entries: >
|
||||
let g:ctrlp_match_current_file = 1
|
||||
|
||||
By default, the current file is excluded from the list.
|
||||
|
||||
Note: does not apply when |g:ctrlp_match_func| is used.
|
||||
|
||||
*'g:ctrlp_types'*
|
||||
Set this to list of names to customize core types: >
|
||||
let g:ctrlp_types = ['mru', 'fil']
|
||||
|
||||
By default, the types are: >
|
||||
let g:ctrlp_types = ['fil', 'buf', 'mru'].
|
||||
|
||||
*'g:ctrlp_abbrev'*
|
||||
Define input abbreviations that can be expanded (either internally or visibly)
|
||||
|
@ -497,12 +531,6 @@ Note #2: you can toggle this feature inside the prompt with a custom mapping: >
|
|||
let g:ctrlp_prompt_mappings = { 'ToggleKeyLoop()': ['<F3>'] }
|
||||
<
|
||||
|
||||
*'g:ctrlp_use_migemo'*
|
||||
Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only
|
||||
works in regexp mode. To split the pattern, separate words with space: >
|
||||
let g:ctrlp_use_migemo = 0
|
||||
<
|
||||
|
||||
*'g:ctrlp_prompt_mappings'*
|
||||
Use this to customize the mappings inside CtrlP's prompt to your liking. You
|
||||
only need to keep the lines that you've changed the values (inside []): >
|
||||
|
@ -549,6 +577,34 @@ default <c-h> mapping: >
|
|||
let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }
|
||||
<
|
||||
|
||||
*'g:ctrlp_line_prefix'*
|
||||
This prefix will be prepended to each line in ctrlp's item listing.
|
||||
default: >
|
||||
let g:ctrlp_line_prefix = '> '
|
||||
<
|
||||
|
||||
*'g:ctrlp_open_single_match'*
|
||||
List of CtrlP modes for which CtrlP should accept an entry directly, if only
|
||||
one candidate exists.
|
||||
Example: >
|
||||
let g:ctrlp_open_single_match = ['buffer tags', 'buffer']
|
||||
<
|
||||
This is currently only really useful together with |g:ctrlp_default_input|
|
||||
set before launching, and cleared afterwards, with a function such as
|
||||
following: >
|
||||
fu! <SID>tagsUnderCursor()
|
||||
try
|
||||
let default_input_save = get(g:, 'ctrlp_default_input', '')
|
||||
let g:ctrlp_default_input = expand('<cword>')
|
||||
CtrlPBufTagAll
|
||||
finally
|
||||
if exists('default_input_save')
|
||||
let g:ctrlp_default_input = default_input_save
|
||||
endif
|
||||
endtry
|
||||
endfu
|
||||
>
|
||||
<
|
||||
----------------------------------------
|
||||
MRU mode options:~
|
||||
|
||||
|
@ -574,6 +630,14 @@ Example: >
|
|||
let g:ctrlp_mruf_include = '\.py$\|\.rb$'
|
||||
<
|
||||
|
||||
*'g:ctrlp_tilde_homedir'*
|
||||
Set this to 1 to save every MRU file path $HOME/$filepath in the $HOME dir
|
||||
as ~/$filepath instead of $HOME/$filepath : >
|
||||
let g:ctrlp_tilde_homedir = 0
|
||||
<
|
||||
Note: This applies also to all dir paths stored by :CtrlPBookmarkDirAdd!
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_relative'*
|
||||
Set this to 1 to show only MRU files in the current working directory: >
|
||||
let g:ctrlp_mruf_relative = 0
|
||||
|
@ -581,7 +645,6 @@ Set this to 1 to show only MRU files in the current working directory: >
|
|||
Note: you can use a custom mapping to toggle this option inside the prompt: >
|
||||
let g:ctrlp_prompt_mappings = { 'ToggleMRURelative()': ['<F2>'] }
|
||||
<
|
||||
|
||||
*'g:ctrlp_mruf_default_order'*
|
||||
Set this to 1 to disable sorting when searching in MRU mode: >
|
||||
let g:ctrlp_mruf_default_order = 0
|
||||
|
@ -598,7 +661,14 @@ Set this to 0 to disable saving of the MRU list to hard drive whenever a new
|
|||
entry is added, saving will then only occur when exiting Vim: >
|
||||
let g:ctrlp_mruf_save_on_update = 1
|
||||
<
|
||||
|
||||
*'g:ctrlp_bufname_mod'*
|
||||
Modify file name section according to modificator string. See |filename-modifiers|. >
|
||||
let g:ctrlp_bufname_mod = ':t'
|
||||
<
|
||||
*'g:ctrlp_bufpath_mod'*
|
||||
Modify file path section according to modificator string. See |filename-modifiers|. >
|
||||
let g:ctrlp_bufpath_mod = ':~:.:h'
|
||||
<
|
||||
----------------------------------------
|
||||
Advanced options:~
|
||||
|
||||
|
@ -772,6 +842,15 @@ Example: >
|
|||
" }
|
||||
endfunction
|
||||
<
|
||||
*'g:ctrlp_brief_prompt'*
|
||||
When this is set to 1, the <bs> on empty prompt exit CtrlP.
|
||||
|
||||
*ctrlp-default-value*
|
||||
Otherwize, you can use below to change default value.
|
||||
Example: >
|
||||
let g:ctrlp_path_nolim = 1
|
||||
|
||||
This is possible to change no-limit mode for match type "path".
|
||||
|
||||
===============================================================================
|
||||
COMMANDS *ctrlp-commands*
|
||||
|
@ -953,8 +1032,12 @@ Function keys:~
|
|||
- Remove deleted files from the MRU list.
|
||||
|
||||
<F7>
|
||||
- Wipe the MRU list.
|
||||
- Delete MRU entries marked by <c-z>.
|
||||
MRU mode:
|
||||
- Wipe the list.
|
||||
- Delete entries marked by <c-z>.
|
||||
Buffer mode:
|
||||
- Delete entry under the cursor or delete multiple entries marked by <c-z>.
|
||||
|
||||
|
||||
Pasting:~
|
||||
|
||||
|
@ -1027,7 +1110,7 @@ d) Submit two dots '..' to go upward the directory tree by 1 level. To go up
|
|||
e) Similarly, submit '/' or '\' to find and go to the project's root.
|
||||
|
||||
If the project is large, using a VCS listing command to look for files
|
||||
might help speeding up the intial scan (see |g:ctrlp_user_command| for more
|
||||
might help speeding up the initial scan (see |g:ctrlp_user_command| for more
|
||||
details).
|
||||
|
||||
Note: d) and e) only work in file, directory and mixed modes.
|
||||
|
@ -1138,8 +1221,27 @@ Available extensions:~
|
|||
* BookmarkDir mode:~
|
||||
- Name: 'bookmarkdir'
|
||||
- Commands: ":CtrlPBookmarkDir",
|
||||
":CtrlPBookmarkDirAdd [directory]".
|
||||
":CtrlPBookmarkDirAdd [directory] [TITLE]".
|
||||
":CtrlPBookmarkDirAdd! [directory] [TITLE]".
|
||||
|
||||
- Search for a bookmarked directory and change the working directory to it.
|
||||
- Add either the dir [directory], if supplied, or otherwise ask for it,
|
||||
under the title given by either [TITLE], if supplied, or otherwise ask for
|
||||
it, to the CtrlPBookmarkDir list.
|
||||
- Add either the dir [directory], if supplied, or otherwise the current
|
||||
work dir ( [CWD] ) under the title given by either [TITLE], if supplied,
|
||||
or otherwise [CWD] to the CtrlPBookmarkDir list.
|
||||
|
||||
The last command can be used to add all recently used work dirs to the
|
||||
CtrlPBookmarkDir list by an autocommand like
|
||||
|
||||
>
|
||||
augroup CtrlPDirMRU
|
||||
autocmd!
|
||||
autocmd FileType * if &modifiable | execute 'silent CtrlPBookmarkDirAdd! %:p:h' | endif
|
||||
augroup END
|
||||
<
|
||||
|
||||
- Mappings:
|
||||
+ <cr> change the local working directory for CtrlP, keep it open and
|
||||
switch to find file mode.
|
||||
|
@ -1149,6 +1251,80 @@ Available extensions:~
|
|||
- Wipe bookmark list.
|
||||
- Delete entries marked by <c-z>.
|
||||
|
||||
*ctrlp-autoignore-extension*
|
||||
* Autoignore mode:~
|
||||
- Name: 'autoignore'
|
||||
|
||||
- This extension doesn't add new commands. It adds support for per-project
|
||||
ignore patterns (as per |ctrlp_custom_ignore|) via a `.ctrlpignore` file
|
||||
at the root of the project. It's basically like a `.gitignore` or
|
||||
`.hgignore` for CtrlP.
|
||||
|
||||
Note: auto-ignore won't work when |g:ctrlp_user_command| is used.
|
||||
|
||||
Note: `.ctrlpignore` will be added to the root markers (see
|
||||
|g:ctrlp_root_markers|).
|
||||
|
||||
- Ignore file syntax:
|
||||
Empty lines, and lines starting with `#` (comments) are ignored.
|
||||
|
||||
Other lines are treated like regular expression patterns. See *string-match*
|
||||
for how patterns are used. Anything that matches any of the patterns will be
|
||||
ignored from CtrlP's search results.
|
||||
|
||||
Example:
|
||||
|
||||
\.tmp$
|
||||
^generated/
|
||||
local\.cfg
|
||||
|
||||
Note: patterns should use forward slashes, even on Windows.
|
||||
|
||||
You can also switch to a glob-like syntax like this:
|
||||
|
||||
syntax:wildignore
|
||||
*.tar.gz
|
||||
*.tmp
|
||||
|
||||
This will temporarily add each pattern to |'wildignore'| for the
|
||||
duration of the file scan, and remove them at the end.
|
||||
|
||||
You can switch back to the default regular-expression-based patterns by
|
||||
writing:
|
||||
|
||||
syntax:regexp
|
||||
|
||||
You can also specify a match on only a given type of item:
|
||||
|
||||
dir:build
|
||||
file:foo\.txt
|
||||
|
||||
This will only ignore directories with "build" in them, and files with
|
||||
"foo.txt" in them. Not files with "build" in them or vice-versa.
|
||||
|
||||
Note: to ignore a root directory "build", and not _any_ directory with
|
||||
"build" in it, you can root the regex: ^build$
|
||||
|
||||
- FAQ:
|
||||
Q: Why can't CtrlP support `.gitignore` or `.hgignore` natively?
|
||||
|
||||
A: Those files look at first like they may contain all the patterns
|
||||
you'd want to exclude from CtrlP already. However, more often than not,
|
||||
there are some differences. Those files list patterns that should not be
|
||||
included in source-control. This includes things you want to ignore, but
|
||||
also things you may not want to: local settings, external packages and
|
||||
dependencies, etc. The author felt the trouble of supporting various
|
||||
syntaxes was too much compared to just copy/pasting a few lines. Feel
|
||||
free to contribute a patch if you disagree :)
|
||||
|
||||
Q: I enabled |ctrlp-autoignore-extension|, or edited `.ctrlpignore`, but
|
||||
none of the new patterns are working. What did I do wrong?
|
||||
|
||||
A: Probably nothing! CtrlP can cache search results for faster response
|
||||
times. You can hit <F5> to force it to refresh. This will use the newer
|
||||
ignore patterns if the `.ctrlpignore` file has changed, too.
|
||||
|
||||
|
||||
----------------------------------------
|
||||
Buffer Tag mode options:~
|
||||
|
||||
|
@ -1189,6 +1365,17 @@ Highlighting:~
|
|||
CtrlPPrtText : the prompt's text (|hl-Normal|)
|
||||
CtrlPPrtCursor : the prompt's cursor when moving over the text (Constant)
|
||||
|
||||
* Buffer explorer mode:
|
||||
CtrlPBufferNr : buffer number
|
||||
CtrlPBufferInd : '+', '-', '=' and '#' indicators (see |:buffers|)
|
||||
CtrlPBufferHid : hidden buffer
|
||||
CtrlPBufferHidMod : hidden and modified buffer
|
||||
CtrlPBufferVis : visible buffer
|
||||
CtrlPBufferVisMod : visible and modified buffer
|
||||
CtrlPBufferCur : current buffer
|
||||
CtrlPBufferCurMod : current and modified buffer
|
||||
CtrlPBufferPath : buffer path
|
||||
|
||||
* In extensions:
|
||||
CtrlPTabExtra : the part of each line that's not matched against (Comment)
|
||||
CtrlPBufName : the buffer name an entry belongs to (|hl-Directory|)
|
||||
|
@ -1259,11 +1446,12 @@ MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
|
|||
===============================================================================
|
||||
CREDITS *ctrlp-credits*
|
||||
|
||||
Developed by Kien Nguyen <github.com/kien>. Distributed under Vim's |license|.
|
||||
Originally developed by Kien Nguyen <github.com/kien>. Now maintained by the
|
||||
members of the ctrlpvim Github organisation
|
||||
(https://github.com/orgs/ctrlpvim/people). Distributed under Vim's |license|.
|
||||
|
||||
Project's homepage: http://kien.github.com/ctrlp.vim
|
||||
Git repository: https://github.com/kien/ctrlp.vim
|
||||
Mercurial repository: https://bitbucket.org/kien/ctrlp.vim
|
||||
Project's homepage: http://ctrlpvim.github.com/ctrlp.vim
|
||||
Git repository: https://github.com/ctrlpvim/ctrlp.vim
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Thanks to everyone that has submitted ideas, bug reports or helped debugging on
|
||||
|
@ -1290,10 +1478,14 @@ Special thanks:~
|
|||
* Jo De Boeck <github.com/grimpy>
|
||||
* Rudi Grinberg <github.com/rgrinberg>
|
||||
* Timothy Mellor <github.com/mellort>
|
||||
* Sergey Vlasov <github.com/noscript>
|
||||
|
||||
===============================================================================
|
||||
CHANGELOG *ctrlp-changelog*
|
||||
|
||||
+ New buffer explorer mode with highlighting (|+conceal| recommended)
|
||||
+ New options: |g:ctrlp_bufname_mod|,
|
||||
|g:ctrlp_bufpath_mod|
|
||||
+ Combine *g:ctrlp_match_window_bottom* *g:ctrlp_match_window_reversed* and
|
||||
*g:ctrlp_max_height* into |g:ctrlp_match_window|.
|
||||
+ New option: |g:ctrlp_match_window|.
|
||||
|
|
|
@ -10,17 +10,23 @@ if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
|
|||
en
|
||||
let g:loaded_ctrlp = 1
|
||||
|
||||
let s:types = ['fil', 'buf', 'mru']
|
||||
if !exists('g:ctrlp_types')
|
||||
let g:ctrlp_types = s:types
|
||||
el
|
||||
call filter(g:ctrlp_types, "index(['fil', 'buf', 'mru'], v:val)!=-1")
|
||||
en
|
||||
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
|
||||
\ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]
|
||||
\ = [[], [], [], [], {}, {}, [], 2]
|
||||
\ = [[], [], [], [], {}, {}, [], len(g:ctrlp_types)-1]
|
||||
|
||||
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
||||
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
||||
|
||||
com! -n=? -com=dir CtrlP cal ctrlp#init(0, { 'dir': <q-args> })
|
||||
com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': <q-args> })
|
||||
com! -n=? -com=dir CtrlP cal ctrlp#init('fil', { 'dir': <q-args> })
|
||||
com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init('mru', { 'dir': <q-args> })
|
||||
|
||||
com! -bar CtrlPBuffer cal ctrlp#init(1)
|
||||
com! -bar CtrlPBuffer cal ctrlp#init('buf')
|
||||
com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })
|
||||
|
||||
com! -bar CtrlPClearCache cal ctrlp#clr()
|
||||
|
@ -29,12 +35,14 @@ com! -bar CtrlPClearAllCaches cal ctrlp#clra()
|
|||
com! -bar ClearCtrlPCache cal ctrlp#clr()
|
||||
com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
|
||||
|
||||
com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' })
|
||||
com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })
|
||||
com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'r' })
|
||||
com! -bar CtrlPCurWD cal ctrlp#init('fil', { 'mode': '' })
|
||||
com! -bar CtrlPCurFile cal ctrlp#init('fil', { 'mode': 'c' })
|
||||
com! -bar CtrlPRoot cal ctrlp#init('fil', { 'mode': 'r' })
|
||||
|
||||
if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')
|
||||
exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
|
||||
exe 'nn <silent> <plug>(ctrlp) :<c-u>'.g:ctrlp_cmd.'<cr>'
|
||||
|
||||
if g:ctrlp_map != '' && !hasmapto('<plug>(ctrlp)')
|
||||
exe 'map' g:ctrlp_map '<plug>(ctrlp)'
|
||||
en
|
||||
|
||||
cal ctrlp#mrufiles#init()
|
||||
|
@ -53,16 +61,16 @@ com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
|||
com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
||||
|
||||
com! -n=? -com=buffer CtrlPLine
|
||||
\ cal ctrlp#init(ctrlp#line#cmd(1, <q-args>))
|
||||
\ cal ctrlp#init(ctrlp#line#cmd('buf', <q-args>))
|
||||
|
||||
com! -n=? -com=buffer CtrlPChange
|
||||
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
|
||||
\ cal ctrlp#init(ctrlp#changes#cmd('fil', <q-args>))
|
||||
|
||||
com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
|
||||
com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
|
||||
com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
|
||||
|
||||
com! -n=? -com=dir CtrlPBookmarkDirAdd
|
||||
\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
|
||||
com! -n=? -com=dir -bang CtrlPBookmarkDirAdd
|
||||
\ cal ctrlp#call('ctrlp#bookmarkdir#add', '<bang>', <q-args>)
|
||||
|
||||
" vim:ts=2:sw=2:sts=2
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#**This project is unmaintained**
|
||||
**You should use [this fork](https://github.com/ctrlpvim/ctrlp.vim) instead.**
|
||||
|
||||
# ctrlp.vim
|
||||
Full path fuzzy __file__, __buffer__, __mru__, __tag__, __...__ finder for Vim.
|
||||
|
||||
|
@ -35,8 +32,8 @@ Check `:help ctrlp-commands` and `:help ctrlp-extensions` for other commands.
|
|||
Run `:help ctrlp-mappings` or submit `?` in CtrlP for more mapping help.
|
||||
|
||||
* Submit two or more dots `..` to go up the directory tree by one or multiple levels.
|
||||
* End the input string with a colon `:` followed by a command to execute it on the opening file(s):
|
||||
Use `:25` to jump to line 25.
|
||||
* End the input string with a colon `:` followed by a command to execute it on the opening file(s):
|
||||
Use `:25` to jump to line 25.
|
||||
Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 files.
|
||||
|
||||
## Basic Options
|
||||
|
@ -47,20 +44,27 @@ Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 fi
|
|||
let g:ctrlp_cmd = 'CtrlP'
|
||||
```
|
||||
|
||||
* When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable:
|
||||
* When invoked without an explicit starting directory, CtrlP will set its local working directory according to this variable:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_working_path_mode = 'ra'
|
||||
```
|
||||
|
||||
`'c'` - the directory of the current file.
|
||||
`'r'` - the nearest ancestor that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs`
|
||||
`'a'` - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.
|
||||
`'a'` - the directory of the current file, unless it is a subdirectory of the cwd
|
||||
`'r'` - the nearest ancestor of the current file that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs`
|
||||
`'w'` - modifier to "r": start search from the cwd instead of the current file's directory
|
||||
`0` or `''` (empty string) - disable this feature.
|
||||
|
||||
Define additional root markers with the `g:ctrlp_root_markers` option.
|
||||
If none of the default markers (`.git` `.hg` `.svn` `.bzr` `_darcs`) are present in a project, you can define additional ones with `g:ctrlp_root_markers`:
|
||||
|
||||
* Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`:
|
||||
```vim
|
||||
let g:ctrlp_root_markers = ['pom.xml', '.p4ignore']
|
||||
```
|
||||
|
||||
If more than one mode is specified, they will be tried in order until a directory is located.
|
||||
|
||||
* Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`. If a custom listing command is being used, exclusions are ignored:
|
||||
|
||||
```vim
|
||||
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
|
||||
|
@ -81,11 +85,17 @@ Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 fi
|
|||
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
|
||||
```
|
||||
|
||||
* Ignore files in `.gitignore`
|
||||
|
||||
```vim
|
||||
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
|
||||
```
|
||||
|
||||
Check `:help ctrlp-options` for other options.
|
||||
|
||||
## Installation
|
||||
Use your favorite method or check the homepage for a [quick installation guide][3].
|
||||
|
||||
[1]: http://i.imgur.com/yIynr.png
|
||||
[2]: https://github.com/kien/ctrlp.vim/tree/extensions
|
||||
[3]: http://kien.github.com/ctrlp.vim#installation
|
||||
[1]: http://i.imgur.com/aOcwHwt.png
|
||||
[2]: https://github.com/ctrlpvim/ctrlp.vim/tree/extensions
|
||||
[3]: http://ctrlpvim.github.com/ctrlp.vim#installation
|
||||
|
|
1
sources_non_forked/lightline.vim/.gitignore
vendored
Normal file
1
sources_non_forked/lightline.vim/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/doc/tags
|
22
sources_non_forked/lightline.vim/.travis.yml
Normal file
22
sources_non_forked/lightline.vim/.travis.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
language: generic
|
||||
|
||||
sudo: false
|
||||
|
||||
install:
|
||||
- git clone --depth=1 https://github.com/thinca/vim-themis /tmp/themis
|
||||
- git clone https://github.com/vim/vim $HOME/vim
|
||||
- (if ! test -d $HOME/vim-7.4/bin; then cd $HOME/vim && git checkout . && git checkout v7.4 && ./configure --prefix=$HOME/vim-7.4 && make && make install; fi)
|
||||
- (if ! test -d $HOME/vim-7.3/bin; then cd $HOME/vim && git checkout . && git checkout v7.3 && ./configure --prefix=$HOME/vim-7.3 && make && make install; fi)
|
||||
- (if ! test -d $HOME/vim-7.2.051/bin; then cd $HOME/vim && git checkout . && git checkout v7.2.051 && ./configure --prefix=$HOME/vim-7.2.051 && make && make install; fi)
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/vim-7.4
|
||||
- $HOME/vim-7.3
|
||||
- $HOME/vim-7.2.051
|
||||
|
||||
script:
|
||||
- /tmp/themis/bin/themis --reporter spec
|
||||
- PATH=$HOME/vim-7.4/bin/:$PATH /tmp/themis/bin/themis --reporter spec
|
||||
- PATH=$HOME/vim-7.3/bin/:$PATH /tmp/themis/bin/themis --reporter spec
|
||||
- PATH=$HOME/vim-7.2.051/bin/:$PATH /tmp/themis/bin/themis --reporter spec
|
21
sources_non_forked/lightline.vim/LICENSE
Normal file
21
sources_non_forked/lightline.vim/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2016 itchyny
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
788
sources_non_forked/lightline.vim/README.md
Normal file
788
sources_non_forked/lightline.vim/README.md
Normal file
|
@ -0,0 +1,788 @@
|
|||
# lightline.vim
|
||||
A light and configurable statusline/tabline for Vim
|
||||
|
||||
https://github.com/itchyny/lightline.vim
|
||||
|
||||
### powerline theme (default)
|
||||
|
||||
![lightline.vim - powerline](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/powerline/0.png)
|
||||
|
||||
### wombat (with the patched font)
|
||||
|
||||
![lightline.vim - wombat](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/wombat/0.png)
|
||||
|
||||
### jellybeans (with the patched font)
|
||||
|
||||
![lightline.vim - jellybeans](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/jellybeans/0.png)
|
||||
|
||||
### solarized theme (dark)
|
||||
|
||||
![lightline.vim - solarized_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark/0.png)
|
||||
|
||||
### solarized theme (light)
|
||||
|
||||
![lightline.vim - solarized_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light/0.png)
|
||||
|
||||
### PaperColor theme (light)
|
||||
|
||||
![lightline.vim - PaperColor](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor/0.png)
|
||||
|
||||
### seoul256 theme
|
||||
|
||||
![lightline.vim - seoul256](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/seoul256/0.png)
|
||||
|
||||
### landscape theme (with the patched font)
|
||||
|
||||
![lightline.vim - landscape](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/landscape/0.png)
|
||||
|
||||
With branch name, read-only mark and modified mark.
|
||||
![lightline.vim - landscape - fugitive](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/landscape/5.png)
|
||||
|
||||
landscape is my colorscheme, which is a high-contrast cui-supported colorscheme, available at https://github.com/itchyny/landscape.vim
|
||||
|
||||
## Why yet another clone of powerline?
|
||||
+ [vim-powerline](https://github.com/Lokaltog/vim-powerline) is a nice plugin, but deprecated.
|
||||
+ [powerline](https://github.com/Lokaltog/powerline) is a nice plugin, but difficult to configure.
|
||||
+ [vim-airline](https://github.com/bling/vim-airline) is a nice plugin, but it uses too much functions of other plugins, which should be done by users in `.vimrc`.
|
||||
|
||||
## Spirit of this plugin
|
||||
+ Minimalism. The core script is very small.
|
||||
+ Configurability. You can create your own component and easily add to the statusline/tabline.
|
||||
+ Orthogonality. Any plugin should not change the settings of another plugin. Such plugin-crossing settings should be written by users in `.vimrc`.
|
||||
|
||||
## Author
|
||||
itchyny (https://github.com/itchyny)
|
||||
|
||||
## License
|
||||
This software is released under the MIT License, see LICENSE.
|
||||
|
||||
## Installation
|
||||
### Manually
|
||||
1. Put all files under $VIM.
|
||||
|
||||
### Pathogen
|
||||
1. Install with the following command.
|
||||
|
||||
git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline.vim
|
||||
|
||||
### Vundle (https://github.com/gmarik/Vundle.vim)
|
||||
1. Add the following configuration to your `.vimrc`.
|
||||
|
||||
Plugin 'itchyny/lightline.vim'
|
||||
|
||||
2. Install with `:PluginInstall`.
|
||||
|
||||
### NeoBundle (https://github.com/Shougo/neobundle.vim)
|
||||
1. Add the following configuration to your `.vimrc`.
|
||||
|
||||
NeoBundle 'itchyny/lightline.vim'
|
||||
|
||||
2. Install with `:NeoBundleInstall`.
|
||||
|
||||
### vim-plug (https://github.com/junegunn/vim-plug)
|
||||
1. Add the following configuration to your `.vimrc`.
|
||||
|
||||
Plug 'itchyny/lightline.vim'
|
||||
|
||||
2. Install with `:PlugInstall`.
|
||||
|
||||
## Configuration tutorial
|
||||
By default, the statusline looks like:
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/1.png)
|
||||
|
||||
If you use the wombat colorscheme, add the following settings to your `.vimrc` (or \_vimrc on Windows):
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ }
|
||||
```
|
||||
to get:
|
||||
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/2.png)
|
||||
|
||||
|
||||
If your statusline looks like
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/21.png)
|
||||
|
||||
and the cool statuslines appear only on `:vsp`, add
|
||||
```vim
|
||||
set laststatus=2
|
||||
```
|
||||
to your `.vimrc`.
|
||||
|
||||
|
||||
If you have problem like
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/20.png)
|
||||
|
||||
then add
|
||||
```sh
|
||||
export TERM=xterm-256color
|
||||
```
|
||||
to your `.*shrc` and add
|
||||
```vim
|
||||
if !has('gui_running')
|
||||
set t_Co=256
|
||||
endif
|
||||
```
|
||||
to your `.vimrc`.
|
||||
|
||||
|
||||
If the colors of the statusline do not change from the default colors, move the settings of `g:lightline` before setting the colorscheme.
|
||||
|
||||
If you are reloading your `.vimrc` via `autocmd` and get this problem
|
||||
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/20.png)
|
||||
|
||||
when saving it you need to add the nested flag to your `autocmd` like so
|
||||
|
||||
```vim
|
||||
augroup reload_vimrc
|
||||
autocmd!
|
||||
autocmd bufwritepost $MYVIMRC nested source $MYVIMRC
|
||||
augroup END
|
||||
```
|
||||
|
||||
|
||||
Colors appear correctly? Now let's see how to change the appearance.
|
||||
|
||||
|
||||
You may think that the default read-only mark is not so cool:
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/3.png)
|
||||
|
||||
Then edit the read-only component.
|
||||
The lightline components are stored in `g:lightline.component`.
|
||||
So you add the settings of `g:lightline.component.readonly` in your `.vimrc`. (the following settings are effective with the patched font for vim-powerline):
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'component': {
|
||||
\ 'readonly': '%{&readonly?"⭤":""}',
|
||||
\ }
|
||||
\ }
|
||||
```
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/4.png)
|
||||
|
||||
How nice!
|
||||
|
||||
But the boundaries are quadrilateral. You may miss the powerline.
|
||||
You have installed a cool font for powerlines, so you can use it.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'component': {
|
||||
\ 'readonly': '%{&readonly?"⭤":""}',
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
```
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/5.png)
|
||||
|
||||
Hurrah! Cool!
|
||||
|
||||
|
||||
If your statusline looks like:
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/16.png)
|
||||
|
||||
the patched font is not installed.
|
||||
|
||||
There are two kinds of patched fonts:
|
||||
|
||||
+ The patched fonts for [vim-powerline](https://github.com/Lokaltog/vim-powerline): see https://github.com/Lokaltog/vim-powerline/tree/develop/fontpatcher
|
||||
+ The patched fonts for [powerline](https://github.com/Lokaltog/powerline): see https://github.com/Lokaltog/powerline-fonts
|
||||
|
||||
Create or download a font and install it.
|
||||
And add the `guifont` setting to your `.vimrc` (see `:help 'guifont'` for more detail).
|
||||
If you are using the vim in a terminal, the font cannot be controlled in `.vimrc`.
|
||||
Open the setting of the terminal and select the patched font.
|
||||
|
||||
This tutorial is based on the former, the font for vim-powerline (Inconsolata for Powerline).
|
||||
If you have installed the patched font for powerline, use the following settings instead.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'component': {
|
||||
\ 'readonly': '%{&readonly?"":""}',
|
||||
\ },
|
||||
\ 'separator': { 'left': '', 'right': '' },
|
||||
\ 'subseparator': { 'left': '', 'right': '' }
|
||||
\ }
|
||||
```
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/19.png)
|
||||
|
||||
If you have installed the font for powerline and your statusline looks like
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/18.png)
|
||||
|
||||
remove
|
||||
```vim
|
||||
set ambiwidth=double
|
||||
```
|
||||
from your `.vimrc`. If you want to keep this setting, use the patched font for vim-powerline.
|
||||
+ https://github.com/Lokaltog/vim-powerline/tree/develop/fontpatcher
|
||||
|
||||
|
||||
If you will not install a patched font, use ascii characters like:
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'component': {
|
||||
\ 'readonly': '%{&readonly?"x":""}',
|
||||
\ },
|
||||
\ 'separator': { 'left': '', 'right': '' },
|
||||
\ 'subseparator': { 'left': '|', 'right': '|' }
|
||||
\ }
|
||||
```
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/17.png)
|
||||
|
||||
|
||||
|
||||
If the triangles do not appear (but you get some spaces or weird characters like <bf> or ¿), firstly try adding
|
||||
```vim
|
||||
set encoding=utf-8
|
||||
scriptencoding utf-8
|
||||
```
|
||||
to the head of your `.vimrc`.
|
||||
Still you have weird characters, use the unicode numbers. For powerline font
|
||||
users:
|
||||
```vim
|
||||
\ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" },
|
||||
\ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }
|
||||
```
|
||||
For vim-powerline font users:
|
||||
```vim
|
||||
\ 'separator': { 'left': "\u2b80", 'right': "\u2b82" },
|
||||
\ 'subseparator': { 'left': "\u2b81", 'right': "\u2b83" }
|
||||
```
|
||||
|
||||
|
||||
Almost all of things go well with the patched font but if the triangle looks weird:
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/22.png)
|
||||
|
||||
If you are using iTerm2, change the following settings of iTerm2:
|
||||
+ set `Profiles>Colors>Minimum contrast` to the Lowest.
|
||||
+ set `Profiles>Window>Transparency` to the Opaquest.
|
||||
|
||||
For other terminals, this weird-triangle problem will be resolved by disabling transparency or contrast adjustment.
|
||||
|
||||
|
||||
If you want to get rid of the extraneous default vim mode information that is now provided by lightline:
|
||||
![lightline.vim - showmode](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/showmode.png)
|
||||
```vim
|
||||
set noshowmode
|
||||
```
|
||||
|
||||
|
||||
Now, let us get back to the tutorial (with the patched font for vim-powerline).
|
||||
You look into a help file to find the marks annoying.
|
||||
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/6.png)
|
||||
|
||||
Help files are read-only and no-modifiable? We know that!
|
||||
OK, so you again edit the components.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'component': {
|
||||
\ 'readonly': '%{&filetype=="help"?"":&readonly?"⭤":""}',
|
||||
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
```
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/7.png)
|
||||
|
||||
Huh? Weird!
|
||||
The components do not collapse even if they have no information!
|
||||
In order to avoid this situation, you set expressions to `g:lightline.component_visible_condition`, which should become 1 only when the corresponding components have information.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'component': {
|
||||
\ 'readonly': '%{&filetype=="help"?"":&readonly?"⭤":""}',
|
||||
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
|
||||
\ },
|
||||
\ 'component_visible_condition': {
|
||||
\ 'readonly': '(&filetype!="help"&& &readonly)',
|
||||
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))'
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
```
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/8.png)
|
||||
|
||||
Okay. It works nice.
|
||||
|
||||
|
||||
|
||||
How does lightline decide the components to show in the statusline?
|
||||
It's very simple.
|
||||
The variables to select components are `g:lightline.active.left` and `g:lightline.active.right`.
|
||||
For example, you add the `g:lightline.active.left` in `.vimrc`.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'readonly', 'filename', 'modified' ] ]
|
||||
\ },
|
||||
\ 'component': {
|
||||
\ 'readonly': '%{&filetype=="help"?"":&readonly?"⭤":""}',
|
||||
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
|
||||
\ },
|
||||
\ 'component_visible_condition': {
|
||||
\ 'readonly': '(&filetype!="help"&& &readonly)',
|
||||
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))'
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
```
|
||||
If the plugin arranges all the components (in a situation you `set paste` and the file `.vimrc` is read-only, try to modify):
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/9.png)
|
||||
|
||||
The mode component, the paste component, read-only component, filename component and modified component in a row.
|
||||
Normally, the paste component does not show up.
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/10.png)
|
||||
|
||||
If the file is not read-only (more common cases), the read-only component does not show up.
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/11.png)
|
||||
|
||||
|
||||
Again look into `g:lightline.active.left`.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'readonly', 'filename', 'modified' ] ] ...
|
||||
```
|
||||
And the screen shot of all the components.
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/9.png)
|
||||
|
||||
The mode and paste component are displayed in the same group.
|
||||
The read-only, filename and modified component are in the second group.
|
||||
It corresponds to the structure of `g:lightline.active.left`.
|
||||
You can configure the components in the statusline by the following four variables:
|
||||
+ `g:lightline.active.left`
|
||||
+ `g:lightline.active.right`
|
||||
+ `g:lightline.inactive.left`
|
||||
+ `g:lightline.inactive.right`
|
||||
|
||||
Of course, your settings in `.vimrc` have priority over the default settings in lightline.
|
||||
|
||||
|
||||
|
||||
GitHub branch is important for us.
|
||||
And it is a default component in [powerline](https://github.com/Lokaltog/powerline) and [vim-powerline](https://github.com/Lokaltog/vim-powerline).
|
||||
However, lightline does not provide the branch feature by default.
|
||||
|
||||
In order to show the branch in the statusline, you firstly install the [vim-fugitive](https://github.com/tpope/vim-fugitive) plugin.
|
||||
Then edit the `g:lightline` in your `.vimrc`.
|
||||
+ Add your fugitive component to `g:lightline.component`.
|
||||
+ Add the condition when the fugitive component has information to `g:lightline.component_visible_condition`.
|
||||
+ Add the component by inserting `'fugitive'` to `g:lightline.active.left`.
|
||||
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ]
|
||||
\ },
|
||||
\ 'component': {
|
||||
\ 'readonly': '%{&filetype=="help"?"":&readonly?"⭤":""}',
|
||||
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}',
|
||||
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
|
||||
\ },
|
||||
\ 'component_visible_condition': {
|
||||
\ 'readonly': '(&filetype!="help"&& &readonly)',
|
||||
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
|
||||
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
```
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/12.png)
|
||||
|
||||
Okay, the branch component is added!
|
||||
|
||||
|
||||
|
||||
Now, you might get tired of setting both `'component'` and `'component_visible_condition'`.
|
||||
Or if you want to do something more complicated?
|
||||
|
||||
|
||||
In fact, the components can be created using functions.
|
||||
Add your function names for components to `g:lightline.component_function`.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ]
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'fugitive': 'LightLineFugitive',
|
||||
\ 'readonly': 'LightLineReadonly',
|
||||
\ 'modified': 'LightLineModified'
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
|
||||
function! LightLineModified()
|
||||
if &filetype == "help"
|
||||
return ""
|
||||
elseif &modified
|
||||
return "+"
|
||||
elseif &modifiable
|
||||
return ""
|
||||
else
|
||||
return ""
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! LightLineReadonly()
|
||||
if &filetype == "help"
|
||||
return ""
|
||||
elseif &readonly
|
||||
return "⭤"
|
||||
else
|
||||
return ""
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! LightLineFugitive()
|
||||
return exists('*fugitive#head') ? fugitive#head() : ''
|
||||
endfunction
|
||||
```
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/13.png)
|
||||
|
||||
Fine and readable!
|
||||
|
||||
|
||||
Finally, you come up with concatenating the three components: the read-only mark, the filename and the modified mark.
|
||||
Now you may know what to do.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'fugitive', 'filename' ] ]
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'fugitive': 'LightLineFugitive',
|
||||
\ 'readonly': 'LightLineReadonly',
|
||||
\ 'modified': 'LightLineModified',
|
||||
\ 'filename': 'LightLineFilename'
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
|
||||
function! LightLineModified()
|
||||
if &filetype == "help"
|
||||
return ""
|
||||
elseif &modified
|
||||
return "+"
|
||||
elseif &modifiable
|
||||
return ""
|
||||
else
|
||||
return ""
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! LightLineReadonly()
|
||||
if &filetype == "help"
|
||||
return ""
|
||||
elseif &readonly
|
||||
return "⭤"
|
||||
else
|
||||
return ""
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! LightLineFugitive()
|
||||
return exists('*fugitive#head') ? fugitive#head() : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFilename()
|
||||
return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
|
||||
\ ('' != expand('%:t') ? expand('%:t') : '[No Name]') .
|
||||
\ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
|
||||
endfunction
|
||||
```
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/14.png)
|
||||
|
||||
Oops! We forgot the cool mark for the branch component! (work with the patched font for vim-powerline)
|
||||
```vim
|
||||
function! LightLineFugitive()
|
||||
if exists("*fugitive#head")
|
||||
let branch = fugitive#head()
|
||||
return branch !=# '' ? '⭠ '.branch : ''
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
```
|
||||
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/15.png)
|
||||
|
||||
How cool!!!
|
||||
|
||||
Of course, you can name your component as you wish.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'my_component' ] ] },
|
||||
\ 'component_function': {
|
||||
\ 'my_component': 'LightLineComponent', ...
|
||||
```
|
||||
|
||||
This is the end of the tutorial. For more information, see `:help lightline`. Good luck with your nice statuslines.
|
||||
|
||||
### Cool characters for the patched fonts
|
||||
|
||||
Symbol | Default | powerline | vim-powerline
|
||||
------------------ | ------- | ------------- | -------------
|
||||
separator.left | '' | '' (\ue0b0) | '⮀' (\u2b80)
|
||||
separator.right | '' | '' (\ue0b2) | '⮂' (\u2b82)
|
||||
subseparator.left | '\|' | '' (\ue0b1) | '⮁' (\u2b81)
|
||||
subseparator.right | '\|' | '' (\ue0b3) | '⮃' (\u2b83)
|
||||
branch symbol | -- | '' (\ue0a0) | '⭠' (\u2b60)
|
||||
readonly symbol | -- | '' (\ue0a2) | '⭤' (\u2b64)
|
||||
linecolumn symbol | -- | '' (\ue0a1) | '⭡' (\u2b81)
|
||||
|
||||
### My settings
|
||||
I show my settings. I use the patched font for vim-powerline.
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'landscape',
|
||||
\ 'mode_map': { 'c': 'NORMAL' },
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'modified': 'LightLineModified',
|
||||
\ 'readonly': 'LightLineReadonly',
|
||||
\ 'fugitive': 'LightLineFugitive',
|
||||
\ 'filename': 'LightLineFilename',
|
||||
\ 'fileformat': 'LightLineFileformat',
|
||||
\ 'filetype': 'LightLineFiletype',
|
||||
\ 'fileencoding': 'LightLineFileencoding',
|
||||
\ 'mode': 'LightLineMode',
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
|
||||
function! LightLineModified()
|
||||
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
||||
endfunction
|
||||
|
||||
function! LightLineReadonly()
|
||||
return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? '⭤' : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFilename()
|
||||
return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
|
||||
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
|
||||
\ &ft == 'unite' ? unite#get_status_string() :
|
||||
\ &ft == 'vimshell' ? vimshell#get_status_string() :
|
||||
\ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
|
||||
\ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
|
||||
endfunction
|
||||
|
||||
function! LightLineFugitive()
|
||||
if &ft !~? 'vimfiler\|gundo' && exists("*fugitive#head")
|
||||
let branch = fugitive#head()
|
||||
return branch !=# '' ? '⭠ '.branch : ''
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFileformat()
|
||||
return winwidth(0) > 70 ? &fileformat : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFiletype()
|
||||
return winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : 'no ft') : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFileencoding()
|
||||
return winwidth(0) > 70 ? (&fenc !=# '' ? &fenc : &enc) : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineMode()
|
||||
return winwidth(0) > 60 ? lightline#mode() : ''
|
||||
endfunction
|
||||
```
|
||||
When the current window width is narrow, the mode component and the file information component collapse.
|
||||
For example, the [gundo](https://github.com/sjl/gundo.vim) buffer is narrow.
|
||||
|
||||
Before:
|
||||
![lightline.vim - gundo](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/gundo0.png)
|
||||
|
||||
After:
|
||||
![lightline.vim - gundo](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/gundo1.png)
|
||||
|
||||
Nice looking, isn't it?
|
||||
|
||||
### For power users
|
||||
For users who uses following plugins.
|
||||
|
||||
- [CtrlP](https://github.com/kien/ctrlp.vim)
|
||||
- [Tagbar](https://github.com/majutsushi/tagbar)
|
||||
- [Gundo](http://github.com/sjl/gundo.vim)
|
||||
- [NERDtree](http://github.com/scrooloose/nerdtree)
|
||||
- [Syntastic](https://github.com/scrooloose/syntastic)
|
||||
- [unite.vim](https://github.com/Shougo/unite.vim)
|
||||
- [vimfiler.vim](https://github.com/Shougo/vimfiler.vim)
|
||||
- [vimshell.vim](https://github.com/Shougo/vimshell.vim)
|
||||
|
||||
```vim
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'wombat',
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark'] ],
|
||||
\ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ]
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'fugitive': 'LightLineFugitive',
|
||||
\ 'filename': 'LightLineFilename',
|
||||
\ 'fileformat': 'LightLineFileformat',
|
||||
\ 'filetype': 'LightLineFiletype',
|
||||
\ 'fileencoding': 'LightLineFileencoding',
|
||||
\ 'mode': 'LightLineMode',
|
||||
\ 'ctrlpmark': 'CtrlPMark',
|
||||
\ },
|
||||
\ 'component_expand': {
|
||||
\ 'syntastic': 'SyntasticStatuslineFlag',
|
||||
\ },
|
||||
\ 'component_type': {
|
||||
\ 'syntastic': 'error',
|
||||
\ },
|
||||
\ 'subseparator': { 'left': '|', 'right': '|' }
|
||||
\ }
|
||||
|
||||
function! LightLineModified()
|
||||
return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
||||
endfunction
|
||||
|
||||
function! LightLineReadonly()
|
||||
return &ft !~? 'help' && &readonly ? 'RO' : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFilename()
|
||||
let fname = expand('%:t')
|
||||
return fname == 'ControlP' && has_key(g:lightline, 'ctrlp_item') ? g:lightline.ctrlp_item :
|
||||
\ fname == '__Tagbar__' ? g:lightline.fname :
|
||||
\ fname =~ '__Gundo\|NERD_tree' ? '' :
|
||||
\ &ft == 'vimfiler' ? vimfiler#get_status_string() :
|
||||
\ &ft == 'unite' ? unite#get_status_string() :
|
||||
\ &ft == 'vimshell' ? vimshell#get_status_string() :
|
||||
\ ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
|
||||
\ ('' != fname ? fname : '[No Name]') .
|
||||
\ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
|
||||
endfunction
|
||||
|
||||
function! LightLineFugitive()
|
||||
try
|
||||
if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head')
|
||||
let mark = '' " edit here for cool mark
|
||||
let branch = fugitive#head()
|
||||
return branch !=# '' ? mark.branch : ''
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFileformat()
|
||||
return winwidth(0) > 70 ? &fileformat : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFiletype()
|
||||
return winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : 'no ft') : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFileencoding()
|
||||
return winwidth(0) > 70 ? (&fenc !=# '' ? &fenc : &enc) : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineMode()
|
||||
let fname = expand('%:t')
|
||||
return fname == '__Tagbar__' ? 'Tagbar' :
|
||||
\ fname == 'ControlP' ? 'CtrlP' :
|
||||
\ fname == '__Gundo__' ? 'Gundo' :
|
||||
\ fname == '__Gundo_Preview__' ? 'Gundo Preview' :
|
||||
\ fname =~ 'NERD_tree' ? 'NERDTree' :
|
||||
\ &ft == 'unite' ? 'Unite' :
|
||||
\ &ft == 'vimfiler' ? 'VimFiler' :
|
||||
\ &ft == 'vimshell' ? 'VimShell' :
|
||||
\ winwidth(0) > 60 ? lightline#mode() : ''
|
||||
endfunction
|
||||
|
||||
function! CtrlPMark()
|
||||
if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item')
|
||||
call lightline#link('iR'[g:lightline.ctrlp_regex])
|
||||
return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item
|
||||
\ , g:lightline.ctrlp_next], 0)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let g:ctrlp_status_func = {
|
||||
\ 'main': 'CtrlPStatusFunc_1',
|
||||
\ 'prog': 'CtrlPStatusFunc_2',
|
||||
\ }
|
||||
|
||||
function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked)
|
||||
let g:lightline.ctrlp_regex = a:regex
|
||||
let g:lightline.ctrlp_prev = a:prev
|
||||
let g:lightline.ctrlp_item = a:item
|
||||
let g:lightline.ctrlp_next = a:next
|
||||
return lightline#statusline(0)
|
||||
endfunction
|
||||
|
||||
function! CtrlPStatusFunc_2(str)
|
||||
return lightline#statusline(0)
|
||||
endfunction
|
||||
|
||||
let g:tagbar_status_func = 'TagbarStatusFunc'
|
||||
|
||||
function! TagbarStatusFunc(current, sort, fname, ...) abort
|
||||
let g:lightline.fname = a:fname
|
||||
return lightline#statusline(0)
|
||||
endfunction
|
||||
|
||||
augroup AutoSyntastic
|
||||
autocmd!
|
||||
autocmd BufWritePost *.c,*.cpp call s:syntastic()
|
||||
augroup END
|
||||
function! s:syntastic()
|
||||
SyntasticCheck
|
||||
call lightline#update()
|
||||
endfunction
|
||||
|
||||
let g:unite_force_overwrite_statusline = 0
|
||||
let g:vimfiler_force_overwrite_statusline = 0
|
||||
let g:vimshell_force_overwrite_statusline = 0
|
||||
```
|
||||
|
||||
### Note for developers of other plugins
|
||||
Appearance consistency matters.
|
||||
|
||||
The statusline is an important space for Vim users.
|
||||
Overwriting the statusline forcibly in your plugin is not a good idea.
|
||||
It is not hospitality, but just an annoying feature.
|
||||
If your plugin has such a feature, add an option to be modest.
|
||||
|
||||
A good design is the following.
|
||||
Firstly, give the users a clue to judge which buffer is the one your plugin creates.
|
||||
The filename is a manner and the filetype is another.
|
||||
Then, export a function which is useful to be shown in the statusline.
|
||||
Lastly, for advanced users, set important information in buffer variables.
|
||||
So that the users can obtain the condition of the plugin easily.
|
485
sources_non_forked/lightline.vim/autoload/lightline.vim
Normal file
485
sources_non_forked/lightline.vim/autoload/lightline.vim
Normal file
|
@ -0,0 +1,485 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2016/06/12 22:40:00.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:_ = 1
|
||||
|
||||
function! lightline#update() abort
|
||||
if s:_
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
endif
|
||||
if !s:lightline.enable.statusline
|
||||
return
|
||||
endif
|
||||
let w = winnr()
|
||||
let s = winnr('$') == 1 ? [lightline#statusline(0)] : [lightline#statusline(0), lightline#statusline(1)]
|
||||
for n in range(1, winnr('$'))
|
||||
call setwinvar(n, '&statusline', s[n!=w])
|
||||
call setwinvar(n, 'lightline', n!=w)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! lightline#update_once() abort
|
||||
if !exists('w:lightline') || w:lightline
|
||||
call lightline#update()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! lightline#update_disable() abort
|
||||
if !s:lightline.enable.statusline
|
||||
return
|
||||
endif
|
||||
call setwinvar(0, '&statusline', '')
|
||||
endfunction
|
||||
|
||||
function! lightline#enable() abort
|
||||
call lightline#colorscheme()
|
||||
call lightline#update()
|
||||
if s:lightline.enable.tabline
|
||||
set tabline=%!lightline#tabline()
|
||||
endif
|
||||
augroup lightline
|
||||
autocmd!
|
||||
autocmd WinEnter,BufWinEnter,FileType,ColorScheme,SessionLoadPost * call lightline#update()
|
||||
autocmd ColorScheme,SessionLoadPost * call lightline#highlight()
|
||||
autocmd CursorMoved,BufUnload * call lightline#update_once()
|
||||
augroup END
|
||||
augroup lightline-disable
|
||||
autocmd!
|
||||
augroup END
|
||||
augroup! lightline-disable
|
||||
endfunction
|
||||
|
||||
function! lightline#disable() abort
|
||||
let [&statusline, &tabline] = [get(s:, '_statusline', ''), get(s:, '_tabline', '')]
|
||||
for t in range(1, tabpagenr('$'))
|
||||
for n in range(1, tabpagewinnr(t, '$'))
|
||||
call settabwinvar(t, n, '&statusline', '')
|
||||
endfor
|
||||
endfor
|
||||
augroup lightline
|
||||
autocmd!
|
||||
augroup END
|
||||
augroup! lightline
|
||||
augroup lightline-disable
|
||||
autocmd!
|
||||
autocmd WinEnter * call lightline#update_disable()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! lightline#toggle() abort
|
||||
if exists('#lightline')
|
||||
call lightline#disable()
|
||||
else
|
||||
call lightline#enable()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:_lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly', 'filename', 'modified' ] ],
|
||||
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat', 'fileencoding', 'filetype' ] ]
|
||||
\ },
|
||||
\ 'inactive': {
|
||||
\ 'left': [ [ 'filename' ] ],
|
||||
\ 'right': [ [ 'lineinfo' ], [ 'percent' ] ]
|
||||
\ },
|
||||
\ 'tabline': {
|
||||
\ 'left': [ [ 'tabs' ] ],
|
||||
\ 'right': [ [ 'close' ] ]
|
||||
\ },
|
||||
\ 'tab': {
|
||||
\ 'active': [ 'tabnum', 'filename', 'modified' ],
|
||||
\ 'inactive': [ 'tabnum', 'filename', 'modified' ]
|
||||
\ },
|
||||
\ 'component': {
|
||||
\ 'mode': '%{lightline#mode()}',
|
||||
\ 'absolutepath': '%F', 'relativepath': '%f', 'filename': '%t', 'modified': '%M', 'bufnum': '%n',
|
||||
\ 'paste': '%{&paste?"PASTE":""}', 'readonly': '%R', 'charvalue': '%b', 'charvaluehex': '%B',
|
||||
\ 'spell': '%{&spell?&spelllang:""}', 'fileencoding': '%{&fenc!=#""?&fenc:&enc}', 'fileformat': '%{&ff}',
|
||||
\ 'filetype': '%{&ft!=#""?&ft:"no ft"}', 'percent': '%3p%%', 'percentwin': '%P',
|
||||
\ 'lineinfo': '%3l:%-2v', 'line': '%l', 'column': '%c', 'close': '%999X X '
|
||||
\ },
|
||||
\ 'component_visible_condition': {
|
||||
\ 'modified': '&modified||!&modifiable', 'readonly': '&readonly', 'paste': '&paste', 'spell': '&spell'
|
||||
\ },
|
||||
\ 'component_function': {},
|
||||
\ 'component_expand': {
|
||||
\ 'tabs': 'lightline#tabs'
|
||||
\ },
|
||||
\ 'component_type': {
|
||||
\ 'tabs': 'tabsel', 'close': 'raw'
|
||||
\ },
|
||||
\ 'tab_component': {},
|
||||
\ 'tab_component_function': {
|
||||
\ 'filename': 'lightline#tab#filename', 'modified': 'lightline#tab#modified',
|
||||
\ 'readonly': 'lightline#tab#readonly', 'tabnum': 'lightline#tab#tabnum'
|
||||
\ },
|
||||
\ 'colorscheme': 'default',
|
||||
\ 'mode_map': {
|
||||
\ 'n': 'NORMAL', 'i': 'INSERT', 'R': 'REPLACE', 'v': 'VISUAL', 'V': 'V-LINE', "\<C-v>": 'V-BLOCK',
|
||||
\ 'c': 'COMMAND', 's': 'SELECT', 'S': 'S-LINE', "\<C-s>": 'S-BLOCK', 't': 'TERMINAL'
|
||||
\ },
|
||||
\ 'separator': { 'left': '', 'right': '' },
|
||||
\ 'subseparator': { 'left': '|', 'right': '|' },
|
||||
\ 'tabline_separator': {},
|
||||
\ 'tabline_subseparator': {},
|
||||
\ 'enable': { 'statusline': 1, 'tabline': 1 },
|
||||
\ '_mode_': {
|
||||
\ 'n': 'normal', 'i': 'insert', 'R': 'replace', 'v': 'visual', 'V': 'visual', "\<C-v>": 'visual',
|
||||
\ 'c': 'command', 's': 'select', 'S': 'select', "\<C-s>": 'select', 't': 'terminal'
|
||||
\ },
|
||||
\ 'mode_fallback': { 'replace': 'insert', 'terminal': 'insert', 'select': 'visual' },
|
||||
\ 'palette': {},
|
||||
\ 'winwidth': winwidth(0),
|
||||
\ }
|
||||
function! lightline#init() abort
|
||||
let s:lightline = deepcopy(get(g:, 'lightline', {}))
|
||||
for [key, value] in items(s:_lightline)
|
||||
if type(value) == 4
|
||||
if !has_key(s:lightline, key)
|
||||
let s:lightline[key] = {}
|
||||
endif
|
||||
call extend(s:lightline[key], value, 'keep')
|
||||
elseif !has_key(s:lightline, key)
|
||||
let s:lightline[key] = value
|
||||
endif
|
||||
unlet value
|
||||
endfor
|
||||
call extend(s:lightline.tabline_separator, s:lightline.separator, 'keep')
|
||||
call extend(s:lightline.tabline_subseparator, s:lightline.subseparator, 'keep')
|
||||
let s:lightline.tabline_configured = 0
|
||||
for components in deepcopy(s:lightline.tabline.left + s:lightline.tabline.right)
|
||||
if len(filter(components, 'v:val !=# "tabs" && v:val !=# "close"')) > 0
|
||||
let s:lightline.tabline_configured = 1
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
if !exists('s:_statusline')
|
||||
let s:_statusline = &statusline
|
||||
endif
|
||||
if !exists('s:_tabline')
|
||||
let s:_tabline = &tabline
|
||||
endif
|
||||
if s:lightline.enable.tabline
|
||||
set tabline=%!lightline#tabline()
|
||||
else
|
||||
let &tabline = get(s:, '_tabline', '')
|
||||
endif
|
||||
for f in values(s:lightline.component_function)
|
||||
silent! call call(f, [])
|
||||
endfor
|
||||
for f in values(s:lightline.tab_component_function)
|
||||
silent! call call(f, [1])
|
||||
endfor
|
||||
let s:mode = ''
|
||||
endfunction
|
||||
|
||||
function! lightline#colorscheme() abort
|
||||
try
|
||||
let s:lightline.palette = g:lightline#colorscheme#{s:lightline.colorscheme}#palette
|
||||
catch
|
||||
call lightline#error('Could not load colorscheme ' . s:lightline.colorscheme . '.')
|
||||
let s:lightline.colorscheme = 'default'
|
||||
let s:lightline.palette = g:lightline#colorscheme#{s:lightline.colorscheme}#palette
|
||||
finally
|
||||
let s:highlight = {}
|
||||
call lightline#highlight('normal')
|
||||
call lightline#link()
|
||||
let s:_ = 0
|
||||
if has('win32') && !has('gui_running') && &t_Co < 256
|
||||
for u in values(s:lightline.palette)
|
||||
for v in values(u)
|
||||
for _ in v
|
||||
let [_[2], _[3]] = [lightline#colortable#gui2cui(_[0], _[2]), lightline#colortable#gui2cui(_[1], _[3])]
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! lightline#palette() abort
|
||||
return s:lightline.palette
|
||||
endfunction
|
||||
|
||||
function! lightline#mode() abort
|
||||
return get(s:lightline.mode_map, mode(), '')
|
||||
endfunction
|
||||
|
||||
let s:mode = ''
|
||||
function! lightline#link(...) abort
|
||||
let mode = get(s:lightline._mode_, a:0 ? a:1 : mode(), 'normal')
|
||||
if s:mode == mode
|
||||
return ''
|
||||
endif
|
||||
let s:mode = mode
|
||||
if !has_key(s:highlight, mode)
|
||||
call lightline#highlight(mode)
|
||||
endif
|
||||
let types = map(s:uniq(sort(filter(values(s:lightline.component_type), 'v:val !=# "raw"'))), '[v:val, 1]')
|
||||
for [p, l] in [['Left', len(s:lightline.active.left)], ['Right', len(s:lightline.active.right)]]
|
||||
for [i, t] in map(range(0, l), '[v:val, 0]') + types
|
||||
if i != l
|
||||
exec printf('hi link LightLine%s_active_%s LightLine%s_%s_%s', p, i, p, mode, i)
|
||||
endif
|
||||
for [j, s] in map(range(0, l), '[v:val, 0]') + types
|
||||
if i + 1 == j || t || s && i != l
|
||||
exec printf('hi link LightLine%s_active_%s_%s LightLine%s_%s_%s_%s', p, i, j, p, mode, i, j)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
exec printf('hi link LightLineMiddle_active LightLineMiddle_%s', mode)
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:term(p) abort
|
||||
return get(a:p, 4) !=# '' ? 'term='.a:p[4].' cterm='.a:p[4].' gui='.a:p[4] : ''
|
||||
endfunction
|
||||
|
||||
if exists('*uniq')
|
||||
let s:uniq = function('uniq')
|
||||
else
|
||||
function! s:uniq(xs) abort
|
||||
let i = len(a:xs) - 1
|
||||
while i > 0
|
||||
if a:xs[i] ==# a:xs[i - 1]
|
||||
call remove(a:xs, i)
|
||||
endif
|
||||
let i -= 1
|
||||
endwhile
|
||||
return a:xs
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! lightline#highlight(...) abort
|
||||
let [c, f] = [s:lightline.palette, s:lightline.mode_fallback]
|
||||
let [s:lightline.llen, s:lightline.rlen] = [len(c.normal.left), len(c.normal.right)]
|
||||
let [s:lightline.tab_llen, s:lightline.tab_rlen] = [len(has_key(get(c, 'tabline', {}), 'left') ? c.tabline.left : c.normal.left), len(has_key(get(c, 'tabline', {}), 'right') ? c.tabline.right : c.normal.right)]
|
||||
let types = map(s:uniq(sort(filter(values(s:lightline.component_type), 'v:val !=# "raw"'))), '[v:val, 1]')
|
||||
let modes = a:0 ? [a:1] : extend(['normal', 'insert', 'replace', 'visual', 'inactive', 'command', 'select', 'tabline'], has('nvim') ? ['terminal'] : [])
|
||||
for mode in modes
|
||||
let s:highlight[mode] = 1
|
||||
let d = has_key(c, mode) ? mode : has_key(f, mode) && has_key(c, f[mode]) ? f[mode] : 'normal'
|
||||
let left = d ==# 'tabline' ? s:lightline.tabline.left : d ==# 'inactive' ? s:lightline.inactive.left : s:lightline.active.left
|
||||
let right = d ==# 'tabline' ? s:lightline.tabline.right : d ==# 'inactive' ? s:lightline.inactive.right : s:lightline.active.right
|
||||
let ls = has_key(get(c, d, {}), 'left') ? c[d].left : has_key(f, d) && has_key(get(c, f[d], {}), 'left') ? c[f[d]].left : c.normal.left
|
||||
let ms = has_key(get(c, d, {}), 'middle') ? c[d].middle[0] : has_key(f, d) && has_key(get(c, f[d], {}), 'middle') ? c[f[d]].middle[0] : c.normal.middle[0]
|
||||
let rs = has_key(get(c, d, {}), 'right') ? c[d].right : has_key(f, d) && has_key(get(c, f[d], {}), 'right') ? c[f[d]].right : c.normal.right
|
||||
for [p, l, zs] in [['Left', len(left), ls], ['Right', len(right), rs]]
|
||||
for [i, t] in map(range(0, l), '[v:val, 0]') + types
|
||||
if i < l || i < 1
|
||||
let r = t ? (has_key(get(c, d, []), i) ? c[d][i][0] : has_key(get(c, 'tabline', {}), i) ? c.tabline[i][0] : get(c.normal, i, zs)[0]) : get(zs, i, ms)
|
||||
exec printf('hi LightLine%s_%s_%s guifg=%s guibg=%s ctermfg=%s ctermbg=%s %s', p, mode, i, r[0], r[1], r[2], r[3], s:term(r))
|
||||
endif
|
||||
for [j, s] in map(range(0, l), '[v:val, 0]') + types
|
||||
if i + 1 == j || t || s && i != l
|
||||
let q = s ? (has_key(get(c, d, []), j) ? c[d][j][0] : has_key(get(c, 'tabline', {}), j) ? c.tabline[j][0] : get(c.normal, j, zs)[0]) : (j != l ? get(zs, j, ms) :ms)
|
||||
exec printf('hi LightLine%s_%s_%s_%s guifg=%s guibg=%s ctermfg=%s ctermbg=%s', p, mode, i, j, r[1], q[1], r[3], q[3])
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
exec printf('hi LightLineMiddle_%s guifg=%s guibg=%s ctermfg=%s ctermbg=%s %s', mode, ms[0], ms[1], ms[2], ms[3], s:term(ms))
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:subseparator(components, subseparator, expanded) abort
|
||||
let [a, c, f, v] = [ a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition ]
|
||||
let xs = map(range(len(a:components)), 'a:expanded[v:val] ? "1" :
|
||||
\ has_key(f, a[v:val]) ? (exists("*".f[a[v:val]]) ? "" : "exists(\"*".f[a[v:val]]."\")&&").f[a[v:val]]."()!=#\"\"" :
|
||||
\ has_key(v, a[v:val]) ? "(" . v[a[v:val]] . ")" : has_key(c, a[v:val]) ? "1" : "0"')
|
||||
return '%{' . (xs[0] ==# '1' ? '' : xs[0] . '&&(') . join(xs[1:], '||') . (xs[0] ==# '1' ? '' : ')') . '?"' . a:subseparator . '":""}'
|
||||
endfunction
|
||||
|
||||
function! lightline#concatenate(xs, right) abort
|
||||
let separator = a:right ? s:lightline.subseparator.right : s:lightline.subseparator.left
|
||||
return join(filter(copy(a:xs), 'v:val !=# ""'), ' ' . separator . ' ')
|
||||
endfunction
|
||||
|
||||
function! lightline#statusline(inactive) abort
|
||||
if a:inactive && !has_key(s:highlight, 'inactive')
|
||||
call lightline#highlight('inactive')
|
||||
endif
|
||||
return s:line(0, a:inactive)
|
||||
endfunction
|
||||
|
||||
function! s:normalize(result) abort
|
||||
if type(a:result) == 3
|
||||
return map(a:result, 'type(v:val) == 1 ? v:val : string(v:val)')
|
||||
elseif type(a:result) == 1
|
||||
return [a:result]
|
||||
else
|
||||
return [string(a:result)]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:evaluate_expand(component) abort
|
||||
try
|
||||
let result = call(a:component, [])
|
||||
if type(result) == 1 && result ==# ''
|
||||
return []
|
||||
endif
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
return map(type(result) == 3 ? (result + [[], [], []])[:2] : [[], [result], []], 'filter(s:normalize(v:val), "v:val !=# ''''")')
|
||||
endfunction
|
||||
|
||||
function! s:convert(name, index) abort
|
||||
if has_key(s:lightline.component_expand, a:name)
|
||||
let type = get(s:lightline.component_type, a:name, a:index)
|
||||
return filter(s:map(s:evaluate_expand(s:lightline.component_expand[a:name]), '[v:val, 1, v:key == 1 ? "' . type . '" : "' . a:index . '"]'), 'v:val[0] != []')
|
||||
else
|
||||
return [[[a:name], 0, a:index]]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:flatten_twice(xss) abort
|
||||
let ys = []
|
||||
for xs in a:xss
|
||||
for x in xs
|
||||
let ys += x
|
||||
endfor
|
||||
endfor
|
||||
return ys
|
||||
endfunction
|
||||
|
||||
if v:version > 702 || v:version == 702 && has('patch295')
|
||||
let s:map = function('map')
|
||||
else
|
||||
function! s:map(xs, f) abort
|
||||
let ys = []
|
||||
for i in range(len(a:xs))
|
||||
call extend(ys, map(a:xs[(i):(i)], substitute(a:f, 'v:key', i, 'g')))
|
||||
endfor
|
||||
return ys
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! s:expand(components) abort
|
||||
let components = []
|
||||
let expanded = []
|
||||
let indices = []
|
||||
let previndex = -1
|
||||
let xs = s:flatten_twice(s:map(deepcopy(a:components), 'map(v:val, "s:convert(v:val, ''" . v:key . "'')")'))
|
||||
for [component, expand, index] in xs
|
||||
if previndex != index
|
||||
call add(indices, index)
|
||||
call add(components, [])
|
||||
call add(expanded, [])
|
||||
endif
|
||||
call extend(components[-1], component)
|
||||
call extend(expanded[-1], repeat([expand], len(component)))
|
||||
let previndex = index
|
||||
endfor
|
||||
call add(indices, string(len(a:components)))
|
||||
return [components, expanded, indices]
|
||||
endfunction
|
||||
|
||||
function! s:line(tabline, inactive) abort
|
||||
let _ = a:tabline ? '' : '%{lightline#link()}'
|
||||
if s:lightline.palette == {}
|
||||
call lightline#colorscheme()
|
||||
endif
|
||||
let [l, r] = a:tabline ? [s:lightline.tab_llen, s:lightline.tab_rlen] : [s:lightline.llen, s:lightline.rlen]
|
||||
let [p, s] = a:tabline ? [s:lightline.tabline_separator, s:lightline.tabline_subseparator] : [s:lightline.separator, s:lightline.subseparator]
|
||||
let [c, f, t] = [s:lightline.component, s:lightline.component_function, s:lightline.component_type]
|
||||
let mode = a:tabline ? 'tabline' : a:inactive ? 'inactive' : 'active'
|
||||
let l_ = has_key(s:lightline, mode) ? s:lightline[mode].left : s:lightline.active.left
|
||||
let [lt, lc, ll] = s:expand(copy(l_))
|
||||
let r_ = has_key(s:lightline, mode) ? s:lightline[mode].right : s:lightline.active.right
|
||||
let [rt, rc, rl] = s:expand(copy(r_))
|
||||
for i in range(len(lt))
|
||||
let _ .= '%#LightLineLeft_' . mode . '_' . ll[i] . '#'
|
||||
for j in range(len(lt[i]))
|
||||
let x = lc[i][j] ? lt[i][j] : has_key(f, lt[i][j]) ? (exists('*' . f[lt[i][j]]) ? '%{' . f[lt[i][j]] . '()}' : '%{exists("*' . f[lt[i][j]] . '")?' . f[lt[i][j]] . '():""}') : get(c, lt[i][j], '')
|
||||
let _ .= has_key(t, lt[i][j]) && t[lt[i][j]] ==# 'raw' || x ==# '' ? x : '%( ' . x . ' %)'
|
||||
if j < len(lt[i]) - 1 && s.left !=# ''
|
||||
let _ .= s:subseparator(lt[i][(j):], s.left, lc[i][(j):])
|
||||
endif
|
||||
endfor
|
||||
let _ .= '%#LightLineLeft_' . mode . '_' . ll[i] . '_' . ll[i + 1] . '#'
|
||||
let _ .= i < l + len(lt) - len(l_) && ll[i] < l || ll[i] != ll[i + 1] ? p.left : len(lt[i]) ? s.left : ''
|
||||
endfor
|
||||
let _ .= '%#LightLineMiddle_' . mode . '#%='
|
||||
for i in reverse(range(len(rt)))
|
||||
let _ .= '%#LightLineRight_' . mode . '_' . rl[i] . '_' . rl[i + 1] . '#'
|
||||
let _ .= i < r + len(rt) - len(r_) && rl[i] < r || rl[i] != rl[i + 1] ? p.right : len(rt[i]) ? s.right : ''
|
||||
let _ .= '%#LightLineRight_' . mode . '_' . rl[i] . '#'
|
||||
for j in range(len(rt[i]))
|
||||
let x = rc[i][j] ? rt[i][j] : has_key(f, rt[i][j]) ? (exists('*' . f[rt[i][j]]) ? '%{' . f[rt[i][j]] . '()}' : '%{exists("*' . f[rt[i][j]] . '")?' . f[rt[i][j]] . '():""}') : get(c, rt[i][j], '')
|
||||
let _ .= has_key(t, rt[i][j]) && t[rt[i][j]] ==# 'raw' || x ==# '' ? x : '%( ' . x . ' %)'
|
||||
if j < len(rt[i]) - 1 && s.right !=# ''
|
||||
let _ .= s:subseparator(rt[i][(j):], s.right, rc[i][(j):])
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
return _
|
||||
endfunction
|
||||
|
||||
let s:tabnr = -1
|
||||
let s:tabcnt = -1
|
||||
let s:tabline = ''
|
||||
function! lightline#tabline() abort
|
||||
if !has_key(s:highlight, 'tabline')
|
||||
call lightline#highlight('tabline')
|
||||
endif
|
||||
if s:lightline.tabline_configured || s:tabnr != tabpagenr() || s:tabcnt != tabpagenr('$')
|
||||
let s:tabnr = tabpagenr()
|
||||
let s:tabcnt = tabpagenr('$')
|
||||
let s:tabline = s:line(1, 0)
|
||||
endif
|
||||
return s:tabline
|
||||
endfunction
|
||||
|
||||
function! lightline#tabs() abort
|
||||
let [x, y, z] = [[], [], []]
|
||||
let nr = tabpagenr()
|
||||
let cnt = tabpagenr('$')
|
||||
for i in range(1, cnt)
|
||||
call add(i < nr ? x : i == nr ? y : z, '%'. i . 'T%{lightline#onetab(' . i . ',' . (i == nr) . ')}' . (i == cnt ? '%T' : ''))
|
||||
endfor
|
||||
let abbr = '...'
|
||||
let n = min([max([s:lightline.winwidth / 40, 2]), 8])
|
||||
if len(x) > n && len(z) > n
|
||||
let x = extend(add(x[:n/2-1], abbr), x[-(n+1)/2:])
|
||||
let z = extend(add(z[:(n+1)/2-1], abbr), z[-n/2:])
|
||||
elseif len(x) + len(z) > 2 * n
|
||||
if len(x) > n
|
||||
let x = extend(add(x[:(2*n-len(z))/2-1], abbr), x[-(2*n-len(z)+1)/2:])
|
||||
elseif len(z) > n
|
||||
let z = extend(add(z[:(2*n-len(x)+1)/2-1], abbr), z[-(2*n-len(x))/2:])
|
||||
endif
|
||||
endif
|
||||
return [x, y, z]
|
||||
endfunction
|
||||
|
||||
function! lightline#onetab(n, active) abort
|
||||
let _ = []
|
||||
for name in a:active ? s:lightline.tab.active : s:lightline.tab.inactive
|
||||
if has_key(s:lightline.tab_component_function, name)
|
||||
call add(_, call(s:lightline.tab_component_function[name], [a:n]))
|
||||
else
|
||||
call add(_, get(s:lightline.tab_component, name, ''))
|
||||
endif
|
||||
endfor
|
||||
return join(filter(_, 'v:val !=# ""'), ' ')
|
||||
endfunction
|
||||
|
||||
function! lightline#error(msg) abort
|
||||
echohl ErrorMsg
|
||||
echomsg 'lightline.vim: '.a:msg
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
|
@ -0,0 +1,228 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2015/03/18 08:37:17.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:cuicolor = {
|
||||
\ 'black' : 16,
|
||||
\ 'white' : 231,
|
||||
\
|
||||
\ 'darkestgreen' : 22,
|
||||
\ 'darkgreen' : 28,
|
||||
\ 'mediumgreen' : 70,
|
||||
\ 'brightgreen' : 148,
|
||||
\
|
||||
\ 'darkestcyan' : 23,
|
||||
\ 'mediumcyan' : 117,
|
||||
\
|
||||
\ 'darkestblue' : 24,
|
||||
\ 'darkblue' : 31,
|
||||
\
|
||||
\ 'darkestred' : 52,
|
||||
\ 'darkred' : 88,
|
||||
\ 'mediumred' : 124,
|
||||
\ 'brightred' : 160,
|
||||
\ 'brightestred' : 196,
|
||||
\
|
||||
\ 'darkestpurple' : 55,
|
||||
\ 'mediumpurple' : 98,
|
||||
\ 'brightpurple' : 189,
|
||||
\
|
||||
\ 'brightorange' : 208,
|
||||
\ 'brightestorange': 214,
|
||||
\
|
||||
\ 'gray0' : 233,
|
||||
\ 'gray1' : 235,
|
||||
\ 'gray2' : 236,
|
||||
\ 'gray3' : 239,
|
||||
\ 'gray4' : 240,
|
||||
\ 'gray5' : 241,
|
||||
\ 'gray6' : 244,
|
||||
\ 'gray7' : 245,
|
||||
\ 'gray8' : 247,
|
||||
\ 'gray9' : 250,
|
||||
\ 'gray10' : 252,
|
||||
\
|
||||
\ 'yellow' : 136,
|
||||
\ 'orange' : 166,
|
||||
\ 'red' : 160,
|
||||
\ 'magenta' : 125,
|
||||
\ 'violet' : 61,
|
||||
\ 'blue' : 33,
|
||||
\ 'cyan' : 37,
|
||||
\ 'green' : 64,
|
||||
\ }
|
||||
|
||||
let s:guicolor = {
|
||||
\ 'black' : '#000000',
|
||||
\ 'white' : '#ffffff',
|
||||
\
|
||||
\ 'darkestgreen' : '#005f00',
|
||||
\ 'darkgreen' : '#008700',
|
||||
\ 'mediumgreen' : '#5faf00',
|
||||
\ 'brightgreen' : '#afdf00',
|
||||
\
|
||||
\ 'darkestcyan' : '#005f5f',
|
||||
\ 'mediumcyan' : '#87dfff',
|
||||
\
|
||||
\ 'darkestblue' : '#005f87',
|
||||
\ 'darkblue' : '#0087af',
|
||||
\
|
||||
\ 'darkestred' : '#5f0000',
|
||||
\ 'darkred' : '#870000',
|
||||
\ 'mediumred' : '#af0000',
|
||||
\ 'brightred' : '#df0000',
|
||||
\ 'brightestred' : '#ff0000',
|
||||
\
|
||||
\ 'darkestpurple' : '#5f00af',
|
||||
\ 'mediumpurple' : '#875fdf',
|
||||
\ 'brightpurple' : '#dfdfff',
|
||||
\
|
||||
\ 'brightorange' : '#ff8700',
|
||||
\ 'brightestorange': '#ffaf00',
|
||||
\
|
||||
\ 'gray0' : '#121212',
|
||||
\ 'gray1' : '#262626',
|
||||
\ 'gray2' : '#303030',
|
||||
\ 'gray3' : '#4e4e4e',
|
||||
\ 'gray4' : '#585858',
|
||||
\ 'gray5' : '#606060',
|
||||
\ 'gray6' : '#808080',
|
||||
\ 'gray7' : '#8a8a8a',
|
||||
\ 'gray8' : '#9e9e9e',
|
||||
\ 'gray9' : '#bcbcbc',
|
||||
\ 'gray10' : '#d0d0d0',
|
||||
\
|
||||
\ 'yellow' : '#b58900',
|
||||
\ 'orange' : '#cb4b16',
|
||||
\ 'red' : '#dc322f',
|
||||
\ 'magenta' : '#d33682',
|
||||
\ 'violet' : '#6c71c4',
|
||||
\ 'blue' : '#268bd2',
|
||||
\ 'cyan' : '#2aa198',
|
||||
\ 'green' : '#859900',
|
||||
\ }
|
||||
|
||||
function! s:convert(rgb) abort
|
||||
let rgb = map(matchlist(a:rgb, '#\(..\)\(..\)\(..\)')[1:3], '0 + ("0x".v:val)')
|
||||
if len(rgb) == 0
|
||||
return 0
|
||||
endif
|
||||
if rgb[0] == 0xc0 && rgb[1] == 0xc0 && rgb[2] == 0xc0
|
||||
return 7
|
||||
elseif rgb[0] == 0x80 && rgb[1] == 0x80 && rgb[2] == 0x80
|
||||
return 8
|
||||
elseif (rgb[0] == 0x80 || rgb[0] == 0x00) && (rgb[1] == 0x80 || rgb[1] == 0x00) && (rgb[2] == 0x80 || rgb[2] == 0x00)
|
||||
return (rgb[0] / 0x80) + (rgb[1] / 0x80) * 2 + (rgb[1] / 0x80) * 4
|
||||
elseif abs(rgb[0]-rgb[1]) < 3 && abs(rgb[1]-rgb[2]) < 3 && abs(rgb[2]-rgb[0]) < 3
|
||||
return s:black((rgb[0] + rgb[1] + rgb[2]) / 3)
|
||||
else
|
||||
return 16 + ((s:nr(rgb[0]) * 6) + s:nr(rgb[1])) * 6 + s:nr(rgb[2])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:black(x) abort
|
||||
if a:x < 0x04
|
||||
return 16
|
||||
elseif a:x > 0xf4
|
||||
return 231
|
||||
elseif index([0x00, 0x5f, 0x87, 0xaf, 0xdf, 0xff], a:x) >= 0
|
||||
let l = a:x / 0x30
|
||||
return ((l * 6) + l) * 6 + l + 16
|
||||
else
|
||||
return 232 + (a:x < 8 ? 0 : a:x < 0x60 ? (a:x-8)/10 : a:x < 0x76 ? (a:x-0x60)/6+9 : (a:x-8)/10)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:nr(x) abort
|
||||
return a:x < 0x2f ? 0 : a:x < 0x73 ? 1 : a:x < 0x9b ? 2 : a:x < 0xc7 ? 3 : a:x < 0xef ? 4 : 5
|
||||
endfunction
|
||||
|
||||
function! s:rgb(r, g, b) abort
|
||||
return printf('#%02x%02x%02x', a:r, a:g, a:b)
|
||||
endfunction
|
||||
|
||||
function! s:upconvert(nr) abort
|
||||
let x = a:nr * 1
|
||||
if x < 7
|
||||
let [b, rg] = [x / 4, x % 4]
|
||||
let [g, r] = [rg / 2, rg % 2]
|
||||
return s:rgb(r * 0x80, g * 0x80, b * 0x80)
|
||||
elseif x == 7
|
||||
return s:rgb(0xc0, 0xc0, 0xc0)
|
||||
elseif x == 8
|
||||
return s:rgb(0x80, 0x80, 0x80)
|
||||
elseif x < 16
|
||||
let y = x - 8
|
||||
let [b, rg] = [y / 4, y % 4]
|
||||
let [g, r] = [rg / 2, rg % 2]
|
||||
return s:rgb(r * 0xff, g * 0xff, b * 0xff)
|
||||
elseif x < 232
|
||||
let y = x - 16
|
||||
let [rg, b] = [y / 6, y % 6]
|
||||
let [r, g] = [rg / 6, rg % 6]
|
||||
let l = [0x00, 0x5f, 0x87, 0xaf, 0xdf, 0xff]
|
||||
return s:rgb(l[r], l[g], l[b])
|
||||
elseif x < 241
|
||||
let k = (x - 232) * 10 + 8
|
||||
return s:rgb(k, k, k)
|
||||
elseif x < 243
|
||||
let k = (x - 241) * 6 + 0x60
|
||||
return s:rgb(k, k, k)
|
||||
else
|
||||
let k = (x - 232) * 10 + 8
|
||||
return s:rgb(k, k, k)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! lightline#colorscheme#fill(p) abort
|
||||
for k in values(a:p)
|
||||
for l in values(k)
|
||||
for m in l
|
||||
if len(m) < 4
|
||||
if type(m[0]) == 1 && type(m[1]) == 1
|
||||
if m[0] =~# '^\d\+$' && m[1] =~# '^\d\+$'
|
||||
call insert(m, s:upconvert(m[1]), 0)
|
||||
call insert(m, s:upconvert(m[1]), 0)
|
||||
else
|
||||
call insert(m, get(s:cuicolor, m[0], s:convert(m[0])), 2)
|
||||
call insert(m, get(s:cuicolor, m[1], s:convert(m[1])), 3)
|
||||
let m[0] = get(s:guicolor, m[0], m[0])
|
||||
let m[1] = get(s:guicolor, m[1], m[1])
|
||||
endif
|
||||
elseif type(m[0]) == 0 && type(m[1]) == 0
|
||||
call insert(m, s:upconvert(m[1]), 0)
|
||||
call insert(m, s:upconvert(m[1]), 0)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
return a:p
|
||||
endfunction
|
||||
|
||||
function! lightline#colorscheme#flatten(p) abort
|
||||
for k in values(a:p)
|
||||
for l in values(k)
|
||||
for m in range(len(l))
|
||||
let attr = ''
|
||||
if len(l[m]) == 3 && type(l[m][2]) == 1
|
||||
let attr = l[m][2]
|
||||
endif
|
||||
let l[m] = [l[m][0][0], l[m][1][0], l[m][0][1], l[m][1][1]]
|
||||
if !empty(attr)
|
||||
call add(l[m], attr)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
return a:p
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
|
@ -0,0 +1,46 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/16color.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2014/01/02 10:04:03.
|
||||
" =============================================================================
|
||||
let s:base03 = [ '#808080', 8 ]
|
||||
let s:base02 = [ '#000000', 0 ]
|
||||
let s:base01 = [ '#00ff00', 10 ]
|
||||
let s:base00 = [ '#ffff00', 11 ]
|
||||
let s:base0 = [ '#0000ff', 12 ]
|
||||
let s:base1 = [ '#00ffff', 14 ]
|
||||
let s:base2 = [ '#c0c0c0', 7 ]
|
||||
let s:base3 = [ '#ffffff', 15 ]
|
||||
let s:yellow = [ '#808000', 3 ]
|
||||
let s:orange = [ '#ff0000', 9 ]
|
||||
let s:red = [ '#800000', 1 ]
|
||||
let s:magenta = [ '#800080', 5 ]
|
||||
let s:violet = [ '#ff00ff', 13 ]
|
||||
let s:blue = [ '#000080', 4 ]
|
||||
let s:cyan = [ '#008080', 6 ]
|
||||
let s:green = [ '#008000', 2 ]
|
||||
if &background ==# 'light'
|
||||
let [s:base03, s:base3] = [s:base3, s:base03]
|
||||
let [s:base02, s:base2] = [s:base2, s:base02]
|
||||
let [s:base01, s:base1] = [s:base1, s:base01]
|
||||
let [s:base00, s:base0] = [s:base0, s:base00]
|
||||
endif
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:base3, s:blue ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
|
||||
let s:p.inactive.right = [ [ s:base02, s:base01 ], [ s:base00, s:base02 ] ]
|
||||
let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ]
|
||||
let s:p.insert.left = [ [ s:base3, s:green ], [ s:base3, s:base01 ] ]
|
||||
let s:p.replace.left = [ [ s:base3, s:red ], [ s:base3, s:base01 ] ]
|
||||
let s:p.visual.left = [ [ s:base3, s:magenta ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
|
||||
let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
|
||||
let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:base2, s:base02 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base01, s:base2 ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:base2, s:red ] ]
|
||||
let s:p.normal.warning = [ [ s:base02, s:yellow ] ]
|
||||
|
||||
let g:lightline#colorscheme#16color#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -0,0 +1,12 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/PaperColor.vim
|
||||
" Author: TKNGUE
|
||||
" License: MIT License
|
||||
" Last Change: 2015/07/28 07:35:00.
|
||||
" =============================================================================
|
||||
|
||||
if &background ==# 'light'
|
||||
let g:lightline#colorscheme#PaperColor#palette = g:lightline#colorscheme#PaperColor_light#palette
|
||||
else
|
||||
let g:lightline#colorscheme#PaperColor#palette = g:lightline#colorscheme#PaperColor_dark#palette
|
||||
endif
|
|
@ -0,0 +1,60 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/PaperColor_dark.vim
|
||||
" Author: TKNGUE
|
||||
" License: MIT License
|
||||
" Last Change: 2015-07-27 06:01
|
||||
" =============================================================================
|
||||
|
||||
let s:red = '#df0000'
|
||||
let s:green = '#008700'
|
||||
let s:blue = '#00afaf'
|
||||
|
||||
let s:pink = '#afdf00'
|
||||
let s:olive = '#dfaf5f'
|
||||
let s:navy = '#df875f'
|
||||
|
||||
let s:orange = '#d75f00'
|
||||
let s:purple = '#8959a8'
|
||||
let s:aqua = '#3e999f'
|
||||
|
||||
" Basics:
|
||||
let s:foreground = '#d0d0d0'
|
||||
let s:background = '#444444'
|
||||
let s:window = '#efefef'
|
||||
let s:status = '#c6c6c6'
|
||||
let s:error = '#5f0000'
|
||||
|
||||
" Tabline:
|
||||
let s:tabline_bg = '#3a3a3a'
|
||||
let s:tabline_active_fg = '#1c1c1c'
|
||||
let s:tabline_active_bg = '#00afaf'
|
||||
let s:tabline_inactive_fg = '#c6c6c6'
|
||||
let s:tabline_inactive_bg = '#585858'
|
||||
|
||||
" Statusline:
|
||||
let s:statusline_active_fg = '#1c1c1c'
|
||||
let s:statusline_active_bg = '#5f8787'
|
||||
let s:statusline_inactive_fg = '#c6c6c6'
|
||||
let s:statusline_inactive_bg = '#444444'
|
||||
|
||||
" Visual:
|
||||
let s:visual_fg = '#000000'
|
||||
let s:visual_bg = '#8787af'
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
|
||||
let s:p.normal.right = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
|
||||
let s:p.normal.middle = [ [ s:statusline_active_fg, s:statusline_active_bg ]]
|
||||
let s:p.inactive.right = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ]
|
||||
let s:p.inactive.left = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ]
|
||||
let s:p.inactive.middle = [ [ s:foreground, s:background ], ]
|
||||
let s:p.insert.left = [ [ s:background, s:blue], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
|
||||
let s:p.replace.left = [ [ s:background, s:pink ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
|
||||
let s:p.visual.left = [ [ s:visual_fg, s:visual_bg ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
|
||||
let s:p.tabline.left = [ [s:tabline_inactive_fg, s:tabline_inactive_bg ]]
|
||||
let s:p.tabline.tabsel = [ [s:tabline_active_fg, s:tabline_active_bg ] ]
|
||||
let s:p.tabline.middle = [ [s:tabline_bg, s:tabline_bg]]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:background, s:error ] ]
|
||||
|
||||
let g:lightline#colorscheme#PaperColor_dark#palette = lightline#colorscheme#fill(s:p)
|
|
@ -0,0 +1,55 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/PaperColor_light.vim
|
||||
" Author: TKNGUE
|
||||
" License: MIT License
|
||||
" Last Change: 2015/07/28 07:46:40.
|
||||
" =============================================================================
|
||||
|
||||
let s:red = '#df0000'
|
||||
let s:green = '#008700'
|
||||
let s:blue = '#4271ae'
|
||||
let s:pink = '#d7005f'
|
||||
let s:olive = '#718c00'
|
||||
let s:navy = '#005f87'
|
||||
let s:orange = '#d75f00'
|
||||
let s:purple = '#8959a8'
|
||||
let s:aqua = '#3e999f'
|
||||
|
||||
" Basics:
|
||||
let s:foreground = '#4d4d4c'
|
||||
let s:background = '#F5F5F5'
|
||||
let s:window = '#efefef'
|
||||
let s:status = s:aqua
|
||||
let s:error = '#ffafdf'
|
||||
|
||||
" Tabline:
|
||||
let s:tabline_bg = s:navy
|
||||
let s:tabline_active_fg = s:foreground
|
||||
let s:tabline_active_bg = s:window
|
||||
let s:tabline_inactive_fg = s:background
|
||||
let s:tabline_inactive_bg = s:aqua
|
||||
|
||||
" Statusline:
|
||||
let s:statusline_active_fg = s:window
|
||||
let s:statusline_active_bg = s:navy
|
||||
let s:statusline_inactive_fg = s:foreground
|
||||
let s:statusline_inactive_bg = '#dadada'
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
|
||||
let s:p.normal.right = [ [ s:foreground, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
|
||||
let s:p.normal.middle = [ [ s:statusline_active_fg, s:statusline_active_bg ]]
|
||||
let s:p.inactive.right = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ]
|
||||
let s:p.inactive.left = [ [ s:foreground, s:background ], [ s:foreground, s:background ] ]
|
||||
let s:p.inactive.middle = [ [ s:foreground, s:background ], ]
|
||||
let s:p.insert.left = [ [ s:blue, s:background ], [ s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
|
||||
let s:p.replace.left = [ [ s:background, s:pink ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
|
||||
let s:p.visual.left = [ [ s:background, s:orange ], [s:statusline_active_fg, s:status ], [ s:statusline_active_fg, s:statusline_active_bg ] ]
|
||||
let s:p.tabline.left = [ [s:tabline_inactive_fg, s:tabline_inactive_bg ]]
|
||||
let s:p.tabline.tabsel = [ [s:tabline_active_fg, s:tabline_active_bg ] ]
|
||||
let s:p.tabline.middle = [ [s:tabline_bg, s:tabline_bg]]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:background, s:error ] ]
|
||||
let s:p.normal.warning = [ [ s:background, s:olive ] ]
|
||||
|
||||
let g:lightline#colorscheme#PaperColor_light#palette = lightline#colorscheme#fill(s:p)
|
|
@ -0,0 +1,41 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/Tomorrow.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/09/07 12:22:37.
|
||||
" =============================================================================
|
||||
let s:base03 = '#fafafa'
|
||||
let s:base023 = '#dfdfdf'
|
||||
let s:base02 = '#c8c8c8'
|
||||
let s:base01 = '#b4b4b4'
|
||||
let s:base00 = '#808080'
|
||||
let s:base0 = '#666666'
|
||||
let s:base1 = '#555555'
|
||||
let s:base2 = '#4f4f4f'
|
||||
let s:base3 = '#4d4d4c'
|
||||
let s:red = '#c82829'
|
||||
let s:orange = '#f5871f'
|
||||
let s:yellow = '#eab700'
|
||||
let s:green = '#718c00'
|
||||
let s:cyan = '#3e999f'
|
||||
let s:blue = '#4271ae'
|
||||
let s:magenta = '#8959a8'
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
|
||||
let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base00, s:base02 ] ]
|
||||
let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base03 ] ]
|
||||
let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
|
||||
let s:p.replace.left = [ [ s:base02, s:orange ], [ s:base3, s:base01 ] ]
|
||||
let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
|
||||
let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
|
||||
let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:base2, s:base023 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base01, s:base00 ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:red, s:base01 ] ]
|
||||
let s:p.normal.warning = [ [ s:yellow, s:base0 ] ]
|
||||
|
||||
let g:lightline#colorscheme#Tomorrow#palette = lightline#colorscheme#fill(s:p)
|
|
@ -0,0 +1,41 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/Tomorrow_Night.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/09/07 12:23:38.
|
||||
" =============================================================================
|
||||
let s:base3 = '#c5c8c6'
|
||||
let s:base2 = '#bababa'
|
||||
let s:base1 = '#a0a0a0'
|
||||
let s:base0 = '#909090'
|
||||
let s:base00 = '#666666'
|
||||
let s:base01 = '#555555'
|
||||
let s:base02 = '#434343'
|
||||
let s:base023 = '#303030'
|
||||
let s:base03 = '#1d1f21'
|
||||
let s:red = '#cc6666'
|
||||
let s:orange = '#de935f'
|
||||
let s:yellow = '#f0c674'
|
||||
let s:green = '#b5bd68'
|
||||
let s:cyan = '#8abeb7'
|
||||
let s:blue = '#81a2be'
|
||||
let s:magenta = '#b294bb'
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
|
||||
let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base00, s:base02 ] ]
|
||||
let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base03 ] ]
|
||||
let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
|
||||
let s:p.replace.left = [ [ s:base02, s:orange ], [ s:base3, s:base01 ] ]
|
||||
let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
|
||||
let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
|
||||
let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:base2, s:base023 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base01, s:base0 ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:red, s:base023 ] ]
|
||||
let s:p.normal.warning = [ [ s:yellow, s:base02 ] ]
|
||||
|
||||
let g:lightline#colorscheme#Tomorrow_Night#palette = lightline#colorscheme#fill(s:p)
|
|
@ -0,0 +1,43 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/Tomorrow_Night_Blue.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/09/07 14:13:21.
|
||||
" =============================================================================
|
||||
let s:base3 = '#ffffff'
|
||||
let s:base23 = '#ffffff'
|
||||
let s:base2 = '#ffffff'
|
||||
let s:base1 = '#ffffff'
|
||||
let s:base0 = '#ffffff'
|
||||
let s:base00 = '#6060df'
|
||||
let s:base01 = '#6060af'
|
||||
let s:base02 = '#606087'
|
||||
let s:base023 = '#202087'
|
||||
let s:base03 = '#002451'
|
||||
let s:red = '#ff9da4'
|
||||
let s:orange = '#ffc58f'
|
||||
let s:yellow = '#ffeead'
|
||||
let s:green = '#d1f1a9'
|
||||
let s:cyan = '#99ffff'
|
||||
let s:blue = '#bbdaff'
|
||||
let s:magenta = '#ebbbff'
|
||||
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:base023, s:blue ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
|
||||
let s:p.inactive.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
|
||||
let s:p.inactive.left = [ [ s:base02, s:base0 ], [ s:base00, s:base03 ] ]
|
||||
let s:p.insert.left = [ [ s:base023, s:green ], [ s:base3, s:base01 ] ]
|
||||
let s:p.replace.left = [ [ s:base023, s:orange ], [ s:base3, s:base01 ] ]
|
||||
let s:p.visual.left = [ [ s:base023, s:magenta ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
|
||||
let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
|
||||
let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:base2, s:base03 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:base023, s:red ] ]
|
||||
let s:p.normal.warning = [ [ s:base023, s:yellow ] ]
|
||||
|
||||
let g:lightline#colorscheme#Tomorrow_Night_Blue#palette = lightline#colorscheme#fill(s:p)
|
|
@ -0,0 +1,42 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/Tomorrow_Night_Bright.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/09/07 14:13:26.
|
||||
" =============================================================================
|
||||
let s:base3 = '#eaeaea'
|
||||
let s:base23 = '#d0d0d0'
|
||||
let s:base2 = '#c6c6c6'
|
||||
let s:base1 = '#b2b2b2'
|
||||
let s:base0 = '#949494'
|
||||
let s:base00 = '#767676'
|
||||
let s:base01 = '#606060'
|
||||
let s:base02 = '#4e4e4e'
|
||||
let s:base023 = '#262626'
|
||||
let s:base03 = '#12124c'
|
||||
let s:red = '#d54e53'
|
||||
let s:orange = '#e78c45'
|
||||
let s:yellow = '#e7c547'
|
||||
let s:green = '#b9ca4a'
|
||||
let s:cyan = '#70c0b1'
|
||||
let s:blue = '#7aa6da'
|
||||
let s:magenta = '#c397d8'
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:base023, s:blue ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
|
||||
let s:p.inactive.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
|
||||
let s:p.inactive.left = [ [ s:base02, s:base0 ], [ s:base00, s:base03 ] ]
|
||||
let s:p.insert.left = [ [ s:base023, s:green ], [ s:base3, s:base01 ] ]
|
||||
let s:p.replace.left = [ [ s:base023, s:orange ], [ s:base3, s:base01 ] ]
|
||||
let s:p.visual.left = [ [ s:base023, s:magenta ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
|
||||
let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
|
||||
let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:base2, s:base023 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:red, s:base023 ] ]
|
||||
let s:p.normal.warning = [ [ s:yellow, s:base02 ] ]
|
||||
|
||||
let g:lightline#colorscheme#Tomorrow_Night_Bright#palette = lightline#colorscheme#fill(s:p)
|
|
@ -0,0 +1,42 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/Tomorrow_Night_Eighties.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/09/07 14:14:14.
|
||||
" =============================================================================
|
||||
let s:base3 = '#cccccc'
|
||||
let s:base23 = '#bbbbbb'
|
||||
let s:base2 = '#aaaaaa'
|
||||
let s:base1 = '#999999'
|
||||
let s:base0 = '#777777'
|
||||
let s:base00 = '#666666'
|
||||
let s:base01 = '#555555'
|
||||
let s:base02 = '#444444'
|
||||
let s:base023 = '#333333'
|
||||
let s:base03 = '#2d2d2d'
|
||||
let s:red = '#f2777a'
|
||||
let s:orange = '#f99157'
|
||||
let s:yellow = '#ffcc66'
|
||||
let s:green = '#99cc99'
|
||||
let s:cyan = '#009999'
|
||||
let s:blue = '#99cccc'
|
||||
let s:magenta = '#cc99cc'
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:base023, s:blue ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
|
||||
let s:p.inactive.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
|
||||
let s:p.inactive.left = [ [ s:base02, s:base0 ], [ s:base00, s:base03 ] ]
|
||||
let s:p.insert.left = [ [ s:base023, s:green ], [ s:base3, s:base01 ] ]
|
||||
let s:p.replace.left = [ [ s:base023, s:orange ], [ s:base3, s:base01 ] ]
|
||||
let s:p.visual.left = [ [ s:base023, s:magenta ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
|
||||
let s:p.inactive.middle = [ [ s:base0, s:base02 ] ]
|
||||
let s:p.tabline.left = [ [ s:base2, s:base01 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:base2, s:base03 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:base023, s:red ] ]
|
||||
let s:p.normal.warning = [ [ s:base023, s:yellow ] ]
|
||||
|
||||
let g:lightline#colorscheme#Tomorrow_Night_Eighties#palette = lightline#colorscheme#fill(s:p)
|
|
@ -0,0 +1,8 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/default.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/08/22 06:05:52.
|
||||
" =============================================================================
|
||||
|
||||
let g:lightline#colorscheme#default#palette = g:lightline#colorscheme#powerline#palette
|
|
@ -0,0 +1,40 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/jellybeans.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/09/07 12:21:04.
|
||||
" =============================================================================
|
||||
let s:base03 = [ '#151513', 233 ]
|
||||
let s:base02 = [ '#30302c ', 236 ]
|
||||
let s:base01 = [ '#4e4e43', 239 ]
|
||||
let s:base00 = [ '#666656', 242 ]
|
||||
let s:base0 = [ '#808070', 244 ]
|
||||
let s:base1 = [ '#949484', 246 ]
|
||||
let s:base2 = [ '#a8a897', 248 ]
|
||||
let s:base3 = [ '#e8e8d3', 253 ]
|
||||
let s:yellow = [ '#ffb964', 215 ]
|
||||
let s:orange = [ '#fad07a', 222 ]
|
||||
let s:red = [ '#cf6a4c', 167 ]
|
||||
let s:magenta = [ '#f0a0c0', 217 ]
|
||||
let s:blue = [ '#8197bf', 103 ]
|
||||
let s:cyan = [ '#8fbfdc', 110 ]
|
||||
let s:green = [ '#99ad6a', 107 ]
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
|
||||
let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base0, s:base02 ] ]
|
||||
let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ]
|
||||
let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
|
||||
let s:p.replace.left = [ [ s:base02, s:red ], [ s:base3, s:base01 ] ]
|
||||
let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.middle = [ [ s:base0, s:base02 ] ]
|
||||
let s:p.inactive.middle = [ [ s:base00, s:base02 ] ]
|
||||
let s:p.tabline.left = [ [ s:base3, s:base00 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:base3, s:base02 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:red, s:base02 ] ]
|
||||
let s:p.normal.warning = [ [ s:yellow, s:base01 ] ]
|
||||
|
||||
let g:lightline#colorscheme#jellybeans#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -0,0 +1,25 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/landscape.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2015/11/26 21:49:44.
|
||||
" =============================================================================
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ ['#0000ff', '#ffffff', 21, 231, 'bold' ], [ '#ffffff', '#0000ff', 231, 21 ] ]
|
||||
let s:p.normal.right = [ [ '#303030', '#d0d0d0', 236, 252 ], [ '#303030', '#8a8a8a', 236, 245 ], [ '#bcbcbc', '#585858', 250, 240 ] ]
|
||||
let s:p.inactive.right = [ [ '#121212', '#606060', 233, 241 ], [ '#121212', '#3a3a3a', 233, 237 ], [ '#121212', '#262626', 233, 235 ] ]
|
||||
let s:p.inactive.left = s:p.inactive.right[1:]
|
||||
let s:p.insert.left = [ ['#005f00', '#ffffff', 22, 231, 'bold' ], [ '#ffffff', '#005f00', 231, 22 ] ]
|
||||
let s:p.replace.left = [ [ '#af0000', '#ffffff', 124, 231, 'bold' ], [ '#ffffff', '#af0000', 231, 124 ] ]
|
||||
let s:p.visual.left = [ [ '#5f00ff', '#ffffff', 57, 231, 'bold' ], [ '#ffffff', '#5f00ff', 231, 57 ] ]
|
||||
let s:p.normal.middle = [ [ '#8a8a8a', '#303030', 245, 236 ] ]
|
||||
let s:p.inactive.middle = [ [ '#303030', '#121212', 236, 233 ] ]
|
||||
let s:p.tabline.left = [ [ '#d0d0d0', '#666666', 252, 242 ] ]
|
||||
let s:p.tabline.tabsel = [ [ '#dadada', '#121212', 253, 233 ] ]
|
||||
let s:p.tabline.middle = [ [ '#8a8a8a', '#3a3a3a', 245, 237 ] ]
|
||||
let s:p.tabline.right = [ [ '#d0d0d0', '#666666', 252, 242 ] ]
|
||||
let s:p.normal.error = [ [ '#d0d0d0', '#ff0000', 252, 196 ] ]
|
||||
let s:p.normal.warning = [ [ '#262626', '#ffff00', 235, 226 ] ]
|
||||
|
||||
let g:lightline#colorscheme#landscape#palette = s:p
|
|
@ -0,0 +1,28 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/powerline.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/09/07 15:54:41.
|
||||
" =============================================================================
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ ['darkestgreen', 'brightgreen', 'bold'], ['white', 'gray4'] ]
|
||||
let s:p.normal.right = [ ['gray5', 'gray10'], ['gray9', 'gray4'], ['gray8', 'gray2'] ]
|
||||
let s:p.inactive.right = [ ['gray1', 'gray5'], ['gray4', 'gray1'], ['gray4', 'gray0'] ]
|
||||
let s:p.inactive.left = s:p.inactive.right[1:]
|
||||
let s:p.insert.left = [ ['darkestcyan', 'white', 'bold'], ['white', 'darkblue'] ]
|
||||
let s:p.insert.right = [ [ 'darkestcyan', 'mediumcyan' ], [ 'mediumcyan', 'darkblue' ], [ 'mediumcyan', 'darkestblue' ] ]
|
||||
let s:p.replace.left = [ ['white', 'brightred', 'bold'], ['white', 'gray4'] ]
|
||||
let s:p.visual.left = [ ['darkred', 'brightorange', 'bold'], ['white', 'gray4'] ]
|
||||
let s:p.normal.middle = [ [ 'gray7', 'gray2' ] ]
|
||||
let s:p.insert.middle = [ [ 'mediumcyan', 'darkestblue' ] ]
|
||||
let s:p.replace.middle = s:p.normal.middle
|
||||
let s:p.replace.right = s:p.normal.right
|
||||
let s:p.tabline.left = [ [ 'gray9', 'gray4' ] ]
|
||||
let s:p.tabline.tabsel = [ [ 'gray9', 'gray1' ] ]
|
||||
let s:p.tabline.middle = [ [ 'gray2', 'gray8' ] ]
|
||||
let s:p.tabline.right = [ [ 'gray9', 'gray3' ] ]
|
||||
let s:p.normal.error = [ [ 'gray9', 'brightestred' ] ]
|
||||
let s:p.normal.warning = [ [ 'gray1', 'yellow' ] ]
|
||||
|
||||
let g:lightline#colorscheme#powerline#palette = lightline#colorscheme#fill(s:p)
|
|
@ -0,0 +1,42 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/seoul256.vim
|
||||
" Author: atweiden
|
||||
" License: MIT License
|
||||
" Last Change: 2015/11/02 08:23:27.
|
||||
" =============================================================================
|
||||
let s:base03 = [ '#151513', 233 ]
|
||||
let s:base02 = [ '#30302c ', 236 ]
|
||||
let s:base01 = [ '#4e4e43', 239 ]
|
||||
let s:base00 = [ '#666656', 242 ]
|
||||
let s:base0 = [ '#808070', 244 ]
|
||||
let s:base1 = [ '#949484', 246 ]
|
||||
let s:base2 = [ '#a8a897', 248 ]
|
||||
let s:base3 = [ '#e8e8d3', 253 ]
|
||||
let s:yellow = [ '#d8af5f', 3 ]
|
||||
let s:orange = [ '#d7875f', 216 ]
|
||||
let s:red = [ '#d68787', 131 ]
|
||||
let s:magenta = [ '#df5f87', 168 ]
|
||||
let s:peach = [ '#d7afaf', 181 ]
|
||||
let s:blue = [ '#87afaf', 109 ]
|
||||
let s:cyan = [ '#87d7d7', 23 ]
|
||||
let s:green = [ '#87af87', 108 ]
|
||||
let s:white = [ '#d0d0d0', 252 ]
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
|
||||
let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base0, s:base02 ] ]
|
||||
let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ]
|
||||
let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
|
||||
let s:p.replace.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
|
||||
let s:p.visual.left = [ [ s:base02, s:peach ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.middle = [ [ s:base0, s:base02 ] ]
|
||||
let s:p.inactive.middle = [ [ s:base00, s:base02 ] ]
|
||||
let s:p.tabline.left = [ [ s:base3, s:base00 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:base3, s:base02 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:red, s:base02 ] ]
|
||||
let s:p.normal.warning = [ [ s:yellow, s:base01 ] ]
|
||||
|
||||
let g:lightline#colorscheme#seoul256#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -0,0 +1,80 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/solarized.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2016/08/08 10:31:00.
|
||||
" =============================================================================
|
||||
|
||||
let s:cuicolors = {
|
||||
\ 'base03': [ '8', '234', 'DarkGray' ],
|
||||
\ 'base02': [ '0', '235', 'Black' ],
|
||||
\ 'base01': [ '10', '239', 'LightGreen' ],
|
||||
\ 'base00': [ '11', '240', 'LightYellow' ],
|
||||
\ 'base0': [ '12', '244', 'LightBlue' ],
|
||||
\ 'base1': [ '14', '245', 'LightCyan' ],
|
||||
\ 'base2': [ '7', '187', 'LightGray' ],
|
||||
\ 'base3': [ '15', '230', 'White' ],
|
||||
\ 'yellow': [ '3', '136', 'DarkYellow' ],
|
||||
\ 'orange': [ '9', '166', 'LightRed' ],
|
||||
\ 'red': [ '1', '124', 'DarkRed' ],
|
||||
\ 'magenta': [ '5', '125', 'DarkMagenta' ],
|
||||
\ 'violet': [ '13', '61', 'LightMagenta' ],
|
||||
\ 'blue': [ '4', '33', 'DarkBlue' ],
|
||||
\ 'cyan': [ '6', '37', 'DarkCyan' ],
|
||||
\ 'green': [ '2', '64', 'DarkGreen' ],
|
||||
\ }
|
||||
|
||||
" The following condition only applies for the console and is the same
|
||||
" condition vim-colors-solarized uses to determine which set of colors
|
||||
" to use.
|
||||
let s:solarized_termcolors = get(g:, 'solarized_termcolors', 256)
|
||||
if s:solarized_termcolors != 256 && &t_Co >= 16
|
||||
let s:cuiindex = 0
|
||||
elseif s:solarized_termcolors == 256
|
||||
let s:cuiindex = 1
|
||||
else
|
||||
let s:cuiindex = 2
|
||||
endif
|
||||
|
||||
let s:base03 = [ '#002b36', s:cuicolors.base03[s:cuiindex] ]
|
||||
let s:base02 = [ '#073642', s:cuicolors.base02[s:cuiindex] ]
|
||||
let s:base01 = [ '#586e75', s:cuicolors.base01[s:cuiindex] ]
|
||||
let s:base00 = [ '#657b83', s:cuicolors.base00[s:cuiindex] ]
|
||||
let s:base0 = [ '#839496', s:cuicolors.base0[s:cuiindex] ]
|
||||
let s:base1 = [ '#93a1a1', s:cuicolors.base1[s:cuiindex] ]
|
||||
let s:base2 = [ '#eee8d5', s:cuicolors.base2[s:cuiindex] ]
|
||||
let s:base3 = [ '#fdf6e3', s:cuicolors.base3[s:cuiindex] ]
|
||||
let s:yellow = [ '#b58900', s:cuicolors.yellow[s:cuiindex] ]
|
||||
let s:orange = [ '#cb4b16', s:cuicolors.orange[s:cuiindex] ]
|
||||
let s:red = [ '#dc322f', s:cuicolors.red[s:cuiindex] ]
|
||||
let s:magenta = [ '#d33682', s:cuicolors.magenta[s:cuiindex] ]
|
||||
let s:violet = [ '#6c71c4', s:cuicolors.violet[s:cuiindex] ]
|
||||
let s:blue = [ '#268bd2', s:cuicolors.blue[s:cuiindex] ]
|
||||
let s:cyan = [ '#2aa198', s:cuicolors.cyan[s:cuiindex] ]
|
||||
let s:green = [ '#859900', s:cuicolors.green[s:cuiindex] ]
|
||||
|
||||
if &background ==# 'light'
|
||||
let [ s:base03, s:base3 ] = [ s:base3, s:base03 ]
|
||||
let [ s:base02, s:base2 ] = [ s:base2, s:base02 ]
|
||||
let [ s:base01, s:base1 ] = [ s:base1, s:base01 ]
|
||||
let [ s:base00, s:base0 ] = [ s:base0, s:base00 ]
|
||||
endif
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:base03, s:blue ], [ s:base03, s:base00 ] ]
|
||||
let s:p.normal.right = [ [ s:base03, s:base1 ], [ s:base03, s:base00 ] ]
|
||||
let s:p.inactive.right = [ [ s:base03, s:base00 ], [ s:base0, s:base02 ] ]
|
||||
let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base0, s:base02 ] ]
|
||||
let s:p.insert.left = [ [ s:base03, s:green ], [ s:base03, s:base00 ] ]
|
||||
let s:p.replace.left = [ [ s:base03, s:red ], [ s:base03, s:base00 ] ]
|
||||
let s:p.visual.left = [ [ s:base03, s:magenta ], [ s:base03, s:base00 ] ]
|
||||
let s:p.normal.middle = [ [ s:base1, s:base02 ] ]
|
||||
let s:p.inactive.middle = [ [ s:base01, s:base02 ] ]
|
||||
let s:p.tabline.left = [ [ s:base03, s:base00 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:base03, s:base1 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base0, s:base02 ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:base03, s:red ] ]
|
||||
let s:p.normal.warning = [ [ s:base03, s:yellow ] ]
|
||||
|
||||
let g:lightline#colorscheme#solarized#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -0,0 +1,40 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/wombat.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2015/11/30 08:37:43.
|
||||
" =============================================================================
|
||||
let s:base03 = [ '#242424', 235 ]
|
||||
let s:base023 = [ '#353535 ', 236 ]
|
||||
let s:base02 = [ '#444444 ', 238 ]
|
||||
let s:base01 = [ '#585858', 240 ]
|
||||
let s:base00 = [ '#666666', 242 ]
|
||||
let s:base0 = [ '#808080', 244 ]
|
||||
let s:base1 = [ '#969696', 247 ]
|
||||
let s:base2 = [ '#a8a8a8', 248 ]
|
||||
let s:base3 = [ '#d0d0d0', 252 ]
|
||||
let s:yellow = [ '#cae682', 180 ]
|
||||
let s:orange = [ '#e5786d', 173 ]
|
||||
let s:red = [ '#e5786d', 203 ]
|
||||
let s:magenta = [ '#f2c68a', 216 ]
|
||||
let s:blue = [ '#8ac6f2', 117 ]
|
||||
let s:cyan = s:blue
|
||||
let s:green = [ '#95e454', 119 ]
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.right = [ [ s:base02, s:base0 ], [ s:base1, s:base01 ] ]
|
||||
let s:p.inactive.right = [ [ s:base023, s:base01 ], [ s:base00, s:base02 ] ]
|
||||
let s:p.inactive.left = [ [ s:base1, s:base02 ], [ s:base00, s:base023 ] ]
|
||||
let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
|
||||
let s:p.replace.left = [ [ s:base023, s:red ], [ s:base3, s:base01 ] ]
|
||||
let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
|
||||
let s:p.normal.middle = [ [ s:base2, s:base02 ] ]
|
||||
let s:p.inactive.middle = [ [ s:base1, s:base023 ] ]
|
||||
let s:p.tabline.left = [ [ s:base3, s:base00 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:base3, s:base03 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base2, s:base02 ] ]
|
||||
let s:p.tabline.right = [ [ s:base2, s:base00 ] ]
|
||||
let s:p.normal.error = [ [ s:base03, s:red ] ]
|
||||
let s:p.normal.warning = [ [ s:base023, s:yellow ] ]
|
||||
|
||||
let g:lightline#colorscheme#wombat#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -0,0 +1,42 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colortable.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2015/03/29 06:21:39.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! s:load() abort
|
||||
let rgbfile = $VIMRUNTIME . '/rgb.txt'
|
||||
let table = {}
|
||||
if filereadable(rgbfile)
|
||||
for _ in map(filter(readfile(rgbfile), 'v:val !~# "^!"'), 'matchlist(v:val, "^\\s*\\(\\d\\+\\)\\s\\+\\(\\d\\+\\)\\s\\+\\(\\d\\+\\)\\s\\+\\(.*\\)")[1:4]')
|
||||
let table[tolower(_[3])] = _[0:2]
|
||||
endfor
|
||||
endif
|
||||
return table
|
||||
endfunction
|
||||
|
||||
let s:table = s:load()
|
||||
|
||||
function! lightline#colortable#name_to_rgb(name) abort
|
||||
let name = tolower(a:name)
|
||||
return has_key(s:table, name) ? s:table[name] : []
|
||||
endfunction
|
||||
|
||||
function! lightline#colortable#gui2cui(rgb, fallback) abort
|
||||
let rgb = map(matchlist(a:rgb, '#\(..\)\(..\)\(..\)')[1:3], '0 + ("0x".v:val)')
|
||||
if len(rgb) == 0
|
||||
let rgb = lightline#colortable#name_to_rgb(a:rgb)
|
||||
if len(rgb) == 0
|
||||
return a:fallback % 128
|
||||
endif
|
||||
endif
|
||||
let rgb = [rgb[0] > 127 ? 4 : 0, rgb[1] > 127 ? 2 : 0, rgb[2] > 127 ? 1 : 0]
|
||||
return rgb[0] + rgb[1] + rgb[2]
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
33
sources_non_forked/lightline.vim/autoload/lightline/tab.vim
Normal file
33
sources_non_forked/lightline.vim/autoload/lightline/tab.vim
Normal file
|
@ -0,0 +1,33 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/tab.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2016/05/07 22:31:02.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! lightline#tab#filename(n) abort
|
||||
let buflist = tabpagebuflist(a:n)
|
||||
let winnr = tabpagewinnr(a:n)
|
||||
let _ = expand('#'.buflist[winnr - 1].':t')
|
||||
return _ !=# '' ? _ : '[No Name]'
|
||||
endfunction
|
||||
|
||||
function! lightline#tab#modified(n) abort
|
||||
let winnr = tabpagewinnr(a:n)
|
||||
return gettabwinvar(a:n, winnr, '&modified') ? '+' : gettabwinvar(a:n, winnr, '&modifiable') ? '' : '-'
|
||||
endfunction
|
||||
|
||||
function! lightline#tab#readonly(n) abort
|
||||
let winnr = tabpagewinnr(a:n)
|
||||
return gettabwinvar(a:n, winnr, '&readonly') ? 'RO' : ''
|
||||
endfunction
|
||||
|
||||
function! lightline#tab#tabnum(n) abort
|
||||
return a:n
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
1280
sources_non_forked/lightline.vim/doc/lightline.txt
Normal file
1280
sources_non_forked/lightline.vim/doc/lightline.txt
Normal file
File diff suppressed because it is too large
Load diff
24
sources_non_forked/lightline.vim/plugin/lightline.vim
Normal file
24
sources_non_forked/lightline.vim/plugin/lightline.vim
Normal file
|
@ -0,0 +1,24 @@
|
|||
" =============================================================================
|
||||
" Filename: plugin/lightline.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2016/03/14 03:31:58.
|
||||
" =============================================================================
|
||||
|
||||
if exists('g:loaded_lightline') || v:version < 700
|
||||
finish
|
||||
endif
|
||||
let g:loaded_lightline = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
augroup lightline
|
||||
autocmd!
|
||||
autocmd WinEnter,BufWinEnter,FileType,ColorScheme,SessionLoadPost * call lightline#update()
|
||||
autocmd ColorScheme,SessionLoadPost * call lightline#highlight()
|
||||
autocmd CursorMoved,BufUnload * call lightline#update_once()
|
||||
augroup END
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
20
sources_non_forked/lightline.vim/test/.themisrc
Normal file
20
sources_non_forked/lightline.vim/test/.themisrc
Normal file
|
@ -0,0 +1,20 @@
|
|||
let s:sids = {}
|
||||
function! s:sid(path) abort
|
||||
if has_key(s:sids, a:path)
|
||||
return s:sids[a:path]
|
||||
endif
|
||||
redir => scriptnames
|
||||
silent! scriptnames
|
||||
redir END
|
||||
for line in split(scriptnames, '\n')
|
||||
if line =~# a:path
|
||||
let sid = matchstr(line, '\v^\s*\zs\d+\ze')
|
||||
let s:sids[a:path] = sid
|
||||
return sid
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! SID(name) abort
|
||||
return function(printf("\<SNR>%d_%s", s:sid('autoload/lightline.vim'), a:name))
|
||||
endfunction
|
90
sources_non_forked/lightline.vim/test/concatenate.vim
Normal file
90
sources_non_forked/lightline.vim/test/concatenate.vim
Normal file
|
@ -0,0 +1,90 @@
|
|||
let s:suite = themis#suite('concatenate')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = { 'subseparator': { 'left': '>', 'right': '<' } }
|
||||
call lightline#init()
|
||||
endfunction
|
||||
|
||||
function! s:suite.nil()
|
||||
call s:assert.equals(lightline#concatenate([], 0), '')
|
||||
call s:assert.equals(lightline#concatenate([], 1), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.one()
|
||||
call s:assert.equals(lightline#concatenate(['foo'], 0), 'foo')
|
||||
call s:assert.equals(lightline#concatenate(['foo'], 1), 'foo')
|
||||
endfunction
|
||||
|
||||
function! s:suite.two()
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar'], 0), 'foo > bar')
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar'], 1), 'foo < bar')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three()
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar', 'baz'], 0), 'foo > bar > baz')
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar', 'baz'], 1), 'foo < bar < baz')
|
||||
endfunction
|
||||
|
||||
function! s:suite.one_empty()
|
||||
call s:assert.equals(lightline#concatenate([''], 0), '')
|
||||
call s:assert.equals(lightline#concatenate([''], 1), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.two_empty_left()
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar'], 0), 'bar')
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar'], 1), 'bar')
|
||||
endfunction
|
||||
|
||||
function! s:suite.two_empty_right()
|
||||
call s:assert.equals(lightline#concatenate(['foo', ''], 0), 'foo')
|
||||
call s:assert.equals(lightline#concatenate(['foo', ''], 1), 'foo')
|
||||
endfunction
|
||||
|
||||
function! s:suite.two_empty_both()
|
||||
call s:assert.equals(lightline#concatenate(['', ''], 0), '')
|
||||
call s:assert.equals(lightline#concatenate(['', ''], 1), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_left()
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar', 'baz'], 0), 'bar > baz')
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar', 'baz'], 1), 'bar < baz')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_middle()
|
||||
call s:assert.equals(lightline#concatenate(['foo', '', 'baz'], 0), 'foo > baz')
|
||||
call s:assert.equals(lightline#concatenate(['foo', '', 'baz'], 1), 'foo < baz')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_right()
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar', ''], 0), 'foo > bar')
|
||||
call s:assert.equals(lightline#concatenate(['foo', 'bar', ''], 1), 'foo < bar')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_middle_right()
|
||||
call s:assert.equals(lightline#concatenate(['foo', '', ''], 0), 'foo')
|
||||
call s:assert.equals(lightline#concatenate(['foo', '', ''], 1), 'foo')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_left_right()
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar', ''], 0), 'bar')
|
||||
call s:assert.equals(lightline#concatenate(['', 'bar', ''], 1), 'bar')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_left_middle()
|
||||
call s:assert.equals(lightline#concatenate(['', '', 'baz'], 0), 'baz')
|
||||
call s:assert.equals(lightline#concatenate(['', '', 'baz'], 1), 'baz')
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_empty_all()
|
||||
call s:assert.equals(lightline#concatenate(['', '', ''], 0), '')
|
||||
call s:assert.equals(lightline#concatenate(['', '', ''], 1), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.keep_original()
|
||||
let xs = ['', 'bar', '']
|
||||
call s:assert.equals(lightline#concatenate(xs, 0), 'bar')
|
||||
call s:assert.equals(xs, ['', 'bar', ''])
|
||||
call s:assert.equals(lightline#concatenate(xs, 1), 'bar')
|
||||
call s:assert.equals(xs, ['', 'bar', ''])
|
||||
endfunction
|
15
sources_non_forked/lightline.vim/test/error.vim
Normal file
15
sources_non_forked/lightline.vim/test/error.vim
Normal file
|
@ -0,0 +1,15 @@
|
|||
let s:suite = themis#suite('error')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:message() abort
|
||||
redir => messages
|
||||
silent! messages
|
||||
redir END
|
||||
return split(messages, '\n')[-1]
|
||||
endfunction
|
||||
|
||||
function! s:suite.error()
|
||||
let message = 'An error occurred.'
|
||||
call lightline#error(message)
|
||||
call s:assert.equals(s:message(), 'lightline.vim: ' . message)
|
||||
endfunction
|
612
sources_non_forked/lightline.vim/test/expand.vim
Normal file
612
sources_non_forked/lightline.vim/test/expand.vim
Normal file
|
@ -0,0 +1,612 @@
|
|||
let s:suite = themis#suite('expand')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:expand(...)
|
||||
return call(SID('expand'), a:000)
|
||||
endfunction
|
||||
|
||||
function! s:suite.expand()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([]),
|
||||
\ [[], [], ['0']])
|
||||
endfunction
|
||||
|
||||
function! s:suite.default()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['mode', 'paste'], ['readonly', 'filename', 'modified']]),
|
||||
\ [[['mode', 'paste'], ['readonly', 'filename', 'modified']], [[0, 0], [0, 0, 0]], ['0', '1', '2']])
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom()
|
||||
function! Custom()
|
||||
return [ ['left'], ['middle'], ['right'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type()
|
||||
function! Custom()
|
||||
return [ ['left'], ['middle'], ['right'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['middle'], ['right'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left'], ['middle'], ['right', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.multiple()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['x0', 'x1', 'x2', 'y0', 'y1', 'y2', 'z0', 'z1', 'z2'], ['modified']], [[0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'x0', 'x1', 'x2', 'y0', 'y1', 'y2', 'z0', 'z1', 'z2', 'modified']], [[0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.multiple_type()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2'], ['modified']], [[0, 0], [1, 1, 1], [1, 1, 1], [1, 1, 1], [0]], ['0', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2', 'modified']], [[0, 0, 1, 1, 1], [1, 1, 1], [1, 1, 1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.flatten()
|
||||
function! Custom()
|
||||
return [ 'left', 'middle', 'right' ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_flatten()
|
||||
function! Custom()
|
||||
return [ 'left', 'middle', 'right' ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['middle'], ['right'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left'], ['middle'], ['right', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_string()
|
||||
function! Custom()
|
||||
return 'custom'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'custom', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_string()
|
||||
function! Custom()
|
||||
return 'custom'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_void_string()
|
||||
function! Custom()
|
||||
return ''
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_void_string()
|
||||
function! Custom()
|
||||
return ''
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_number()
|
||||
function! Custom()
|
||||
return 24
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['24'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', '24', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_number()
|
||||
function! Custom()
|
||||
return 24
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['24'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename'], ['24'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_void_string_array()
|
||||
function! Custom()
|
||||
return ['', '', '']
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_void_string_array()
|
||||
function! Custom()
|
||||
return ['', '', '']
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_void_string_array_2()
|
||||
function! Custom()
|
||||
return [[''], [''], ['']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_void_string_array_2()
|
||||
function! Custom()
|
||||
return [[''], [''], ['']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_void_string_array_3()
|
||||
function! Custom()
|
||||
return ['', 'custom', '']
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'custom', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_void_string_array_3()
|
||||
function! Custom()
|
||||
return ['', 'custom', '']
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_void_string_array_4()
|
||||
function! Custom()
|
||||
return [[''], ['custom'], ['']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'custom', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_void_string_array_4()
|
||||
function! Custom()
|
||||
return [[''], ['custom'], ['']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename'], ['custom'], ['modified']], [[0, 0], [1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_left_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'z0', 'z1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
|
||||
\ [[['filename', 'y0', 'y1', 'z0', 'z1', 'modified']], [[0, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_left_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1'], ['z0', 'z1'], ['modified']], [[0], [1, 1], [1, 1], [0]], ['0', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
|
||||
\ [[['filename'], ['y0', 'y1'], ['z0', 'z1', 'modified']], [[0], [1, 1], [1, 1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_right_nil()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
|
||||
\ [[['filename'], ['x0', 'x1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
|
||||
\ [[['filename', 'x0', 'x1', 'y0', 'y1', 'modified']], [[0, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_right_nil()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom'], ['modified']]),
|
||||
\ [[['filename'], ['x0', 'x1'], ['y0', 'y1'], ['modified']], [[0], [1, 1], [1, 1], [0]], ['0', '1', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'modified']]),
|
||||
\ [[['filename', 'x0', 'x1'], ['y0', 'y1'], ['modified']], [[0, 1, 1], [1, 1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_one()
|
||||
function! Custom()
|
||||
return [ 'left' ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_one()
|
||||
function! Custom()
|
||||
return [ 'left' ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['modified']], [[0, 0], [1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'modified']], [[0, 0, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_two()
|
||||
function! Custom()
|
||||
return [ 'left', 'middle']
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', 'middle'], ['modified']], [[0, 0], [1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'middle', 'modified']], [[0, 0, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_two()
|
||||
function! Custom()
|
||||
return [ 'left', 'middle' ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['middle'], ['modified']], [[0, 0], [1], [1], [0]], ['0', '1', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left'], ['middle'], ['modified']], [[0, 0, 1], [1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_mixed()
|
||||
function! Custom()
|
||||
return ['left', { 'custom': 24 }, [function('tr')]]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', '{''custom'': 24}', 'function(''tr'')'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', '{''custom'': 24}', 'function(''tr'')', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_mixed()
|
||||
function! Custom()
|
||||
return ['left', { 'custom': 24 }, [function('tr')]]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['{''custom'': 24}'], ['function(''tr'')'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left'], ['{''custom'': 24}'], ['function(''tr'')', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_mixed_2()
|
||||
function! Custom()
|
||||
return [['left', ''], ['', { 'custom': 24 }, ''], [[function('tr')], '']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', '{''custom'': 24}', '[function(''tr'')]'], ['modified']], [[0, 0], [1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', '{''custom'': 24}', '[function(''tr'')]', 'modified']], [[0, 0, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_mixed_2()
|
||||
function! Custom()
|
||||
return [['left', ''], ['', { 'custom': 24 }, ''], [[function('tr')], '']]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['{''custom'': 24}'], ['[function(''tr'')]'], ['modified']], [[0, 0], [1], [1], [1], [0]], ['0', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left'], ['{''custom'': 24}'], ['[function(''tr'')]', 'modified']], [[0, 0, 1], [1], [1, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_error()
|
||||
function! Custom()
|
||||
throw 'error'
|
||||
return 'custom'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_error()
|
||||
function! Custom()
|
||||
throw 'error'
|
||||
return 'custom'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.notfound()
|
||||
let g:lightline = { 'component_expand': { 'custom': 'NotFound' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
endfunction
|
||||
|
||||
function! s:suite.custom_type_notfound()
|
||||
let g:lightline = { 'component_expand': { 'custom': 'NotFound' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['modified']], [[0, 0], [0]], ['0', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'modified']], [[0, 0, 0]], ['0', '1']])
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_left_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'z0', 'z1', 'y0', 'y1', 'z0', 'z1'], ['modified']], [[0], [1, 1, 1, 1, 1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename', 'y0', 'y1', 'z0', 'z1', 'y0', 'y1', 'z0', 'z1', 'modified']], [[0, 1, 1, 1, 1, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_type_left_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], ['z0', 'z1'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1'], ['z0', 'z1'], ['y0', 'y1'], ['z0', 'z1'], ['modified']], [[0], [1, 1], [1, 1], [1, 1], [1, 1], [0]], ['0', 'custom', '1', 'custom', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename'], ['y0', 'y1'], ['z0', 'z1'], ['y0', 'y1'], ['z0', 'z1', 'modified']], [[0], [1, 1], [1, 1], [1, 1], [1, 1, 0]], ['0', 'custom', '0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_right_nil()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['x0', 'x1', 'y0', 'y1', 'x0', 'x1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1, 1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename', 'x0', 'x1', 'y0', 'y1', 'x0', 'x1', 'y0', 'y1', 'modified']], [[0, 1, 1, 1, 1, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_type_right_nil()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1'], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['x0', 'x1'], ['y0', 'y1'], ['x0', 'x1'], ['y0', 'y1'], ['modified']], [[0], [1, 1], [1, 1], [1, 1], [1, 1], [0]], ['0', '1', 'custom', '1', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename', 'x0', 'x1'], ['y0', 'y1'], ['x0', 'x1'], ['y0', 'y1'], ['modified']], [[0, 1, 1], [1, 1], [1, 1], [1, 1], [0]], ['0', 'custom', '0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_both_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename', 'y0', 'y1', 'y0', 'y1', 'modified']], [[0, 1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_type_both_nil()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom'], ['modified']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', 'custom', '2', '3']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom', 'modified']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1'], ['modified']], [[0], [1, 1, 1, 1], [0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_both_nil_left_most()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['custom', 'custom'], ['modified']]),
|
||||
\ [[['y0', 'y1', 'y0', 'y1'], ['modified']], [[1, 1, 1, 1], [0]], ['0', '1', '2']])
|
||||
call s:assert.equals(s:expand([['custom', 'custom', 'modified']]),
|
||||
\ [[['y0', 'y1', 'y0', 'y1', 'modified']], [[1, 1, 1, 1, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_type_both_nil_left_most()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['custom', 'custom'], ['modified']]),
|
||||
\ [[['y0', 'y1', 'y0', 'y1'], ['modified']], [[1, 1, 1, 1], [0]], ['custom', '1', '2']])
|
||||
call s:assert.equals(s:expand([['custom', 'custom', 'modified']]),
|
||||
\ [[['y0', 'y1', 'y0', 'y1'], ['modified']], [[1, 1, 1, 1], [0]], ['custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_both_nil_right_most()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1']], [[0], [1, 1, 1, 1]], ['0', '1', '2']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom']]),
|
||||
\ [[['filename', 'y0', 'y1', 'y0', 'y1']], [[0, 1, 1, 1, 1]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.duplicated_type_both_nil_right_most()
|
||||
function! Custom()
|
||||
return [ [], ['y0', 'y1'], [] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['filename'], ['custom', 'custom']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1']], [[0], [1, 1, 1, 1]], ['0', 'custom', '2']])
|
||||
call s:assert.equals(s:expand([['filename', 'custom', 'custom']]),
|
||||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1']], [[0], [1, 1, 1, 1]], ['0', 'custom', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
171
sources_non_forked/lightline.vim/test/highlight.vim
Normal file
171
sources_non_forked/lightline.vim/test/highlight.vim
Normal file
|
@ -0,0 +1,171 @@
|
|||
let s:suite = themis#suite('highlight')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
hi clear
|
||||
endfunction
|
||||
|
||||
function! s:hi(name)
|
||||
redir => hi
|
||||
silent! exec 'hi' a:name
|
||||
redir END
|
||||
return substitute(join(split(hi, "\n"), ''), ' \+', ' ', 'g')
|
||||
endfunction
|
||||
|
||||
function! s:pattern(xs, ...) abort
|
||||
let ys = a:0 ? a:xs[1:] : a:xs
|
||||
let zs = get(a:000, 0, a:xs)
|
||||
return 'ctermfg=' . ys[2] . ' ctermbg=' . zs[3] . '.*guifg=' . ys[0] . ' guibg=' . zs[1]
|
||||
endfunction
|
||||
|
||||
function! s:suite.highlight()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightLineLeft_normal_0'), s:pattern(palette.normal.left[0]))
|
||||
call s:assert.match(s:hi('LightLineLeft_normal_1'), s:pattern(palette.normal.left[1]))
|
||||
call s:assert.match(s:hi('LightLineLeft_normal_2'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineRight_normal_0'), s:pattern(palette.normal.right[0]))
|
||||
call s:assert.match(s:hi('LightLineRight_normal_1'), s:pattern(palette.normal.right[1]))
|
||||
call s:assert.match(s:hi('LightLineRight_normal_2'), s:pattern(palette.normal.right[2]))
|
||||
call s:assert.match(s:hi('LightLineRight_normal_3'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineMiddle_normal'), s:pattern(palette.normal.middle[0]))
|
||||
endfunction
|
||||
|
||||
function! s:suite.insert()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#highlight('insert')
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightLineLeft_insert_0'), s:pattern(palette.insert.left[0]))
|
||||
call s:assert.match(s:hi('LightLineLeft_insert_1'), s:pattern(palette.insert.left[1]))
|
||||
call s:assert.match(s:hi('LightLineLeft_insert_2'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineRight_insert_0'), s:pattern(palette.insert.right[0]))
|
||||
call s:assert.match(s:hi('LightLineRight_insert_1'), s:pattern(palette.insert.right[1]))
|
||||
call s:assert.match(s:hi('LightLineRight_insert_2'), s:pattern(palette.insert.right[2]))
|
||||
call s:assert.match(s:hi('LightLineRight_insert_3'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineMiddle_insert'), s:pattern(palette.insert.middle[0]))
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:suite.visual()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#highlight('visual')
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightLineLeft_visual_0'), s:pattern(palette.visual.left[0]))
|
||||
call s:assert.match(s:hi('LightLineLeft_visual_1'), s:pattern(palette.visual.left[1]))
|
||||
call s:assert.match(s:hi('LightLineLeft_visual_2'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineRight_visual_0'), s:pattern(palette.normal.right[0]))
|
||||
call s:assert.match(s:hi('LightLineRight_visual_1'), s:pattern(palette.normal.right[1]))
|
||||
call s:assert.match(s:hi('LightLineRight_visual_2'), s:pattern(palette.normal.right[2]))
|
||||
call s:assert.match(s:hi('LightLineRight_visual_3'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineMiddle_normal'), s:pattern(palette.normal.middle[0]))
|
||||
endfunction
|
||||
|
||||
function! s:suite.replace()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#highlight('replace')
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightLineLeft_replace_0'), s:pattern(palette.replace.left[0]))
|
||||
call s:assert.match(s:hi('LightLineLeft_replace_1'), s:pattern(palette.replace.left[1]))
|
||||
call s:assert.match(s:hi('LightLineLeft_replace_2'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineRight_replace_0'), s:pattern(palette.replace.right[0]))
|
||||
call s:assert.match(s:hi('LightLineRight_replace_1'), s:pattern(palette.replace.right[1]))
|
||||
call s:assert.match(s:hi('LightLineRight_replace_2'), s:pattern(palette.replace.right[2]))
|
||||
call s:assert.match(s:hi('LightLineRight_replace_3'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineMiddle_replace'), s:pattern(palette.replace.middle[0]))
|
||||
endfunction
|
||||
|
||||
function! s:suite.left_right()
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
|
||||
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
|
||||
\ },
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightLineLeft_normal_0'), s:pattern(palette.normal.left[0]))
|
||||
call s:assert.match(s:hi('LightLineLeft_normal_1'), s:pattern(palette.normal.left[1]))
|
||||
call s:assert.match(s:hi('LightLineLeft_normal_2'), s:pattern(palette.normal.middle[0]))
|
||||
call s:assert.match(s:hi('LightLineLeft_normal_3'), s:pattern(palette.normal.middle[0]))
|
||||
call s:assert.match(s:hi('LightLineLeft_normal_4'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineRight_normal_0'), s:pattern(palette.normal.right[0]))
|
||||
call s:assert.match(s:hi('LightLineRight_normal_1'), s:pattern(palette.normal.right[1]))
|
||||
call s:assert.match(s:hi('LightLineRight_normal_2'), s:pattern(palette.normal.right[2]))
|
||||
call s:assert.match(s:hi('LightLineRight_normal_3'), s:pattern(palette.normal.middle[0]))
|
||||
call s:assert.match(s:hi('LightLineRight_normal_4'), s:pattern(palette.normal.middle[0]))
|
||||
call s:assert.match(s:hi('LightLineRight_normal_5'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineMiddle_normal'), s:pattern(palette.normal.middle[0]))
|
||||
endfunction
|
||||
|
||||
function! s:suite.no_components()
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [],
|
||||
\ 'right': []
|
||||
\ },
|
||||
\ 'inactive': {
|
||||
\ 'left': [],
|
||||
\ 'right': []
|
||||
\ },
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
let palette = lightline#palette()
|
||||
call s:assert.match(s:hi('LightLineLeft_normal_0'), s:pattern(palette.normal.left[0]))
|
||||
call s:assert.match(s:hi('LightLineLeft_normal_1'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineRight_normal_0'), s:pattern(palette.normal.right[0]))
|
||||
call s:assert.match(s:hi('LightLineRight_normal_1'), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi('LightLineMiddle_normal'), s:pattern(palette.normal.middle[0]))
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator()
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
|
||||
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
|
||||
\ },
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
let palette = lightline#palette()
|
||||
for i in range(4)
|
||||
for j in range(5)
|
||||
if i + 1 == j
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_normal_%s_%s', i, j)), s:pattern(get(palette.normal.left, i, palette.normal.middle[0]), get(palette.normal.left, j, palette.normal.middle[0])))
|
||||
else
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_normal_%s_%s', i, j)), 'E411: highlight group not found\|cleared')
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:suite.component_type()
|
||||
let g:lightline = { 'component_type': { 'error': 'error', 'warning': 'warning' } }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
let palette = lightline#palette()
|
||||
for type in ['error', 'warning']
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_normal_%s', type)), s:pattern(palette.normal[type][0]))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_normal_0_%s', type)), s:pattern(palette.normal.left[0], palette.normal[type][0]))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_normal_1_%s', type)), s:pattern(palette.normal.left[1], palette.normal[type][0]))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_normal_2_%s', type)), 'E411: highlight group not found\|cleared')
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_normal_%s_0', type)), s:pattern(palette.normal[type][0], palette.normal.left[0]))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_normal_%s_1', type)), s:pattern(palette.normal[type][0], palette.normal.left[1]))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_normal_%s_2', type)), s:pattern(palette.normal[type][0], palette.normal.middle[0]))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_normal_%s_3', type)), 'E411: highlight group not found\|cleared')
|
||||
endfor
|
||||
for type1 in ['error', 'warning']
|
||||
for type2 in ['error', 'warning']
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_normal_%s_%s', type1, type2)), s:pattern(palette.normal[type1][0], palette.normal[type2][0]))
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
131
sources_non_forked/lightline.vim/test/link.vim
Normal file
131
sources_non_forked/lightline.vim/test/link.vim
Normal file
|
@ -0,0 +1,131 @@
|
|||
let s:suite = themis#suite('link')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
hi clear
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
endfunction
|
||||
|
||||
function! s:hi(name)
|
||||
redir => hi
|
||||
silent! exec 'hi' a:name
|
||||
redir END
|
||||
return substitute(join(split(hi, "\n"), ''), ' \+', ' ', 'g')
|
||||
endfunction
|
||||
|
||||
function! s:suite.link()
|
||||
call lightline#link()
|
||||
call s:assert.match(s:hi('LightLineLeft_active_0'), 'LightLineLeft_normal_0')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_1'), 'LightLineLeft_normal_1')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_2'), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi('LightLineRight_active_0'), 'LightLineRight_normal_0')
|
||||
call s:assert.match(s:hi('LightLineRight_active_1'), 'LightLineRight_normal_1')
|
||||
call s:assert.match(s:hi('LightLineRight_active_2'), 'LightLineRight_normal_2')
|
||||
call s:assert.match(s:hi('LightLineRight_active_3'), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi('LightLineMiddle_active'), 'LightLineMiddle_normal')
|
||||
endfunction
|
||||
|
||||
function! s:suite.insert()
|
||||
call lightline#link('i')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_0'), 'LightLineLeft_insert_0')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_1'), 'LightLineLeft_insert_1')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_2'), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi('LightLineRight_active_0'), 'LightLineRight_insert_0')
|
||||
call s:assert.match(s:hi('LightLineRight_active_1'), 'LightLineRight_insert_1')
|
||||
call s:assert.match(s:hi('LightLineRight_active_2'), 'LightLineRight_insert_2')
|
||||
call s:assert.match(s:hi('LightLineRight_active_3'), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi('LightLineMiddle_active'), 'LightLineMiddle_insert')
|
||||
endfunction
|
||||
|
||||
function! s:suite.visual()
|
||||
call lightline#link('v')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_0'), 'LightLineLeft_visual_0')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_1'), 'LightLineLeft_visual_1')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_2'), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi('LightLineRight_active_0'), 'LightLineRight_visual_0')
|
||||
call s:assert.match(s:hi('LightLineRight_active_1'), 'LightLineRight_visual_1')
|
||||
call s:assert.match(s:hi('LightLineRight_active_2'), 'LightLineRight_visual_2')
|
||||
call s:assert.match(s:hi('LightLineRight_active_3'), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi('LightLineMiddle_active'), 'LightLineMiddle_visual')
|
||||
endfunction
|
||||
|
||||
function! s:suite.replace()
|
||||
call lightline#link('R')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_0'), 'LightLineLeft_replace_0')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_1'), 'LightLineLeft_replace_1')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_2'), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi('LightLineRight_active_0'), 'LightLineRight_replace_0')
|
||||
call s:assert.match(s:hi('LightLineRight_active_1'), 'LightLineRight_replace_1')
|
||||
call s:assert.match(s:hi('LightLineRight_active_2'), 'LightLineRight_replace_2')
|
||||
call s:assert.match(s:hi('LightLineRight_active_3'), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi('LightLineMiddle_active'), 'LightLineMiddle_replace')
|
||||
endfunction
|
||||
|
||||
function! s:suite.left_right()
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
|
||||
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
|
||||
\ },
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#link()
|
||||
call s:assert.match(s:hi('LightLineLeft_active_0'), 'LightLineLeft_normal_0')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_1'), 'LightLineLeft_normal_1')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_2'), 'LightLineLeft_normal_2')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_3'), 'LightLineLeft_normal_3')
|
||||
call s:assert.match(s:hi('LightLineLeft_active_4'), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi('LightLineRight_active_0'), 'LightLineRight_normal_0')
|
||||
call s:assert.match(s:hi('LightLineRight_active_1'), 'LightLineRight_normal_1')
|
||||
call s:assert.match(s:hi('LightLineRight_active_2'), 'LightLineRight_normal_2')
|
||||
call s:assert.match(s:hi('LightLineRight_active_3'), 'LightLineRight_normal_3')
|
||||
call s:assert.match(s:hi('LightLineRight_active_4'), 'LightLineRight_normal_4')
|
||||
call s:assert.match(s:hi('LightLineRight_active_5'), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi('LightLineMiddle_active'), 'LightLineMiddle_normal')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator()
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly' ], [ 'filename' ], [ 'modified' ] ],
|
||||
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat' ], [ 'fileencoding' ], [ 'filetype' ] ]
|
||||
\ },
|
||||
\ }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#link()
|
||||
for i in range(4)
|
||||
for j in range(5)
|
||||
if i + 1 == j
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_active_%s_%s', i, j)), printf('LightLineLeft_normal_%s_%s', i, j))
|
||||
else
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_active_%s_%s', i, j)), 'E411: highlight group not found')
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:suite.component_type()
|
||||
let g:lightline = { 'component_type': { 'error': 'error', 'warning': 'warning' } }
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#link()
|
||||
for type in ['error', 'warning']
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_active_%s', type)), printf('LightLineLeft_normal_%s', type))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_active_0_%s', type)), printf('LightLineLeft_normal_0_%s', type))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_active_1_%s', type)), printf('LightLineLeft_normal_1_%s', type))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_active_2_%s', type)), 'E411: highlight group not found')
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_active_%s_0', type)), printf('LightLineLeft_normal_%s_0', type))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_active_%s_1', type)), printf('LightLineLeft_normal_%s_1', type))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_active_%s_2', type)), printf('LightLineLeft_normal_%s_2', type))
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_active_%s_3', type)), 'E411: highlight group not found')
|
||||
endfor
|
||||
for type1 in ['error', 'warning']
|
||||
for type2 in ['error', 'warning']
|
||||
call s:assert.match(s:hi(printf('LightLineLeft_active_%s_%s', type1, type2)), printf('LightLineLeft_normal_%s_%s', type1, type2))
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
14
sources_non_forked/lightline.vim/test/mode.vim
Normal file
14
sources_non_forked/lightline.vim/test/mode.vim
Normal file
|
@ -0,0 +1,14 @@
|
|||
let s:suite = themis#suite('mode')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.mode()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#mode(), 'NORMAL')
|
||||
endfunction
|
||||
|
||||
function! s:suite.mode_map()
|
||||
let g:lightline = { 'mode_map': { 'n': 'N' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#mode(), 'N')
|
||||
endfunction
|
98
sources_non_forked/lightline.vim/test/onetab.vim
Normal file
98
sources_non_forked/lightline.vim/test/onetab.vim
Normal file
|
@ -0,0 +1,98 @@
|
|||
let s:suite = themis#suite('onetab')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
tabnew
|
||||
tabonly
|
||||
endfunction
|
||||
|
||||
function! s:suite.onetab()
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 [No Name]')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew()
|
||||
tabnew
|
||||
call s:assert.equals(lightline#onetab(1, 0), '1 [No Name]')
|
||||
call s:assert.equals(lightline#onetab(2, 1), '2 [No Name]')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_tabnew()
|
||||
tabnew
|
||||
tabnew
|
||||
call s:assert.equals(lightline#onetab(1, 0), '1 [No Name]')
|
||||
call s:assert.equals(lightline#onetab(2, 0), '2 [No Name]')
|
||||
call s:assert.equals(lightline#onetab(3, 1), '3 [No Name]')
|
||||
endfunction
|
||||
|
||||
function! s:suite.modified()
|
||||
call append(0, '')
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 [No Name] +')
|
||||
undo
|
||||
endfunction
|
||||
|
||||
function! s:suite.filename()
|
||||
edit test
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 test')
|
||||
tabnew
|
||||
bunload test
|
||||
endfunction
|
||||
|
||||
function! s:suite.filename_modified()
|
||||
edit test
|
||||
call append(0, '')
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 test +')
|
||||
tabnew
|
||||
bunload! test
|
||||
endfunction
|
||||
|
||||
function! s:suite.active_inactive()
|
||||
let g:lightline = { 'tab': { 'active': [ 'tabnum', 'filename' ], 'inactive': [ 'filename' ] } }
|
||||
call lightline#init()
|
||||
edit test
|
||||
call append(0, '')
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 test')
|
||||
call s:assert.equals(lightline#onetab(1, 0), 'test')
|
||||
tabnew
|
||||
bunload! test
|
||||
endfunction
|
||||
|
||||
function! s:suite.tab_component()
|
||||
let g:lightline = { 'tab': { 'active': [ 'custom' ] }, 'tab_component': { 'custom': 'custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#onetab(1, 1), 'custom')
|
||||
call s:assert.equals(lightline#onetab(2, 1), 'custom')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tab_component_function()
|
||||
function! Custom(n)
|
||||
return 'custom: ' . a:n
|
||||
endfunction
|
||||
let g:lightline = { 'tab': { 'active': [ 'custom' ] }, 'tab_component_function': { 'custom': 'Custom' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#onetab(1, 1), 'custom: 1')
|
||||
call s:assert.equals(lightline#onetab(2, 1), 'custom: 2')
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.tab_component_empty_middle()
|
||||
let g:lightline = { 'tab': { 'active': [ 'tabnum', 'custom', 'filename' ], 'inactive': [ 'tabnum', 'custom', 'custom', 'filename' ] }, 'tab_component': { 'custom': '' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1 [No Name]')
|
||||
call s:assert.equals(lightline#onetab(2, 1), '2 [No Name]')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tab_component_empty_left()
|
||||
let g:lightline = { 'tab': { 'active': [ 'custom', 'filename' ], 'inactive': [ 'custom', 'custom', 'filename' ] }, 'tab_component': { 'custom': '' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#onetab(1, 1), '[No Name]')
|
||||
call s:assert.equals(lightline#onetab(2, 1), '[No Name]')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tab_component_empty_middle()
|
||||
let g:lightline = { 'tab': { 'active': [ 'tabnum', 'custom' ], 'inactive': [ 'tabnum', 'custom', 'custom' ] }, 'tab_component': { 'custom': '' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(lightline#onetab(1, 1), '1')
|
||||
call s:assert.equals(lightline#onetab(2, 1), '2')
|
||||
endfunction
|
302
sources_non_forked/lightline.vim/test/subseparator.vim
Normal file
302
sources_non_forked/lightline.vim/test/subseparator.vim
Normal file
|
@ -0,0 +1,302 @@
|
|||
let s:suite = themis#suite('subseparator')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:subseparator(...)
|
||||
return eval(substitute(call(SID('subseparator'), a:000), '^%{\|}$', '', 'g'))
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_1()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1', 'custom2': '1', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_2()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '0', 'custom2': '1', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_3()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_4()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1', 'custom2': '0', 'custom3': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_5()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '0', 'custom2': '0', 'custom3': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_6()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1||0', 'custom2': '0', 'custom3': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_visible_condition_7()
|
||||
let g:lightline = { 'component': { 'custom1': 'custom1', 'custom2': 'custom2', 'custom3': 'custom3' }, 'component_visible_condition': { 'custom1': '1||1', 'custom2': '0', 'custom3': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_1()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom1
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_2()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_3()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_4()
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_5()
|
||||
function! Custom1()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_6()
|
||||
function! Custom1()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_7()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return ''
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 1, 1]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 1, 1]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand_1()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom1': 'Custom1' }, 'component_function': { 'custom2': 'Custom2', 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 0, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand_2()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom1': 'Custom1', 'custom2': 'Custom2' }, 'component_function': { 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [1, 1, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand_3()
|
||||
function! Custom1()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2' }, 'component_expand': { 'custom3': 'Custom3' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 1]), '')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_not_found()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom1
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_not_found_1()
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom2': 'Custom2' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
delfunction Custom2
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_not_found_2()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return 'custom2'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
delfunction Custom1
|
||||
delfunction Custom2
|
||||
endfunction
|
67
sources_non_forked/lightline.vim/test/tabline.vim
Normal file
67
sources_non_forked/lightline.vim/test/tabline.vim
Normal file
|
@ -0,0 +1,67 @@
|
|||
let s:suite = themis#suite('tabline')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
tabnew
|
||||
tabonly
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabline()
|
||||
call s:assert.equals(&tabline, '%!lightline#tabline()')
|
||||
endfunction
|
||||
|
||||
function! s:suite.enabled()
|
||||
let g:lightline = { 'enable': { 'tabline': 1 } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(&tabline, '%!lightline#tabline()')
|
||||
endfunction
|
||||
|
||||
function! s:suite.disabled()
|
||||
let g:lightline = { 'enable': { 'tabline': 0 } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(&tabline, '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew()
|
||||
let tabline = lightline#tabline()
|
||||
tabnew
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_first()
|
||||
let tabline = lightline#tabline()
|
||||
0tabnew
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnext()
|
||||
tabnew
|
||||
let tabline = lightline#tabline()
|
||||
tabnext
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabonly()
|
||||
tabnew
|
||||
tabfirst
|
||||
let tabline = lightline#tabline()
|
||||
tabonly
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabclose()
|
||||
tabnew
|
||||
let tabline = lightline#tabline()
|
||||
tabclose
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabclose_last()
|
||||
tabnew
|
||||
tabfirst
|
||||
let tabline = lightline#tabline()
|
||||
$tabclose
|
||||
call s:assert.not_equals(lightline#tabline(), tabline)
|
||||
endfunction
|
99
sources_non_forked/lightline.vim/test/tabs.vim
Normal file
99
sources_non_forked/lightline.vim/test/tabs.vim
Normal file
|
@ -0,0 +1,99 @@
|
|||
let s:suite = themis#suite('tabs')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = { 'winwidth': 180 }
|
||||
call lightline#init()
|
||||
tabnew
|
||||
tabonly
|
||||
endfunction
|
||||
|
||||
function! s:tab(number, ...) abort
|
||||
let active = get(a:000, 0, 0)
|
||||
let last = get(a:000, 1, 0)
|
||||
return '%' . a:number . 'T%{lightline#onetab(' . a:number . ',' . active . ')}' . (last ? '%T' : '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabs()
|
||||
call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1, 1)], []])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew()
|
||||
tabnew
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1)], [s:tab(2, 1, 1)], []])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_tabnew()
|
||||
tabnew
|
||||
tabnew
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2)], [s:tab(3, 1, 1)], []])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_tabfirst()
|
||||
tabnew
|
||||
tabfirst
|
||||
call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1)], [s:tab(2, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_tabnew_tabfirst()
|
||||
tabnew
|
||||
tabnew
|
||||
tabfirst
|
||||
call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1)], [s:tab(2), s:tab(3, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_tabnew_tabprevious()
|
||||
tabnew
|
||||
tabnew
|
||||
tabprevious
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1)], [s:tab(2, 1)], [s:tab(3, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), s:tab(3), s:tab(4), '...', s:tab(16), s:tab(17), s:tab(18), s:tab(19)], [s:tab(20, 1, 1)], []])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20_tabfirst()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
tabfirst
|
||||
call s:assert.equals(lightline#tabs(), [[], [s:tab(1, 1)], [s:tab(2), s:tab(3), s:tab(4), s:tab(5), '...', s:tab(17), s:tab(18), s:tab(19), s:tab(20, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20_tabfirst_tabnext()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
tabfirst
|
||||
tabnext
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1)], [s:tab(2, 1)], [s:tab(3), s:tab(4), s:tab(5), s:tab(6), '...', s:tab(18), s:tab(19), s:tab(20, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20_tabnext_10()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
tabnext 10
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), '...', s:tab(8), s:tab(9)], [s:tab(10, 1)], [s:tab(11), s:tab(12), '...', s:tab(19), s:tab(20, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20_tabprevious()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
tabprevious
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), s:tab(3), '...', s:tab(15), s:tab(16), s:tab(17), s:tab(18)], [s:tab(19, 1)], [s:tab(20, 0, 1)]])
|
||||
endfunction
|
||||
|
||||
function! s:suite.tabnew_20_tabprevious_tabprevious()
|
||||
for i in range(19)
|
||||
tabnew
|
||||
endfor
|
||||
tabprevious
|
||||
tabprevious
|
||||
call s:assert.equals(lightline#tabs(), [[s:tab(1), s:tab(2), s:tab(3), '...', s:tab(15), s:tab(16), s:tab(17)], [s:tab(18, 1)], [s:tab(19), s:tab(20, 0, 1)]])
|
||||
endfunction
|
37
sources_non_forked/lightline.vim/test/toggle.vim
Normal file
37
sources_non_forked/lightline.vim/test/toggle.vim
Normal file
|
@ -0,0 +1,37 @@
|
|||
let s:suite = themis#suite('toggle')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:suite.before_each()
|
||||
let g:lightline = {}
|
||||
call lightline#init()
|
||||
tabnew
|
||||
tabonly
|
||||
endfunction
|
||||
|
||||
function! s:suite.default()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.disable_enable()
|
||||
call lightline#disable()
|
||||
call s:assert.equals(exists('#lightline'), 0)
|
||||
call s:assert.equals(exists('#lightline-disable'), 1)
|
||||
call s:assert.equals(&tabline, '')
|
||||
call lightline#enable()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.toggle()
|
||||
call lightline#toggle()
|
||||
call s:assert.equals(exists('#lightline'), 0)
|
||||
call s:assert.equals(exists('#lightline-disable'), 1)
|
||||
call s:assert.equals(&tabline, '')
|
||||
call lightline#toggle()
|
||||
call s:assert.equals(exists('#lightline'), 1)
|
||||
call s:assert.equals(exists('#lightline-disable'), 0)
|
||||
call s:assert.not_equals(&tabline, '')
|
||||
endfunction
|
46
sources_non_forked/lightline.vim/test/uniq.vim
Normal file
46
sources_non_forked/lightline.vim/test/uniq.vim
Normal file
|
@ -0,0 +1,46 @@
|
|||
let s:suite = themis#suite('uniq')
|
||||
let s:assert = themis#helper('assert')
|
||||
|
||||
function! s:uniq(...)
|
||||
try
|
||||
return call(SID('uniq'), a:000)
|
||||
catch
|
||||
return call(function('uniq'), a:000)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:suite.nil()
|
||||
call s:assert.equals(s:uniq([]), [])
|
||||
endfunction
|
||||
|
||||
function! s:suite.one()
|
||||
call s:assert.equals(s:uniq(['foo']), ['foo'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.two()
|
||||
call s:assert.equals(s:uniq(['foo', 'bar']), ['foo', 'bar'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.three()
|
||||
call s:assert.equals(s:uniq(['foo', 'bar', 'baz']), ['foo', 'bar', 'baz'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.two_duplicated()
|
||||
call s:assert.equals(s:uniq(['foo', 'foo']), ['foo'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.three_duplicated()
|
||||
call s:assert.equals(s:uniq(['foo', 'bar', 'foo']), ['foo', 'bar', 'foo'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.many1()
|
||||
call s:assert.equals(s:uniq(['foo', 'foo', 'bar', 'baz', 'baz', 'qux', 'foo']), ['foo', 'bar', 'baz', 'qux', 'foo'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.many2()
|
||||
call s:assert.equals(s:uniq(['foo', 'foo', 'foo', 'foo', 'bar', 'bar', 'bar']), ['foo', 'bar'])
|
||||
endfunction
|
||||
|
||||
function! s:suite.many3()
|
||||
call s:assert.equals(s:uniq(['foo', 'foo', 'bar', 'bar', 'bar', 'foo', 'foo', 'foo']), ['foo', 'bar', 'foo'])
|
||||
endfunction
|
|
@ -76,6 +76,7 @@ Faq
|
|||
|
||||
Yes, install [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin).
|
||||
|
||||
---
|
||||
|
||||
> Can I have the nerdtree on every tab automatically?
|
||||
|
||||
|
@ -85,10 +86,12 @@ http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers
|
|||
|
||||
If you are interested in this behaviour then consider [vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs)
|
||||
|
||||
---
|
||||
> How can I open a NERDTree automatically when vim starts up?
|
||||
|
||||
Stick this in your vimrc: `autocmd vimenter * NERDTree`
|
||||
|
||||
---
|
||||
> How can I open a NERDTree automatically when vim starts up if no files were specified?
|
||||
|
||||
Stick this in your vimrc:
|
||||
|
@ -98,22 +101,26 @@ Stick this in your vimrc:
|
|||
|
||||
Note: Now start vim with plain `vim`, not `vim .`
|
||||
|
||||
---
|
||||
> How can I map a specific key or shortcut to open NERDTree?
|
||||
|
||||
Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want):
|
||||
|
||||
map <C-n> :NERDTreeToggle<CR>
|
||||
|
||||
---
|
||||
> How can I close vim if the only window left open is a NERDTree?
|
||||
|
||||
Stick this in your vimrc:
|
||||
|
||||
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
||||
|
||||
---
|
||||
> Can I have different highlighting for different file extensions?
|
||||
|
||||
See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-92590696
|
||||
|
||||
---
|
||||
> How can I change default arrows?
|
||||
|
||||
Use these variables in your vimrc. Note that below are default arrow symbols
|
||||
|
|
|
@ -187,17 +187,17 @@ endfunction
|
|||
" closes the parent dir of the current node
|
||||
function! s:closeCurrentDir(node)
|
||||
let parent = a:node.parent
|
||||
while g:NERDTreeCascadeOpenSingleChildDir && !parent.isRoot()
|
||||
let childNodes = parent.getVisibleChildren()
|
||||
if len(childNodes) == 1 && childNodes[0].path.isDirectory
|
||||
let parent = parent.parent
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
if parent ==# {} || parent.isRoot()
|
||||
call nerdtree#echo("cannot close tree root")
|
||||
else
|
||||
while g:NERDTreeCascadeOpenSingleChildDir && !parent.parent.isRoot()
|
||||
if parent.parent.getVisibleChildCount() == 1
|
||||
call parent.close()
|
||||
let parent = parent.parent
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
call parent.close()
|
||||
call b:NERDTree.render()
|
||||
call parent.putCursorHere(0, 0)
|
||||
|
@ -280,7 +280,7 @@ function! s:findAndRevealPath()
|
|||
else
|
||||
call g:NERDTree.CursorToTreeWin()
|
||||
endif
|
||||
call b:NERDTree.setShowHidden(g:NERDTreeShowHidden)
|
||||
call b:NERDTree.ui.setShowHidden(g:NERDTreeShowHidden)
|
||||
call s:chRoot(g:NERDTreeDirNode.New(p.getParent(), b:NERDTree))
|
||||
else
|
||||
if !g:NERDTree.IsOpen()
|
||||
|
|
|
@ -679,6 +679,9 @@ NERD tree. These options should be set in your vimrc.
|
|||
a buffer when a file is being deleted or renamed
|
||||
via a context menu command.
|
||||
|
||||
|'NERDTreeCreatePrefix'| Specify a prefix to be used when creating the
|
||||
NERDTree window.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2. Customisation details *NERDTreeOptionDetails*
|
||||
|
||||
|
@ -1010,6 +1013,17 @@ option: >
|
|||
let NERDTreeAutoDeleteBuffer=0
|
||||
let NERDTreeAutoDeleteBuffer=1
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeCreatePrefix'*
|
||||
Values: Any valid command prefix.
|
||||
Default: "silent".
|
||||
|
||||
Internally, NERDTree uses the |:edit| command to create a buffer in which to
|
||||
display its tree view. You can augment this behavior by specifying a prefix
|
||||
string such as "keepalt" or similar. For example, to have NERDTree create its
|
||||
tree window using `silent keepalt keepjumps edit`:
|
||||
let NERDTreeCreatePrefix='silent keepalt keepjumps'
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
4. The NERD tree API *NERDTreeAPI*
|
||||
|
|
|
@ -96,7 +96,7 @@ function! s:Creator.createWindowTree(dir)
|
|||
|
||||
"we need a unique name for each window tree buffer to ensure they are
|
||||
"all independent
|
||||
exec "silent edit " . self._nextBufferName()
|
||||
exec g:NERDTreeCreatePrefix . " edit " . self._nextBufferName()
|
||||
|
||||
call self._createNERDTree(path, "window")
|
||||
let b:NERDTree._previousBuf = bufnr(previousBuf)
|
||||
|
|
|
@ -61,7 +61,7 @@ function! s:Path.cacheDisplayString() abort
|
|||
endif
|
||||
|
||||
if self.isReadOnly
|
||||
let self.cachedDisplayString .= ' [RO]'
|
||||
let self.cachedDisplayString .= ' ['.g:NERDTreeGlyphReadOnly.']'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -375,7 +375,7 @@ function! s:UI._stripMarkup(line, removeLeadingSpaces)
|
|||
let line = substitute (line, g:NERDTreeUI.MarkupReg(),"","")
|
||||
|
||||
"strip off any read only flag
|
||||
let line = substitute (line, ' \[RO\]', "","")
|
||||
let line = substitute (line, ' \['.g:NERDTreeGlyphReadOnly.'\]', "","")
|
||||
|
||||
"strip off any bookmark flags
|
||||
let line = substitute (line, ' {[^}]*}', "","")
|
||||
|
|
|
@ -48,6 +48,7 @@ call s:initVariable("g:NERDTreeAutoCenterThreshold", 3)
|
|||
call s:initVariable("g:NERDTreeCaseSensitiveSort", 0)
|
||||
call s:initVariable("g:NERDTreeSortHiddenFirst", 1)
|
||||
call s:initVariable("g:NERDTreeChDirMode", 0)
|
||||
call s:initVariable("g:NERDTreeCreatePrefix", "silent")
|
||||
call s:initVariable("g:NERDTreeMinimalUI", 0)
|
||||
if !exists("g:NERDTreeIgnore")
|
||||
let g:NERDTreeIgnore = ['\~$']
|
||||
|
@ -84,6 +85,8 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
call s:initVariable("g:NERDTreeGlyphReadOnly", "RO")
|
||||
|
||||
if !exists('g:NERDTreeStatusline')
|
||||
|
||||
"the exists() crap here is a hack to stop vim spazzing out when
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
let s:tree_up_dir_line = '.. (up a dir)'
|
||||
syn match NERDTreeIgnore #\~#
|
||||
syn match NERDTreeIgnore #\[RO\]#
|
||||
exec 'syn match NERDTreeIgnore #\['.g:NERDTreeGlyphReadOnly.'\]#'
|
||||
|
||||
"highlighting for the .. (up dir) line at the top of the tree
|
||||
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
|
||||
|
@ -31,7 +31,7 @@ syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmar
|
|||
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
|
||||
|
||||
"highlighting for readonly files
|
||||
syn match NERDTreeRO # *\zs.*\ze \[RO\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile
|
||||
exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
|
||||
|
||||
syn match NERDTreeFlags #^ *\zs\[.\]# containedin=NERDTreeFile,NERDTreeExecFile
|
||||
syn match NERDTreeFlags #\[.\]# containedin=NERDTreeDir
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
## 1. Bug reports / GitHub issues
|
||||
|
||||
Please note that the preferred channel for posting bug reports is the
|
||||
[issue tracker at GitHub][0]. Reports posted elsewhere are less likely
|
||||
[issue tracker at GitHub][bug_tracker]. Reports posted elsewhere are less likely
|
||||
to be seen by the core team.
|
||||
|
||||
When reporting a bug make sure you search the existing GitHub issues
|
||||
|
@ -39,14 +39,14 @@ too:
|
|||
## 2. Submitting a patch
|
||||
|
||||
Before you consider adding features to syntastic, _please_ spend a few minutes
|
||||
(re-)reading the latest version of the [manual][1]. Syntastic is changing
|
||||
(re-)reading the latest version of the [manual][manual]. Syntastic is changing
|
||||
rapidly at times, and it's possible that some features you want to add exist
|
||||
already.
|
||||
|
||||
To submit a patch:
|
||||
|
||||
* fork the [repo][2] on GitHub;
|
||||
* make a [topic branch][3] and start hacking;
|
||||
* fork the [repo][github] on GitHub;
|
||||
* make a [topic branch][branches] and start hacking;
|
||||
* submit a pull request based off your topic branch.
|
||||
|
||||
Small, focused patches are preferred.
|
||||
|
@ -69,14 +69,14 @@ Follow the coding conventions/styles used in the syntastic core:
|
|||
* don't use `l:` prefixes for variables unless actually required (i.e.
|
||||
almost never);
|
||||
* code for maintainability; we would rather a function be a couple of
|
||||
lines longer and have (for example) some [explaining variables][4] to
|
||||
lines longer and have (for example) some [explaining variables][variables] to
|
||||
aid readability.
|
||||
|
||||
<a name="checkerstyle"></a>
|
||||
|
||||
## 4. Syntax checker notes
|
||||
|
||||
Make sure to read the [guide][5] if you plan to add new syntax checkers.
|
||||
Make sure to read the [guide][guide] if you plan to add new syntax checkers.
|
||||
|
||||
Use the existing checkers as templates, rather than writing everything
|
||||
from scratch.
|
||||
|
@ -97,9 +97,9 @@ let errorformat =
|
|||
\ '%-G%.%#'
|
||||
```
|
||||
|
||||
[0]: https://github.com/scrooloose/syntastic/issues
|
||||
[1]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic.txt
|
||||
[2]: https://github.com/scrooloose/syntastic
|
||||
[3]: https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches
|
||||
[4]: http://www.refactoring.com/catalog/extractVariable.html
|
||||
[5]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
|
||||
[bug_tracker]: https://github.com/scrooloose/syntastic/issues
|
||||
[manual]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic.txt
|
||||
[github]: https://github.com/scrooloose/syntastic
|
||||
[branches]: https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches
|
||||
[variables]: http://www.refactoring.com/catalog/extractVariable.html
|
||||
[guide]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
|
||||
|
|
|
@ -25,19 +25,22 @@
|
|||
3. [Recommended settings](#settings)
|
||||
4. [FAQ](#faq)
|
||||
4.1. [I installed syntastic but it isn't reporting any errors...](#faqinfo)
|
||||
4.2. [The `python` checker complains about syntactically valid Python 3 constructs...](#faqpython3)
|
||||
4.3. [Are there any local checkers for HTML5 that I can use with syntastic?](#faqhtml5)
|
||||
4.4. [The `perl` checker has stopped working...](#faqperl)
|
||||
4.5. [What happened to the `rustc` checker?](#faqrust)
|
||||
4.6. [What happened to the `xcrun` checker?](#faqxcrun)
|
||||
4.7. [I run a checker and the location list is not updated...](#faqloclist)
|
||||
4.7. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
|
||||
4.8. [How can I pass additional arguments to a checker?](#faqargs)
|
||||
4.9. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
|
||||
4.10. [What is the difference between syntax checkers and style checkers?](#faqstyle)
|
||||
4.11. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
|
||||
4.12. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
|
||||
4.13. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete)
|
||||
4.2. [How can I check scripts written for different versions of Python?](#faqpython)
|
||||
4.3. [How can I check scripts written for different versions of Ruby?](#faqruby)
|
||||
4.4. [Are there any local checkers for HTML5 that I can use with syntastic?](#faqhtml5)
|
||||
4.5. [The `perl` checker has stopped working...](#faqperl)
|
||||
4.6. [What happened to the `rustc` checker?](#faqrust)
|
||||
4.7. [What happened to the `tsc` checker?](#faqtsc)
|
||||
4.8. [What happened to the `xcrun` checker?](#faqxcrun)
|
||||
4.9. [I run a checker and the location list is not updated...](#faqloclist)
|
||||
4.9. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
|
||||
4.10. [How can I pass additional arguments to a checker?](#faqargs)
|
||||
4.11. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
|
||||
4.12. [What is the difference between syntax checkers and style checkers?](#faqstyle)
|
||||
4.13. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
|
||||
4.14. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
|
||||
4.15. [My favourite checker needs to load a configuration file from the project's root rather than the current directory...](#faqconfig)
|
||||
4.16. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete)
|
||||
5. [Resources](#otherresources)
|
||||
|
||||
- - -
|
||||
|
@ -46,36 +49,38 @@
|
|||
|
||||
## 1\. Introduction
|
||||
|
||||
Syntastic is a syntax checking plugin for [Vim][13] that runs files through
|
||||
Syntastic is a syntax checking plugin for [Vim][vim] that runs files through
|
||||
external syntax checkers and displays any resulting errors to the user. This
|
||||
can be done on demand, or automatically as files are saved. If syntax errors
|
||||
are detected, the user is notified and is happy because they didn't have to
|
||||
compile their code or execute their script to find them.
|
||||
|
||||
At the time of this writing, syntastic has checking plugins for ActionScript,
|
||||
Ada, Ansible configurations, API Blueprint, AppleScript, AsciiDoc, ASM,
|
||||
BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco,
|
||||
Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir,
|
||||
Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe,
|
||||
Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP,
|
||||
LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix,
|
||||
Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable
|
||||
Object, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python, QML,
|
||||
R, Racket, Relax NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim,
|
||||
SML, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog,
|
||||
VHDL, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML, z80, Zope page templates, and
|
||||
zsh. See the [wiki][3] for details about the corresponding supported checkers.
|
||||
At the time of this writing, syntastic has checking plugins for ACPI
|
||||
Source Language, ActionScript, Ada, Ansible configurations, API Blueprint,
|
||||
AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C,
|
||||
C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart,
|
||||
DocBook, Dockerfile, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata,
|
||||
GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON,
|
||||
JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown,
|
||||
MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl
|
||||
POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug (formerly
|
||||
Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG,
|
||||
reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity,
|
||||
Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog,
|
||||
VHDL, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML, YANG data models, z80, Zope
|
||||
page templates, and Zsh. See the [manual][checkers] for details about the
|
||||
corresponding supported checkers (`:help syntastic-checkers` in Vim).
|
||||
|
||||
A number of third-party Vim plugins also provide checkers for syntastic,
|
||||
for example: [merlin][30], [omnisharp-vim][25], [rust.vim][12],
|
||||
[syntastic-extras][26], [syntastic-more][27], [vim-crystal][29],
|
||||
[vim-eastwood][28], and [vim-swift][24].
|
||||
A number of third-party Vim plugins also provide checkers for syntastic, for
|
||||
example: [merlin][merlin], [omnisharp-vim][omnisharp], [rust.vim][rust],
|
||||
[syntastic-extras][myint], [syntastic-more][roktas], [tsuquyomi][tsuquyomi],
|
||||
[vim-crystal][crystal], [vim-eastwood][eastwood], and [vim-swift][swift].
|
||||
|
||||
Below is a screenshot showing the methods that Syntastic uses to display syntax
|
||||
errors. Note that, in practise, you will only have a subset of these methods
|
||||
enabled.
|
||||
|
||||
![Screenshot 1][0]
|
||||
![Screenshot 1][screenshot]
|
||||
|
||||
1. Errors are loaded into the location list for the corresponding window.
|
||||
2. When the cursor is on a line containing an error, the error message is echoed in the command window.
|
||||
|
@ -93,7 +98,7 @@ enabled.
|
|||
### 2.1\. Requirements
|
||||
|
||||
Syntastic itself has rather relaxed requirements: it doesn't have any external
|
||||
dependencies, and it needs a version of [Vim][13] compiled with a few common
|
||||
dependencies, and it needs a version of [Vim][vim] compiled with a few common
|
||||
features: `autocmd`, `eval`, `file_in_path`, `modify_fname`, `quickfix`,
|
||||
`reltime`, and `user_commands`. Not all possible combinations of features that
|
||||
include the ones above make equal sense on all operating systems, but Vim
|
||||
|
@ -101,8 +106,8 @@ version 7 or later with the "normal", "big", or "huge" feature sets should be
|
|||
fine.
|
||||
|
||||
Syntastic should work with any modern plugin managers for Vim, such as
|
||||
[NeoBundle][14], [Pathogen][1], [Vim-Addon-Manager][15], [Vim-Plug][16], or
|
||||
[Vundle][17]. Instructions for installing syntastic with [Pathogen][1] are
|
||||
[NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam], [Vim-Plug][plug], or
|
||||
[Vundle][vundle]. Instructions for installing syntastic with [Pathogen][pathogen] are
|
||||
included below for completeness.
|
||||
|
||||
Starting with Vim version 7.4.1486 you can also load syntastic using the
|
||||
|
@ -114,20 +119,21 @@ syntastic is present only in versions 7.4.1486 and later.
|
|||
Last but not least: syntastic doesn't know how to do any syntax checks by
|
||||
itself. In order to get meaningful results you need to install external
|
||||
checkers corresponding to the types of files you use. Please consult the
|
||||
[wiki][3] for a list of supported checkers.
|
||||
[manual][checkers] (`:help syntastic-checkers` in Vim) for a list of supported
|
||||
checkers.
|
||||
|
||||
<a name="installpathogen"></a>
|
||||
|
||||
### 2.2\. Installing syntastic with Pathogen
|
||||
|
||||
If you already have [Pathogen][1] working then skip [Step 1](#step1) and go to
|
||||
If you already have [Pathogen][pathogen] working then skip [Step 1](#step1) and go to
|
||||
[Step 2](#step2).
|
||||
|
||||
<a name="step1"></a>
|
||||
|
||||
#### 2.2.1\. Step 1: Install pathogen.vim
|
||||
|
||||
First I'll show you how to install Tim Pope's [Pathogen][1] so that it's easy to
|
||||
First I'll show you how to install Tim Pope's [Pathogen][pathogen] so that it's easy to
|
||||
install syntastic. Do this in your terminal so that you get the `pathogen.vim`
|
||||
file and the directories it needs:
|
||||
```sh
|
||||
|
@ -147,14 +153,14 @@ You now have pathogen installed and can put syntastic into `~/.vim/bundle` like
|
|||
this:
|
||||
```sh
|
||||
cd ~/.vim/bundle && \
|
||||
git clone https://github.com/scrooloose/syntastic.git
|
||||
git clone --depth=1 https://github.com/scrooloose/syntastic.git
|
||||
```
|
||||
Quit vim and start it back up to reload it, then type:
|
||||
```vim
|
||||
:Helptags
|
||||
```
|
||||
If you get an error when you do this, then you probably didn't install
|
||||
[Pathogen][1] right. Go back to [Step 1](#step1) and make sure you did the
|
||||
[Pathogen][pathogen] right. Go back to [Step 1](#step1) and make sure you did the
|
||||
following:
|
||||
|
||||
1. Created both the `~/.vim/autoload` and `~/.vim/bundle` directories.
|
||||
|
@ -191,10 +197,11 @@ __4.1. Q. I installed syntastic but it isn't reporting any errors...__
|
|||
|
||||
A. The most likely reason is that none of the syntax checkers that it requires
|
||||
are installed. For example: by default, python requires either `flake8` or
|
||||
`pylint` to be installed and in your `$PATH`. To see which executables are
|
||||
supported, look at the [wiki][3]. Note that aliases do not work; the actual
|
||||
executables must be available in your `$PATH`. Symbolic links are okay though.
|
||||
You can see syntastic's idea of available checkers by running `:SyntasticInfo`.
|
||||
`pylint` to be installed and in your `$PATH`. Read the [manual][checkers]
|
||||
(`:help syntastic-checkers` in Vim) to find out what executables are
|
||||
supported. Note that aliases do not work; the actual executables must be
|
||||
available in your `$PATH`. Symbolic links are okay though. You can see
|
||||
syntastic's idea of available checkers by running `:SyntasticInfo`.
|
||||
|
||||
A second probable reason is that none of the available checkers are
|
||||
enabled. Syntastic comes preconfigured with a default list of enabled checkers
|
||||
|
@ -221,45 +228,66 @@ on Windows.
|
|||
Finally, another reason it could fail is that either the command line options
|
||||
or the error output for a syntax checker may have changed. In this case, make
|
||||
sure you have the latest version of the syntax checker installed. If it still
|
||||
fails then post an [issue][4] - or better yet, create a pull request.
|
||||
fails then post an [issue][bug_tracker] - or better yet, create a pull request.
|
||||
|
||||
<a name="faqpython3"></a>
|
||||
<a name="faqpython"></a>
|
||||
|
||||
__4.2. Q. The `python` checker complains about syntactically valid Python 3 constructs...__
|
||||
__4.2. Q. How can I check scripts written for different versions of Python?__
|
||||
|
||||
A. Configure the `python` checker to call a Python 3 interpreter rather than
|
||||
Python 2, e.g:
|
||||
```vim
|
||||
let g:syntastic_python_python_exec = '/path/to/python3'
|
||||
```
|
||||
A. Install a Python version manager such as [virtualenv][virtualenv]
|
||||
or [pyenv][pyenv], activate the environment for the relevant version
|
||||
of Python, and install in it the checkers you want to use. Set
|
||||
`g:syntastic_python_checkers` accordingly in your `vimrc`, and run [Vim][vim]
|
||||
from the virtual environment.
|
||||
|
||||
If you're starting Vim from a desktop manager rather than from a terminal you
|
||||
might need to write wrapper scripts around your checkers, to activate the
|
||||
virtual environment before running the actual checks. Then you'll need to
|
||||
point the relevant `g:syntastic_python_<checker>_exec` variables to the wrapper
|
||||
scripts.
|
||||
|
||||
<a name="faqruby"></a>
|
||||
|
||||
__4.3. Q. How can I check scripts written for different versions of Ruby?__
|
||||
|
||||
A. Install a Ruby version manager such as [rvm][rvm] or [rbenv][rbenv],
|
||||
activate the environment for the relevant version of Ruby, and install in it
|
||||
the checkers you want to use. Set `g:syntastic_ruby_checkers` accordingly in
|
||||
your `vimrc`, and run [Vim][vim] from the virtual environment.
|
||||
|
||||
If you're starting Vim from a desktop manager rather than from a terminal you
|
||||
might need to write wrapper scripts around your checkers, to activate the
|
||||
virtual environment before running the actual checks. Then you'll need to
|
||||
point the relevant `g:syntastic_ruby_<checker>_exec` variables to the wrapper
|
||||
scripts.
|
||||
|
||||
<a name="faqhtml5"></a>
|
||||
|
||||
__4.3. Q. Are there any local checkers for HTML5 that I can use with syntastic?__
|
||||
__4.4. Q. Are there any local checkers for HTML5 that I can use with syntastic?__
|
||||
|
||||
[HTML Tidy][18] has a fork named [HTML Tidy for HTML5][19]. It's a drop
|
||||
[HTML Tidy][tidy_old] has a fork named [HTML Tidy for HTML5][tidy]. It's a drop
|
||||
in replacement, and syntastic can use it without changes. Just install it
|
||||
somewhere and point `g:syntastic_html_tidy_exec` to its executable:
|
||||
```vim
|
||||
let g:syntastic_html_tidy_exec = 'tidy5'
|
||||
```
|
||||
Alternatively, you can install [vnu.jar][21] from the [validator.nu][20]
|
||||
project and run it as a [HTTP server][23]:
|
||||
Alternatively, you can install [vnu.jar][vnu_jar] from the [validator.nu][vnu]
|
||||
project and run it as a [HTTP server][vnu_server]:
|
||||
```sh
|
||||
$ java -Xss512k -cp /path/to/vnu.jar nu.validator.servlet.Main 8888
|
||||
```
|
||||
Then you can [configure][22] syntastic to use it:
|
||||
Then you can configure syntastic to use it:
|
||||
```vim
|
||||
let g:syntastic_html_validator_api = 'http://localhost:8888/'
|
||||
```
|
||||
|
||||
<a name="faqperl"></a>
|
||||
|
||||
__4.4. Q. The `perl` checker has stopped working...__
|
||||
__4.5. Q. The `perl` checker has stopped working...__
|
||||
|
||||
A. The `perl` checker runs `perl -c` against your file, which in turn
|
||||
__executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use`
|
||||
statements in your file (cf. [perlrun][10]). This is probably fine if you
|
||||
statements in your file (cf. [perlrun][perlrun]). This is probably fine if you
|
||||
wrote the file yourself, but it's a security problem if you're checking
|
||||
third-party files. Since there is currently no way to disable this behaviour
|
||||
while still producing useful results, the checker is now disabled by default.
|
||||
|
@ -271,23 +299,31 @@ let g:syntastic_enable_perl_checker = 1
|
|||
|
||||
<a name="faqrust"></a>
|
||||
|
||||
__4.5. Q. What happened to the `rustc` checker?__
|
||||
__4.6. Q. What happened to the `rustc` checker?__
|
||||
|
||||
A. It is now part of the [rust.vim][12] plugin. If you install this plugin the
|
||||
A. It is now part of the [rust.vim][rust] plugin. If you install this plugin the
|
||||
checker should be picked up automatically by syntastic.
|
||||
|
||||
<a name="faqtsc"></a>
|
||||
|
||||
__4.7. Q. What happened to the `tsc` checker?__
|
||||
|
||||
A. It didn't meet people's expectations and it has been removed. Please
|
||||
consider using the external checker [tsuquyomi][tsuquyomi] instead. If you
|
||||
install this plugin the checker should be picked up automatically by syntastic.
|
||||
|
||||
<a name="faqxcrun"></a>
|
||||
|
||||
__4.6. Q. What happened to the `xcrun` checker?__
|
||||
__4.8. Q. What happened to the `xcrun` checker?__
|
||||
|
||||
A. The `xcrun` checker used to have a security problem and it has been removed.
|
||||
A better checker for __Swift__ is part of the [vim-swift][24] plugin. If you
|
||||
A better checker for __Swift__ is part of the [vim-swift][swift] plugin. If you
|
||||
install this plugin the checker should be picked up automatically by syntastic.
|
||||
|
||||
<a name="faqloclist"></a>
|
||||
|
||||
__4.7. Q. I run a checker and the location list is not updated...__
|
||||
__4.7. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
|
||||
__4.9. Q. I run a checker and the location list is not updated...__
|
||||
__4.9. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
|
||||
|
||||
A. By default the location list is changed only when you run the `:Errors`
|
||||
command, in order to minimise conflicts with other plugins. If you want the
|
||||
|
@ -299,7 +335,7 @@ let g:syntastic_always_populate_loc_list = 1
|
|||
|
||||
<a name="faqargs"></a>
|
||||
|
||||
__4.8. Q. How can I pass additional arguments to a checker?__
|
||||
__4.10. Q. How can I pass additional arguments to a checker?__
|
||||
|
||||
A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers
|
||||
that do can be configured using global variables. The general form of the
|
||||
|
@ -315,7 +351,7 @@ See `:help syntastic-checker-options` for more information.
|
|||
|
||||
<a name="faqcheckers"></a>
|
||||
|
||||
__4.9. Q. Syntastic supports several checkers for my filetype - how do I tell it
|
||||
__4.11. Q. Syntastic supports several checkers for my filetype - how do I tell it
|
||||
which one(s) to use?__
|
||||
|
||||
A. Stick a line like this in your `vimrc`:
|
||||
|
@ -323,8 +359,8 @@ A. Stick a line like this in your `vimrc`:
|
|||
let g:syntastic_<filetype>_checkers = ['<checker-name>']
|
||||
```
|
||||
|
||||
To see the list of supported checkers for your filetype look at the
|
||||
[wiki][3].
|
||||
To see the list of supported checkers for your filetype read the
|
||||
[manual][checkers] (`:help syntastic-checkers` in Vim).
|
||||
|
||||
e.g. Python has the following checkers, among others: `flake8`, `pyflakes`,
|
||||
`pylint` and a native `python` checker.
|
||||
|
@ -356,7 +392,7 @@ filetype of the current file is `php`).
|
|||
|
||||
<a name="faqstyle"></a>
|
||||
|
||||
__4.10. Q. What is the difference between syntax checkers and style checkers?__
|
||||
__4.12. Q. What is the difference between syntax checkers and style checkers?__
|
||||
|
||||
A. The errors and warnings they produce are highlighted differently and can
|
||||
be filtered by different rules, but otherwise the distinction is pretty much
|
||||
|
@ -386,7 +422,7 @@ See `:help syntastic_quiet_messages` for details.
|
|||
|
||||
<a name="faqaggregate"></a>
|
||||
|
||||
__4.11. Q. I have enabled multiple checkers for the current filetype. How can I
|
||||
__4.13. Q. I have enabled multiple checkers for the current filetype. How can I
|
||||
display all errors from all checkers together?__
|
||||
|
||||
A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`:
|
||||
|
@ -398,19 +434,38 @@ See `:help syntastic-aggregating-errors` for more details.
|
|||
|
||||
<a name="faqlnext"></a>
|
||||
|
||||
__4.12. Q. How can I jump between the different errors without using the location
|
||||
__4.14. Q. How can I jump between the different errors without using the location
|
||||
list at the bottom of the window?__
|
||||
|
||||
A. Vim provides several built-in commands for this. See `:help :lnext` and
|
||||
`:help :lprevious`.
|
||||
|
||||
If you use these commands a lot then you may want to add shortcut mappings to
|
||||
your `vimrc`, or install something like [unimpaired][2], which provides such
|
||||
your `vimrc`, or install something like [unimpaired][unimpaired], which provides such
|
||||
mappings (among other things).
|
||||
|
||||
<a name="faqconfig"></a>
|
||||
|
||||
__4.15. My favourite checker needs to load a configuration file from the
|
||||
project's root rather than the current directory...__
|
||||
|
||||
A. You can set up an `autocmd` to search for the configuration file in the
|
||||
current directory and upwards, and add it to the checker's options when found.
|
||||
For example for `jscs`:
|
||||
|
||||
```vim
|
||||
function! FindConfig(prefix, what, where)
|
||||
let cfg = findfile(a:what, escape(a:where, ' ') . ';')
|
||||
return cfg !=# '' ? ' ' . a:prefix . ' ' . shellescape(cfg) : ''
|
||||
endfunction
|
||||
|
||||
autocmd FileType javascript let b:syntastic_javascript_jscs_args =
|
||||
\ get(g:, 'syntastic_javascript_jscs_args', '') .
|
||||
\ FindConfig('-c', '.jscsrc', expand('<afile>:p:h', 1))
|
||||
```
|
||||
<a name="faqbdelete"></a>
|
||||
|
||||
__4.13. Q. The error window is closed automatically when I :quit the current buffer
|
||||
__4.16. Q. The error window is closed automatically when I :quit the current buffer
|
||||
but not when I :bdelete it?__
|
||||
|
||||
A. There is no safe way to handle that situation automatically, but you can
|
||||
|
@ -426,50 +481,55 @@ cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdele
|
|||
## 5\. Resources
|
||||
|
||||
The preferred place for posting suggestions, reporting bugs, and general
|
||||
discussions related to syntastic is the [issue tracker at GitHub][4].
|
||||
A guide for writing syntax checkers can be found in the [wiki][11].
|
||||
There are also a dedicated [google group][5], and a
|
||||
[syntastic tag at StackOverflow][6].
|
||||
discussions related to syntastic is the [issue tracker at GitHub][bug_tracker].
|
||||
A guide for writing syntax checkers can be found in the [wiki][guide].
|
||||
There are also a dedicated [google group][google_group], and a
|
||||
[syntastic tag at StackOverflow][stack_overflow].
|
||||
|
||||
Syntastic aims to provide a common interface to syntax checkers for as many
|
||||
languages as possible. For particular languages, there are, of course, other
|
||||
plugins that provide more functionality than syntastic. You might want to take
|
||||
a look at [ghcmod-vim][31], [jedi-vim][7], [python-mode][8], [vim-go][32], or
|
||||
[YouCompleteMe][9].
|
||||
a look at [ghcmod-vim][ghcmod], [jedi-vim][jedi], [python-mode][python_mode], [vim-go][vimgo], or
|
||||
[YouCompleteMe][ycm].
|
||||
|
||||
[0]: https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png
|
||||
[1]: https://github.com/tpope/vim-pathogen
|
||||
[2]: https://github.com/tpope/vim-unimpaired
|
||||
[3]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
|
||||
[4]: https://github.com/scrooloose/syntastic/issues
|
||||
[5]: https://groups.google.com/group/vim-syntastic
|
||||
[6]: http://stackoverflow.com/questions/tagged/syntastic
|
||||
[7]: https://github.com/davidhalter/jedi-vim
|
||||
[8]: https://github.com/klen/python-mode
|
||||
[9]: http://valloric.github.io/YouCompleteMe/
|
||||
[10]: http://perldoc.perl.org/perlrun.html#*-c*
|
||||
[11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
|
||||
[12]: https://github.com/rust-lang/rust.vim
|
||||
[13]: http://www.vim.org/
|
||||
[14]: https://github.com/Shougo/neobundle.vim
|
||||
[15]: https://github.com/MarcWeber/vim-addon-manager
|
||||
[16]: https://github.com/junegunn/vim-plug/
|
||||
[17]: https://github.com/gmarik/Vundle.vim
|
||||
[18]: http://tidy.sourceforge.net/
|
||||
[19]: http://www.htacg.org/tidy-html5/
|
||||
[20]: http://about.validator.nu/
|
||||
[21]: https://github.com/validator/validator/releases/latest
|
||||
[22]: https://github.com/scrooloose/syntastic/wiki/HTML%3A---validator
|
||||
[23]: http://validator.github.io/validator/#standalone
|
||||
[24]: https://github.com/kballard/vim-swift
|
||||
[25]: https://github.com/OmniSharp/omnisharp-vim
|
||||
[26]: https://github.com/myint/syntastic-extras
|
||||
[27]: https://github.com/roktas/syntastic-more
|
||||
[28]: https://github.com/venantius/vim-eastwood
|
||||
[29]: https://github.com/rhysd/vim-crystal
|
||||
[30]: https://github.com/the-lambda-church/merlin
|
||||
[31]: https://github.com/eagletmt/ghcmod-vim
|
||||
[32]: https://github.com/fatih/vim-go
|
||||
[screenshot]: https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png
|
||||
|
||||
[bug_tracker]: https://github.com/scrooloose/syntastic/issues
|
||||
[checkers]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic-checkers.txt
|
||||
[crystal]: https://github.com/rhysd/vim-crystal
|
||||
[eastwood]: https://github.com/venantius/vim-eastwood
|
||||
[ghcmod]: https://github.com/eagletmt/ghcmod-vim
|
||||
[google_group]: https://groups.google.com/group/vim-syntastic
|
||||
[guide]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
|
||||
[jedi]: https://github.com/davidhalter/jedi-vim
|
||||
[merlin]: https://github.com/the-lambda-church/merlin
|
||||
[myint]: https://github.com/myint/syntastic-extras
|
||||
[neobundle]: https://github.com/Shougo/neobundle.vim
|
||||
[omnisharp]: https://github.com/OmniSharp/omnisharp-vim
|
||||
[pathogen]: https://github.com/tpope/vim-pathogen
|
||||
[perlrun]: http://perldoc.perl.org/perlrun.html#*-c*
|
||||
[plug]: https://github.com/junegunn/vim-plug/
|
||||
[pyenv]: https://github.com/yyuu/pyenv
|
||||
[python_mode]: https://github.com/klen/python-mode
|
||||
[rbenv]: https://github.com/rbenv/rbenv
|
||||
[roktas]: https://github.com/roktas/syntastic-more
|
||||
[rust]: https://github.com/rust-lang/rust.vim
|
||||
[rvm]: https://rvm.io/
|
||||
[stack_overflow]: http://stackoverflow.com/questions/tagged/syntastic
|
||||
[swift]: https://github.com/kballard/vim-swift
|
||||
[tidy]: http://www.htacg.org/tidy-html5/
|
||||
[tidy_old]: http://tidy.sourceforge.net/
|
||||
[tsuquyomi]: https://github.com/Quramy/tsuquyomi/
|
||||
[unimpaired]: https://github.com/tpope/vim-unimpaired
|
||||
[vam]: https://github.com/MarcWeber/vim-addon-manager
|
||||
[vim]: http://www.vim.org/
|
||||
[vimgo]: https://github.com/fatih/vim-go
|
||||
[virtualenv]: https://virtualenv.pypa.io/en/stable/
|
||||
[vnu]: http://about.validator.nu/
|
||||
[vnu_jar]: https://github.com/validator/validator/releases/latest
|
||||
[vnu_server]: http://validator.github.io/validator/#standalone
|
||||
[vundle]: https://github.com/gmarik/Vundle.vim
|
||||
[ycm]: http://valloric.github.io/YouCompleteMe/
|
||||
|
||||
<!--
|
||||
vim:tw=79:sw=4:
|
||||
|
|
|
@ -89,8 +89,12 @@ function! syntastic#log#debugShowOptions(level, names) abort " {{{2
|
|||
call s:_logRedirect(1)
|
||||
|
||||
let vlist = copy(type(a:names) == type('') ? [a:names] : a:names)
|
||||
let add_shell = index(vlist, 'shell') >= 0 && &shell !=# syntastic#util#var('shell')
|
||||
if !empty(vlist)
|
||||
call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val))) . (s:_is_modified(v:val) ? ' (!)' : '')")
|
||||
if add_shell
|
||||
call add(vlist, 'u:shell = ' . strtrans(string(syntastic#util#var('shell'))) . ' (!)')
|
||||
endif
|
||||
echomsg leader . join(vlist, ', ')
|
||||
endif
|
||||
call s:_logRedirect(0)
|
||||
|
|
|
@ -89,11 +89,11 @@ function! syntastic#preprocess#dockerfile_lint(errors) abort " {{{2
|
|||
call add(out, msg)
|
||||
endfor
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format')
|
||||
call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format (crashed checker?)')
|
||||
let out = []
|
||||
endtry
|
||||
else
|
||||
call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format')
|
||||
call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
@ -132,18 +132,18 @@ function! syntastic#preprocess#flow(errors) abort " {{{2
|
|||
|
||||
call add(out, msg)
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker javascript/flow: unrecognized error format')
|
||||
call syntastic#log#warn('checker javascript/flow: unrecognized error format (crashed checker?)')
|
||||
let out = []
|
||||
break
|
||||
endtry
|
||||
else
|
||||
call syntastic#log#warn('checker javascript/flow: unrecognized error format')
|
||||
call syntastic#log#warn('checker javascript/flow: unrecognized error format (crashed checker?)')
|
||||
let out = []
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker javascript/flow: unrecognized error format')
|
||||
call syntastic#log#warn('checker javascript/flow: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
|
||||
return out
|
||||
|
@ -178,11 +178,11 @@ function! syntastic#preprocess#jscs(errors) abort " {{{2
|
|||
endtry
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker javascript/jscs: unrecognized error format')
|
||||
call syntastic#log#warn('checker javascript/jscs: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker javascript/jscs: unrecognized error format')
|
||||
call syntastic#log#warn('checker javascript/jscs: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
@ -238,7 +238,7 @@ function! syntastic#preprocess#prospector(errors) abort " {{{2
|
|||
endif
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker python/prospector: unrecognized error format')
|
||||
call syntastic#log#warn('checker python/prospector: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -311,11 +311,11 @@ function! syntastic#preprocess#scss_lint(errors) abort " {{{2
|
|||
endtry
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker scss/scss_lint: unrecognized error format')
|
||||
call syntastic#log#warn('checker scss/scss_lint: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker scss/scss_lint: unrecognized error format')
|
||||
call syntastic#log#warn('checker scss/scss_lint: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
@ -351,12 +351,60 @@ function! syntastic#preprocess#stylelint(errors) abort " {{{2
|
|||
endtry
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker css/stylelint: unrecognized error format')
|
||||
call syntastic#log#warn('checker css/stylelint: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
endif
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#tern_lint(errors) abort " {{{2
|
||||
let errs = join(a:errors, '')
|
||||
let json = s:_decode_JSON(errs)
|
||||
|
||||
echomsg string(json)
|
||||
let out = []
|
||||
if type(json) == type({}) && has_key(json, 'messages') && type(json['messages']) == type([])
|
||||
for e in json['messages']
|
||||
try
|
||||
let line_from = byte2line(e['from'] + 1)
|
||||
if line_from > 0
|
||||
let line = line_from
|
||||
let column = e['from'] - line2byte(line_from) + 2
|
||||
let line_to = byte2line(e['from'] + 1)
|
||||
let hl = line_to == line ? e['to'] - line2byte(line_to) + 1 : 0
|
||||
else
|
||||
let line = 0
|
||||
let column = 0
|
||||
let hl = 0
|
||||
endif
|
||||
|
||||
if column < 0
|
||||
let column = 0
|
||||
endif
|
||||
if hl < 0
|
||||
let hl = 0
|
||||
endif
|
||||
|
||||
call add(out,
|
||||
\ e['file'] . ':' .
|
||||
\ e['severity'][0] . ':' .
|
||||
\ line . ':' .
|
||||
\ column . ':' .
|
||||
\ hl . ':' .
|
||||
\ e['message'])
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker javascript/tern_lint: unrecognized error item ' . string(e))
|
||||
let out = []
|
||||
endtry
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker javascript/tern_lint: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
|
||||
echomsg string(out)
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#tslint(errors) abort " {{{2
|
||||
return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")')
|
||||
endfunction " }}}2
|
||||
|
@ -405,7 +453,7 @@ function! syntastic#preprocess#vint(errors) abort " {{{2
|
|||
endif
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker vim/vint: unrecognized error format')
|
||||
call syntastic#log#warn('checker vim/vint: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
|
||||
return out
|
||||
|
|
|
@ -37,13 +37,19 @@ function! syntastic#util#system(command) abort " {{{2
|
|||
let $LC_MESSAGES = 'C'
|
||||
let $LC_ALL = ''
|
||||
|
||||
let cmd_start = reltime()
|
||||
let out = system(a:command)
|
||||
let cmd_time = split(reltimestr(reltime(cmd_start)))[0]
|
||||
|
||||
let $LC_ALL = old_lc_all
|
||||
let $LC_MESSAGES = old_lc_messages
|
||||
|
||||
let &shell = old_shell
|
||||
|
||||
if exists('g:_SYNTASTIC_DEBUG_TRACE')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'system: command run in ' . cmd_time . 's')
|
||||
endif
|
||||
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
|
@ -120,12 +126,14 @@ function! syntastic#util#parseShebang() abort " {{{2
|
|||
return { 'exe': '', 'args': [] }
|
||||
endfunction " }}}2
|
||||
|
||||
" Get the value of a variable. Allow local variables to override global ones.
|
||||
" Get the value of a Vim variable. Allow local variables to override global ones.
|
||||
function! syntastic#util#rawVar(name, ...) abort " {{{2
|
||||
return get(b:, a:name, get(g:, a:name, a:0 > 0 ? a:1 : ''))
|
||||
endfunction " }}}2
|
||||
|
||||
" Get the value of a syntastic variable. Allow local variables to override global ones.
|
||||
function! syntastic#util#var(name, ...) abort " {{{2
|
||||
return
|
||||
\ exists('b:syntastic_' . a:name) ? b:syntastic_{a:name} :
|
||||
\ exists('g:syntastic_' . a:name) ? g:syntastic_{a:name} :
|
||||
\ a:0 > 0 ? a:1 : ''
|
||||
return call('syntastic#util#rawVar', ['syntastic_' . a:name] + a:000)
|
||||
endfunction " }}}2
|
||||
|
||||
" Parse a version string. Return an array of version components.
|
||||
|
|
6995
sources_non_forked/syntastic/doc/syntastic-checkers.txt
Normal file
6995
sources_non_forked/syntastic/doc/syntastic-checkers.txt
Normal file
File diff suppressed because it is too large
Load diff
|
@ -44,6 +44,7 @@ CONTENTS *syntastic-contents*
|
|||
6.2.Editing files over network.............|syntastic-netrw|
|
||||
6.3.The 'shellslash' option................|syntastic-shellslash|
|
||||
6.4.Saving Vim sessions....................|syntastic-sessions|
|
||||
6.5.The location list callback.............|syntastic-loclist-callback|
|
||||
7.Compatibility with other software............|syntastic-compatibility|
|
||||
7.1.The csh and tcsh shells................|syntastic-csh|
|
||||
7.2.Eclim..................................|syntastic-eclim|
|
||||
|
@ -76,9 +77,7 @@ syntax checker plugins are defined on a per-filetype basis where each one wraps
|
|||
up an external syntax checking program. The core script delegates off to these
|
||||
plugins and uses their output to provide the syntastic functionality.
|
||||
|
||||
Take a look at the wiki for a list of supported filetypes and checkers:
|
||||
|
||||
https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
|
||||
Take a look at the list of supported filetypes and checkers: |syntastic-checkers|.
|
||||
|
||||
Note: This doc only deals with using syntastic. To learn how to write syntax
|
||||
checker integrations, see the guide on the GitHub wiki:
|
||||
|
@ -563,7 +562,7 @@ option should be set to something like: >
|
|||
\ "file:p": ['\m^/usr/include/', '\m\c\.h$'] }
|
||||
<
|
||||
Each element turns off messages matching the patterns specified by the
|
||||
corresponding value. Values are lists, but if a list consist of a single
|
||||
corresponding value. Values are lists, but if a list consists of a single
|
||||
element you may omit the brackets (e.g. you may write "style" instead of
|
||||
["style"]). Elements with values [] or "" are ignored (this is useful for
|
||||
overriding filters, cf. |filter-overrides|).
|
||||
|
@ -751,10 +750,8 @@ If neither |'g:syntastic_<filetype>_checkers'| nor |'b:syntastic_checkers'|
|
|||
is set, a default list of checker is used. Beware however that this list
|
||||
deliberately kept minimal, for performance reasons.
|
||||
|
||||
Take a look at the wiki to find out what checkers and filetypes are supported
|
||||
by syntastic:
|
||||
|
||||
https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
|
||||
Take a look elsewhere in this manual to find out what checkers and filetypes
|
||||
are supported by syntastic: |syntastic-checkers|.
|
||||
|
||||
Use `:SyntasticInfo` to see which checkers are available for a given filetype.
|
||||
|
||||
|
@ -848,9 +845,8 @@ omitting the filename from the command line: >
|
|||
*syntastic-config-no-makeprgbuild*
|
||||
For checkers that do not use the "makeprgBuild()" function you will have to
|
||||
look at the source code of the checker in question. If there are specific
|
||||
options that can be set, they are normally documented in the wiki:
|
||||
|
||||
https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
|
||||
options that can be set they are normally documented in this manual (see
|
||||
|syntastic-checkers|).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5.4 Sorting errors *syntastic-config-sort*
|
||||
|
@ -887,6 +883,7 @@ The syntax is of course identical to that of |syntastic_quiet_messages|.
|
|||
|
||||
------------------------------------------------------------------------------
|
||||
5.6 Debugging *syntastic-config-debug*
|
||||
*syntastic-debug*
|
||||
|
||||
Syntastic can log a trace of its working to Vim's |message-history|. To verify
|
||||
the command line constructed by syntastic to run a checker, set the variable
|
||||
|
@ -963,6 +960,29 @@ remove option "blank" from 'sessionoptions': >
|
|||
This will prevent `:mksession` from saving |syntastic-error-window| as empty
|
||||
quickfix windows.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6.5 The location list callback *syntastic-loclist-callback*
|
||||
|
||||
*SyntasticCheckHook()*
|
||||
Syntastic also gives you direct access to the list of errors. A function
|
||||
named |SyntasticCheckHook()| is called by syntastic (if it exists) right
|
||||
before populating the |location-list| and enabling the notifiers. The function
|
||||
takes exactly one argument, the list of errors in |location-list| format (see
|
||||
|getqflist()| for details). format. You can do essentially anything with this
|
||||
list, as long as you don't change its format, and you don't add or remove
|
||||
elements.
|
||||
|
||||
For example the following function will make the error window smaller if fewer
|
||||
than 10 errors are found: >
|
||||
function! SyntasticCheckHook(errors)
|
||||
if !empty(a:errors)
|
||||
let g:syntastic_loc_list_height = min([len(a:errors), 10])
|
||||
endif
|
||||
endfunction
|
||||
<
|
||||
(Please keep in mind however that Vim options |winheight| and |winminheight|
|
||||
also affect window sizes.)
|
||||
|
||||
==============================================================================
|
||||
7. Compatibility with other software *syntastic-compatibility*
|
||||
|
||||
|
@ -1071,11 +1091,17 @@ mode only work with "vim-auto-save" version 0.1.7 or later.
|
|||
Syntastic can be used along with the "vim-go" Vim plugin (see
|
||||
https://github.com/fatih/vim-go). However, both "vim-go" and syntastic run
|
||||
syntax checks by default when you save buffers to disk. To avoid conflicts,
|
||||
you have to either set passive mode in syntastic for the go filetype (see
|
||||
you have to either set passive mode in syntastic for the "go" filetype (see
|
||||
|syntastic_mode_map|), or prevent "vim-go" from showing a quickfix window when
|
||||
|g:go_fmt_command| fails, by setting |g:go_fmt_fail_silently| to 1. E.g.: >
|
||||
let g:go_fmt_fail_silently = 1
|
||||
<
|
||||
"vim-go" version 1.4 and earlier always uses |quickfix| lists. Starting with
|
||||
version 1.5, "vim-go" can also use location lists (see |location-list|). To
|
||||
avoid conflicts with syntastic, you probably want to configure "vim-go" to
|
||||
stick with |quickfix| lists: >
|
||||
let g:go_list_type = "quickfix"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
7.11. vim-virtualenv *syntastic-vim-virtualenv*
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ if has('reltime')
|
|||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.7.0-112'
|
||||
let g:_SYNTASTIC_VERSION = '3.7.0-193'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
@ -522,7 +522,7 @@ function! SyntasticMake(options) abort " {{{2
|
|||
let env_save = {}
|
||||
if has_key(a:options, 'env') && len(a:options['env'])
|
||||
for key in keys(a:options['env'])
|
||||
if key =~? '\m^[a-z_]\+$'
|
||||
if key =~? '\m^[a-z_][a-z0-9_]*$'
|
||||
execute 'let env_save[' . string(key) . '] = $' . key
|
||||
execute 'let $' . key . ' = ' . string(a:options['env'][key])
|
||||
endif
|
||||
|
|
|
@ -91,6 +91,7 @@ function! g:SyntasticChecker.getExecEscaped() abort " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getLocListRaw() abort " {{{2
|
||||
let checker_start = reltime()
|
||||
let name = self._filetype . '/' . self._name
|
||||
|
||||
if has_key(self, '_enable')
|
||||
|
@ -128,6 +129,8 @@ function! g:SyntasticChecker.getLocListRaw() abort " {{{2
|
|||
call self._populateHighlightRegexes(list)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, name . ' raw:', list)
|
||||
call self._quietMessages(list)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE,
|
||||
\ 'getLocList: checker ' . name . ' run in ' . split(reltimestr(reltime(checker_start)))[0] . 's')
|
||||
return list
|
||||
endfunction " }}}2
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ let s:_DEFAULT_CHECKERS = {
|
|||
\ 'apiblueprint': ['drafter'],
|
||||
\ 'applescript': ['osacompile'],
|
||||
\ 'asciidoc': ['asciidoc'],
|
||||
\ 'asl': ['iasl'],
|
||||
\ 'asm': ['gcc'],
|
||||
\ 'bro': ['bro'],
|
||||
\ 'bemhtml': ['bemhtmllint'],
|
||||
|
@ -37,7 +38,7 @@ let s:_DEFAULT_CHECKERS = {
|
|||
\ 'eruby': ['ruby'],
|
||||
\ 'fortran': ['gfortran'],
|
||||
\ 'glsl': ['cgc'],
|
||||
\ 'go': ['go'],
|
||||
\ 'go': [],
|
||||
\ 'haml': ['haml'],
|
||||
\ 'handlebars': ['handlebars'],
|
||||
\ 'haskell': ['hdevtools', 'hlint'],
|
||||
|
@ -84,14 +85,17 @@ let s:_DEFAULT_CHECKERS = {
|
|||
\ 'slim': ['slimrb'],
|
||||
\ 'sml': ['smlnj'],
|
||||
\ 'spec': ['rpmlint'],
|
||||
\ 'solidity': ['solc'],
|
||||
\ 'sql': ['sqlint'],
|
||||
\ 'stylus': ['stylint'],
|
||||
\ 'tcl': ['nagelfar'],
|
||||
\ 'tex': ['lacheck', 'chktex'],
|
||||
\ 'texinfo': ['makeinfo'],
|
||||
\ 'text': [],
|
||||
\ 'trig': ['rapper'],
|
||||
\ 'turtle': ['rapper'],
|
||||
\ 'twig': ['twiglint'],
|
||||
\ 'typescript': ['tsc'],
|
||||
\ 'typescript': [],
|
||||
\ 'vala': ['valac'],
|
||||
\ 'verilog': ['verilator'],
|
||||
\ 'vhdl': ['ghdl'],
|
||||
|
@ -102,6 +106,7 @@ let s:_DEFAULT_CHECKERS = {
|
|||
\ 'xquery': ['basex'],
|
||||
\ 'yacc': ['bison'],
|
||||
\ 'yaml': ['jsyaml'],
|
||||
\ 'yang': ['pyang'],
|
||||
\ 'z80': ['z80syntaxchecker'],
|
||||
\ 'zpt': ['zptlint'],
|
||||
\ 'zsh': ['zsh'],
|
||||
|
|
|
@ -32,8 +32,8 @@ function! SyntaxCheckers_ada_gcc_GetLocList() dict
|
|||
\ '%-G%f:%s:,' .
|
||||
\ '%f:%l:%c: %m,' .
|
||||
\ '%f:%l: %m',
|
||||
\ 'main_flags': '-c -x ada -gnats',
|
||||
\ 'header_flags': '-x ada -gnats',
|
||||
\ 'main_flags': '-c -x ada -gnats -gnatef',
|
||||
\ 'header_flags': '-x ada -gnats -gnatef',
|
||||
\ 'header_names': '\.ads$' })
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -28,7 +28,9 @@ endfunction
|
|||
function! SyntaxCheckers_ansible_ansible_lint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '-p' })
|
||||
|
||||
let errorformat = '%f:%l: [ANSIBLE%n] %m'
|
||||
let errorformat =
|
||||
\ '%f:%l: [EANSIBLE%n] %m,' .
|
||||
\ '%f:%l: [ANSIBLE%n] %m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
|
|
59
sources_non_forked/syntastic/syntax_checkers/asl/iasl.vim
Normal file
59
sources_non_forked/syntastic/syntax_checkers/asl/iasl.vim
Normal file
|
@ -0,0 +1,59 @@
|
|||
"============================================================================
|
||||
"File: iasl.vim
|
||||
"Description: Syntax checking plugin for syntastic using iasl
|
||||
"Maintainer: Peter Wu <peter@lekensteyn.nl>
|
||||
"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_syntastic_asl_iasl_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_asl_iasl_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_asl_iasl_GetLocList() dict
|
||||
let tmpdir = syntastic#util#tmpdir() . syntastic#util#Slash()
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': '-vi',
|
||||
\ 'args_after': ['-p', tmpdir] })
|
||||
|
||||
let errorformat =
|
||||
\ '%f(%l) : %trror %n - %m,' .
|
||||
\ '%f(%l) : %tarning %n - %m,' .
|
||||
\ '%f(%l) : %temark %n - %m,' .
|
||||
\ '%f(%l) : %tptimize %n - %m,' .
|
||||
\ '%f(%l) : %m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'returns': [0, 255] })
|
||||
|
||||
for e in loclist
|
||||
if e['type'] =~? 'r'
|
||||
let e['type'] = 'W'
|
||||
elseif e['type'] =~? 'o'
|
||||
let e['type'] = 'W'
|
||||
let e['subtype'] = 'Style'
|
||||
endif
|
||||
endfor
|
||||
|
||||
call syntastic#util#rmrf(tmpdir)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'asl',
|
||||
\ 'name': 'iasl'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -1,6 +1,6 @@
|
|||
"============================================================================
|
||||
"File: avrgcc.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: Karel <karelishere at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
|
@ -22,10 +22,12 @@ endif
|
|||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:opt_x = { 'c': 'c', 'cpp': 'c++' }
|
||||
|
||||
function! SyntaxCheckers_c_avrgcc_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_before': syntastic#c#ReadConfig(g:syntastic_avrgcc_config_file),
|
||||
\ 'args_after': '-x c -fsyntax-only' })
|
||||
\ 'args_after': '-x ' . get(s:opt_x, self.getFiletype(), '') . ' -fsyntax-only' })
|
||||
|
||||
let errorformat =
|
||||
\ '%-G%f:%s:,' .
|
||||
|
|
24
sources_non_forked/syntastic/syntax_checkers/cpp/avrgcc.vim
Normal file
24
sources_non_forked/syntastic/syntax_checkers/cpp/avrgcc.vim
Normal file
|
@ -0,0 +1,24 @@
|
|||
"============================================================================
|
||||
"File: avrgcc.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: Sławek Piotrowski <sentinel at atteo dot com>
|
||||
"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_syntastic_cpp_avrgcc_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_cpp_avrgcc_checker = 1
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'cpp',
|
||||
\ 'name': 'avrgcc',
|
||||
\ 'exec': 'avr-g++',
|
||||
\ 'redirect': 'c/avrgcc'})
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -17,7 +17,6 @@ let g:loaded_syntastic_cpp_clang_check_checker = 1
|
|||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'cpp',
|
||||
\ 'name': 'clang_check',
|
||||
\ 'exec': 'clang-check',
|
||||
\ 'redirect': 'c/clang_check'})
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
|
|
@ -17,7 +17,6 @@ let g:loaded_syntastic_cpp_clang_tidy_checker = 1
|
|||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'cpp',
|
||||
\ 'name': 'clang_tidy',
|
||||
\ 'exec': 'clang-tidy',
|
||||
\ 'redirect': 'c/clang_tidy'})
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
|
|
@ -18,7 +18,6 @@ let g:loaded_syntastic_cpp_pc_lint_checker = 1
|
|||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'cpp',
|
||||
\ 'name': 'pc_lint',
|
||||
\ 'exec': 'lint-nt',
|
||||
\ 'redirect': 'c/pc_lint'})
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"============================================================================
|
||||
"File: cuda.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Author: Hannes Schulz <schulz at ais dot uni-bonn dot de>
|
||||
"
|
||||
"============================================================================
|
||||
|
@ -11,19 +10,41 @@ if exists('g:loaded_syntastic_cuda_nvcc_checker')
|
|||
endif
|
||||
let g:loaded_syntastic_cuda_nvcc_checker = 1
|
||||
|
||||
if !exists('g:syntastic_cuda_config_file')
|
||||
let g:syntastic_cuda_config_file = '.syntastic_cuda_config'
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
|
||||
if exists('g:syntastic_cuda_arch')
|
||||
let arch_flag = '-arch=' . g:syntastic_cuda_arch
|
||||
else
|
||||
let arch_flag = ''
|
||||
let arch_flag = syntastic#util#var('cuda_arch')
|
||||
if arch_flag !=# ''
|
||||
let arch_flag = '-arch=' . arch_flag
|
||||
call syntastic#log#oneTimeWarn('variable g:syntastic_cuda_arch is deprecated, ' .
|
||||
\ 'please add ' . string(arch_flag) . ' to g:syntastic_cuda_nvcc_args instead')
|
||||
endif
|
||||
let makeprg =
|
||||
\ self.getExecEscaped() . ' ' . arch_flag .
|
||||
\ ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' .
|
||||
\ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput()
|
||||
|
||||
let build_opts = {}
|
||||
let dummy = ''
|
||||
if index(['h', 'hpp', 'cuh'], expand('%:e', 1), 0, 1) >= 0
|
||||
if syntastic#util#var('cuda_check_header', 0)
|
||||
let dummy = expand('%:p:h', 1) . syntastic#util#Slash() . '.syntastic_dummy.cu'
|
||||
let build_opts = {
|
||||
\ 'exe_before': 'echo > ' . syntastic#util#shescape(dummy) . ' ;',
|
||||
\ 'fname_before': '.syntastic_dummy.cu -include' }
|
||||
else
|
||||
return []
|
||||
endif
|
||||
endif
|
||||
|
||||
call extend(build_opts, {
|
||||
\ 'args_before': arch_flag . ' --cuda -O0 -I .',
|
||||
\ 'args': syntastic#c#ReadConfig(g:syntastic_cuda_config_file),
|
||||
\ 'args_after': '-Xcompiler -fsyntax-only',
|
||||
\ 'tail_after': syntastic#c#NullOutput() })
|
||||
|
||||
let makeprg = self.makeprgBuild(build_opts)
|
||||
|
||||
let errorformat =
|
||||
\ '%*[^"]"%f"%*\D%l: %m,'.
|
||||
|
@ -41,19 +62,13 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
|
|||
\ '%DMaking %*\a in %f,'.
|
||||
\ '%f|%l| %m'
|
||||
|
||||
if expand('%', 1) =~? '\m\%(.h\|.hpp\|.cuh\)$'
|
||||
if exists('g:syntastic_cuda_check_header')
|
||||
let makeprg =
|
||||
\ 'echo > .syntastic_dummy.cu ; ' .
|
||||
\ self.getExecEscaped() . ' ' . arch_flag .
|
||||
\ ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' .
|
||||
\ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput()
|
||||
else
|
||||
return []
|
||||
endif
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
if dummy !=# ''
|
||||
call delete(dummy)
|
||||
endif
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"============================================================================
|
||||
"File: dockerfile_lint.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim using dockerfile-lint
|
||||
" (https://github.com/projectatomic/dockerfile-lint).
|
||||
" (https://github.com/projectatomic/dockerfile_lint).
|
||||
"Maintainer: Tim Carry <tim at pixelastic dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
|
|
|
@ -18,10 +18,6 @@ let g:loaded_syntastic_go_govet_checker = 1
|
|||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_go_govet_IsAvailable() dict
|
||||
return executable(self.getExec())
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_go_govet_GetLocList() dict
|
||||
let makeprg = self.getExecEscaped() . ' vet'
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ let s:ghc_mod_new = -1
|
|||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict
|
||||
function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict " {{{1
|
||||
if !executable(self.getExec())
|
||||
return 0
|
||||
endif
|
||||
|
@ -59,9 +59,9 @@ function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict
|
|||
let s:ghc_mod_bailout = syntastic#util#versionIsAtLeast(parsed_ver, [5, 4])
|
||||
|
||||
return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new) && !s:ghc_mod_bailout
|
||||
endfunction
|
||||
endfunction " }}}1
|
||||
|
||||
function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict
|
||||
function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict " {{{1
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe': self.getExecEscaped() . ' check' . (s:ghc_mod_new ? ' --boundary=""' : '') })
|
||||
|
||||
|
@ -81,7 +81,7 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict
|
|||
\ 'preprocess': 'iconv',
|
||||
\ 'postprocess': ['compressWhitespace'],
|
||||
\ 'returns': [0] })
|
||||
endfunction
|
||||
endfunction " }}}1
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'haskell',
|
||||
|
|
23
sources_non_forked/syntastic/syntax_checkers/html/eslint.vim
Normal file
23
sources_non_forked/syntastic/syntax_checkers/html/eslint.vim
Normal file
|
@ -0,0 +1,23 @@
|
|||
"============================================================================
|
||||
"File: eslint.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: LCD 47 <lcd047 at gmail dot com>
|
||||
"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_syntastic_html_eslint_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_html_eslint_checker = 1
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'html',
|
||||
\ 'name': 'eslint',
|
||||
\ 'redirect': 'javascript/eslint'})
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -0,0 +1,23 @@
|
|||
"============================================================================
|
||||
"File: gjslint.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: LCD 47 <lcd047 at gmail dot com>
|
||||
"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_syntastic_html_gjslint_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_html_gjslint_checker = 1
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'html',
|
||||
\ 'name': 'gjslint',
|
||||
\ 'redirect': 'javascript/gjslint'})
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -21,7 +21,8 @@ function! SyntaxCheckers_javascript_gjslint_GetLocList() dict
|
|||
call syntastic#log#deprecationWarn('javascript_gjslint_conf', 'javascript_gjslint_args')
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': '--nosummary --unix_mode --nodebug_indentation --nobeep' })
|
||||
\ 'args': '--nodebug_indentation',
|
||||
\ 'args_after': '--check_html --nosummary --unix_mode --nobeep' })
|
||||
|
||||
let errorformat =
|
||||
\ "%f:%l:(New Error -%\\?\%n) %m," .
|
||||
|
|
|
@ -17,7 +17,7 @@ let g:loaded_syntastic_javascript_jsxhint_checker = 1
|
|||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
|
||||
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict " {{{1
|
||||
if !executable(self.getExec())
|
||||
return 0
|
||||
endif
|
||||
|
@ -32,9 +32,9 @@ function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
|
|||
endif
|
||||
|
||||
return syntastic#util#versionIsAtLeast(parsed_ver, [0, 4, 1])
|
||||
endfunction
|
||||
endfunction " }}}1
|
||||
|
||||
function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict
|
||||
function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict " {{{1
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': '--verbose' })
|
||||
|
||||
|
@ -44,7 +44,7 @@ function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict
|
|||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'bufnr': bufnr('')} })
|
||||
endfunction
|
||||
endfunction " }}}1
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'javascript',
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
"============================================================================
|
||||
"File: tern_lint.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
"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_syntastic_javascript_tern_lint_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_javascript_tern_lint_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_javascript_tern_lint_IsAvailable() dict
|
||||
return has('byte_offset') && executable(self.getExec())
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_javascript_tern_lint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat = '%f:%t:%l:%c:%n:%m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'preprocess': 'tern_lint',
|
||||
\ 'returns': [0] })
|
||||
|
||||
for e in loclist
|
||||
if get(e, 'col', 0) && get(e, 'nr', 0)
|
||||
let e['hl'] = '\%>' . (e['col'] - 1) . 'c\%<' . (e['nr'] + 1) . 'c'
|
||||
endif
|
||||
let e['nr'] = 0
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'name': 'tern_lint',
|
||||
\ 'exec': 'tern-lint' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -15,10 +15,6 @@ if exists('g:loaded_syntastic_less_lessc_checker')
|
|||
endif
|
||||
let g:loaded_syntastic_less_lessc_checker = 1
|
||||
|
||||
if !exists('g:syntastic_less_options')
|
||||
let g:syntastic_less_options = ''
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_less_use_less_lint')
|
||||
let g:syntastic_less_use_less_lint = 0
|
||||
endif
|
||||
|
@ -34,13 +30,10 @@ function! SyntaxCheckers_less_lessc_IsAvailable() dict
|
|||
endfunction
|
||||
|
||||
function! SyntaxCheckers_less_lessc_GetLocList() dict
|
||||
if !exists('s:check_file')
|
||||
let s:check_file = g:syntastic_less_use_less_lint ? s:node_file : self.getExecEscaped()
|
||||
endif
|
||||
call syntastic#log#deprecationWarn('less_options', 'less_lessc_args')
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe': s:check_file,
|
||||
\ 'args': g:syntastic_less_options,
|
||||
\ 'exe': (g:syntastic_less_use_less_lint ? s:node_file : self.getExecEscaped()),
|
||||
\ 'args_after': '--no-color',
|
||||
\ 'tail': '> ' . syntastic#util#DevNull() })
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_matlab_mlint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '-id $*' })
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '-id' })
|
||||
|
||||
let errorformat =
|
||||
\ 'L %l (C %c): %*[a-zA-Z0-9]: %m,'.
|
||||
|
|
|
@ -15,12 +15,6 @@ if exists('g:loaded_syntastic_ocaml_camlp4o_checker')
|
|||
endif
|
||||
let g:loaded_syntastic_ocaml_camlp4o_checker = 1
|
||||
|
||||
if exists('g:syntastic_ocaml_camlp4r') && g:syntastic_ocaml_camlp4r != 0
|
||||
let s:ocamlpp='camlp4r'
|
||||
else
|
||||
let s:ocamlpp='camlp4o'
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
@ -34,6 +28,10 @@ if !exists('g:syntastic_ocaml_use_janestreet_core')
|
|||
let g:syntastic_ocaml_use_janestreet_core = 0
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_ocaml_janestreet_core_dir')
|
||||
let g:syntastic_ocaml_janestreet_core_dir = '.'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_ocaml_use_ocamlbuild') || !executable('ocamlbuild')
|
||||
let g:syntastic_ocaml_use_ocamlbuild = 0
|
||||
endif
|
||||
|
@ -41,6 +39,7 @@ endif
|
|||
" }}}1
|
||||
|
||||
function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() dict " {{{1
|
||||
let s:ocamlpp = get(g:, 'syntastic_ocaml_camlp4r', 0) ? 'camlp4r' : 'camlp4o'
|
||||
return executable(s:ocamlpp)
|
||||
endfunction " }}}1
|
||||
|
||||
|
@ -81,31 +80,22 @@ endfunction " }}}1
|
|||
" Utilities {{{1
|
||||
|
||||
function! s:GetMakeprg() " {{{2
|
||||
if g:syntastic_ocaml_use_ocamlc
|
||||
return s:GetOcamlcMakeprg()
|
||||
endif
|
||||
|
||||
if g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')
|
||||
return s:GetOcamlBuildMakeprg()
|
||||
endif
|
||||
|
||||
return s:GetOtherMakeprg()
|
||||
return
|
||||
\ g:syntastic_ocaml_use_ocamlc ? g:syntastic_ocaml_use_ocamlc :
|
||||
\ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg() :
|
||||
\ s:GetOtherMakeprg()
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:GetOcamlcMakeprg() " {{{2
|
||||
if g:syntastic_ocaml_use_janestreet_core
|
||||
let build_cmd = 'ocamlc -I '
|
||||
let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir, 1)
|
||||
let build_cmd .= ' -c ' . syntastic#util#shexpand('%')
|
||||
return build_cmd
|
||||
else
|
||||
return 'ocamlc -c ' . syntastic#util#shexpand('%')
|
||||
endif
|
||||
let build_cmd = g:syntastic_ocaml_use_janestreet_core ?
|
||||
\ 'ocamlc -I ' . syntastic#util#shexpand(g:syntastic_ocaml_janestreet_core_dir) : 'ocamlc'
|
||||
let build_cmd .= ' -c ' . syntastic#util#shexpand('%')
|
||||
return build_cmd
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:GetOcamlBuildMakeprg() " {{{2
|
||||
return 'ocamlbuild -quiet -no-log -tag annot,' . s:ocamlpp . ' -no-links -no-hygiene -no-sanitize ' .
|
||||
\ syntastic#util#shexpand('%:r') . '.cmi'
|
||||
\ syntastic#util#shexpand('%:r') . '.cmi'
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:GetOtherMakeprg() " {{{2
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"============================================================================
|
||||
"File: perl.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: Anthony Carapetis <anthony.carapetis at gmail dot com>,
|
||||
" Eric Harmon <http://eharmon.net>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
|
@ -23,7 +23,7 @@
|
|||
"
|
||||
" let g:syntastic_enable_perl_checker = 1
|
||||
"
|
||||
" References:
|
||||
" Reference:
|
||||
"
|
||||
" - http://perldoc.perl.org/perlrun.html#*-c*
|
||||
|
||||
|
@ -39,7 +39,7 @@ endif
|
|||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_perl_perl_IsAvailable() dict
|
||||
function! SyntaxCheckers_perl_perl_IsAvailable() dict " {{{1
|
||||
if !exists('g:syntastic_perl_perl_exec') && exists('g:syntastic_perl_interpreter')
|
||||
let g:syntastic_perl_perl_exec = g:syntastic_perl_interpreter
|
||||
endif
|
||||
|
@ -48,22 +48,22 @@ function! SyntaxCheckers_perl_perl_IsAvailable() dict
|
|||
" let g:syntastic_perl_interpreter='/usr/bin/env perl'
|
||||
silent! call syntastic#util#system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('exit(0)'))
|
||||
return v:shell_error == 0
|
||||
endfunction
|
||||
endfunction " }}}1
|
||||
|
||||
function! SyntaxCheckers_perl_perl_GetLocList() dict
|
||||
function! SyntaxCheckers_perl_perl_GetLocList() dict " {{{1
|
||||
if type(g:syntastic_perl_lib_path) == type('')
|
||||
call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list')
|
||||
let includes = split(g:syntastic_perl_lib_path, ',')
|
||||
else
|
||||
let includes = copy(syntastic#util#var('perl_lib_path'))
|
||||
let includes = copy(syntastic#util#var('perl_lib_path', []))
|
||||
endif
|
||||
let shebang = syntastic#util#parseShebang()
|
||||
let extra = join(map(includes, '"-I" . v:val')) .
|
||||
\ (index(shebang['args'], '-T') >= 0 ? ' -T' : '') .
|
||||
\ (index(shebang['args'], '-t') >= 0 ? ' -t' : '')
|
||||
let extra = map(includes, '"-I" . v:val') +
|
||||
\ (index(shebang['args'], '-T') >= 0 ? ['-T'] : []) +
|
||||
\ (index(shebang['args'], '-t') >= 0 ? ['-t'] : [])
|
||||
let errorformat = '%f:%l:%m'
|
||||
|
||||
let makeprg = self.makeprgBuild({ 'args_before': '-c -X ' . extra })
|
||||
let makeprg = self.makeprgBuild({ 'args_before': ['-c', '-X '] + extra })
|
||||
|
||||
let errors = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
|
@ -74,14 +74,14 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict
|
|||
return errors
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({ 'args_before': '-c -Mwarnings ' . extra })
|
||||
let makeprg = self.makeprgBuild({ 'args_before': ['-c', '-Mwarnings'] + extra })
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'preprocess': 'perl',
|
||||
\ 'defaults': {'type': 'W'} })
|
||||
endfunction
|
||||
endfunction " }}}1
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'perl',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"============================================================================
|
||||
"File: pep8.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: LCD 47 <lcd047 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
|
@ -15,34 +15,9 @@ if exists('g:loaded_syntastic_python_pep8_checker')
|
|||
endif
|
||||
let g:loaded_syntastic_python_pep8_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_python_pep8_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat = '%f:%l:%c: %m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'subtype': 'Style' })
|
||||
|
||||
for e in loclist
|
||||
let e['type'] = e['text'] =~? '^W' ? 'W' : 'E'
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'python',
|
||||
\ 'name': 'pep8'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
\ 'name': 'pep8',
|
||||
\ 'redirect': 'python/pycodestyle'})
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue