commit
d93ef4ac31
|
@ -1,8 +1,10 @@
|
|||
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_plugins/
|
||||
my_configs.vim
|
||||
tags
|
||||
.DS_Store
|
||||
|
|
221
README.md
221
README.md
|
@ -1,28 +1,42 @@
|
|||
![VIM](https://dnp4pehkvoo6n.cloudfront.net/43c5af597bd5c1a64eb1829f011c208f/as/Ultimate%20Vimrc.svg)
|
||||
|
||||
# The Ultimate vimrc
|
||||
|
||||
Over the last 8 years I have used and tweaked Vim. This is my Ultimate vimrc.
|
||||
Over the last 10 years, I have used and tweaked Vim. This configuration is the ultimate vimrc (or at least my version of it).
|
||||
|
||||
There are two versions:
|
||||
|
||||
* **Basic**: If you want something small just copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) into your ~/.vimrc and you will have a great basic setup
|
||||
* **Awesome**: This includes a ton of useful plugins, color schemes and configurations
|
||||
* **The Basic**: If you want something small just copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) into your ~/.vimrc and you will have a good basic setup
|
||||
* **The Awesome**: Includes a ton of useful plugins, color schemes, and configurations
|
||||
|
||||
I would, of course, recommend using the awesome version.
|
||||
|
||||
I would of course recommend using the awesome version.c
|
||||
|
||||
## How to install the Awesome version?
|
||||
The awesome version includes a lot of great plugins, configurations and color schemes that make Vim a lot better. To install it simply do following:
|
||||
|
||||
git clone https://github.com/amix/vimrc.git ~/.vim_runtime
|
||||
sh ~/.vim_runtime/install_awesome_vimrc.sh
|
||||
The awesome version includes a lot of great plugins, configurations and color schemes that make Vim a lot better. To install it simply do following from your terminal:
|
||||
|
||||
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
|
||||
sh ~/.vim_runtime/install_awesome_vimrc.sh
|
||||
|
||||
|
||||
## Fonts
|
||||
|
||||
I recommend using [IBM Plex Mono font](https://ibm.github.io/type/) (it's an open-source and awesome font that can make your code beautiful). The Awesome vimrc is already setup to try to use it.
|
||||
|
||||
Some other fonts that Awesome will try to use:
|
||||
|
||||
* [Hack](http://sourcefoundry.org/hack/)
|
||||
* [Source Code Pro](https://adobe-fonts.github.io/source-code-pro/)
|
||||
|
||||
I also recommend using [Source Code Pro font from Adobe](http://store1.adobe.com/cfusion/store/html/index.cfm?event=displayFontPackage&code=1960) (it's free and awesome font for writing and programming). The Awesome vimrc is already setup to try to use it
|
||||
|
||||
## How to install the Basic version?
|
||||
The basic version is basically just one file and no plugins. You can check out [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim).
|
||||
|
||||
This is useful to install on remote servers where you don't need many plugins and you don't do many edits.
|
||||
The basic version is just one file and no plugins. Just copy [basic.vim](https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim) and paste it into your vimrc.
|
||||
|
||||
git clone git://github.com/amix/vimrc.git ~/.vim_runtime
|
||||
The basic version is useful to install on remote servers where you don't need many plugins, and you don't do many edits.
|
||||
|
||||
git clone --depth=1 git://github.com/amix/vimrc.git ~/.vim_runtime
|
||||
sh ~/.vim_runtime/install_basic_vimrc.sh
|
||||
|
||||
|
||||
|
@ -31,9 +45,14 @@ 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!
|
||||
Just do a git rebase!
|
||||
|
||||
cd ~/.vim_runtime
|
||||
git pull --rebase
|
||||
|
@ -42,49 +61,47 @@ Simply just do a git rebase!
|
|||
## Some screenshots
|
||||
|
||||
Colors when editing a Python file:
|
||||
![Screenshot 1](http://files1.wedoist.com/e952fdb343b1e617b90d256e474d0370/as/screenshot_1.png)
|
||||
|
||||
Opening recently opened files [mru.vim](https://github.com/vim-scripts/mru.vim):
|
||||
![Screenshot 2](http://files1.wedoist.com/1967b0e48af40e513d1a464e08196990/as/screenshot_2.png)
|
||||
![Screenshot 1](https://dnp4pehkvoo6n.cloudfront.net/07583008e4da885801657e8781777844/as/Python%20editing.png)
|
||||
|
||||
Opening recently opened files with the [mru.vim](https://github.com/vim-scripts/mru.vim) plugin:
|
||||
|
||||
![Screenshot 2](https://dnp4pehkvoo6n.cloudfront.net/1d49a88f9bd5d013c025bb1e1272a7d8/as/MRU%20plugin.png)
|
||||
|
||||
[NERD Tree](https://github.com/scrooloose/nerdtree) plugin in a terminal window:
|
||||
![Screenshot 3](http://files1.wedoist.com/b1509d7ed9e9f357e8d04797f9fad67b/as/screenshot3.png)
|
||||
|
||||
This vimrc even works on Windows!
|
||||
![Screenshot 4](http://files1.wedoist.com/4e85163d97b81422240c822c82022f2f/as/screenshot_4.png)
|
||||
![Screenshot 3](https://dnp4pehkvoo6n.cloudfront.net/ae719203166585d64728f28398f4b1b7/as/Terminal%20usage.png)
|
||||
|
||||
Distraction free mode using [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2):
|
||||
![Screenshot 5](https://d2dq6e731uoz0t.cloudfront.net/a5182977c3d6c2a6cd3f9e97398ca8ca/as/zen_mode.jpg)
|
||||
![Screenshot 4](https://dnp4pehkvoo6n.cloudfront.net/f0dcc4c9739148c56cbf8285a910ac41/as/Zen%20mode.png)
|
||||
|
||||
|
||||
## Included Plugins
|
||||
|
||||
I recommend reading the docs of these plugins to understand them better. Each of them provide a much better Vim experience!
|
||||
I recommend reading the docs of these plugins to understand them better. Each plugin provides a much better Vim experience!
|
||||
|
||||
* [pathogen.vim](https://github.com/tpope/vim-pathogen): Manages the runtime path of the plugins
|
||||
* [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>`
|
||||
* [ack.vim](https://github.com/mileszs/ack.vim): Vim plugin for `the_silver_searcher` (ag) or ack -- a wicked fast grep
|
||||
* [bufexplorer.zip](https://github.com/vim-scripts/bufexplorer.zip): Quickly and easily switch between buffers. This plugin can be opened with `<leader+o>`
|
||||
* [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. It's mapped to `<Ctrl+F>`
|
||||
* [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2):
|
||||
* [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim
|
||||
* [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/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>`
|
||||
* [mru.vim](https://github.com/vim-scripts/mru.vim): Plugin to manage Most Recently Used (MRU) files. 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`
|
||||
* [pathogen.vim](https://github.com/tpope/vim-pathogen): Manage your vim runtimepath
|
||||
* [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
|
||||
* [syntastic](https://github.com/scrooloose/syntastic): Syntax checking hacks for vim
|
||||
* [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.
|
||||
* [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-fugitive](https://github.com/tpope/vim-fugitive): A Git wrapper so awesome, it should be illegal
|
||||
* [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-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
|
||||
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)
|
||||
|
||||
|
||||
## Included color schemes
|
||||
|
||||
* [peaksea](https://github.com/vim-scripts/peaksea): My favorite!
|
||||
* [peaksea](https://github.com/vim-scripts/peaksea): The default
|
||||
* [vim-colors-solarized](https://github.com/altercation/vim-colors-solarized)
|
||||
* [vim-irblack](https://github.com/wgibbs/vim-irblack)
|
||||
* [mayansmoke](https://github.com/vim-scripts/mayansmoke)
|
||||
|
@ -103,60 +120,53 @@ Remove all clutter and focus only on the essential. Similar to iA Writer or Writ
|
|||
|
||||
## How to include your own stuff?
|
||||
|
||||
After you have installed the setup you can create **~/.vim_runtime/my_configs.vim** to fill in any configurations that are important for you. For instance, my **my_configs.vim** looks like this:
|
||||
After you have installed the setup, you can create **~/.vim_runtime/my_configs.vim** to fill in any configurations that are important for you. For instance, my **my_configs.vim** looks like this:
|
||||
|
||||
~/.vim_runtime (master)> cat my_configs.vim
|
||||
map <leader>ct :cd ~/Desktop/Todoist/todoist<cr>
|
||||
map <leader>cw :cd ~/Desktop/Wedoist/wedoist<cr>
|
||||
|
||||
You can also install your own plugins, for instance, via pathogen we can install [vim-rails](https://github.com/tpope/vim-rails):
|
||||
You can also install your plugins, for instance, via pathogen you can install [vim-rails](https://github.com/tpope/vim-rails):
|
||||
|
||||
cd ~/.vim_runtime
|
||||
git clone git://github.com/tpope/vim-rails.git sources_non_forked/vim-rails
|
||||
|
||||
Now you have vim-rails installed ;-)
|
||||
|
||||
|
||||
## Key Mappings
|
||||
|
||||
The [leader](http://learnvimscriptthehardway.stevelosh.com/chapters/06.html#leader) is `,`, so whenever you see `<leader>` it means `,`.
|
||||
|
||||
|
||||
### 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) to 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) to 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 to quickly find a file or a buffer (`<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:
|
||||
[NERD Tree](https://github.com/scrooloose/nerdtree) mappings:
|
||||
|
||||
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):
|
||||
|
||||
|
@ -164,18 +174,18 @@ Map `<Space>` to `/` (search) and `<Ctrl>+<Space>` to `?` (backwards search):
|
|||
map <c-space> ?
|
||||
map <silent> <leader><cr> :noh<cr>
|
||||
|
||||
Disable highlight when `<leader><cr>` is pressed:
|
||||
Disable highlights when you press `<leader><cr>`:
|
||||
|
||||
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 the current buffer(s) (`<leader>bd` and (`<leader>ba`)):
|
||||
|
||||
" Close current buffer
|
||||
map <leader>bd :Bclose<cr>
|
||||
|
@ -194,22 +204,14 @@ Useful mappings for managing tabs:
|
|||
" Super useful when editing files in the same directory
|
||||
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
|
||||
|
||||
Switch CWD to the directory of the open buffer:
|
||||
Switch [CWD](http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file) to the directory of the open buffer:
|
||||
|
||||
map <leader>cd :cd %:p:h<cr>:pwd<cr>
|
||||
|
||||
Open vimgrep and put the cursor in the right position:
|
||||
Open `ack.vim` for fast search:
|
||||
|
||||
map <leader>g :vimgrep // **/*.<left><left><left><left><left><left><left>
|
||||
map <leader>g :Ack
|
||||
|
||||
Vimgreps in the current file:
|
||||
|
||||
map <leader><space> :vimgrep // <C-R>%<C-A><right><right><right><right><right><right><right><right><right>
|
||||
|
||||
Remove the Windows ^M - when the encodings gets messed up:
|
||||
|
||||
noremap <leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
|
||||
|
||||
Quickly open a buffer for scripbble:
|
||||
|
||||
map <leader>q :e ~/buffer<cr>
|
||||
|
@ -219,6 +221,31 @@ Toggle paste mode on and off:
|
|||
map <leader>pp :setlocal paste!<cr>
|
||||
|
||||
|
||||
### Visual mode mappings
|
||||
|
||||
Visual mode pressing `*` or `#` searches for the current selection:
|
||||
|
||||
vnoremap <silent> * :call VisualSelection('f')<CR>
|
||||
vnoremap <silent> # :call VisualSelection('b')<CR>
|
||||
|
||||
When you press gv you `Ack.vim` after the selected text:
|
||||
|
||||
vnoremap <silent> gv :call VisualSelection('gv', '')<CR>
|
||||
|
||||
When you press `<leader>r` you can search and replace the selected text:
|
||||
|
||||
vnoremap <silent> <leader>r :call VisualSelection('replace')<CR>
|
||||
|
||||
Surround the visual selection in parenthesis/brackets/etc.:
|
||||
|
||||
vnoremap $1 <esc>`>a)<esc>`<i(<esc>
|
||||
vnoremap $2 <esc>`>a]<esc>`<i[<esc>
|
||||
vnoremap $3 <esc>`>a}<esc>`<i{<esc>
|
||||
vnoremap $$ <esc>`>a"<esc>`<i"<esc>
|
||||
vnoremap $q <esc>`>a'<esc>`<i'<esc>
|
||||
vnoremap $e <esc>`>a"<esc>`<i"<esc>
|
||||
|
||||
|
||||
### Insert mode mappings
|
||||
|
||||
Quickly insert parenthesis/brackets/etc.:
|
||||
|
@ -236,31 +263,6 @@ Insert the current date and time (useful for timestamps):
|
|||
iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
|
||||
|
||||
|
||||
### Visual mode mappings
|
||||
|
||||
Visual mode pressing `*` or `#` searches for the current selection:
|
||||
|
||||
vnoremap <silent> * :call VisualSelection('f')<CR>
|
||||
vnoremap <silent> # :call VisualSelection('b')<CR>
|
||||
|
||||
When you press gv you vimgrep after the selected text:
|
||||
|
||||
vnoremap <silent> gv :call VisualSelection('gv')<CR>
|
||||
|
||||
When you press `<leader>r` you can search and replace the selected text:
|
||||
|
||||
vnoremap <silent> <leader>r :call VisualSelection('replace')<CR>
|
||||
|
||||
Surround the visual selection in parenthesis/brackets/etc.:
|
||||
|
||||
vnoremap $1 <esc>`>a)<esc>`<i(<esc>
|
||||
vnoremap $2 <esc>`>a]<esc>`<i[<esc>
|
||||
vnoremap $3 <esc>`>a}<esc>`<i{<esc>
|
||||
vnoremap $$ <esc>`>a"<esc>`<i"<esc>
|
||||
vnoremap $q <esc>`>a'<esc>`<i'<esc>
|
||||
vnoremap $e <esc>`>a"<esc>`<i"<esc>
|
||||
|
||||
|
||||
### Command line mappings
|
||||
|
||||
$q is super useful when browsing on the command line. It deletes everything until the last slash:
|
||||
|
@ -276,27 +278,28 @@ Bash like keys for the command line:
|
|||
cnoremap <C-P> <Up>
|
||||
cnoremap <C-N> <Down>
|
||||
|
||||
Write the file as sudo (only on Unix). Super useful when you open a file and you don't have permissions to save your changes. [Vim tip](http://vim.wikia.com/wiki/Su-write):
|
||||
Write the file as sudo (works only on Unix). Super useful when you open a file and you don't have permissions to save your changes. [Vim tip](http://vim.wikia.com/wiki/Su-write):
|
||||
|
||||
:W
|
||||
|
||||
|
||||
### Spell checking
|
||||
Pressing `<leader>ss` will toggle and untoggle spell checking
|
||||
Pressing `<leader>ss` will toggle spell checking:
|
||||
|
||||
map <leader>ss :setlocal spell!<cr>
|
||||
|
||||
Shortcuts using `<leader>` instead of special chars
|
||||
Shortcuts using `<leader>` instead of special characters:
|
||||
|
||||
map <leader>sn ]s
|
||||
map <leader>sp [s
|
||||
map <leader>sa zg
|
||||
map <leader>s? z=
|
||||
|
||||
### Cope
|
||||
Do :help cope if you are unsure what cope is. It's super useful!
|
||||
|
||||
When you search with vimgrep, display your results in cope by doing:
|
||||
### Cope
|
||||
Query `:help cope` if you are unsure what cope is. It's super useful!
|
||||
|
||||
When you search with `Ack.vim`, display your results in cope by doing:
|
||||
`<leader>cc`
|
||||
|
||||
To go to the next search result do:
|
||||
|
@ -305,27 +308,15 @@ To go to the next search result do:
|
|||
To go to the previous search results do:
|
||||
`<leader>p`
|
||||
|
||||
Vimscript mappings:
|
||||
Cope mappings:
|
||||
|
||||
map <leader>cc :botright cope<cr>
|
||||
map <leader>co ggVGy:tabnew<cr>:set syntax=qf<cr>pgg
|
||||
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:
|
||||
Just do following:
|
||||
* Remove `~/.vim_runtime`
|
||||
* Remove any lines that refernce `.vim_runtime` in your `~/.vimrc`
|
||||
|
||||
* Remove any lines that reference `.vim_runtime` in your `~/.vimrc`
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cd ~/.vim_runtime
|
||||
|
||||
echo 'set runtimepath+=~/.vim_runtime
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cd ~/.vim_runtime
|
||||
cat ~/.vim_runtime/vimrcs/basic.vim > ~/.vimrc
|
||||
echo "Installed the Basic Vim configuration successfully! Enjoy :-)"
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
This is a mirror of http://www.vim.org/scripts/script.php?script_id=1234
|
||||
|
||||
Vim already maintains a list of numbered registers containing the last 9 deletes. These previous deletes can be referenced using [register]p, so "1p will paste the last delete, "2p the 2nd last delete. For more information see |quote_number|.
|
||||
|
||||
Vim does not provide any mechanism to reference previous yanked, deleted or changed text. In Emacs this feature is called the "kill ring".
|
||||
|
||||
The YankRing plugin allows the user to configure the number of yanked, deleted and changed text. A split window can be used to choose which element(s) from the yankring you wish to paste. Alternately after text has been pasted (using p), it can be replaced with a previous value from the yankring with a single key stroke.
|
||||
|
||||
The captured text is stored in a file (location configurable) and is instantly available (also configurable) to any other instance of Vim also running on the same machine. This can especially be useful on *nix machines when you are sshed in running Vim in multiple terminals.
|
||||
|
||||
Storing the capture text in a file allows the text to be shared easily between multiple instances of Vim running in X, Windows, SSH or Screen.
|
||||
|
||||
A tutorial is included to take you through the various features of the plugin. After you have installed the plugin just run:
|
||||
:h yankring.txt
|
||||
:h yankring-tutorial
|
||||
|
||||
The yankring can be interacted with in two ways: a GUI or via maps.
|
||||
|
||||
The yankring supports all of Vim motions and text-objects. There are very few new keystrokes the user must learn. One keystroke to open the yankring to choose which item to paste is all that is required. It has been designed work seamlessly with Vim
|
||||
|
||||
All the mappings and behaviours are configurable via global variables you can optionally specify in your vimrc.
|
||||
|
||||
The plugin can be toggled on and off, and supports:
|
||||
Ranges
|
||||
Registers
|
||||
Counts
|
||||
All visual modes (characterwise, linewise and blockwise)
|
||||
All motions
|
||||
All text-objects
|
||||
|
||||
Examples:
|
||||
yy - Adds the current line to the yankring.
|
||||
dd - Adds the current line to the yankring and deletes it.
|
||||
5yw - Adds 5 words to the yankring.
|
||||
"ade - Deletes the word, and puts it into both the yankring and the "a register.
|
||||
cw - Changes the word and stores the previous value in the yankring.
|
||||
10"zyy - Places 10 lines into both the yankring and the "z register.
|
||||
:1,4YRYankRange - Similar to 1,4y
|
||||
:3,$YRDeleteRange - Similar to 3,$d
|
||||
|
||||
If you wish to paste previous values from the yankring and do not want to use the GUI, there are only two additional maps you must learn (these are configurable via your vimrc if needed). The purpose of the yankring is to gain access to previously yanked (or deleted) elements. The YRReplace command will replace the previously pasted text with a different entry from the yankring. By default, I choose <C-P> (P for previous) to replace the text last pasted while moving backwards through your previous text from the yankring and <C-N> (N for next) to replace the previous paste while moving forward through the yankring.
|
||||
|
||||
A separate buffer window to allow you to easily interact with the contents of the yankring. The window is similar to many other plugins: TagList, SelectBuf and so on. You can use the mouse or standard Vim keys (p, gp, P, ...). Visual mode is used to support counts, pasting multiple times and reversing the order of pasted elements.
|
||||
|
||||
The GUI significantly simplifies your interaction with the yankring for basic functions. But often it useful to take advantage of the more powerful features of the yankring.
|
||||
|
||||
Here is a small section from the tutorial (using maps) so you have some idea of how you interact with the plugin gaining access to previous yanks. Using the GUI for basic operations is self explanatory.
|
||||
|
||||
:h yankring-tutorial
|
||||
|
||||
---- Partial Tutorial ----
|
||||
To understand how to use the yankring, the following example should demonstrate the various features.
|
||||
|
||||
Assume we have this buffer:
|
||||
one
|
||||
two
|
||||
three
|
||||
four
|
||||
five
|
||||
|
||||
Now yank (yy) each line separately starting at line 1. Display the
|
||||
contents of the yankring.
|
||||
:YRShow
|
||||
--- YankRing ---
|
||||
Elem Content
|
||||
5 five^@
|
||||
4 four^@
|
||||
3 three^@
|
||||
2 two^@
|
||||
1 one^@
|
||||
Since we yanked the text starting at line 1 and finishing at line 5, the most current yankring element is the last one, the contents of line 5.
|
||||
"five^@" is displayed, the "^@" is a newline character (since we issued a "yy").
|
||||
|
||||
Now, go to the end of the file and press p. The resulting buffer appears as:
|
||||
one
|
||||
two
|
||||
three
|
||||
four
|
||||
five
|
||||
five
|
||||
Now press <C-P> to move backwards through the yankring, this results in:
|
||||
one
|
||||
two
|
||||
three
|
||||
four
|
||||
five
|
||||
four
|
||||
Now press 2<C-P>. This would be the same as pressing <C-P> two times in a row. This results in:
|
||||
one
|
||||
two
|
||||
three
|
||||
four
|
||||
five
|
||||
two
|
||||
Now press <C-N> to move forwards through the yankring, this results in:
|
||||
one
|
||||
two
|
||||
three
|
||||
four
|
||||
five
|
||||
three
|
||||
|
||||
You can create a map to display a buffer displaying the yankring's contents:
|
||||
nnoremap <silent> <F11> :YRShow<CR>
|
||||
|
||||
YRShow creates a new split buffer (you can configure where it should be and it's size)
|
||||
:YRShow
|
||||
AutoClose=1;Cmds:<enter>,[g]p,[p]P,d,r,a,u,q,<space>;Help=?
|
||||
--- YankRing ---
|
||||
Elem Content
|
||||
3 three^@
|
||||
2 two^@
|
||||
1 one^@
|
||||
5 five^@
|
||||
4 four^@
|
||||
You can simply hit "p", <enter>, double click on an item and it will be pasted into your document. The window will automatically close (by default) after you have made a choice. The element will be pasted into the correct buffer if you have multiple split windows.
|
||||
|
||||
You can paste multiple items using visual mode.
|
||||
You can also remove items from the yankring.
|
||||
|
||||
---- Partial Tutorial ----
|
||||
|
||||
Concentrating on the last line of the buffer you could see how we were able to replace our pasted text with lines yanked previously. This is a feature Vim only has for deletes, and is limited to 9. This plugin enables the same features for both yanks, deletes and changes, the size of the history is configurable.
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -2,22 +2,22 @@
|
|||
|
||||
Run your favorite search tool from Vim, with an enhanced results list.
|
||||
|
||||
This plugin was designed as a Vim frontend for the Perl module [App::Ack]. Ack
|
||||
can be used as a replacement for 99% of the uses of _grep_. The plugin allows
|
||||
you to run ack from Vim, and shows the results in a split window.
|
||||
This plugin was designed as a Vim frontend for the programmer's search tool
|
||||
[ack]. ack can be used as a replacement for 99% of the uses of `grep`. The
|
||||
plugin allows you to search with ack from within Vim and shows the results in a
|
||||
split window.
|
||||
|
||||
But here's a little secret for the Vim-seasoned: it's just a light wrapper for
|
||||
Vim's [grepprg] and the [quickfix] window for match results. This makes it easy
|
||||
to integrate with your own Vim configuration and use existing knowledge of core
|
||||
features. It also means the plugin is flexible to use with other search tools.
|
||||
|
||||
[App::Ack]: http://search.cpan.org/~petdance/ack/ack
|
||||
[grepprg]: http://vimdoc.sourceforge.net/htmldoc/options.html#'grepprg'
|
||||
[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
|
||||
|
||||
## Installation
|
||||
|
||||
### Ack
|
||||
### ack
|
||||
|
||||
You will need ack (>= 2.0), of course. To install it follow the
|
||||
[manual](http://beyondgrep.com/install/).
|
||||
|
@ -49,8 +49,6 @@ NeoBundle 'mileszs/ack.vim'
|
|||
[Download][releases] the plugin and extract it in `~/.vim/` (or
|
||||
`%PROGRAMFILES%/Vim/vimfiles` on Windows).
|
||||
|
||||
[zipball]: https://github.com/mileszs/ack.vim/archive/master.zip
|
||||
|
||||
## Usage
|
||||
|
||||
:Ack [options] {pattern} [{directories}]
|
||||
|
@ -60,7 +58,7 @@ for the `{pattern}`.
|
|||
|
||||
Files containing the search term will be listed in the quickfix window, along
|
||||
with the line number of the occurrence, once for each occurrence. `<Enter>` on
|
||||
a line in this window will open the file, and place the cursor on the matching
|
||||
a line in this window will open the file and place the cursor on the matching
|
||||
line.
|
||||
|
||||
Just like where you use `:grep`, `:grepadd`, `:lgrep`, and :`lgrepadd`, you can
|
||||
|
@ -89,6 +87,10 @@ The quickfix results window is augmented with these convenience mappings:
|
|||
|
||||
### Gotchas
|
||||
|
||||
To search for a pattern that contains whitespace, you need to enclose the
|
||||
pattern in single quotes. For example: `:Ack 'foo bar'` to search for
|
||||
'foo bar'.
|
||||
|
||||
Some characters have special meaning, and need to be escaped in your search
|
||||
pattern. For instance, `#`. You need to escape it with `:Ack '\\\#define
|
||||
foo'` to search for '#define foo'. See [issue #5].
|
||||
|
@ -122,27 +124,40 @@ 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
|
||||
|
||||
## Changelog
|
||||
|
||||
Please see [the Github releases page][releases].
|
||||
Please see [the GitHub releases page][releases].
|
||||
|
||||
## Credits
|
||||
|
||||
This plugin is derived from Antoine Imbert's blog post [Ack and Vim
|
||||
This plugin is derived from Antoine Imbert's blog post [ack and Vim
|
||||
Integration][] (in particular, the function in the update to the post). [Miles
|
||||
Sterrett][mileszs] packaged it up as a plugin and documented it in Vim's help
|
||||
format, and since then [many contributors][contributors] have submitted
|
||||
enhancements and fixes.
|
||||
|
||||
And of course, where would we be without [Ack]. And, you know, Vim.
|
||||
And of course, where would we be without [ack]. And, you know, Vim.
|
||||
|
||||
[Ack and Vim Integration]: http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html
|
||||
[ack and Vim Integration]: http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html
|
||||
[mileszs]: https://github.com/mileszs
|
||||
[contributors]: https://github.com/mileszs/ack.vim/graphs/contributors
|
||||
[Ack]: http://beyondgrep.com/
|
||||
[ack]: http://beyondgrep.com/
|
||||
|
||||
[vim-dispatch]: https://github.com/tpope/vim-dispatch
|
||||
[releases]: https://github.com/mileszs/ack.vim/releases
|
||||
|
|
|
@ -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.')
|
||||
|
@ -238,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,9 +220,7 @@ Example:
|
|||
>
|
||||
let g:ack_use_dispatch = 1
|
||||
<
|
||||
|
||||
*g:ack_use_cword_for_empty_search*
|
||||
|
||||
g:ack_use_cword_for_empty_search
|
||||
Default: 1
|
||||
|
||||
|
@ -239,34 +228,88 @@ 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,4 +1,4 @@
|
|||
if exists('g:loaded_ack')
|
||||
if exists('g:loaded_ack') || &cp
|
||||
finish
|
||||
endif
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
tags
|
||||
ag-vim.tgz
|
|
@ -1,79 +0,0 @@
|
|||
# ag.vim #
|
||||
|
||||
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
|
||||
you to run ag from vim, and shows the results in a split window.
|
||||
|
||||
## Installation ##
|
||||
|
||||
See [the_silver_searcher's README](https://github.com/ggreer/the_silver_searcher#installing) for its installation instructions (if you haven't installed it already).
|
||||
|
||||
You have to first install [ag](https://github.com/ggreer/the_silver_searcher), itself. On Mac+Homebrew, Gentoo Linux, several others, there's package named `the_silver_searcher`, but if your OS/distro don't have one, the GitHub repo installs fine:
|
||||
|
||||
Vim has various ways of installing plugins, the standard way is in [the documentation](http://vimdoc.sourceforge.net/htmldoc/usr_05.html#plugin), but most people use a plugin to manage their plugins. If you don't already have a preferred plugin manager plugin, why not try one of the following?
|
||||
- [vim-plug](https://github.com/junegunn/vim-plug#readme)
|
||||
- [vim-pathogen](https://github.com/tpope/vim-pathogen#readme)
|
||||
- [Vundle.vim](https://github.com/gmarik/Vundle.vim#readme)
|
||||
- Or, if you don't use any sort of Vim plugin management:
|
||||
|
||||
```sh
|
||||
cd ~/.vim/bundle && git clone https://github.com/rking/ag.vim ag && echo "set runtimepath^=~/.vim/bundle/ag" >> ~/.vimrc
|
||||
```
|
||||
|
||||
Then open vim and run `:helptags ~/.vim/bundle/ag/doc`.
|
||||
|
||||
### Configuration ###
|
||||
|
||||
You can specify a custom ag name and path in your .vimrc like so:
|
||||
|
||||
let g:ag_prg="<custom-ag-path-goes-here> --vimgrep"
|
||||
|
||||
You can configure ag.vim to always start searching from your project root
|
||||
instead of the cwd
|
||||
|
||||
let g:ag_working_path_mode="r"
|
||||
|
||||
## Usage ##
|
||||
|
||||
:Ag [options] {pattern} [{directory}]
|
||||
|
||||
Search recursively in {directory} (which defaults to the current directory) for the {pattern}.
|
||||
|
||||
Files containing the search term will be listed in the split window, along with
|
||||
the line number of the occurrence, once for each occurrence. [Enter] on a line
|
||||
in this window will open the file, and place the cursor on the matching line.
|
||||
|
||||
Just like where you use :grep, :grepadd, :lgrep, and :lgrepadd, you can use `:Ag`, `:AgAdd`, `:LAg`, and `:LAgAdd` respectively. (See `doc/ag.txt`, or install and `:h Ag` for more information.)
|
||||
|
||||
### Gotchas ###
|
||||
|
||||
Some characters have special meaning, and need to be escaped your search pattern. For instance, '#'. You have to escape it like this `:Ag '\\\#define foo'` to search for `#define foo`. (From [blueyed in issue #5](https://github.com/mileszs/ack.vim/issues/5).)
|
||||
|
||||
Sometimes `git grep` is even faster, though in my experience it's not noticeably so.
|
||||
|
||||
### Keyboard Shortcuts ###
|
||||
|
||||
In the quickfix window, you can use:
|
||||
|
||||
e to open file and close the quickfix window
|
||||
o to open (same as enter)
|
||||
go to preview file (open but maintain focus on ag.vim results)
|
||||
t to open in new tab
|
||||
T to open in new tab silently
|
||||
h to open in horizontal split
|
||||
H to open in horizontal split silently
|
||||
v to open in vertical split
|
||||
gv to open in vertical split silently
|
||||
q to close the quickfix window
|
||||
|
||||
### Related Plugin ###
|
||||
[vim-ag-anything](https://github.com/Chun-Yang/vim-ag-anything) adds an 'ga' action to search any text object.
|
||||
|
||||
### Acknowledgements ###
|
||||
|
||||
This Vim plugin is derived (and by derived, I mean copied, almost entirely)
|
||||
from [milesz's ack.vim](https://github.com/mileszs/ack.vim), which I also
|
||||
recommend installing since you might be in a situation where you have ack but
|
||||
not ag, and don't want to stop to install ag. Also, ack supports `--type`, and
|
||||
a few other features.
|
|
@ -1,3 +0,0 @@
|
|||
task :tgz do
|
||||
sh 'cd ..; tar czvf ag/ag-vim.tgz ag/{plugin,autoload,doc}'
|
||||
end
|
|
@ -1,234 +0,0 @@
|
|||
" NOTE: You must, of course, install ag / the_silver_searcher
|
||||
|
||||
" FIXME: Delete deprecated options below on or after 2016-4 (6 months from when the deprecation warning was added) {{{
|
||||
|
||||
if exists("g:agprg")
|
||||
let g:ag_prg = g:agprg
|
||||
echohl WarningMsg
|
||||
call input('g:agprg is deprecated and will be removed. Please use g:ag_prg')
|
||||
echohl None
|
||||
endif
|
||||
|
||||
if exists("g:aghighlight")
|
||||
let g:ag_highlight = g:aghighlight
|
||||
echohl WarningMsg
|
||||
call input('g:aghighlight is deprecated and will be removed. Please use g:ag_highlight')
|
||||
echohl None
|
||||
endif
|
||||
|
||||
if exists("g:agformat")
|
||||
let g:ag_format = g:agformat
|
||||
echohl WarningMsg
|
||||
call input('g:agformat is deprecated and will be removed. Please use g:ag_format')
|
||||
echohl None
|
||||
endif
|
||||
|
||||
" }}} FIXME: Delete the deprecated options above on or after 15-7 (6 months from when they were changed)
|
||||
|
||||
" Location of the ag utility
|
||||
if !exists("g:ag_prg")
|
||||
" --vimgrep (consistent output we can parse) is available from version 0.25.0+
|
||||
if split(system("ag --version"), "[ \n\r\t]")[2] =~ '\d\+.\(\(2[5-9]\)\|\([3-9][0-9]\)\)\(.\d\+\)\?'
|
||||
let g:ag_prg="ag --vimgrep"
|
||||
else
|
||||
" --noheading seems odd here, but see https://github.com/ggreer/the_silver_searcher/issues/361
|
||||
let g:ag_prg="ag --column --nogroup --noheading"
|
||||
endif
|
||||
endif
|
||||
|
||||
if !exists("g:ag_apply_qmappings")
|
||||
let g:ag_apply_qmappings=1
|
||||
endif
|
||||
|
||||
if !exists("g:ag_apply_lmappings")
|
||||
let g:ag_apply_lmappings=1
|
||||
endif
|
||||
|
||||
if !exists("g:ag_qhandler")
|
||||
let g:ag_qhandler="botright copen"
|
||||
endif
|
||||
|
||||
if !exists("g:ag_lhandler")
|
||||
let g:ag_lhandler="botright lopen"
|
||||
endif
|
||||
|
||||
if !exists("g:ag_mapping_message")
|
||||
let g:ag_mapping_message=1
|
||||
endif
|
||||
|
||||
if !exists("g:ag_working_path_mode")
|
||||
let g:ag_working_path_mode = 'c'
|
||||
endif
|
||||
|
||||
function! ag#AgBuffer(cmd, args)
|
||||
let l:bufs = filter(range(1, bufnr('$')), 'buflisted(v:val)')
|
||||
let l:files = []
|
||||
for buf in l:bufs
|
||||
let l:file = fnamemodify(bufname(buf), ':p')
|
||||
if !isdirectory(l:file)
|
||||
call add(l:files, l:file)
|
||||
endif
|
||||
endfor
|
||||
call ag#Ag(a:cmd, a:args . ' ' . join(l:files, ' '))
|
||||
endfunction
|
||||
|
||||
function! ag#Ag(cmd, args)
|
||||
let l:ag_executable = get(split(g:ag_prg, " "), 0)
|
||||
|
||||
" Ensure that `ag` is installed
|
||||
if !executable(l:ag_executable)
|
||||
echoe "Ag command '" . l:ag_executable . "' was not found. Is the silver searcher installed and on your $PATH?"
|
||||
return
|
||||
endif
|
||||
|
||||
" If no pattern is provided, search for the word under the cursor
|
||||
if empty(a:args)
|
||||
let l:grepargs = expand("<cword>")
|
||||
else
|
||||
let l:grepargs = a:args . join(a:000, ' ')
|
||||
end
|
||||
|
||||
if empty(l:grepargs)
|
||||
echo "Usage: ':Ag {pattern}' (or just :Ag to search for the word under the cursor). See ':help :Ag' for more information."
|
||||
return
|
||||
endif
|
||||
|
||||
" Format, used to manage column jump
|
||||
if a:cmd =~# '-g$'
|
||||
let s:ag_format_backup=g:ag_format
|
||||
let g:ag_format="%f"
|
||||
elseif exists("s:ag_format_backup")
|
||||
let g:ag_format=s:ag_format_backup
|
||||
elseif !exists("g:ag_format")
|
||||
let g:ag_format="%f:%l:%c:%m"
|
||||
endif
|
||||
|
||||
let l:grepprg_bak=&grepprg
|
||||
let l:grepformat_bak=&grepformat
|
||||
let l:t_ti_bak=&t_ti
|
||||
let l:t_te_bak=&t_te
|
||||
try
|
||||
let &grepprg=g:ag_prg
|
||||
let &grepformat=g:ag_format
|
||||
set t_ti=
|
||||
set t_te=
|
||||
if g:ag_working_path_mode ==? 'r' " Try to find the projectroot for current buffer
|
||||
let l:cwd_back = getcwd()
|
||||
let l:cwd = s:guessProjectRoot()
|
||||
try
|
||||
exe "lcd ".l:cwd
|
||||
catch
|
||||
echom 'Failed to change directory to:'.l:cwd
|
||||
finally
|
||||
silent! execute a:cmd . " " . escape(l:grepargs, '|')
|
||||
exe "lcd ".l:cwd_back
|
||||
endtry
|
||||
else " Someone chose an undefined value or 'c' so we revert to the default
|
||||
silent! execute a:cmd . " " . escape(l:grepargs, '|')
|
||||
endif
|
||||
finally
|
||||
let &grepprg=l:grepprg_bak
|
||||
let &grepformat=l:grepformat_bak
|
||||
let &t_ti=l:t_ti_bak
|
||||
let &t_te=l:t_te_bak
|
||||
endtry
|
||||
|
||||
if a:cmd =~# '^l'
|
||||
let l:match_count = len(getloclist(winnr()))
|
||||
else
|
||||
let l:match_count = len(getqflist())
|
||||
endif
|
||||
|
||||
if a:cmd =~# '^l' && l:match_count
|
||||
exe g:ag_lhandler
|
||||
let l:apply_mappings = g:ag_apply_lmappings
|
||||
let l:matches_window_prefix = 'l' " we're using the location list
|
||||
elseif l:match_count
|
||||
exe g:ag_qhandler
|
||||
let l:apply_mappings = g:ag_apply_qmappings
|
||||
let l:matches_window_prefix = 'c' " we're using the quickfix window
|
||||
endif
|
||||
|
||||
" If highlighting is on, highlight the search keyword.
|
||||
if exists('g:ag_highlight')
|
||||
let @/ = matchstr(a:args, "\\v(-)\@<!(\<)\@<=\\w+|['\"]\\zs.{-}\\ze['\"]")
|
||||
call feedkeys(":let &hlsearch=1 \| echo \<CR>", 'n')
|
||||
end
|
||||
|
||||
redraw!
|
||||
|
||||
if l:match_count
|
||||
if l:apply_mappings
|
||||
nnoremap <silent> <buffer> h <C-W><CR><C-w>K
|
||||
nnoremap <silent> <buffer> H <C-W><CR><C-w>K<C-w>b
|
||||
nnoremap <silent> <buffer> o <CR>
|
||||
nnoremap <silent> <buffer> t <C-w><CR><C-w>T
|
||||
nnoremap <silent> <buffer> T <C-w><CR><C-w>TgT<C-W><C-W>
|
||||
nnoremap <silent> <buffer> v <C-w><CR><C-w>H<C-W>b<C-W>J<C-W>t
|
||||
|
||||
exe 'nnoremap <silent> <buffer> e <CR><C-w><C-w>:' . l:matches_window_prefix .'close<CR>'
|
||||
exe 'nnoremap <silent> <buffer> go <CR>:' . l:matches_window_prefix . 'open<CR>'
|
||||
exe 'nnoremap <silent> <buffer> q :' . l:matches_window_prefix . 'close<CR>'
|
||||
|
||||
exe 'nnoremap <silent> <buffer> gv :let b:height=winheight(0)<CR><C-w><CR><C-w>H:' . l:matches_window_prefix . 'open<CR><C-w>J:exe printf(":normal %d\<lt>c-w>_", b:height)<CR>'
|
||||
" Interpretation:
|
||||
" :let b:height=winheight(0)<CR> Get the height of the quickfix/location list window
|
||||
" <CR><C-w> Open the current item in a new split
|
||||
" <C-w>H Slam the newly opened window against the left edge
|
||||
" :copen<CR> -or- :lopen<CR> Open either the quickfix window or the location list (whichever we were using)
|
||||
" <C-w>J Slam the quickfix/location list window against the bottom edge
|
||||
" :exe printf(":normal %d\<lt>c-w>_", b:height)<CR> Restore the quickfix/location list window's height from before we opened the match
|
||||
|
||||
if g:ag_mapping_message && l:apply_mappings
|
||||
echom "ag.vim keys: q=quit <cr>/e/t/h/v=enter/edit/tab/split/vsplit go/T/H/gv=preview versions of same"
|
||||
endif
|
||||
endif
|
||||
else " Close the split window automatically:
|
||||
cclose
|
||||
lclose
|
||||
echohl WarningMsg
|
||||
echom 'No matches for "'.a:args.'"'
|
||||
echohl None
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ag#AgFromSearch(cmd, args)
|
||||
let search = getreg('/')
|
||||
" translate vim regular expression to perl regular expression.
|
||||
let search = substitute(search,'\(\\<\|\\>\)','\\b','g')
|
||||
call ag#Ag(a:cmd, '"' . search .'" '. a:args)
|
||||
endfunction
|
||||
|
||||
function! ag#GetDocLocations()
|
||||
let dp = ''
|
||||
for p in split(&runtimepath,',')
|
||||
let p = p.'doc/'
|
||||
if isdirectory(p)
|
||||
let dp = p.'*.txt '.dp
|
||||
endif
|
||||
endfor
|
||||
return dp
|
||||
endfunction
|
||||
|
||||
function! ag#AgHelp(cmd,args)
|
||||
let args = a:args.' '.ag#GetDocLocations()
|
||||
call ag#Ag(a:cmd,args)
|
||||
endfunction
|
||||
|
||||
function! s:guessProjectRoot()
|
||||
let l:splitsearchdir = split(getcwd(), "/")
|
||||
|
||||
while len(l:splitsearchdir) > 2
|
||||
let l:searchdir = '/'.join(l:splitsearchdir, '/').'/'
|
||||
for l:marker in ['.rootdir', '.git', '.hg', '.svn', 'bzr', '_darcs', 'build.xml']
|
||||
" found it! Return the dir
|
||||
if filereadable(l:searchdir.l:marker) || isdirectory(l:searchdir.l:marker)
|
||||
return l:searchdir
|
||||
endif
|
||||
endfor
|
||||
let l:splitsearchdir = l:splitsearchdir[0:-2] " Splice the list to get rid of the tail directory
|
||||
endwhile
|
||||
|
||||
" Nothing found, fallback to current working dir
|
||||
return getcwd()
|
||||
endfunction
|
|
@ -1,174 +0,0 @@
|
|||
*ag.txt* Plugin that integrates ag with Vim
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *ag*
|
||||
|
||||
This plugin is a front for the_silver_searcher: ag. Ag can be used as a
|
||||
replacement for ack. This plugin will allow you to run ag from vim, and shows
|
||||
the results in a split window.
|
||||
|
||||
:Ag[!] [options] {pattern} [{directory}] *:Ag*
|
||||
|
||||
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
|
||||
error is jumped to.
|
||||
|
||||
:AgBuffer[!] [options] {pattern} *:AgBuffer*
|
||||
|
||||
Search for {pattern} in all open buffers. Behaves just like the |:grep|
|
||||
command, but will open the |Quickfix| window for you. If [!] is not given
|
||||
the first error is jumped to.
|
||||
|
||||
Note: this will not find changes in modified buffers, since ag can only
|
||||
find what is on disk! You can save buffers automatically when searching
|
||||
with the 'autowrite' option. A buffer will be ignored if it is a directory
|
||||
(an explorer, like netrw).
|
||||
|
||||
:AgAdd [options] {pattern} [{directory}] *:AgAdd*
|
||||
|
||||
Just like |:Ag|, but instead of making a new list, the matches are
|
||||
appended to the current |quickfix| list.
|
||||
|
||||
:AgFromSearch [{directory}] *:AgFromSearch*
|
||||
|
||||
Just like |:Ag| but the pattern is from previous search.
|
||||
|
||||
:LAg [options] {pattern} [{directory}] *:LAg*
|
||||
|
||||
Just like |:Ag| but instead of the |quickfix| list, matches are placed in
|
||||
the current |location-list|.
|
||||
|
||||
:LAgBuffer [options] {pattern} *:LAgBuffer*
|
||||
|
||||
Just like |:AgBuffer| but instead of the |quickfix| list, matches are
|
||||
placed in the current |location-list|.
|
||||
|
||||
:LAgAdd [options] {pattern} [{directory}] *:LAgAdd*
|
||||
|
||||
Just like |:AgAdd| but instead of the |quickfix| list, matches are added
|
||||
to the current |location-list|
|
||||
|
||||
:AgFile [options] {pattern} [{directory}] *:AgFile*
|
||||
|
||||
Search recursively in {directory} (which defaults to the current
|
||||
directory) for filenames matching the {pattern}. Behaves just like the
|
||||
|:grep| command, but will open the |Quickfix| window for you.
|
||||
|
||||
:AgHelp[!] [options] {pattern} *:AgHelp*
|
||||
|
||||
Search vim documentation files for the {pattern}. Behaves just like the
|
||||
|:Ag| command, but searches only vim documentation .txt files
|
||||
|
||||
:LAgHelp [options] {pattern} *:LAgHelp*
|
||||
|
||||
Just like |:AgHelp| but instead of the |quickfix| list, matches are placed
|
||||
in the current |location-list|.
|
||||
|
||||
Files containing the search term will be listed in the split window, along
|
||||
with the line number of the occurrence, once for each occurrence. <Enter> on a
|
||||
line in this window will open the file, and place the cursor on the matching
|
||||
line.
|
||||
|
||||
See http://geoff.greer.fm/2011/12/27/the-silver-searcher-better-than-ack/ for
|
||||
more information.
|
||||
|
||||
==============================================================================
|
||||
OPTIONS *ag-options*
|
||||
|
||||
*g:ag_prg*
|
||||
The location of the Ag program, and any options you want passed to it before
|
||||
searching. Default: "ag --vimgrep" (for parsable output). Example: >
|
||||
let g:ag_prg="ag --vimgrep --smart-case"
|
||||
<
|
||||
Note: the `--vimgrep` option was added in Ag 0.25.0. If ag.vim detects that
|
||||
you're using a lower version, the following default will be used instead: >
|
||||
let g:ag_prg="ag --column --nogroup --noheading"
|
||||
<
|
||||
This works around inconsistent behaviors in earlier Ag versions, but it is
|
||||
recommended that you upgrade if possible for a better experience. `--vimgrep`
|
||||
supports multiple matches on the same line of text, for example.
|
||||
|
||||
For background, see: https://github.com/rking/ag.vim/pull/88
|
||||
|
||||
*g:ag_working_path_mode*
|
||||
A mapping that describes where ag will be run. Default is the current working
|
||||
directory. Specifying 'r' as the argument will tell it to run from the project
|
||||
rootdirectory. For now any other mapping will result to the default.
|
||||
Example:
|
||||
let g:ag_working_path_mode='r'
|
||||
|
||||
*g:ag_highlight*
|
||||
If 1, highlight the search terms after searching. Default: 0. Example: >
|
||||
let g:ag_highlight=1
|
||||
<
|
||||
|
||||
*g:ag_format*
|
||||
Format to recognize the matches. See 'errorformat' for more info. Default:
|
||||
"%f" when searching for files, "%f:%l:%c:%m" if not otherwise set. For
|
||||
example, if your `g:ag_prg` is set to just "ag" (no column numbers in the
|
||||
output, so when you jump to a match your cursor will be on the start of the
|
||||
line): >
|
||||
let g:ag_format="%f:%l:%m"
|
||||
<
|
||||
|
||||
*g:ag_apply_lmappings*
|
||||
Whether or not to add custom mappings to location list windows opened by this
|
||||
plugin. Only applies if you're using the location list. Default 1. Example: >
|
||||
let g:ag_apply_lmappings=0
|
||||
<
|
||||
|
||||
*g:ag_apply_qmappings*
|
||||
Whether or not to add custom mappings to quickfix windows opened by this
|
||||
plugin. Only applies if you're using the error list. Default 1. Example: >
|
||||
let g:ag_apply_qmappings=0
|
||||
<
|
||||
|
||||
*g:ag_lhandler*
|
||||
A custom command used to open the location list after it's populated.
|
||||
Default: "botright lopen". You might want to set this to change where the
|
||||
location list is opened, or what size it is. Example: >
|
||||
let g:ag_lhandler="topleft lopen"
|
||||
<
|
||||
|
||||
*g:ag_qhandler*
|
||||
A custom command used to open the error list after it's populated. Default:
|
||||
"botright copen". You might want to set this to change where the quickfix
|
||||
window is opened, or what size it is. Example: >
|
||||
let g:ag_qhandler="copen 20"
|
||||
<
|
||||
|
||||
*g:ag_mapping_message*
|
||||
Whether or not to show the message explaining the extra mappings that are
|
||||
added to the results list this plugin populates. This message is not shown if
|
||||
the mappings are not applied (see |g:ag_apply_qmappings| and
|
||||
|g:ag_apply_lmappings| for more info. Default 1. Example: >
|
||||
let g:ag_mapping_message=0
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
MAPPINGS *ag-mappings*
|
||||
|
||||
The following keyboard shortcuts are available in the quickfix window:
|
||||
|
||||
e open file and close the quickfix window.
|
||||
|
||||
o open file (same as enter).
|
||||
|
||||
go preview file (open but maintain focus on ag.vim results).
|
||||
|
||||
t open in a new tab.
|
||||
|
||||
T open in new tab silently.
|
||||
|
||||
h open in horizontal split.
|
||||
|
||||
H open in horizontal split silently.
|
||||
|
||||
v open in vertical split.
|
||||
|
||||
gv open in vertical split silently.
|
||||
|
||||
q close the quickfix window.
|
||||
|
||||
vim:tw=78:fo=tcq2:ft=help:norl:
|
|
@ -1,11 +0,0 @@
|
|||
" NOTE: You must, of course, install ag / the_silver_searcher
|
||||
command! -bang -nargs=* -complete=file Ag call ag#Ag('grep<bang>',<q-args>)
|
||||
command! -bang -nargs=* -complete=file AgBuffer call ag#AgBuffer('grep<bang>',<q-args>)
|
||||
command! -bang -nargs=* -complete=file AgAdd call ag#Ag('grepadd<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file AgFromSearch call ag#AgFromSearch('grep<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file LAg call ag#Ag('lgrep<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file LAgBuffer call ag#AgBuffer('lgrep<bang>',<q-args>)
|
||||
command! -bang -nargs=* -complete=file LAgAdd call ag#Ag('lgrepadd<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file AgFile call ag#Ag('grep<bang> -g', <q-args>)
|
||||
command! -bang -nargs=* -complete=help AgHelp call ag#AgHelp('grep<bang>',<q-args>)
|
||||
command! -bang -nargs=* -complete=help LAgHelp call ag#AgHelp('lgrep<bang>',<q-args>)
|
|
@ -1,8 +1,9 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp.vim
|
||||
" Description: Fuzzy file, buffer, mru, tag, etc finder.
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" Version: 1.79
|
||||
" Author: CtrlP Dev Team
|
||||
" Original: Kien Nguyen <github.com/kien>
|
||||
" Version: 1.80
|
||||
" =============================================================================
|
||||
|
||||
" ** Static variables {{{1
|
||||
|
@ -93,9 +94,12 @@ let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] =
|
|||
\ 'open_single_match': ['s:opensingle', []],
|
||||
\ 'brief_prompt': ['s:brfprt', 0],
|
||||
\ 'match_current_file': ['s:matchcrfile', 0],
|
||||
\ 'match_natural_name': ['s:matchnatural', 0],
|
||||
\ 'compare_lim': ['s:compare_lim', 3000],
|
||||
\ 'bufname_mod': ['s:bufname_mod', ':t'],
|
||||
\ 'bufpath_mod': ['s:bufpath_mod', ':~:.:h'],
|
||||
\ 'formatline_func': ['s:flfunc', 's:formatline(v:val)'],
|
||||
\ 'user_command_async': ['s:usrcmdasync', 0],
|
||||
\ }, {
|
||||
\ 'open_multiple_files': 's:opmul',
|
||||
\ 'regexp': 's:regexp',
|
||||
|
@ -148,6 +152,7 @@ let [s:lcmap, s:prtmaps] = ['nn <buffer> <silent>', {
|
|||
\ 'CreateNewFile()': ['<c-y>'],
|
||||
\ 'MarkToOpen()': ['<c-z>'],
|
||||
\ 'OpenMulti()': ['<c-o>'],
|
||||
\ 'YankLine()': [],
|
||||
\ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'],
|
||||
\ }]
|
||||
|
||||
|
@ -201,11 +206,21 @@ let s:hlgrps = {
|
|||
\ }
|
||||
|
||||
" lname, sname of the basic(non-extension) modes
|
||||
let s:coretypes = [
|
||||
\ ['files', 'fil'],
|
||||
\ ['buffers', 'buf'],
|
||||
\ ['mru files', 'mru'],
|
||||
\ ]
|
||||
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_builtins = len(g:ctrlp_types)-1
|
||||
|
||||
let s:coretype_names = {
|
||||
\ 'fil' : 'files',
|
||||
\ 'buf' : 'buffers',
|
||||
\ 'mru' : 'mru files',
|
||||
\ }
|
||||
|
||||
let s:coretypes = map(copy(g:ctrlp_types), '[s:coretype_names[v:val], v:val]')
|
||||
|
||||
" Get the options {{{2
|
||||
fu! s:opts(...)
|
||||
|
@ -288,7 +303,6 @@ fu! s:match_window_opts()
|
|||
let s:mw_res =
|
||||
\ s:mw =~ 'results:[^,]\+' ? str2nr(matchstr(s:mw, 'results:\zs\d\+'))
|
||||
\ : min([s:mw_max, &lines])
|
||||
let s:mw_res = max([s:mw_res, 1])
|
||||
endf
|
||||
"}}}1
|
||||
" * Open & Close {{{1
|
||||
|
@ -315,11 +329,11 @@ fu! s:Open()
|
|||
cal s:setupblank()
|
||||
endf
|
||||
|
||||
fu! s:Close(exit)
|
||||
fu! s:Close()
|
||||
cal s:buffunc(0)
|
||||
if winnr('$') == 1
|
||||
bw!
|
||||
elsei a:exit
|
||||
el
|
||||
try | bun!
|
||||
cat | clo! | endt
|
||||
cal s:unmarksigns()
|
||||
|
@ -420,12 +434,17 @@ fu! s:GlobPath(dirs, depth)
|
|||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#addfile(ch, file)
|
||||
call add(g:ctrlp_allfiles, a:file)
|
||||
cal s:BuildPrompt(1)
|
||||
endf
|
||||
|
||||
fu! s:UserCmd(lscmd)
|
||||
let [path, lscmd] = [s:dyncwd, a:lscmd]
|
||||
let do_ign =
|
||||
\ type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore']
|
||||
if do_ign && ctrlp#igncwd(s:cwd) | retu | en
|
||||
if exists('+ssl') && &ssl
|
||||
if exists('+ssl') && &ssl && &shell !~ 'sh'
|
||||
let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')]
|
||||
en
|
||||
if (has('win32') || has('win64')) && match(&shellcmdflag, "/") != -1
|
||||
|
@ -435,11 +454,17 @@ fu! s:UserCmd(lscmd)
|
|||
if (has('win32') || has('win64')) && match(&shell, 'sh') != -1
|
||||
let path = tr(path, '\', '/')
|
||||
en
|
||||
if has('patch-7.4-597') && !(has('win32') || has('win64'))
|
||||
if s:usrcmdasync && v:version >= 800 && exists('*job_start')
|
||||
if exists('s:job')
|
||||
call job_stop(s:job)
|
||||
en
|
||||
let g:ctrlp_allfiles = []
|
||||
let s:job = job_start([&shell, &shellcmdflag, printf(lscmd, path)], {'callback': 'ctrlp#addfile'})
|
||||
elsei has('patch-7.4-597') && !(has('win32') || has('win64'))
|
||||
let g:ctrlp_allfiles = systemlist(printf(lscmd, path))
|
||||
else
|
||||
el
|
||||
let g:ctrlp_allfiles = split(system(printf(lscmd, path)), "\n")
|
||||
end
|
||||
en
|
||||
if exists('+ssl') && exists('ssl')
|
||||
let &ssl = ssl
|
||||
cal map(g:ctrlp_allfiles, 'tr(v:val, "\\", "/")')
|
||||
|
@ -544,9 +569,14 @@ endf
|
|||
fu! s:MatchedItems(items, pat, limit)
|
||||
let exc = exists('s:crfilerel') ? s:crfilerel : ''
|
||||
let items = s:narrowable() ? s:matched + s:mdata[3] : a:items
|
||||
if s:matcher != {}
|
||||
let matcher = s:getextvar('matcher')
|
||||
if empty(matcher) || type(matcher) != 4 || !has_key(matcher, 'match')
|
||||
unlet matcher
|
||||
let matcher = s:matcher
|
||||
en
|
||||
if matcher != {}
|
||||
let argms =
|
||||
\ has_key(s:matcher, 'arg_type') && s:matcher['arg_type'] == 'dict' ? [{
|
||||
\ has_key(matcher, 'arg_type') && matcher['arg_type'] == 'dict' ? [{
|
||||
\ 'items': items,
|
||||
\ 'str': a:pat,
|
||||
\ 'limit': a:limit,
|
||||
|
@ -555,7 +585,7 @@ fu! s:MatchedItems(items, pat, limit)
|
|||
\ 'crfile': exc,
|
||||
\ 'regex': s:regexp,
|
||||
\ }] : [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp]
|
||||
let lines = call(s:matcher['match'], argms, s:matcher)
|
||||
let lines = call(matcher['match'], argms, matcher)
|
||||
el
|
||||
let lines = s:MatchIt(items, a:pat, a:limit, exc)
|
||||
en
|
||||
|
@ -622,7 +652,7 @@ fu! s:Render(lines, pat)
|
|||
en
|
||||
if s:mw_order == 'btt' | cal reverse(lines) | en
|
||||
let s:lines = copy(lines)
|
||||
cal map(lines, 's:formatline(v:val)')
|
||||
cal map(lines, s:flfunc)
|
||||
cal setline(1, s:offset(lines, height))
|
||||
cal s:unmarksigns()
|
||||
cal s:remarksigns()
|
||||
|
@ -647,15 +677,15 @@ fu! s:Update(str)
|
|||
let pat = s:matcher == {} ? s:SplitPattern(str) : str
|
||||
let lines = s:nolim == 1 && empty(str) ? copy(g:ctrlp_lines)
|
||||
\ : s:MatchedItems(g:ctrlp_lines, pat, s:mw_res)
|
||||
if empty(str) | call clearmatches() | en
|
||||
if empty(str) | cal clearmatches() | en
|
||||
cal s:Render(lines, pat)
|
||||
return lines
|
||||
endf
|
||||
|
||||
fu! s:ForceUpdate()
|
||||
let wv = winsaveview()
|
||||
let pos = exists('*getcurpos') ? getcurpos() : getpos('.')
|
||||
sil! cal s:Update(escape(s:getinput(), '\'))
|
||||
cal winrestview(wv)
|
||||
cal setpos('.', pos)
|
||||
endf
|
||||
|
||||
fu! s:BuildPrompt(upd)
|
||||
|
@ -717,7 +747,7 @@ fu! s:PrtBS()
|
|||
if empty(s:prompt[0]) && s:brfprt != 0
|
||||
cal s:PrtExit()
|
||||
retu
|
||||
endif
|
||||
en
|
||||
unl! s:hstgot
|
||||
let [s:prompt[0], s:matches] = [substitute(s:prompt[0], '.$', '', ''), 1]
|
||||
cal s:BuildPrompt(1)
|
||||
|
@ -839,9 +869,9 @@ fu! s:PrtSelectMove(dir)
|
|||
let wht = winheight(0)
|
||||
let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'}
|
||||
exe 'keepj norm!' dirs[a:dir]
|
||||
let wv = winsaveview()
|
||||
let pos = exists('*getcurpos') ? getcurpos() : getpos('.')
|
||||
cal s:BuildPrompt(0)
|
||||
cal winrestview(wv)
|
||||
cal setpos('.', pos)
|
||||
endf
|
||||
|
||||
fu! s:PrtSelectJump(char)
|
||||
|
@ -864,9 +894,9 @@ fu! s:PrtSelectJump(char)
|
|||
let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]]
|
||||
en
|
||||
exe 'keepj norm!' ( jmpln + 1 ).'G'
|
||||
let wv = winsaveview()
|
||||
let pos = exists('*getcurpos') ? getcurpos() : getpos('.')
|
||||
cal s:BuildPrompt(0)
|
||||
cal winrestview(wv)
|
||||
cal setpos('.', pos)
|
||||
en
|
||||
endf
|
||||
" Misc {{{2
|
||||
|
@ -875,12 +905,13 @@ fu! s:PrtFocusMap(char)
|
|||
endf
|
||||
|
||||
fu! s:PrtClearCache()
|
||||
if s:itemtype == 0
|
||||
let ct = s:curtype()
|
||||
if ct == 'fil'
|
||||
cal ctrlp#clr()
|
||||
elsei s:itemtype > 2
|
||||
elsei s:itemtype >= len(s:coretypes)
|
||||
cal ctrlp#clr(s:statypes[s:itemtype][1])
|
||||
en
|
||||
if s:itemtype == 2
|
||||
if ct == 'mru'
|
||||
let g:ctrlp_lines = ctrlp#mrufiles#refresh()
|
||||
el
|
||||
cal ctrlp#setlines()
|
||||
|
@ -891,9 +922,10 @@ fu! s:PrtClearCache()
|
|||
endf
|
||||
|
||||
fu! s:PrtDeleteEnt()
|
||||
if s:itemtype == 2
|
||||
let ct = s:curtype()
|
||||
if ct == 'mru'
|
||||
cal s:PrtDeleteMRU()
|
||||
elsei s:itemtype == 1
|
||||
elsei ct == 'buf'
|
||||
cal s:delbuf()
|
||||
elsei type(s:getextvar('wipe')) == 1
|
||||
cal s:delent(s:getextvar('wipe'))
|
||||
|
@ -901,15 +933,19 @@ fu! s:PrtDeleteEnt()
|
|||
endf
|
||||
|
||||
fu! s:PrtDeleteMRU()
|
||||
if s:itemtype == 2
|
||||
if s:curtype() == 'mru'
|
||||
cal s:delent('ctrlp#mrufiles#remove')
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:PrtExit()
|
||||
let bw = bufwinnr('%')
|
||||
exe bufwinnr(s:bufnr).'winc w'
|
||||
if bufnr('%') == s:bufnr && bufname('%') == 'ControlP'
|
||||
noa cal s:Close(1)
|
||||
noa cal s:Close()
|
||||
noa winc p
|
||||
els
|
||||
exe bw.'winc w'
|
||||
en
|
||||
endf
|
||||
|
||||
|
@ -970,7 +1006,9 @@ fu! s:KeyLoop()
|
|||
wh exists('s:init') && s:keyloop
|
||||
try
|
||||
set t_ve=
|
||||
set guicursor=a:NONE
|
||||
if guicursor != ''
|
||||
set guicursor=a:NONE
|
||||
en
|
||||
let nr = getchar()
|
||||
fina
|
||||
let &t_ve = t_ve
|
||||
|
@ -1008,7 +1046,7 @@ fu! s:ToggleByFname()
|
|||
endf
|
||||
|
||||
fu! s:ToggleType(dir)
|
||||
let max = len(g:ctrlp_ext_vars) + 2
|
||||
let max = len(g:ctrlp_ext_vars) + len(s:coretypes) - 1
|
||||
let next = s:walker(max, s:itemtype, a:dir)
|
||||
cal ctrlp#setlines(next)
|
||||
cal ctrlp#syntax()
|
||||
|
@ -1148,7 +1186,7 @@ fu! s:AcceptSelection(action)
|
|||
if subm | if s:SpecInputs(str) | retu | en | en
|
||||
" Get the selected line
|
||||
let line = ctrlp#getcline()
|
||||
if !subm && !s:itemtype && line == '' && line('.') > s:offset
|
||||
if !subm && s:curtype() != 'fil' && line == '' && line('.') > s:offset
|
||||
\ && str !~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*|/|\\|\?|\@.+)$'
|
||||
cal s:CreateNewFile(md) | retu
|
||||
en
|
||||
|
@ -1158,14 +1196,14 @@ fu! s:AcceptSelection(action)
|
|||
let actfunc = s:openfunc[s:ctype]
|
||||
let type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'list'
|
||||
el
|
||||
if s:itemtype < 3
|
||||
if s:itemtype < len(s:coretypes)
|
||||
let [actfunc, type] = ['ctrlp#acceptfile', 'dict']
|
||||
el
|
||||
let [actfunc, exttype] = [s:getextvar('accept'), s:getextvar('act_farg')]
|
||||
let type = exttype == 'dict' ? exttype : 'list'
|
||||
en
|
||||
en
|
||||
let actargs = type == 'dict' ? [{ 'action': md, 'line': line, 'icr': icr }]
|
||||
let actargs = type == 'dict' ? [{ 'action': md, 'line': line, 'icr': icr, 'input': str}]
|
||||
\ : [md, line]
|
||||
cal call(actfunc, actargs)
|
||||
endf
|
||||
|
@ -1203,15 +1241,16 @@ fu! s:CreateNewFile(...)
|
|||
endf
|
||||
" * OpenMulti() {{{1
|
||||
fu! s:MarkToOpen()
|
||||
let ct = s:curtype()
|
||||
if s:bufnr <= 0 || s:opmul == '0'
|
||||
\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 )
|
||||
\ || ( s:itemtype >= len(s:coretypes) && s:getextvar('opmul') != 1 )
|
||||
retu
|
||||
en
|
||||
let line = ctrlp#getcline()
|
||||
|
||||
" Do not allow to mark modified or current buffer
|
||||
let bufnr = s:bufnrfilpath(line)[0]
|
||||
if (s:itemtype == 1 && s:delbufcond(bufnr))
|
||||
if (ct == 'buf' && s:delbufcond(bufnr))
|
||||
retu
|
||||
en
|
||||
|
||||
|
@ -1244,7 +1283,7 @@ endf
|
|||
fu! s:OpenMulti(...)
|
||||
let has_marked = exists('s:marked')
|
||||
if ( !has_marked && a:0 ) || s:opmul == '0' || !s:ispath
|
||||
\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 )
|
||||
\ || ( s:itemtype >= len(s:coretypes) && s:getextvar('opmul') != 1 )
|
||||
retu -1
|
||||
en
|
||||
" Get the options
|
||||
|
@ -1323,6 +1362,18 @@ fu! s:OpenMulti(...)
|
|||
unl! s:tabct
|
||||
endf
|
||||
|
||||
fu! s:YankLine(...)
|
||||
let @" = s:getinput()
|
||||
let has_marked = exists('s:marked')
|
||||
if !has_marked
|
||||
let line = ctrlp#getcline()
|
||||
if line == '' | retu | en
|
||||
let marked = { 1 : fnamemodify(line, ':p') }
|
||||
en
|
||||
let @" = join(values(has_marked ? s:marked : marked), "\n")
|
||||
cal s:PrtExit()
|
||||
endf
|
||||
|
||||
fu! s:OpenNoMarks(md, line)
|
||||
if a:md == 'a'
|
||||
let [s:marked, key] = [{}, 1]
|
||||
|
@ -1427,7 +1478,8 @@ fu! s:shortest(lens)
|
|||
endf
|
||||
|
||||
fu! s:mixedsort(...)
|
||||
if s:itemtype == 1
|
||||
let ct = s:curtype()
|
||||
if ct == 'buf'
|
||||
let pat = '[\/]\?\[\d\+\*No Name\]$'
|
||||
if a:1 =~# pat && a:2 =~# pat | retu 0
|
||||
elsei a:1 =~# pat | retu 1
|
||||
|
@ -1438,10 +1490,10 @@ fu! s:mixedsort(...)
|
|||
let ms = []
|
||||
if s:res_count < 21
|
||||
let ms += [s:compfnlen(a:1, a:2)]
|
||||
if s:itemtype !~ '^[12]$' | let ms += [s:comptime(a:1, a:2)] | en
|
||||
if ct !~ '^\(buf\|mru\)$' | let ms += [s:comptime(a:1, a:2)] | en
|
||||
if !s:itemtype | let ms += [s:comparent(a:1, a:2)] | en
|
||||
en
|
||||
if s:itemtype =~ '^[12]$'
|
||||
if ct =~ '^\(buf\|mru\)$'
|
||||
let ms += [s:compmref(a:1, a:2)]
|
||||
let cln = cml ? cln : 0
|
||||
en
|
||||
|
@ -1525,7 +1577,8 @@ endf
|
|||
" Line formatting {{{3
|
||||
fu! s:formatline(str)
|
||||
let str = a:str
|
||||
if s:itemtype == 1
|
||||
let ct = s:curtype()
|
||||
if ct == 'buf'
|
||||
let bufnr = s:bufnrfilpath(str)[0]
|
||||
let parts = s:bufparts(bufnr)
|
||||
let str = printf('%'.s:bufnr_width.'s', bufnr)
|
||||
|
@ -1537,7 +1590,7 @@ fu! s:formatline(str)
|
|||
let str .= printf(' %s', '<bp>'.parts[3].'</bp>')
|
||||
en
|
||||
el
|
||||
let str .= printf(' %-5s %-30s %s',
|
||||
let str .= printf(' %-5s %-30s',
|
||||
\ parts[0],
|
||||
\ parts[2])
|
||||
if (!empty(s:bufpath_mod))
|
||||
|
@ -1545,7 +1598,7 @@ fu! s:formatline(str)
|
|||
en
|
||||
en
|
||||
en
|
||||
let cond = s:itemtype != 1 &&s:ispath && ( s:winw - 4 ) < s:strwidth(str)
|
||||
let cond = ct != 'buf' &&s:ispath && ( s:winw - 4 ) < s:strwidth(str)
|
||||
retu s:lineprefix.( cond ? s:pathshorten(str) : str )
|
||||
endf
|
||||
|
||||
|
@ -1600,7 +1653,7 @@ fu! s:lash(...)
|
|||
endf
|
||||
|
||||
fu! s:ispathitem()
|
||||
retu s:itemtype < 3 || ( s:itemtype > 2 && s:getextvar('type') == 'path' )
|
||||
retu s:itemtype < len(s:coretypes) || s:getextvar('type') == 'path'
|
||||
endf
|
||||
|
||||
fu! ctrlp#igncwd(cwd)
|
||||
|
@ -1634,11 +1687,11 @@ fu! ctrlp#dirnfile(entries)
|
|||
endf
|
||||
|
||||
fu! s:usrign(item, type)
|
||||
if s:igntype == 1 | retu a:item =~ s:usrign | end
|
||||
if s:igntype == 1 | retu a:item =~ s:usrign | en
|
||||
if s:igntype == 2
|
||||
if call(s:usrign, [a:item, a:type])
|
||||
retu 1
|
||||
end
|
||||
en
|
||||
elsei s:igntype == 4
|
||||
if has_key(s:usrign, a:type) && s:usrign[a:type] != ''
|
||||
\ && a:item =~ s:usrign[a:type]
|
||||
|
@ -1646,8 +1699,8 @@ fu! s:usrign(item, type)
|
|||
elsei has_key(s:usrign, 'func') && s:usrign['func'] != ''
|
||||
\ && call(s:usrign['func'], [a:item, a:type])
|
||||
retu 1
|
||||
end
|
||||
end
|
||||
en
|
||||
en
|
||||
retu 0
|
||||
endf
|
||||
|
||||
|
@ -1717,6 +1770,7 @@ fu! ctrlp#setpathmode(pmode, ...)
|
|||
let spath = a:0 ? a:1 : s:crfpath
|
||||
let markers = ['.git', '.hg', '.svn', '.bzr', '_darcs']
|
||||
if type(s:rmarkers) == 3 && !empty(s:rmarkers)
|
||||
if s:findroot(spath, s:rmarkers, 0, 0) != [] | retu 1 | en
|
||||
cal filter(markers, 'index(s:rmarkers, v:val) < 0')
|
||||
let markers = s:rmarkers + markers
|
||||
en
|
||||
|
@ -1757,7 +1811,7 @@ fu! ctrlp#syntax()
|
|||
exe "sy match CtrlPLinePre '^".escape(get(g:, 'ctrlp_line_prefix', '>'),'^$.*~\')."'"
|
||||
en
|
||||
|
||||
if s:itemtype == 1 && s:has_conceal
|
||||
if s:curtype() == 'buf' && s:has_conceal
|
||||
sy region CtrlPBufferNr matchgroup=CtrlPLinePre start='^>\s\+' end='\s'
|
||||
sy region CtrlPBufferInd concealends matchgroup=Ignore start='<bi>' end='</bi>'
|
||||
sy region CtrlPBufferRegion concealends matchgroup=Ignore start='<bn>' end='</bn>'
|
||||
|
@ -1795,7 +1849,7 @@ fu! s:highlight(pat, grp)
|
|||
if s:byfname()
|
||||
" Make sure there are no slashes in our match
|
||||
let beginning = beginning.'\([^\/]*$\)\@='
|
||||
end
|
||||
en
|
||||
|
||||
for i in range(len(chars))
|
||||
" Surround our current target letter with \zs and \ze so it only
|
||||
|
@ -1807,14 +1861,14 @@ fu! s:highlight(pat, grp)
|
|||
if i == 0
|
||||
let charcopy[i] = '\zs'.charcopy[i].'\ze'
|
||||
let middle = join(charcopy, '.\{-}')
|
||||
else
|
||||
el
|
||||
let before = join(charcopy[0:i-1], '.\{-}')
|
||||
let after = join(charcopy[i+1:-1], '.\{-}')
|
||||
let c = charcopy[i]
|
||||
" for abc, match either ab.\{-}c or a.*b.\{-}c in that order
|
||||
let cpat = '\(\zs'.c.'\|'.'.*\zs'.c.'\)\ze.*'
|
||||
let middle = before.cpat.after
|
||||
endif
|
||||
en
|
||||
|
||||
" Now we matchadd for each letter, the basic form being:
|
||||
" ^.*\zsx\ze.*$, but with our pattern we built above for the letter,
|
||||
|
@ -1822,10 +1876,15 @@ fu! s:highlight(pat, grp)
|
|||
" occurrence of our letters. We also ensure that our matcher is case
|
||||
" insensitive or sensitive depending.
|
||||
cal matchadd(a:grp, beginning.middle.ending)
|
||||
endfor
|
||||
endfo
|
||||
en
|
||||
|
||||
cal matchadd('CtrlPLinePre', '^>')
|
||||
elseif !empty(a:pat) && s:regexp &&
|
||||
\ exists('g:ctrlp_regex_always_higlight') &&
|
||||
\ g:ctrlp_regex_always_higlight
|
||||
let pat = substitute(a:pat, '\\\@<!\^', '^> \\zs', 'g')
|
||||
cal matchadd(a:grp, ( s:martcs == '' ? '\c' : '\C').pat)
|
||||
en
|
||||
endf
|
||||
|
||||
|
@ -1941,16 +2000,21 @@ fu! s:isabs(path)
|
|||
endf
|
||||
|
||||
fu! s:bufnrfilpath(line)
|
||||
if s:isabs(a:line) || a:line =~ '^\~[/\\]' || a:line =~ '^\w\+:\/\/'
|
||||
if s:isabs(a:line) || a:line =~ '^\~[/\\]' || a:line =~ '^\w\+:\/\/'
|
||||
let filpath = a:line
|
||||
el
|
||||
let filpath = s:dyncwd.s:lash().a:line
|
||||
en
|
||||
let filpath = fnamemodify(filpath, ':p')
|
||||
let bufnr = bufnr('^'.filpath.'$')
|
||||
if (a:line =~ '[\/]\?\[\d\+\*No Name\]$' && !filereadable(filpath) && bufnr < 1)
|
||||
let bufnr = str2nr(matchstr(a:line, '[\/]\?\[\zs\d\+\ze\*No Name\]$'))
|
||||
let filpath = bufnr
|
||||
if (!filereadable(filpath) && bufnr < 1)
|
||||
if (a:line =~ '[\/]\?\[\d\+\*No Name\]$')
|
||||
let bufnr = str2nr(matchstr(a:line, '[\/]\?\[\zs\d\+\ze\*No Name\]$'))
|
||||
let filpath = bufnr
|
||||
els
|
||||
let bufnr = bufnr(a:line)
|
||||
retu [bufnr, a:line]
|
||||
en
|
||||
en
|
||||
retu [bufnr, filpath]
|
||||
endf
|
||||
|
@ -2011,7 +2075,7 @@ fu! s:checkbuf()
|
|||
endf
|
||||
|
||||
fu! s:iscmdwin()
|
||||
let ermsg = v:errmsg
|
||||
let [ermsg, v:errmsg] = [v:errmsg, '']
|
||||
sil! noa winc p
|
||||
sil! noa winc p
|
||||
let [v:errmsg, ermsg] = [ermsg, v:errmsg]
|
||||
|
@ -2125,12 +2189,13 @@ fu! s:modevar()
|
|||
endf
|
||||
|
||||
fu! s:nosort()
|
||||
retu s:matcher != {} || s:nolim == 1 || ( s:itemtype == 2 && s:mrudef )
|
||||
\ || ( s:itemtype =~ '\v^(1|2)$' && s:prompt == ['', '', ''] ) || !s:dosort
|
||||
let ct = s:curtype()
|
||||
retu s:matcher != {} || s:nolim == 1 || ( ct == 'mru' && s:mrudef )
|
||||
\ || ( ct =~ '^\(buf\|mru\)$' && s:prompt == ['', '', ''] ) || !s:dosort
|
||||
endf
|
||||
|
||||
fu! s:byfname()
|
||||
retu s:itemtype != 1 && s:ispath && s:byfname
|
||||
retu s:curtype() != 'buf' && s:ispath && s:byfname
|
||||
endf
|
||||
|
||||
fu! s:narrowable()
|
||||
|
@ -2252,7 +2317,7 @@ fu! s:lastvisual()
|
|||
let cview = winsaveview()
|
||||
let [ovreg, ovtype] = [getreg('v'), getregtype('v')]
|
||||
let [oureg, outype] = [getreg('"'), getregtype('"')]
|
||||
sil! norm! gv"vy
|
||||
sil! norm! gV"vy
|
||||
let selected = s:regisfilter('v')
|
||||
cal setreg('v', ovreg, ovtype)
|
||||
cal setreg('"', oureg, outype)
|
||||
|
@ -2332,7 +2397,7 @@ endf
|
|||
fu! s:matchbuf(item, pat)
|
||||
let bufnr = s:bufnrfilpath(a:item)[0]
|
||||
let parts = s:bufparts(bufnr)
|
||||
let item = bufnr.parts[0].parts[2].s:lash().parts[3]
|
||||
let item = s:byfname ? parts[2] : bufnr.parts[0].parts[2].s:lash().parts[3]
|
||||
retu match(item, a:pat)
|
||||
endf
|
||||
|
||||
|
@ -2346,19 +2411,30 @@ endf
|
|||
|
||||
fu! s:buildpat(lst)
|
||||
let pat = a:lst[0]
|
||||
for item in range(1, len(a:lst) - 1)
|
||||
let pat .= '[^'.a:lst[item - 1].']\{-}'.a:lst[item]
|
||||
endfo
|
||||
if s:matchnatural == 1
|
||||
for item in range(1, len(a:lst) - 1)
|
||||
let c = a:lst[item - 1]
|
||||
let pat .= (c == '/' ? '[^/]\{-}' : '[^'.c.'/]\{-}').a:lst[item]
|
||||
endfo
|
||||
els
|
||||
for item in range(1, len(a:lst) - 1)
|
||||
let pat .= '[^'.a:lst[item - 1].']\{-}'.a:lst[item]
|
||||
endfo
|
||||
en
|
||||
retu pat
|
||||
endf
|
||||
|
||||
fu! s:curtype()
|
||||
return s:CurTypeName()[1]
|
||||
endf
|
||||
|
||||
fu! s:mfunc()
|
||||
let mfunc = 'match'
|
||||
if s:byfname()
|
||||
let mfunc = 's:matchfname'
|
||||
elsei s:itemtype == 1
|
||||
elsei s:curtype() == 'buf'
|
||||
let mfunc = 's:matchbuf'
|
||||
elsei s:itemtype > 2
|
||||
elsei s:itemtype >= len(s:coretypes)
|
||||
let matchtypes = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' }
|
||||
if has_key(matchtypes, s:matchtype)
|
||||
let mfunc = matchtypes[s:matchtype]
|
||||
|
@ -2417,7 +2493,7 @@ fu! s:insertcache(str)
|
|||
endf
|
||||
" Extensions {{{2
|
||||
fu! s:mtype()
|
||||
retu s:itemtype > 2 ? s:getextvar('type') : 'path'
|
||||
retu s:itemtype >= len(s:coretypes) ? s:getextvar('type') : 'path'
|
||||
endf
|
||||
|
||||
fu! s:execextvar(key)
|
||||
|
@ -2428,9 +2504,11 @@ fu! s:execextvar(key)
|
|||
endf
|
||||
|
||||
fu! s:getextvar(key)
|
||||
if s:itemtype > 2
|
||||
let vars = g:ctrlp_ext_vars[s:itemtype - 3]
|
||||
retu has_key(vars, a:key) ? vars[a:key] : -1
|
||||
if s:itemtype >= len(s:coretypes) && len(g:ctrlp_ext_vars) > 0
|
||||
let vars = g:ctrlp_ext_vars[s:itemtype - len(s:coretypes)]
|
||||
if has_key(vars, a:key)
|
||||
retu vars[a:key]
|
||||
en
|
||||
en
|
||||
retu get(g:, 'ctrlp_' . s:matchtype . '_' . a:key, -1)
|
||||
endf
|
||||
|
@ -2483,7 +2561,8 @@ endf
|
|||
fu! ctrlp#setlines(...)
|
||||
if a:0 | let s:itemtype = a:1 | en
|
||||
cal s:modevar()
|
||||
let types = ['ctrlp#files()', 'ctrlp#buffers()', 'ctrlp#mrufiles#list()']
|
||||
let inits = {'fil': 'ctrlp#files()', 'buf': 'ctrlp#buffers()', 'mru': 'ctrlp#mrufiles#list()'}
|
||||
let types = map(copy(g:ctrlp_types), 'inits[v:val]')
|
||||
if !empty(g:ctrlp_ext_vars)
|
||||
cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])')
|
||||
en
|
||||
|
@ -2492,11 +2571,11 @@ endf
|
|||
|
||||
" Returns [lname, sname]
|
||||
fu! s:CurTypeName()
|
||||
if s:itemtype < 3
|
||||
return s:coretypes[s:itemtype]
|
||||
else
|
||||
if s:itemtype < len(s:coretypes)
|
||||
return filter(copy(s:coretypes), 'v:val[1]==g:ctrlp_types[s:itemtype]')[0]
|
||||
el
|
||||
return [s:getextvar("lname"), s:getextvar('sname')]
|
||||
endif
|
||||
en
|
||||
endfu
|
||||
|
||||
fu! s:ExitIfSingleCandidate()
|
||||
|
@ -2504,7 +2583,7 @@ fu! s:ExitIfSingleCandidate()
|
|||
call s:AcceptSelection('e')
|
||||
call ctrlp#exit()
|
||||
return 1
|
||||
endif
|
||||
en
|
||||
return 0
|
||||
endfu
|
||||
|
||||
|
@ -2517,14 +2596,27 @@ fu! ctrlp#init(type, ...)
|
|||
cal s:SetWD(a:0 ? a:1 : {})
|
||||
cal s:MapNorms()
|
||||
cal s:MapSpecs()
|
||||
cal ctrlp#setlines(s:settype(a:type))
|
||||
if empty(g:ctrlp_types) && empty(g:ctrlp_ext_vars)
|
||||
call ctrlp#exit()
|
||||
retu
|
||||
en
|
||||
if type(a:type) == 0
|
||||
let type = a:type
|
||||
el
|
||||
let type = index(g:ctrlp_types, a:type)
|
||||
if type == -1
|
||||
call ctrlp#exit()
|
||||
retu
|
||||
en
|
||||
en
|
||||
cal ctrlp#setlines(s:settype(type))
|
||||
cal ctrlp#syntax()
|
||||
cal s:SetDefTxt()
|
||||
let curName = s:CurTypeName()
|
||||
let shouldExitSingle = index(s:opensingle, curName[0])>=0 || index(s:opensingle, curName[1])>=0
|
||||
if shouldExitSingle && s:ExitIfSingleCandidate()
|
||||
return 0
|
||||
endif
|
||||
en
|
||||
cal s:BuildPrompt(1)
|
||||
if s:keyloop | cal s:KeyLoop() | en
|
||||
return 1
|
||||
|
@ -2534,7 +2626,7 @@ if has('autocmd')
|
|||
aug CtrlPAug
|
||||
au!
|
||||
au BufEnter ControlP cal s:checkbuf()
|
||||
au BufLeave ControlP noa cal s:Close(0)
|
||||
au BufLeave ControlP noa cal s:Close()
|
||||
au VimLeavePre * cal s:leavepre()
|
||||
aug END
|
||||
en
|
||||
|
|
|
@ -59,6 +59,7 @@ let s:types = {
|
|||
\ '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',
|
||||
|
@ -138,7 +139,7 @@ fu! s:exectags(cmd)
|
|||
endf
|
||||
|
||||
fu! s:exectagsonfile(fname, ftype)
|
||||
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs --extra= ', a:ftype]
|
||||
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs --extra= --file-scope=yes ', a:ftype]
|
||||
if type(s:types[ft]) == 1
|
||||
let ags .= s:types[ft]
|
||||
let bin = s:bin
|
||||
|
|
|
@ -13,6 +13,7 @@ let g:loaded_ctrlp_line = 1
|
|||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#line#init(s:crbufnr)',
|
||||
\ 'accept': 'ctrlp#line#accept',
|
||||
\ 'act_farg' : 'dict',
|
||||
\ 'lname': 'lines',
|
||||
\ 'sname': 'lns',
|
||||
\ 'type': 'tabe',
|
||||
|
@ -31,7 +32,7 @@ endf
|
|||
" Public {{{1
|
||||
fu! ctrlp#line#init(bufnr)
|
||||
let [lines, bufnr] = [[], exists('s:bufnr') ? s:bufnr : a:bufnr]
|
||||
let bufs = exists('s:lnmode') && s:lnmode ? ctrlp#buffers('id') : [bufnr]
|
||||
let bufs = exists('s:lnmode') && !empty(s:lnmode) ? ctrlp#buffers('id') : [bufnr]
|
||||
for bufnr in bufs
|
||||
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
|
||||
if lfb == [] && bufn != ''
|
||||
|
@ -50,11 +51,17 @@ fu! ctrlp#line#init(bufnr)
|
|||
retu lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#line#accept(mode, str)
|
||||
let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
|
||||
fu! ctrlp#line#accept(dict)
|
||||
let mode = a:dict['action']
|
||||
let str = a:dict['line']
|
||||
let input = a:dict['input']
|
||||
let info = matchlist(str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
|
||||
let bufnr = str2nr(get(info, 1))
|
||||
if bufnr
|
||||
cal ctrlp#acceptfile(a:mode, bufnr, get(info, 2))
|
||||
cal ctrlp#acceptfile(mode, bufnr, get(info, 2))
|
||||
let @/ = input
|
||||
call search(input, 'c')
|
||||
call histadd("search", input)
|
||||
en
|
||||
endf
|
||||
|
||||
|
|
|
@ -137,8 +137,8 @@ fu! ctrlp#tag#id()
|
|||
endf
|
||||
|
||||
fu! ctrlp#tag#enter()
|
||||
let tfs = tagfiles()
|
||||
let s:tagfiles = tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, ":p")'),
|
||||
let tfs = get(g:, 'ctrlp_custom_tag_files', tagfiles())
|
||||
let s:tagfiles = type(tfs) == 3 && tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, ":p")'),
|
||||
\ 'filereadable(v:val)') : []
|
||||
endf
|
||||
"}}}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
*ctrlp.txt* 模糊的 文件, 缓冲区, 最近最多使用, 标签, ... 检索. v1.79
|
||||
*ctrlp.txt* 支持模糊匹配的 文件, 缓冲区, 最近最多使用, 标签, ... 检索. v1.79
|
||||
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
|
||||
===============================================================================
|
||||
# #
|
||||
|
@ -68,7 +68,7 @@ OPTIONS *ctrlp-options*
|
|||
|ctrlp_arg_map|...............是否拦截<c-y> 和 <c-o> 命令。
|
||||
|ctrlp_follow_symlinks|.......是否跟随链接。
|
||||
|ctrlp_lazy_update|...........停止输入时才更新。
|
||||
|ctrlp_default_input|.........为提示符面板提供一个种子。
|
||||
|ctrlp_default_input|.........为提示符面板提供一个初始字符串。
|
||||
|ctrlp_abbrev|................输入缩写。
|
||||
|ctrlp_key_loop|..............为多字节输入开启输入事件循环。
|
||||
|ctrlp_prompt_mappings|.......改变提示符面板内部的按键绑定。
|
||||
|
@ -76,6 +76,7 @@ OPTIONS *ctrlp-options*
|
|||
|ctrlp_open_single_match|.....当只有一个候选时自动接受。
|
||||
|ctrlp_brief_prompt|..........提示符为空的时候使用<bs>退出 CtrlP。
|
||||
|ctrlp_match_current_file|....在匹配条目中包含当前文件。
|
||||
|ctrlp_types|.................內建类型的名称。
|
||||
|
||||
最近最多使用模式:
|
||||
|ctrlp_mruf_max|..............记录的最近最多使用的最大数据。
|
||||
|
@ -154,6 +155,7 @@ OPTIONS *ctrlp-options*
|
|||
|
||||
结果集的最大数目:
|
||||
results:{n} - 列出最多 {n} 条结果 (默认: 和最大高度同步).
|
||||
0代表没有限制。
|
||||
|
||||
注意: 当一个设置项没有被设置时,将会使用默认值。
|
||||
|
||||
|
@ -254,7 +256,7 @@ OPTIONS *ctrlp-options*
|
|||
考虑清楚。
|
||||
|
||||
*'g:ctrlp_custom_ignore'*
|
||||
作为对 |'wildignore'| 的补充,用来设置你只是想在CtrlP中隐藏的文件和目录。使用正
|
||||
作为对 |'wildignore'| 和 |g:ctrlp_show_hidden| 的补充,用来设置你只是想在CtrlP中隐藏的文件和目录。使用正
|
||||
则表达式来指定匹配模式: >
|
||||
let g:ctrlp_custom_ignore = ''
|
||||
<
|
||||
|
@ -439,13 +441,19 @@ OPTIONS *ctrlp-options*
|
|||
|
||||
|
||||
*'g:ctrlp_match_current_file'*
|
||||
在匹配条目中包含当前文件:
|
||||
在匹配条目中包含当前文件: >
|
||||
let g:ctrlp_match_current_file = 1
|
||||
|
||||
默认情况下,当前文件不包含在列表中。
|
||||
|
||||
注意: 当使用 |g:ctrlp_match_func| 时不会应用这个选项。
|
||||
|
||||
*'g:ctrlp_types'*
|
||||
通过设置这个列表变量的值来定制核心类型: >
|
||||
let g:ctrlp_types = ['mru', 'fil']
|
||||
|
||||
类型默认为: >
|
||||
let g:ctrlp_types = ['fil', 'buf', 'mru'].
|
||||
|
||||
*'g:ctrlp_abbrev'*
|
||||
定义可以在提示面包内被扩展(内部的或者可见的)的输入缩写: >
|
||||
|
@ -817,7 +825,8 @@ MRU mode options:~
|
|||
:CtrlP [起始目录]
|
||||
用文件搜索模式打开CtrlP。
|
||||
|
||||
如果没有给定参数,|g:ctrlp_working_path_mode| 会被用来决定起始目录。
|
||||
如果没有给定参数,|g:ctrlp_working_path_mode| 会被用来决定起始目录。临时覆盖
|
||||
这个参数 的方法见 |:CtrlPCurFile| 和 |:CtrlPCurWD| 。
|
||||
|
||||
在输入时你可以使用 <tab> 自动补全[起始目录]。
|
||||
|
||||
|
@ -825,6 +834,16 @@ MRU mode options:~
|
|||
:CtrlPBuffer
|
||||
用缓冲区搜索模式打开CtrlP。
|
||||
|
||||
*:CtrlPCurFile*
|
||||
:CtrlPCurFile
|
||||
行为类似变量 |g:ctrlp_working_path_mode| = '' 时执行 |:CtrlP| ,忽略这个变量
|
||||
现在的值。
|
||||
|
||||
*:CtrlPCurWD*
|
||||
:CtrlPCurWD
|
||||
行为类似变量 |g:ctrlp_working_path_mode| = '' 时执行 |:CtrlP| ,忽略这个变量
|
||||
现在的值。
|
||||
|
||||
*:CtrlPMRU*
|
||||
:CtrlPMRU
|
||||
用最近最多使用模式打开CtrlP。
|
||||
|
@ -885,7 +904,8 @@ MRU mode options:~
|
|||
在匹配窗口和提示符面板之间切换焦点。
|
||||
|
||||
<esc>,
|
||||
<c-c>
|
||||
<c-c>,
|
||||
<c-g>
|
||||
退出CtrlP。
|
||||
|
||||
移动:~
|
||||
|
@ -1258,7 +1278,8 @@ h) 使用?打开帮助文件。
|
|||
缓冲标签模式选项:~
|
||||
|
||||
*'g:ctrlp_buftag_ctags_bin'*
|
||||
如果ctags没有在环境变量中配置,使用该选项来指定它的位置: >
|
||||
如果ctags没有在环境变量中配置,或者一个二进制ctags文件存在于
|
||||
/opt/local/bin 或 /usr/local/bin,使用该选项来指定它的位置: >
|
||||
let g:ctrlp_buftag_ctags_bin = ''
|
||||
<
|
||||
|
||||
|
@ -1410,6 +1431,31 @@ Git 仓库: https://github.com/ctrlpvim/ctrlp.vim
|
|||
===============================================================================
|
||||
更新日志 *ctrlp-changelog*
|
||||
|
||||
* 新选项 |g:ctrlp_custom_tag_files| 用来指定自定义的标签文件。
|
||||
* 设置 g:ctrlp_match_window 为0来不限制窗口大小
|
||||
|
||||
Before 2016/11/28~
|
||||
|
||||
+ 新命令: |YankLine()| 来复制整个文件。
|
||||
+ 新选项: |g:ctrlp_types| 来选择內建类型。
|
||||
+ 新特性: 异步在新线程中调用 |g:ctrlp_user_command| 。 设置
|
||||
|g:user_command_async| 为1来启用。
|
||||
+ 为 delphi, rust 和 golang提供buffertag支持。
|
||||
+ 新选项: |g:ctrlp_brief_prompt|,
|
||||
|g:match_current_file|,
|
||||
|g:ctrlp_compare_lim|.
|
||||
+ 新功能: 自动忽略扩展。
|
||||
+ 为 ant, tex, dosbatch, matlab 和 vhdl提供buffertag支持。
|
||||
+ 新选项 |g:ctrlp_line_prefix| 来结合第三方插件。
|
||||
+ 新选项 |g:open_single_match| 在 matches 中打开单个文件。
|
||||
+ 添加启动方式 <plug>(ctrlp) 。
|
||||
+ 接受 bang for CtrlPBookmarkDirAdd 来避免确认。
|
||||
+ 处理像 "g:ctrlp_TYPE_MODE" 大小写混合的变量名。
|
||||
例如: let g:ctrlp_path_sort
|
||||
+ 新选项: |g:ctrlp_custom_ancestors|
|
||||
|
||||
在2014/08/08之前~
|
||||
|
||||
+ 新的支持高亮的缓冲区浏览模式 (建议 |+conceal|)
|
||||
+ 新选项: |g:ctrlp_bufname_mod|,
|
||||
|g:ctrlp_bufpath_mod|
|
||||
|
|
|
@ -68,6 +68,7 @@ Overview:~
|
|||
|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.
|
||||
|
@ -147,6 +148,7 @@ The minimum and maximum heights:
|
|||
|
||||
The maximum number of results:
|
||||
results:{n} - list maximum {n} results (default: sync with max height).
|
||||
0 mean no-limit.
|
||||
|
||||
Note: When a setting isn't set, its default value will be used.
|
||||
|
||||
|
@ -254,8 +256,9 @@ plugins look for .git/, .hg/,... some other plugins look for external *.exe
|
|||
tools on Windows). So be a little mindful of what you put in your |wildignore|.
|
||||
|
||||
*'g:ctrlp_custom_ignore'*
|
||||
In addition to |'wildignore'|, use this for files and directories you want only
|
||||
CtrlP to not show. Use regexp to specify the patterns: >
|
||||
In addition to |'wildignore'| and |g:ctrlp_show_hidden|, use this for files
|
||||
and directories you want only CtrlP to not show. Use regexp to specify the
|
||||
patterns: >
|
||||
let g:ctrlp_custom_ignore = ''
|
||||
<
|
||||
Examples: >
|
||||
|
@ -454,13 +457,19 @@ This option works well together with |g:ctrlp_open_single_match|
|
|||
|
||||
|
||||
*'g:ctrlp_match_current_file'*
|
||||
Includes the current file in the match entries:
|
||||
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)
|
||||
|
@ -629,7 +638,6 @@ Set this to 1 to save every MRU file path $HOME/$filepath in the $HOME dir
|
|||
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: >
|
||||
|
@ -839,7 +847,7 @@ Example: >
|
|||
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.
|
||||
Otherwise, you can use below to change default value.
|
||||
Example: >
|
||||
let g:ctrlp_path_nolim = 1
|
||||
|
||||
|
@ -853,7 +861,8 @@ COMMANDS *ctrlp-commands*
|
|||
Open CtrlP in find file mode.
|
||||
|
||||
If no argument is given, the value of |g:ctrlp_working_path_mode| will be
|
||||
used to determine the starting directory.
|
||||
used to determine the starting directory. See |:CtrlPCurFile| and
|
||||
|:CtrlPCurWD| to temporarily override the setting.
|
||||
|
||||
You can use <tab> to auto-complete the [starting-directory] when typing it.
|
||||
|
||||
|
@ -861,6 +870,16 @@ COMMANDS *ctrlp-commands*
|
|||
:CtrlPBuffer
|
||||
Open CtrlP in find buffer mode.
|
||||
|
||||
*:CtrlPCurFile*
|
||||
:CtrlPCurFile
|
||||
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'c' and ignores
|
||||
the variable's current value.
|
||||
|
||||
*:CtrlPCurWD*
|
||||
:CtrlPCurWD
|
||||
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'd' and ignores
|
||||
the variable's current value.
|
||||
|
||||
*:CtrlPMRU*
|
||||
:CtrlPMRU
|
||||
Open CtrlP in find Most-Recently-Used file mode.
|
||||
|
@ -924,7 +943,8 @@ Once inside the prompt:~
|
|||
Toggle the focus between the match window and the prompt.
|
||||
|
||||
<esc>,
|
||||
<c-c>
|
||||
<c-c>,
|
||||
<c-g>
|
||||
Exit CtrlP.
|
||||
|
||||
Moving:~
|
||||
|
@ -1322,7 +1342,8 @@ Available extensions:~
|
|||
Buffer Tag mode options:~
|
||||
|
||||
*'g:ctrlp_buftag_ctags_bin'*
|
||||
If ctags isn't in your $PATH, use this to set its location: >
|
||||
If ctags isn't in your $PATH, or a ctags binary exists in either
|
||||
/opt/local/bin or /usr/local/bin, us this to set its location: >
|
||||
let g:ctrlp_buftag_ctags_bin = ''
|
||||
<
|
||||
|
||||
|
@ -1476,6 +1497,31 @@ Special thanks:~
|
|||
===============================================================================
|
||||
CHANGELOG *ctrlp-changelog*
|
||||
|
||||
* New option |g:ctrlp_custom_tag_files| to specify custom tag files.
|
||||
* Accept 0 for g:ctrlp_match_window no-limited window size.
|
||||
|
||||
Before 2016/11/28~
|
||||
|
||||
+ New command: |YankLine()| to yank current line.
|
||||
+ New option: |g:ctrlp_types| to select builtin modes.
|
||||
+ New feature: asynchronized spawn of |g:ctrlp_user_command|. This enable
|
||||
with set |g:user_command_async| to 1.
|
||||
+ Support buffertag for delphi, rust and golang.
|
||||
+ New option: |g:ctrlp_brief_prompt|,
|
||||
|g:match_current_file|,
|
||||
|g:ctrlp_compare_lim|.
|
||||
+ New feature: Auto-ignore extension.
|
||||
+ Support buffertag for ant, tex, dosbatch, matlab and vhdl.
|
||||
+ New option |g:ctrlp_line_prefix| for integrating third party plugins.
|
||||
+ New option |g:open_single_match| to open single file in matches.
|
||||
+ Add <plug>(ctrlp) for launch CtrlP.
|
||||
+ Accept bang for CtrlPBookmarkDirAdd to avoid confirm.
|
||||
+ Handle variable like "g:ctrlp_TYPE_MODE".
|
||||
ex: let g:ctrlp_path_sort
|
||||
+ New option: |g:ctrlp_custom_ancestors|
|
||||
|
||||
Before 2014/08/08~
|
||||
|
||||
+ New buffer explorer mode with highlighting (|+conceal| recommended)
|
||||
+ New options: |g:ctrlp_bufname_mod|,
|
||||
|g:ctrlp_bufpath_mod|
|
||||
|
|
|
@ -18,9 +18,9 @@ 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 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,9 +29,9 @@ 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' })
|
||||
|
||||
exe 'nn <silent> <plug>(ctrlp) :<c-u>'.g:ctrlp_cmd.'<cr>'
|
||||
|
||||
|
@ -39,7 +39,9 @@ if g:ctrlp_map != '' && !hasmapto('<plug>(ctrlp)')
|
|||
exe 'map' g:ctrlp_map '<plug>(ctrlp)'
|
||||
en
|
||||
|
||||
cal ctrlp#mrufiles#init()
|
||||
if !exists('g:ctrlp_types') || index(g:ctrlp_types, 'mru') >= 0
|
||||
cal ctrlp#mrufiles#init()
|
||||
en
|
||||
|
||||
com! -bar CtrlPTag cal ctrlp#init(ctrlp#tag#id())
|
||||
com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
|
||||
|
@ -55,10 +57,10 @@ 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())
|
||||
|
|
|
@ -64,6 +64,10 @@ Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 fi
|
|||
|
||||
If more than one mode is specified, they will be tried in order until a directory is located.
|
||||
|
||||
* If a file is already open, open it again in a new pane instead of switching to the existing pane
|
||||
|
||||
`let g:ctrlp_switch_buffer = 'et'`
|
||||
|
||||
* 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
|
||||
|
|
|
@ -33,7 +33,7 @@ function! s:get_color(group, attr)
|
|||
endfunction
|
||||
|
||||
function! s:set_color(group, attr, color)
|
||||
let gui = a:color =~ '^#'
|
||||
let gui = has('gui_running') || has('termguicolors') && &termguicolors
|
||||
execute printf('hi %s %s%s=%s', a:group, gui ? 'gui' : 'cterm', a:attr, a:color)
|
||||
endfunction
|
||||
|
||||
|
@ -122,7 +122,7 @@ function! s:tranquilize()
|
|||
endfunction
|
||||
|
||||
function! s:hide_statusline()
|
||||
let &l:statusline = repeat(' ', winwidth(0))
|
||||
setlocal statusline=\
|
||||
endfunction
|
||||
|
||||
function! s:hide_linenr()
|
||||
|
@ -239,7 +239,7 @@ function! s:goyo_on(dim)
|
|||
set showtabline=0
|
||||
set noruler
|
||||
set fillchars+=vert:\
|
||||
set fillchars+=stl:.
|
||||
set fillchars+=stl:\
|
||||
set fillchars+=stlnc:\
|
||||
set sidescroll=1
|
||||
set sidescrolloff=0
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
goyo.txt goyo Last change: April 2 2017
|
||||
GOYO - TABLE OF CONTENTS *goyo* *goyo-toc*
|
||||
==============================================================================
|
||||
|
||||
goyo.vim (고요)
|
||||
Installation
|
||||
Usage
|
||||
Dimension expression
|
||||
Configuration
|
||||
Callbacks
|
||||
Inspiration
|
||||
Pros.
|
||||
License
|
||||
|
||||
GOYO.VIM (고요) *goyo-vim*
|
||||
==============================================================================
|
||||
|
||||
Distraction-free writing in Vim.
|
||||
|
||||
https://raw.github.com/junegunn/i/master/goyo.png
|
||||
|
||||
(Color scheme: {seoul256}{1})
|
||||
|
||||
Best served with {limelight.vim}{2}.
|
||||
|
||||
{1} https://github.com/junegunn/seoul256.vim
|
||||
{2} https://github.com/junegunn/limelight.vim
|
||||
|
||||
|
||||
INSTALLATION *goyo-installation*
|
||||
==============================================================================
|
||||
|
||||
Use your favorite plugin manager.
|
||||
|
||||
*:PlugInstall*
|
||||
|
||||
- {vim-plug}{3}
|
||||
1. Add `Plug 'junegunn/goyo.vim'` to .vimrc
|
||||
2. Run `:PlugInstall`
|
||||
|
||||
{3} https://github.com/junegunn/vim-plug
|
||||
|
||||
|
||||
USAGE *goyo-usage*
|
||||
==============================================================================
|
||||
|
||||
*:Goyo*
|
||||
|
||||
- `:Goyo`
|
||||
- Toggle Goyo
|
||||
- `:Goyo [dimension]`
|
||||
- Turn on or resize Goyo
|
||||
- `:Goyo!`
|
||||
- Turn Goyo off
|
||||
|
||||
The window can be resized with the usual count]<CTRL-W + `>`, `<`, `+`, `-`
|
||||
keys.
|
||||
|
||||
|
||||
< Dimension expression >______________________________________________________~
|
||||
*goyo-dimension-expression*
|
||||
|
||||
The expected format of a dimension expression is
|
||||
`[WIDTH][XOFFSET][x[HEIGHT][YOFFSET]]`. `XOFFSET` and `YOFFSET` should be
|
||||
prefixed by `+` or `-`. Each component can be given in percentage.
|
||||
>
|
||||
" Width
|
||||
Goyo 120
|
||||
|
||||
" Height
|
||||
Goyo x30
|
||||
|
||||
" Both
|
||||
Goyo 120x30
|
||||
|
||||
" In percentage
|
||||
Goyo 120x50%
|
||||
|
||||
" With offsets
|
||||
Goyo 50%+25%x50%-25%
|
||||
<
|
||||
|
||||
CONFIGURATION *goyo-configuration*
|
||||
==============================================================================
|
||||
|
||||
*g:goyo_width* *g:goyo_height* *g:goyo_linenr*
|
||||
|
||||
- `g:goyo_width` (default: 80)
|
||||
- `g:goyo_height` (default: 85%)
|
||||
- `g:goyo_linenr` (default: 0)
|
||||
|
||||
|
||||
< Callbacks >_________________________________________________________________~
|
||||
*goyo-callbacks*
|
||||
|
||||
By default, {vim-airline}{4}, {vim-powerline}{5}, {powerline}{6},
|
||||
{lightline.vim}{7}, {vim-signify}{8}, and {vim-gitgutter}{9} are temporarily
|
||||
disabled while in Goyo mode.
|
||||
|
||||
If you have other plugins that you want to disable/enable, or if you want to
|
||||
change the default settings of Goyo window, you can set up custom routines to
|
||||
be triggered on `GoyoEnter` and `GoyoLeave` events.
|
||||
>
|
||||
function! s:goyo_enter()
|
||||
silent !tmux set status off
|
||||
silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z
|
||||
set noshowmode
|
||||
set noshowcmd
|
||||
set scrolloff=999
|
||||
Limelight
|
||||
" ...
|
||||
endfunction
|
||||
|
||||
function! s:goyo_leave()
|
||||
silent !tmux set status on
|
||||
silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z
|
||||
set showmode
|
||||
set showcmd
|
||||
set scrolloff=5
|
||||
Limelight!
|
||||
" ...
|
||||
endfunction
|
||||
|
||||
autocmd! User GoyoEnter nested call <SID>goyo_enter()
|
||||
autocmd! User GoyoLeave nested call <SID>goyo_leave()
|
||||
<
|
||||
More examples can be found here: {Customization}{10}
|
||||
|
||||
{4} https://github.com/bling/vim-airline
|
||||
{5} https://github.com/Lokaltog/vim-powerline
|
||||
{6} https://github.com/Lokaltog/powerline
|
||||
{7} https://github.com/itchyny/lightline.vim
|
||||
{8} https://github.com/mhinz/vim-signify
|
||||
{9} https://github.com/airblade/vim-gitgutter
|
||||
{10} https://github.com/junegunn/goyo.vim/wiki/Customization
|
||||
|
||||
|
||||
INSPIRATION *goyo-inspiration*
|
||||
==============================================================================
|
||||
|
||||
- {LiteDFM}{11}
|
||||
- {VimRoom}{12}
|
||||
|
||||
{11} https://github.com/bilalq/lite-dfm
|
||||
{12} http://projects.mikewest.org/vimroom/
|
||||
|
||||
|
||||
PROS. *goyo-pros*
|
||||
==============================================================================
|
||||
|
||||
1. Works well with splits. Doesn't mess up with the current window arrangement
|
||||
2. Works well with popular statusline plugins
|
||||
3. Prevents accessing the empty windows around the central buffer
|
||||
4. Can be closed with any of `:q[uit]`, `:clo[se]`, `:tabc[lose]`, or `:Goyo`
|
||||
5. Can dynamically change the width of the window
|
||||
6. Adjusts its colors when color scheme is changed
|
||||
7. Realigns the window when the terminal (or window) is resized or when the size
|
||||
of the font is changed
|
||||
8. Correctly hides colorcolumns and Emojis in statusline
|
||||
9. Highly customizable with callbacks
|
||||
|
||||
|
||||
LICENSE *goyo-license*
|
||||
==============================================================================
|
||||
|
||||
MIT
|
||||
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap:
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 705e68d90d6596c621093a28bf480a572a41ad02
|
|
@ -0,0 +1,117 @@
|
|||
# Change Log
|
||||
|
||||
## [Unreleased](https://github.com/morhetz/gruvbox/tree/HEAD)
|
||||
|
||||
[Full Changelog](https://github.com/morhetz/gruvbox/compare/v1.3.5...HEAD)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Lighter background on terminal [\#8](https://github.com/morhetz/gruvbox/issues/8)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Installation issue. [\#54](https://github.com/morhetz/gruvbox/issues/54)
|
||||
|
||||
- Italic font in terminal\(urxvt\) [\#49](https://github.com/morhetz/gruvbox/issues/49)
|
||||
|
||||
- Unable to log in when sourcing the palette shellscript [\#48](https://github.com/morhetz/gruvbox/issues/48)
|
||||
|
||||
- How can i modify multiple comment scheme [\#46](https://github.com/morhetz/gruvbox/issues/46)
|
||||
|
||||
- Remove comment highlight in iterm [\#44](https://github.com/morhetz/gruvbox/issues/44)
|
||||
|
||||
- Comments looking strange withing tmux [\#43](https://github.com/morhetz/gruvbox/issues/43)
|
||||
|
||||
- comments are reverse-video in xterm [\#41](https://github.com/morhetz/gruvbox/issues/41)
|
||||
|
||||
- What font are you using in the screenshots? [\#39](https://github.com/morhetz/gruvbox/issues/39)
|
||||
|
||||
- vim-signature crashes when I use gruvbox [\#38](https://github.com/morhetz/gruvbox/issues/38)
|
||||
|
||||
- Color of statusbar in inactive windows [\#37](https://github.com/morhetz/gruvbox/issues/37)
|
||||
|
||||
- Go method and struct highlighting missing [\#36](https://github.com/morhetz/gruvbox/issues/36)
|
||||
|
||||
- gruvbox\_256palette.sh doesn't work for Konsole [\#35](https://github.com/morhetz/gruvbox/issues/35)
|
||||
|
||||
- Contrast in jekyll markdown files [\#33](https://github.com/morhetz/gruvbox/issues/33)
|
||||
|
||||
- Pentadactyl Gruvbox Theme [\#32](https://github.com/morhetz/gruvbox/issues/32)
|
||||
|
||||
- make vertsplit better [\#31](https://github.com/morhetz/gruvbox/issues/31)
|
||||
|
||||
- Console support. [\#30](https://github.com/morhetz/gruvbox/issues/30)
|
||||
|
||||
- How can I change the background color? [\#29](https://github.com/morhetz/gruvbox/issues/29)
|
||||
|
||||
- Some words are not bold [\#28](https://github.com/morhetz/gruvbox/issues/28)
|
||||
|
||||
- Terminal theme on base gruvbox [\#25](https://github.com/morhetz/gruvbox/issues/25)
|
||||
|
||||
- Markdown has inverted colors when using \* [\#24](https://github.com/morhetz/gruvbox/issues/24)
|
||||
|
||||
- how install it on mac osx [\#23](https://github.com/morhetz/gruvbox/issues/23)
|
||||
|
||||
- Comments color for Terminal Vim [\#22](https://github.com/morhetz/gruvbox/issues/22)
|
||||
|
||||
- Move palette files to gruvbox-generalized [\#20](https://github.com/morhetz/gruvbox/issues/20)
|
||||
|
||||
- Maybe add Gruvbox Airline theme? [\#19](https://github.com/morhetz/gruvbox/issues/19)
|
||||
|
||||
- For Sublime text [\#18](https://github.com/morhetz/gruvbox/issues/18)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fix the 256 palette script failed login issue [\#53](https://github.com/morhetz/gruvbox/pull/53) ([jonasmalacofilho](https://github.com/jonasmalacofilho))
|
||||
|
||||
- add minimal coloring for gitcommit highlighting [\#52](https://github.com/morhetz/gruvbox/pull/52) ([daniely](https://github.com/daniely))
|
||||
|
||||
- For terminals, turn off italics by default. [\#47](https://github.com/morhetz/gruvbox/pull/47) ([ryanmjacobs](https://github.com/ryanmjacobs))
|
||||
|
||||
- Change color of vertical/horizontal seperators between split windows [\#45](https://github.com/morhetz/gruvbox/pull/45) ([deshtop](https://github.com/deshtop))
|
||||
|
||||
- Improve gruvbox with C code [\#34](https://github.com/morhetz/gruvbox/pull/34) ([gladiac](https://github.com/gladiac))
|
||||
|
||||
- Fix for linux console [\#27](https://github.com/morhetz/gruvbox/pull/27) ([vyp](https://github.com/vyp))
|
||||
|
||||
- Colors for plugin vimshell.vim [\#21](https://github.com/morhetz/gruvbox/pull/21) ([joelmo](https://github.com/joelmo))
|
||||
|
||||
## [v1.3.5](https://github.com/morhetz/gruvbox/tree/v1.3.5) (2014-03-19)
|
||||
|
||||
[Full Changelog](https://github.com/morhetz/gruvbox/compare/v0.0.8...v1.3.5)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Better selection colors [\#15](https://github.com/morhetz/gruvbox/issues/15)
|
||||
|
||||
- When hlsearch is on, the cursor inverts the search color and not visible [\#2](https://github.com/morhetz/gruvbox/issues/2)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Problem with changing between dark and light on 256 color terminal [\#7](https://github.com/morhetz/gruvbox/issues/7)
|
||||
|
||||
- IndentGuides coloring doesn't show up [\#1](https://github.com/morhetz/gruvbox/issues/1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Requesting rxvt-unicode theme [\#17](https://github.com/morhetz/gruvbox/issues/17)
|
||||
|
||||
- gruvbox\_256palette.sh gets reset \(gnome-terminal on Ubuntu\) [\#13](https://github.com/morhetz/gruvbox/issues/13)
|
||||
|
||||
- Powerline colors [\#12](https://github.com/morhetz/gruvbox/issues/12)
|
||||
|
||||
- Info necessary for making a port of this colorscheme [\#10](https://github.com/morhetz/gruvbox/issues/10)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fix GNU screen detection for \*-bce [\#16](https://github.com/morhetz/gruvbox/pull/16) ([blueyed](https://github.com/blueyed))
|
||||
|
||||
- Added iTerm2 dark theme [\#11](https://github.com/morhetz/gruvbox/pull/11) ([Greduan](https://github.com/Greduan))
|
||||
|
||||
- Fix typo in Readme [\#5](https://github.com/morhetz/gruvbox/pull/5) ([ViViDboarder](https://github.com/ViViDboarder))
|
||||
|
||||
## [v0.0.8](https://github.com/morhetz/gruvbox/tree/v0.0.8) (2012-12-08)
|
||||
|
||||
|
||||
|
||||
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
|
@ -0,0 +1,113 @@
|
|||
<p align="center"><img src="http://svgur.com/i/3Dp.svg"></p>
|
||||
|
||||
gruvbox is heavily inspired by [badwolf][], [jellybeans][] and [solarized][].
|
||||
|
||||
Designed as a bright theme with pastel 'retro groove' colors and light/dark mode switching in the way of [solarized][]. The main focus when developing gruvbox is to keep colors easily distinguishable, contrast enough and still pleasant for the eyes.
|
||||
|
||||
[badwolf]: https://github.com/sjl/badwolf
|
||||
[jellybeans]: https://github.com/nanotech/jellybeans.vim
|
||||
[solarized]: http://ethanschoonover.com/solarized
|
||||
|
||||
Attention
|
||||
---------
|
||||
|
||||
1. [Read this first](https://github.com/morhetz/gruvbox/wiki/Terminal-specific)
|
||||
2. Typeface from gallery is [Fantasque Sans Mono](https://github.com/belluzj/fantasque-sans)
|
||||
3. Typeface from screenshots below is [Fira Mono](http://www.carrois.com/fira-4-1/)
|
||||
|
||||
Screenshots
|
||||
-----------
|
||||
|
||||
Refer [Gallery][] for more syntax-specific screenshots.
|
||||
|
||||
[Gallery]: https://github.com/morhetz/gruvbox/wiki/Gallery
|
||||
|
||||
### Dark mode
|
||||
|
||||
![Screenshot Dark](http://i.imgur.com/GkIl8Fn.png)
|
||||
|
||||
### Light mode
|
||||
|
||||
![Screenshot Light](http://i.imgur.com/X75niEa.png)
|
||||
|
||||
### Airline theme
|
||||
|
||||
![Screenshot Airline](http://i.imgur.com/wRQceUR.png)
|
||||
|
||||
Palette
|
||||
-------
|
||||
|
||||
### Dark mode
|
||||
|
||||
![Palette Dark](http://i.imgur.com/wa666xg.png)
|
||||
|
||||
### Light mode
|
||||
|
||||
![Palette Light](http://i.imgur.com/49qKyYW.png)
|
||||
|
||||
Contrast options
|
||||
----------------
|
||||
|
||||
Refer [wiki section][] for contrast configuration and other options.
|
||||
|
||||
[wiki section]: https://github.com/morhetz/gruvbox/wiki/Configuration#ggruvbox_contrast_dark
|
||||
|
||||
![Contrast Options](http://i.imgur.com/5MSbe6T.png)
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
Please check [wiki][] for installation details, terminal-specific setup, troubleshooting, configuration options and others.
|
||||
|
||||
[wiki]: https://github.com/morhetz/gruvbox/wiki
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Lots of style-customization options (contrast, color invertion, italics usage etc.)
|
||||
* Extended filetype highlighting: Html, Xml, Vim, Clojure, C, Python, JavaScript, TypeScript, PureScript, CoffeeScript, Ruby, Objective-C, Go, Lua, MoonScript, Java, Markdown, Haskell, Elixir
|
||||
* Supported plugins: [EasyMotion][], [vim-sneak][], [Indent Guides][], [indentLine][], [Rainbow Parentheses][], [Airline][], [Lightline][], [GitGutter][], [Signify][], [ShowMarks][], [Signature][], [Syntastic][], [Ale][], [CtrlP][], [Startify][], [NERDTree][], [Dirvish][]
|
||||
|
||||
[EasyMotion]: https://github.com/Lokaltog/vim-easymotion
|
||||
[vim-sneak]: https://github.com/justinmk/vim-sneak
|
||||
[Indent Guides]: https://github.com/nathanaelkane/vim-indent-guides
|
||||
[indentLine]: https://github.com/Yggdroot/indentLine
|
||||
[Rainbow Parentheses]: https://github.com/kien/rainbow_parentheses.vim
|
||||
[Airline]: https://github.com/bling/vim-airline
|
||||
[Lightline]: https://github.com/itchyny/lightline.vim
|
||||
[GitGutter]: https://github.com/airblade/vim-gitgutter
|
||||
[Signify]: https://github.com/mhinz/vim-signify
|
||||
[ShowMarks]: http://www.vim.org/scripts/script.php?script_id=152
|
||||
[Signature]: https://github.com/kshenoy/vim-signature
|
||||
[Syntastic]: https://github.com/scrooloose/syntastic
|
||||
[Ale]: https://github.com/w0rp/ale
|
||||
[CtrlP]: https://github.com/kien/ctrlp.vim
|
||||
[Startify]: https://github.com/mhinz/vim-startify
|
||||
[NERDTree]: https://github.com/scrooloose/nerdtree
|
||||
[Dirvish]: https://github.com/justinmk/vim-dirvish
|
||||
|
||||
Contributions
|
||||
-------------
|
||||
|
||||
See [gruvbox-contrib][] repo for contributions, ports and extras.
|
||||
|
||||
[gruvbox-contrib]: https://github.com/morhetz/gruvbox-contrib
|
||||
|
||||
ToDo
|
||||
----
|
||||
|
||||
* Filetype syntax highlighting (R, TeX, Swift, Erlang)
|
||||
* Plugin support (Tagbar, VimPlug)
|
||||
|
||||
Self-Promotion
|
||||
--------------
|
||||
|
||||
If you like gruvbox follow the repository on
|
||||
[GitHub](https://github.com/morhetz/gruvbox) and vote for it on
|
||||
[vim.org](http://www.vim.org/scripts/script.php?script_id=4349).
|
||||
|
||||
License
|
||||
-------
|
||||
[MIT/X11][]
|
||||
|
||||
[MIT/X11]: https://en.wikipedia.org/wiki/MIT_License
|
|
@ -0,0 +1,79 @@
|
|||
" -----------------------------------------------------------------------------
|
||||
" File: gruvbox.vim
|
||||
" Description: Retro groove color scheme for Airline
|
||||
" Author: morhetz <morhetz@gmail.com>
|
||||
" Source: https://github.com/morhetz/gruvbox
|
||||
" Last Modified: 12 Aug 2017
|
||||
" -----------------------------------------------------------------------------
|
||||
|
||||
let g:airline#themes#gruvbox#palette = {}
|
||||
|
||||
function! airline#themes#gruvbox#refresh()
|
||||
|
||||
let M0 = airline#themes#get_highlight('Identifier')
|
||||
let accents_group = airline#themes#get_highlight('Special')
|
||||
let modified_group = [M0[0], '', M0[2], '', '']
|
||||
let warning_group = airline#themes#get_highlight2(['Normal', 'bg'], ['Question', 'fg'])
|
||||
let error_group = airline#themes#get_highlight2(['Normal', 'bg'], ['WarningMsg', 'fg'])
|
||||
|
||||
let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['StatusLineNC', 'bg'])
|
||||
let s:N2 = airline#themes#get_highlight2(['StatusLineNC', 'bg'], ['Pmenu', 'bg'])
|
||||
let s:N3 = airline#themes#get_highlight2(['StatusLineNC', 'bg'], ['CursorLine', 'bg'])
|
||||
let g:airline#themes#gruvbox#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#gruvbox#palette.normal_modified = { 'airline_c': modified_group }
|
||||
let g:airline#themes#gruvbox#palette.normal.airline_warning = warning_group
|
||||
let g:airline#themes#gruvbox#palette.normal_modified.airline_warning = warning_group
|
||||
let g:airline#themes#gruvbox#palette.normal.airline_error = error_group
|
||||
let g:airline#themes#gruvbox#palette.normal_modified.airline_error = error_group
|
||||
|
||||
let s:I1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Identifier', 'fg'])
|
||||
let s:I2 = s:N2
|
||||
let s:I3 = airline#themes#get_highlight2(['Normal', 'fg'], ['Pmenu', 'bg'])
|
||||
let g:airline#themes#gruvbox#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#gruvbox#palette.insert_modified = g:airline#themes#gruvbox#palette.normal_modified
|
||||
let g:airline#themes#gruvbox#palette.insert.airline_warning = g:airline#themes#gruvbox#palette.normal.airline_warning
|
||||
let g:airline#themes#gruvbox#palette.insert_modified.airline_warning = g:airline#themes#gruvbox#palette.normal_modified.airline_warning
|
||||
let g:airline#themes#gruvbox#palette.insert.airline_error = g:airline#themes#gruvbox#palette.normal.airline_error
|
||||
let g:airline#themes#gruvbox#palette.insert_modified.airline_error = g:airline#themes#gruvbox#palette.normal_modified.airline_error
|
||||
|
||||
let s:R1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Structure', 'fg'])
|
||||
let s:R2 = s:I2
|
||||
let s:R3 = s:I3
|
||||
let g:airline#themes#gruvbox#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
|
||||
let g:airline#themes#gruvbox#palette.replace_modified = g:airline#themes#gruvbox#palette.normal_modified
|
||||
let g:airline#themes#gruvbox#palette.replace.airline_warning = g:airline#themes#gruvbox#palette.normal.airline_warning
|
||||
let g:airline#themes#gruvbox#palette.replace_modified.airline_warning = g:airline#themes#gruvbox#palette.normal_modified.airline_warning
|
||||
let g:airline#themes#gruvbox#palette.replace.airline_error = g:airline#themes#gruvbox#palette.normal.airline_error
|
||||
let g:airline#themes#gruvbox#palette.replace_modified.airline_error = g:airline#themes#gruvbox#palette.normal_modified.airline_error
|
||||
|
||||
let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Question', 'fg'])
|
||||
let s:V2 = s:N2
|
||||
let s:V3 = airline#themes#get_highlight2(['Normal', 'bg'], ['TabLine', 'fg'])
|
||||
let g:airline#themes#gruvbox#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#gruvbox#palette.visual_modified = { 'airline_c': [ s:V3[0], '', s:V3[2], '', '' ] }
|
||||
let g:airline#themes#gruvbox#palette.visual.airline_warning = g:airline#themes#gruvbox#palette.normal.airline_warning
|
||||
let g:airline#themes#gruvbox#palette.visual_modified.airline_warning = g:airline#themes#gruvbox#palette.normal_modified.airline_warning
|
||||
let g:airline#themes#gruvbox#palette.visual.airline_error = g:airline#themes#gruvbox#palette.normal.airline_error
|
||||
let g:airline#themes#gruvbox#palette.visual_modified.airline_error = g:airline#themes#gruvbox#palette.normal_modified.airline_error
|
||||
|
||||
let s:IA = airline#themes#get_highlight2(['TabLine', 'fg'], ['CursorLine', 'bg'])
|
||||
let g:airline#themes#gruvbox#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#gruvbox#palette.inactive_modified = { 'airline_c': modified_group }
|
||||
|
||||
let g:airline#themes#gruvbox#palette.accents = { 'red': accents_group }
|
||||
|
||||
let s:TF = airline#themes#get_highlight2(['Normal', 'bg'], ['Normal', 'bg'])
|
||||
let g:airline#themes#gruvbox#palette.tabline = {
|
||||
\ 'airline_tab': s:N2,
|
||||
\ 'airline_tabsel': s:N1,
|
||||
\ 'airline_tabtype': s:V1,
|
||||
\ 'airline_tabfill': s:TF,
|
||||
\ 'airline_tabhid': s:IA,
|
||||
\ 'airline_tabmod': s:I1
|
||||
\ }
|
||||
|
||||
endfunction
|
||||
|
||||
call airline#themes#gruvbox#refresh()
|
||||
|
||||
" vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker:
|
|
@ -0,0 +1,41 @@
|
|||
" -----------------------------------------------------------------------------
|
||||
" File: gruvbox.vim
|
||||
" Description: Retro groove color scheme for Vim
|
||||
" Author: morhetz <morhetz@gmail.com>
|
||||
" Source: https://github.com/morhetz/gruvbox
|
||||
" Last Modified: 09 Apr 2014
|
||||
" -----------------------------------------------------------------------------
|
||||
|
||||
function! gruvbox#invert_signs_toggle()
|
||||
if g:gruvbox_invert_signs == 0
|
||||
let g:gruvbox_invert_signs=1
|
||||
else
|
||||
let g:gruvbox_invert_signs=0
|
||||
endif
|
||||
|
||||
colorscheme gruvbox
|
||||
endfunction
|
||||
|
||||
" Search Highlighting {{{
|
||||
|
||||
function! gruvbox#hls_show()
|
||||
set hlsearch
|
||||
call GruvboxHlsShowCursor()
|
||||
endfunction
|
||||
|
||||
function! gruvbox#hls_hide()
|
||||
set nohlsearch
|
||||
call GruvboxHlsHideCursor()
|
||||
endfunction
|
||||
|
||||
function! gruvbox#hls_toggle()
|
||||
if &hlsearch
|
||||
call gruvbox#hls_hide()
|
||||
else
|
||||
call gruvbox#hls_show()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}
|
||||
|
||||
" vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker:
|
|
@ -0,0 +1,57 @@
|
|||
" -----------------------------------------------------------------------------
|
||||
" File: gruvbox.vim
|
||||
" Description: Gruvbox colorscheme for Lightline (itchyny/lightline.vim)
|
||||
" Author: gmoe <me@griffinmoe.com>
|
||||
" Source: https://github.com/morhetz/gruvbox
|
||||
" Last Modified: 20 Sep 2017
|
||||
" -----------------------------------------------------------------------------
|
||||
|
||||
function! s:getGruvColor(group)
|
||||
let guiColor = synIDattr(hlID(a:group), "fg", "gui")
|
||||
let termColor = synIDattr(hlID(a:group), "fg", "cterm")
|
||||
return [ guiColor, termColor ]
|
||||
endfunction
|
||||
|
||||
if exists('g:lightline')
|
||||
|
||||
let s:bg0 = s:getGruvColor('GruvboxBg0')
|
||||
let s:bg1 = s:getGruvColor('GruvboxBg1')
|
||||
let s:bg2 = s:getGruvColor('GruvboxBg2')
|
||||
let s:bg4 = s:getGruvColor('GruvboxBg4')
|
||||
let s:fg1 = s:getGruvColor('GruvboxFg1')
|
||||
let s:fg4 = s:getGruvColor('GruvboxFg4')
|
||||
|
||||
let s:yellow = s:getGruvColor('GruvboxYellow')
|
||||
let s:blue = s:getGruvColor('GruvboxBlue')
|
||||
let s:aqua = s:getGruvColor('GruvboxAqua')
|
||||
let s:orange = s:getGruvColor('GruvboxOrange')
|
||||
let s:green = s:getGruvColor('GruvboxGreen')
|
||||
|
||||
let s:p = {'normal':{}, 'inactive':{}, 'insert':{}, 'replace':{}, 'visual':{}, 'tabline':{}, 'terminal':{}}
|
||||
let s:p.normal.left = [ [ s:bg0, s:fg4, 'bold' ], [ s:fg4, s:bg2 ] ]
|
||||
let s:p.normal.right = [ [ s:bg0, s:fg4 ], [ s:fg4, s:bg2 ] ]
|
||||
let s:p.normal.middle = [ [ s:fg4, s:bg1 ] ]
|
||||
let s:p.inactive.right = [ [ s:bg4, s:bg1 ], [ s:bg4, s:bg1 ] ]
|
||||
let s:p.inactive.left = [ [ s:bg4, s:bg1 ], [ s:bg4, s:bg1 ] ]
|
||||
let s:p.inactive.middle = [ [ s:bg4, s:bg1 ] ]
|
||||
let s:p.insert.left = [ [ s:bg0, s:blue, 'bold' ], [ s:fg1, s:bg2 ] ]
|
||||
let s:p.insert.right = [ [ s:bg0, s:blue ], [ s:fg1, s:bg2 ] ]
|
||||
let s:p.insert.middle = [ [ s:fg4, s:bg2 ] ]
|
||||
let s:p.terminal.left = [ [ s:bg0, s:green, 'bold' ], [ s:fg1, s:bg2 ] ]
|
||||
let s:p.terminal.right = [ [ s:bg0, s:green ], [ s:fg1, s:bg2 ] ]
|
||||
let s:p.terminal.middle = [ [ s:fg4, s:bg2 ] ]
|
||||
let s:p.replace.left = [ [ s:bg0, s:aqua, 'bold' ], [ s:fg1, s:bg2 ] ]
|
||||
let s:p.replace.right = [ [ s:bg0, s:aqua ], [ s:fg1, s:bg2 ] ]
|
||||
let s:p.replace.middle = [ [ s:fg4, s:bg2 ] ]
|
||||
let s:p.visual.left = [ [ s:bg0, s:orange, 'bold' ], [ s:bg0, s:bg4 ] ]
|
||||
let s:p.visual.right = [ [ s:bg0, s:orange ], [ s:bg0, s:bg4 ] ]
|
||||
let s:p.visual.middle = [ [ s:fg4, s:bg1 ] ]
|
||||
let s:p.tabline.left = [ [ s:fg4, s:bg2 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:bg0, s:fg4 ] ]
|
||||
let s:p.tabline.middle = [ [ s:bg0, s:bg0 ] ]
|
||||
let s:p.tabline.right = [ [ s:bg0, s:orange ] ]
|
||||
let s:p.normal.error = [ [ s:bg0, s:orange ] ]
|
||||
let s:p.normal.warning = [ [ s:bg2, s:yellow ] ]
|
||||
|
||||
let g:lightline#colorscheme#gruvbox#palette = lightline#colorscheme#flatten(s:p)
|
||||
endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,118 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "${TERM%%-*}" = "screen" ]; then
|
||||
if [ -n "$TMUX" ]; then
|
||||
printf "\033Ptmux;\033\033]4;236;rgb:32/30/2f\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;234;rgb:1d/20/21\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;235;rgb:28/28/28\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;237;rgb:3c/38/36\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;239;rgb:50/49/45\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;241;rgb:66/5c/54\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;243;rgb:7c/6f/64\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;244;rgb:92/83/74\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;245;rgb:92/83/74\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;228;rgb:f2/e5/bc\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;230;rgb:f9/f5/d7\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;229;rgb:fb/f1/c7\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;223;rgb:eb/db/b2\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;250;rgb:d5/c4/a1\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;248;rgb:bd/ae/93\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;246;rgb:a8/99/84\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;167;rgb:fb/49/34\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;142;rgb:b8/bb/26\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;214;rgb:fa/bd/2f\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;109;rgb:83/a5/98\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;175;rgb:d3/86/9b\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;108;rgb:8e/c0/7c\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;208;rgb:fe/80/19\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;88;rgb:9d/00/06\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;100;rgb:79/74/0e\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;136;rgb:b5/76/14\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;24;rgb:07/66/78\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;96;rgb:8f/3f/71\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;66;rgb:42/7b/58\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;130;rgb:af/3a/03\007\033\\"
|
||||
else
|
||||
printf "\033P\033]4;236;rgb:32/30/2f\007\033\\"
|
||||
printf "\033P\033]4;234;rgb:1d/20/21\007\033\\"
|
||||
|
||||
printf "\033P\033]4;235;rgb:28/28/28\007\033\\"
|
||||
printf "\033P\033]4;237;rgb:3c/38/36\007\033\\"
|
||||
printf "\033P\033]4;239;rgb:50/49/45\007\033\\"
|
||||
printf "\033P\033]4;241;rgb:66/5c/54\007\033\\"
|
||||
printf "\033P\033]4;243;rgb:7c/6f/64\007\033\\"
|
||||
|
||||
printf "\033P\033]4;244;rgb:92/83/74\007\033\\"
|
||||
printf "\033P\033]4;245;rgb:92/83/74\007\033\\"
|
||||
|
||||
printf "\033P\033]4;228;rgb:f2/e5/bc\007\033\\"
|
||||
printf "\033P\033]4;230;rgb:f9/f5/d7\007\033\\"
|
||||
|
||||
printf "\033P\033]4;229;rgb:fb/f1/c7\007\033\\"
|
||||
printf "\033P\033]4;223;rgb:eb/db/b2\007\033\\"
|
||||
printf "\033P\033]4;250;rgb:d5/c4/a1\007\033\\"
|
||||
printf "\033P\033]4;248;rgb:bd/ae/93\007\033\\"
|
||||
printf "\033P\033]4;246;rgb:a8/99/84\007\033\\"
|
||||
|
||||
printf "\033P\033]4;167;rgb:fb/49/34\007\033\\"
|
||||
printf "\033P\033]4;142;rgb:b8/bb/26\007\033\\"
|
||||
printf "\033P\033]4;214;rgb:fa/bd/2f\007\033\\"
|
||||
printf "\033P\033]4;109;rgb:83/a5/98\007\033\\"
|
||||
printf "\033P\033]4;175;rgb:d3/86/9b\007\033\\"
|
||||
printf "\033P\033]4;108;rgb:8e/c0/7c\007\033\\"
|
||||
printf "\033P\033]4;208;rgb:fe/80/19\007\033\\"
|
||||
|
||||
printf "\033P\033]4;88;rgb:9d/00/06\007\033\\"
|
||||
printf "\033P\033]4;100;rgb:79/74/0e\007\033\\"
|
||||
printf "\033P\033]4;136;rgb:b5/76/14\007\033\\"
|
||||
printf "\033P\033]4;24;rgb:07/66/78\007\033\\"
|
||||
printf "\033P\033]4;96;rgb:8f/3f/71\007\033\\"
|
||||
printf "\033P\033]4;66;rgb:42/7b/58\007\033\\"
|
||||
printf "\033P\033]4;130;rgb:af/3a/03\007\033\\"
|
||||
fi
|
||||
|
||||
elif [ "$TERM" != "linux" ] && [ "$TERM" != "vt100" ] && [ "$TERM" != "vt220" ]; then
|
||||
|
||||
printf "\033]4;236;rgb:32/30/2f\033\\"
|
||||
printf "\033]4;234;rgb:1d/20/21\033\\"
|
||||
|
||||
printf "\033]4;235;rgb:28/28/28\033\\"
|
||||
printf "\033]4;237;rgb:3c/38/36\033\\"
|
||||
printf "\033]4;239;rgb:50/49/45\033\\"
|
||||
printf "\033]4;241;rgb:66/5c/54\033\\"
|
||||
printf "\033]4;243;rgb:7c/6f/64\033\\"
|
||||
|
||||
printf "\033]4;244;rgb:92/83/74\033\\"
|
||||
printf "\033]4;245;rgb:92/83/74\033\\"
|
||||
|
||||
printf "\033]4;228;rgb:f2/e5/bc\033\\"
|
||||
printf "\033]4;230;rgb:f9/f5/d7\033\\"
|
||||
|
||||
printf "\033]4;229;rgb:fb/f1/c7\033\\"
|
||||
printf "\033]4;223;rgb:eb/db/b2\033\\"
|
||||
printf "\033]4;250;rgb:d5/c4/a1\033\\"
|
||||
printf "\033]4;248;rgb:bd/ae/93\033\\"
|
||||
printf "\033]4;246;rgb:a8/99/84\033\\"
|
||||
|
||||
printf "\033]4;167;rgb:fb/49/34\033\\"
|
||||
printf "\033]4;142;rgb:b8/bb/26\033\\"
|
||||
printf "\033]4;214;rgb:fa/bd/2f\033\\"
|
||||
printf "\033]4;109;rgb:83/a5/98\033\\"
|
||||
printf "\033]4;175;rgb:d3/86/9b\033\\"
|
||||
printf "\033]4;108;rgb:8e/c0/7c\033\\"
|
||||
printf "\033]4;208;rgb:fe/80/19\033\\"
|
||||
|
||||
printf "\033]4;88;rgb:9d/00/06\033\\"
|
||||
printf "\033]4;100;rgb:79/74/0e\033\\"
|
||||
printf "\033]4;136;rgb:b5/76/14\033\\"
|
||||
printf "\033]4;24;rgb:07/66/78\033\\"
|
||||
printf "\033]4;96;rgb:8f/3f/71\033\\"
|
||||
printf "\033]4;66;rgb:42/7b/58\033\\"
|
||||
printf "\033]4;130;rgb:af/3a/03\033\\"
|
||||
fi
|
|
@ -0,0 +1,116 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "${TERM%%-*}" = "screen" ]; then
|
||||
if [ -n "$TMUX" ]; then
|
||||
printf "\033Ptmux;\033\033]4;236;rgb:26/24/23\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;234;rgb:16/18/19\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;235;rgb:1e/1e/1e\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;237;rgb:2e/2a/29\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;239;rgb:3f/39/35\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;241;rgb:53/4a/42\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;243;rgb:68/5c/51\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;244;rgb:7f/70/61\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;245;rgb:7f/70/61\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;228;rgb:ef/df/ae\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;230;rgb:f8/f4/cd\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;229;rgb:fa/ee/bb\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;223;rgb:e6/d4/a3\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;250;rgb:cb/b8/90\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;248;rgb:af/9f/81\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;246;rgb:97/87/71\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;167;rgb:f7/30/28\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;142;rgb:aa/b0/1e\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;214;rgb:f7/b1/25\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;109;rgb:71/95/86\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;175;rgb:c7/70/89\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;108;rgb:7d/b6/69\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;208;rgb:fb/6a/16\007\033\\"
|
||||
|
||||
printf "\033Ptmux;\033\033]4;88;rgb:89/00/09\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;100;rgb:66/62/0d\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;136;rgb:a5/63/11\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;24;rgb:0e/53/65\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;96;rgb:7b/2b/5e\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;66;rgb:35/6a/46\007\033\\"
|
||||
printf "\033Ptmux;\033\033]4;130;rgb:9d/28/07\007\033\\"
|
||||
else
|
||||
printf "\033P\033]4;236;rgb:26/24/23\007\033\\"
|
||||
printf "\033P\033]4;234;rgb:16/18/19\007\033\\"
|
||||
|
||||
printf "\033P\033]4;235;rgb:1e/1e/1e\007\033\\"
|
||||
printf "\033P\033]4;237;rgb:2e/2a/29\007\033\\"
|
||||
printf "\033P\033]4;239;rgb:3f/39/35\007\033\\"
|
||||
printf "\033P\033]4;241;rgb:53/4a/42\007\033\\"
|
||||
printf "\033P\033]4;243;rgb:68/5c/51\007\033\\"
|
||||
|
||||
printf "\033P\033]4;244;rgb:7f/70/61\007\033\\"
|
||||
printf "\033P\033]4;245;rgb:7f/70/61\007\033\\"
|
||||
|
||||
printf "\033P\033]4;228;rgb:ef/df/ae\007\033\\"
|
||||
printf "\033P\033]4;230;rgb:f8/f4/cd\007\033\\"
|
||||
|
||||
printf "\033P\033]4;229;rgb:fa/ee/bb\007\033\\"
|
||||
printf "\033P\033]4;223;rgb:e6/d4/a3\007\033\\"
|
||||
printf "\033P\033]4;250;rgb:cb/b8/90\007\033\\"
|
||||
printf "\033P\033]4;248;rgb:af/9f/81\007\033\\"
|
||||
printf "\033P\033]4;246;rgb:97/87/71\007\033\\"
|
||||
|
||||
printf "\033P\033]4;167;rgb:f7/30/28\007\033\\"
|
||||
printf "\033P\033]4;142;rgb:aa/b0/1e\007\033\\"
|
||||
printf "\033P\033]4;214;rgb:f7/b1/25\007\033\\"
|
||||
printf "\033P\033]4;109;rgb:71/95/86\007\033\\"
|
||||
printf "\033P\033]4;175;rgb:c7/70/89\007\033\\"
|
||||
printf "\033P\033]4;108;rgb:7d/b6/69\007\033\\"
|
||||
printf "\033P\033]4;208;rgb:fb/6a/16\007\033\\"
|
||||
|
||||
printf "\033P\033]4;88;rgb:89/00/09\007\033\\"
|
||||
printf "\033P\033]4;100;rgb:66/62/0d\007\033\\"
|
||||
printf "\033P\033]4;136;rgb:a5/63/11\007\033\\"
|
||||
printf "\033P\033]4;24;rgb:0e/53/65\007\033\\"
|
||||
printf "\033P\033]4;96;rgb:7b/2b/5e\007\033\\"
|
||||
printf "\033P\033]4;66;rgb:35/6a/46\007\033\\"
|
||||
printf "\033P\033]4;130;rgb:9d/28/07\007\033\\"
|
||||
fi
|
||||
else
|
||||
printf "\033]4;236;rgb:26/24/23\033\\"
|
||||
printf "\033]4;234;rgb:16/18/19\033\\"
|
||||
|
||||
printf "\033]4;235;rgb:1e/1e/1e\033\\"
|
||||
printf "\033]4;237;rgb:2e/2a/29\033\\"
|
||||
printf "\033]4;239;rgb:3f/39/35\033\\"
|
||||
printf "\033]4;241;rgb:53/4a/42\033\\"
|
||||
printf "\033]4;243;rgb:68/5c/51\033\\"
|
||||
|
||||
printf "\033]4;244;rgb:7f/70/61\033\\"
|
||||
printf "\033]4;245;rgb:7f/70/61\033\\"
|
||||
|
||||
printf "\033]4;228;rgb:ef/df/ae\033\\"
|
||||
printf "\033]4;230;rgb:f8/f4/cd\033\\"
|
||||
|
||||
printf "\033]4;229;rgb:fa/ee/bb\033\\"
|
||||
printf "\033]4;223;rgb:e6/d4/a3\033\\"
|
||||
printf "\033]4;250;rgb:cb/b8/90\033\\"
|
||||
printf "\033]4;248;rgb:af/9f/81\033\\"
|
||||
printf "\033]4;246;rgb:97/87/71\033\\"
|
||||
|
||||
printf "\033]4;167;rgb:f7/30/28\033\\"
|
||||
printf "\033]4;142;rgb:aa/b0/1e\033\\"
|
||||
printf "\033]4;214;rgb:f7/b1/25\033\\"
|
||||
printf "\033]4;109;rgb:71/95/86\033\\"
|
||||
printf "\033]4;175;rgb:c7/70/89\033\\"
|
||||
printf "\033]4;108;rgb:7d/b6/69\033\\"
|
||||
printf "\033]4;208;rgb:fb/6a/16\033\\"
|
||||
|
||||
printf "\033]4;88;rgb:89/00/09\033\\"
|
||||
printf "\033]4;100;rgb:66/62/0d\033\\"
|
||||
printf "\033]4;136;rgb:a5/63/11\033\\"
|
||||
printf "\033]4;24;rgb:0e/53/65\033\\"
|
||||
printf "\033]4;96;rgb:7b/2b/5e\033\\"
|
||||
printf "\033]4;66;rgb:35/6a/46\033\\"
|
||||
printf "\033]4;130;rgb:9d/28/07\033\\"
|
||||
fi
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "gruvbox",
|
||||
"version": "2.0.0",
|
||||
"repository": "git@github.com:morhetz/gruvbox.git",
|
||||
"author": "Pavel Pertsev <morhetz@gmail.com>",
|
||||
"license": "MIT",
|
||||
"vim": {
|
||||
"opt": true
|
||||
}
|
||||
}
|
|
@ -4,19 +4,25 @@ 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)
|
||||
- (if ! test -d $HOME/vim-$VIM_VERSION/bin; then
|
||||
git clone https://github.com/vim/vim $HOME/vim &&
|
||||
cd $HOME/vim &&
|
||||
git checkout v$VIM_VERSION &&
|
||||
./configure --prefix=$HOME/vim-$VIM_VERSION &&
|
||||
make &&
|
||||
make install;
|
||||
fi)
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/vim-7.4
|
||||
- $HOME/vim-7.3
|
||||
- $HOME/vim-7.2.051
|
||||
- $HOME/vim-$VIM_VERSION
|
||||
|
||||
env:
|
||||
- VIM_VERSION=8.0.0000
|
||||
- VIM_VERSION=7.4
|
||||
- VIM_VERSION=7.3
|
||||
|
||||
script:
|
||||
- export PATH=$HOME/vim-$VIM_VERSION/bin:$PATH
|
||||
- vim --version
|
||||
- /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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2016 itchyny
|
||||
Copyright (c) 2013-2017 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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
" Filename: autoload/lightline.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2016/06/11 14:05:27.
|
||||
" Last Change: 2017/11/11 13:29:26.
|
||||
" =============================================================================
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
|
@ -105,18 +105,20 @@ let s:_lightline = {
|
|||
\ '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 '
|
||||
\ 'lineinfo': '%3l:%-2v', 'line': '%l', 'column': '%c', 'close': '%999X X ', 'winnr': '%{winnr()}'
|
||||
\ },
|
||||
\ 'component_visible_condition': {
|
||||
\ 'modified': '&modified||!&modifiable', 'readonly': '&readonly', 'paste': '&paste', 'spell': '&spell'
|
||||
\ },
|
||||
\ 'component_function': {},
|
||||
\ 'component_function_visible_condition': {},
|
||||
\ 'component_expand': {
|
||||
\ 'tabs': 'lightline#tabs'
|
||||
\ },
|
||||
\ 'component_type': {
|
||||
\ 'tabs': 'tabsel', 'close': 'raw'
|
||||
\ },
|
||||
\ 'component_raw': {},
|
||||
\ 'tab_component': {},
|
||||
\ 'tab_component_function': {
|
||||
\ 'filename': 'lightline#tab#filename', 'modified': 'lightline#tab#modified',
|
||||
|
@ -155,7 +157,7 @@ function! lightline#init() abort
|
|||
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
|
||||
let s:lightline.tabline_configured = has_key(get(get(g:, 'lightline', {}), 'component_expand', {}), 'tabs')
|
||||
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
|
||||
|
@ -190,10 +192,6 @@ function! lightline#colorscheme() abort
|
|||
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)
|
||||
|
@ -203,6 +201,10 @@ function! lightline#colorscheme() abort
|
|||
endfor
|
||||
endfor
|
||||
endif
|
||||
let s:highlight = {}
|
||||
call lightline#highlight('normal')
|
||||
call lightline#link()
|
||||
let s:_ = 0
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
|
@ -228,16 +230,16 @@ function! lightline#link(...) abort
|
|||
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)
|
||||
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)
|
||||
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)
|
||||
exec printf('hi link LightlineMiddle_active LightlineMiddle_%s', mode)
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
@ -263,9 +265,9 @@ 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 [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'] : [])
|
||||
let modes = a:0 ? [a:1] : extend(['normal', 'insert', 'replace', 'visual', 'inactive', 'command', 'select', 'tabline'], exists(':terminal') == 2 ? ['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'
|
||||
|
@ -278,26 +280,26 @@ function! lightline#highlight(...) abort
|
|||
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))
|
||||
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])
|
||||
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))
|
||||
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 [a, c, f, v, u ] = [ a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition, s:lightline.component_function_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 . '":""}'
|
||||
\ has_key(f, a[v:val]) ? (has_key(u, a[v:val]) ? "(".u[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] ==# '(1)' ? '' : xs[0] . '&&(') . join(xs[1:], '||') . (xs[0] ==# '1' || xs[0] ==# '(1)' ? '' : ')') . '?"' . a:subseparator . '":""}'
|
||||
endfunction
|
||||
|
||||
function! lightline#concatenate(xs, right) abort
|
||||
|
@ -324,7 +326,7 @@ endfunction
|
|||
|
||||
function! s:evaluate_expand(component) abort
|
||||
try
|
||||
let result = call(a:component, [])
|
||||
let result = eval(a:component . '()')
|
||||
if type(result) == 1 && result ==# ''
|
||||
return []
|
||||
endif
|
||||
|
@ -337,7 +339,9 @@ 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] != []')
|
||||
let is_raw = get(s:lightline.component_raw, a:name) || type ==# 'raw'
|
||||
return filter(s:map(s:evaluate_expand(s:lightline.component_expand[a:name]),
|
||||
\ '[v:val, 1 + ' . is_raw . ', v:key == 1 && ' . (type !=# 'raw') . ' ? "' . type . '" : "' . a:index . '"]'), 'v:val[0] != []')
|
||||
else
|
||||
return [[[a:name], 0, a:index]]
|
||||
endif
|
||||
|
@ -392,32 +396,32 @@ function! s:line(tabline, inactive) abort
|
|||
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 [c, f, t, w] = [s:lightline.component, s:lightline.component_function, s:lightline.component_type, s:lightline.component_raw]
|
||||
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] . '#'
|
||||
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 . ' %)'
|
||||
let _ .= has_key(t, lt[i][j]) && t[lt[i][j]] ==# 'raw' || get(w, lt[i][j]) || lc[i][j] ==# 2 || 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 _ .= '%#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 . '#%='
|
||||
let _ .= '%#LightlineMiddle_' . mode . '#%='
|
||||
for i in reverse(range(len(rt)))
|
||||
let _ .= '%#LightLineRight_' . mode . '_' . rl[i] . '_' . rl[i + 1] . '#'
|
||||
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] . '#'
|
||||
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 . ' %)'
|
||||
let _ .= has_key(t, rt[i][j]) && t[rt[i][j]] ==# 'raw' || get(w, rt[i][j]) || rc[i][j] ==# 2 || x ==# '' ? x : '%( ' . x . ' %)'
|
||||
if j < len(rt[i]) - 1 && s.right !=# ''
|
||||
let _ .= s:subseparator(rt[i][(j):], s.right, rc[i][(j):])
|
||||
endif
|
||||
|
@ -446,7 +450,7 @@ function! lightline#tabs() abort
|
|||
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' : ''))
|
||||
call add(i < nr ? x : i == nr ? y : z, (i > nr + 3 ? '%<' : '') . '%'. i . 'T%{lightline#onetab(' . i . ',' . (i == nr) . ')}' . (i == cnt ? '%T' : ''))
|
||||
endfor
|
||||
let abbr = '...'
|
||||
let n = min([max([s:lightline.winwidth / 40, 2]), 8])
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/Dracula.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2016/11/06 01:08:03.
|
||||
" =============================================================================
|
||||
|
||||
let s:black = [ '#282a36', 235 ]
|
||||
let s:gray = [ '#44475a', 236 ]
|
||||
let s:white = [ '#f8f8f2', 231 ]
|
||||
let s:darkblue = [ '#6272a4', 61 ]
|
||||
let s:cyan = [ '#8be9fd', 117 ]
|
||||
let s:green = [ '#50fa7b', 84 ]
|
||||
let s:orange = [ '#ffb86c', 215 ]
|
||||
let s:purple = [ '#bd93f9', 141 ]
|
||||
let s:red = [ '#ff79c6', 212 ]
|
||||
let s:yellow = [ '#f1fa8c', 228 ]
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:black, s:purple ], [ s:cyan, s:gray ] ]
|
||||
let s:p.normal.right = [ [ s:black, s:purple ], [ s:white, s:darkblue ] ]
|
||||
let s:p.inactive.right = [ [ s:black, s:gray ], [ s:white, s:black ] ]
|
||||
let s:p.inactive.left = [ [ s:cyan, s:black ], [ s:white, s:black ] ]
|
||||
let s:p.insert.left = [ [ s:black, s:green ], [ s:cyan, s:gray ] ]
|
||||
let s:p.replace.left = [ [ s:black, s:red ], [ s:cyan, s:gray ] ]
|
||||
let s:p.visual.left = [ [ s:black, s:orange ], [ s:cyan, s:gray ] ]
|
||||
let s:p.normal.middle = [ [ s:white, s:gray ] ]
|
||||
let s:p.inactive.middle = [ [ s:white, s:gray ] ]
|
||||
let s:p.tabline.left = [ [ s:darkblue, s:gray ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:cyan, s:black ] ]
|
||||
let s:p.tabline.middle = [ [ s:darkblue, s:gray ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.normal.error = [ [ s:red, s:black ] ]
|
||||
let s:p.normal.warning = [ [ s:yellow, s:black ] ]
|
||||
|
||||
let g:lightline#colorscheme#Dracula#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -0,0 +1,44 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/OldHope.vim
|
||||
" Author: tomb0y
|
||||
" License: MIT License
|
||||
" Last Change: 2017/10/15 06:20:54.
|
||||
" =============================================================================
|
||||
|
||||
let s:yellow = [ '#e5cd52' , 221 ]
|
||||
let s:blue = [ '#4fb4d8' , 39 ]
|
||||
let s:red = [ '#f92672' , 161 ]
|
||||
let s:green = [ '#78bd65' , 41 ]
|
||||
let s:orange = [ '#ef7c2a' , 202 ]
|
||||
let s:white = [ '#ffffff' , 15 ]
|
||||
let s:lightGray = [ '#848794' , 245 ]
|
||||
let s:gray = [ '#686b78' , 242 ]
|
||||
let s:darkGray = [ '#45474f' , 238 ]
|
||||
let s:veryDarkGray = [ '#1c1d21' , 234 ]
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
|
||||
let s:p.normal.left = [ [ s:white, s:blue ], [ s:white, s:gray ] ]
|
||||
let s:p.insert.left = [ [ s:white, s:green ], [ s:white, s:gray ] ]
|
||||
let s:p.visual.left = [ [ s:white, s:orange ], [ s:white, s:gray ] ]
|
||||
let s:p.replace.left = [ [ s:white, s:red ], [ s:white, s:gray ] ]
|
||||
|
||||
let s:p.inactive.right = [ [ s:darkGray, s:gray ], [ s:darkGray, s:gray ] ]
|
||||
let s:p.inactive.left = [ [ s:lightGray, s:darkGray ], [ s:white, s:darkGray ] ]
|
||||
let s:p.inactive.middle = [ [ s:white, s:darkGray ] ]
|
||||
|
||||
let s:p.normal.middle = [ [ s:white, s:darkGray ] ]
|
||||
let s:p.normal.error = [ [ s:red, s:darkGray ] ]
|
||||
let s:p.normal.warning = [ [ s:orange, s:darkGray ] ]
|
||||
|
||||
let s:p.tabline.left = [ [ s:lightGray, s:darkGray ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:darkGray, s:yellow ] ]
|
||||
let s:p.tabline.middle = [ [ s:yellow, s:veryDarkGray ] ]
|
||||
|
||||
let s:p.normal.right = copy(s:p.normal.left)
|
||||
let s:p.insert.right = copy(s:p.insert.left)
|
||||
let s:p.visual.right = copy(s:p.visual.left)
|
||||
let s:p.replace.right = copy(s:p.replace.left)
|
||||
let s:p.tabline.right = copy(s:p.tabline.left)
|
||||
|
||||
let g:lightline#colorscheme#OldHope#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -0,0 +1,37 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/darcula.vim
|
||||
" Author: kkopec
|
||||
" License: MIT License
|
||||
" Last Change: 2017/02/11 21:18:54.
|
||||
" =============================================================================
|
||||
|
||||
let s:black = [ '#2b2b2b', 235 ]
|
||||
let s:gray = [ '#323232', 236 ]
|
||||
let s:white = [ '#a9b7c6', 250 ]
|
||||
let s:blue = [ '#6897bb' , 67 ]
|
||||
let s:green = [ '#629755', 71 ]
|
||||
let s:purple = [ '#9876aa', 104 ]
|
||||
let s:red = [ '#ff6b68', 204 ]
|
||||
let s:yellow = [ '#ffc66d', 222 ]
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
let s:p.normal.left = [ [ s:black, s:purple ], [ s:purple, s:gray ] ]
|
||||
let s:p.normal.right = [ [ s:black, s:purple ], [ s:purple, s:gray ] ]
|
||||
let s:p.inactive.left = [ [ s:black, s:blue ], [ s:blue, s:gray ] ]
|
||||
let s:p.inactive.right = [ [ s:black, s:blue ], [ s:blue, s:gray ] ]
|
||||
let s:p.insert.left = [ [ s:black, s:green ], [ s:green, s:gray ] ]
|
||||
let s:p.insert.right = [ [ s:black, s:green ], [ s:green, s:gray ] ]
|
||||
let s:p.replace.left = [ [ s:black, s:red ], [ s:red, s:gray ] ]
|
||||
let s:p.replace.right = [ [ s:black, s:red ], [ s:red, s:gray ] ]
|
||||
let s:p.visual.left = [ [ s:black, s:yellow ], [ s:yellow, s:gray ] ]
|
||||
let s:p.visual.right = [ [ s:black, s:yellow ], [ s:yellow, s:gray ] ]
|
||||
let s:p.normal.middle = [ [ s:white, s:gray ] ]
|
||||
let s:p.inactive.middle = [ [ s:white, s:gray ] ]
|
||||
let s:p.tabline.left = [ [ s:blue, s:gray ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:black, s:blue ] ]
|
||||
let s:p.tabline.middle = [ [ s:blue, s:gray ] ]
|
||||
let s:p.tabline.right = [ [ s:black, s:blue ] ]
|
||||
let s:p.normal.error = [ [ s:red, s:black ] ]
|
||||
let s:p.normal.warning = [ [ s:yellow, s:black ] ]
|
||||
|
||||
let g:lightline#colorscheme#darcula#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -0,0 +1,63 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/materia.vim
|
||||
" Author: Lokesh Krishna
|
||||
" License: MIT License
|
||||
" Last Change: 2017/10/21 11:32:27.
|
||||
" =============================================================================
|
||||
|
||||
" Common colors
|
||||
let s:fg = '#d5dbe5'
|
||||
let s:blue = '#89ddff'
|
||||
let s:green = '#8bd649'
|
||||
let s:purple = '#82aaff'
|
||||
let s:red1 = '#ec5f67'
|
||||
let s:red2 = '#ec5f67'
|
||||
let s:yellow = '#ffcc00'
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
|
||||
if &background ==# 'light'
|
||||
" Light variant
|
||||
let s:bg = '#ffffff'
|
||||
let s:gray1 = '#2c393f'
|
||||
let s:gray2 = '#d5dbe5'
|
||||
let s:gray3 = '#707880'
|
||||
|
||||
let s:p.normal.left = [ [ s:bg, s:green, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
let s:p.normal.middle = [ [ s:gray1, s:gray2 ] ]
|
||||
let s:p.inactive.left = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
|
||||
let s:p.inactive.middle = [ [ s:gray3, s:gray2 ] ]
|
||||
let s:p.inactive.right = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
|
||||
let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
else
|
||||
" Dark variant
|
||||
let s:bg = '#263238'
|
||||
let s:gray1 = '#37474f'
|
||||
let s:gray2 = '#2c393f'
|
||||
let s:gray3 = '#37474f'
|
||||
|
||||
let s:p.normal.left = [ [ s:bg, s:green, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
let s:p.normal.middle = [ [ s:fg, s:gray2 ] ]
|
||||
let s:p.inactive.left = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
|
||||
let s:p.inactive.middle = [ [ s:gray1, s:gray2 ] ]
|
||||
let s:p.inactive.right = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
|
||||
let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
endif
|
||||
|
||||
" Common
|
||||
let s:p.normal.right = [ [ s:bg, s:green, 'bold' ], [ s:bg, s:green, 'bold' ] ]
|
||||
let s:p.normal.error = [ [ s:red2, s:bg ] ]
|
||||
let s:p.normal.warning = [ [ s:yellow, s:bg ] ]
|
||||
let s:p.insert.right = [ [ s:bg, s:blue, 'bold' ], [ s:bg, s:blue, 'bold' ] ]
|
||||
let s:p.replace.right = [ [ s:bg, s:red1, 'bold' ], [ s:bg, s:red1, 'bold' ] ]
|
||||
let s:p.visual.right = [ [ s:bg, s:purple, 'bold' ], [ s:bg, s:purple, 'bold' ] ]
|
||||
let s:p.tabline.left = [ [ s:bg, s:gray3 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:bg, s:purple, 'bold' ] ]
|
||||
let s:p.tabline.middle = [ [ s:gray3, s:gray2 ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
|
||||
let g:lightline#colorscheme#materia#palette = lightline#colorscheme#fill(s:p)
|
|
@ -0,0 +1,63 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/material.vim
|
||||
" Author: Lokesh Krishna
|
||||
" License: MIT License
|
||||
" Last Change: 2017/10/30 16:35:27.
|
||||
" =============================================================================
|
||||
|
||||
" Common colors
|
||||
let s:fg = '#eeffff'
|
||||
let s:blue = '#82aaff'
|
||||
let s:green = '#c3e88d'
|
||||
let s:purple = '#c792ea'
|
||||
let s:red1 = '#f07178'
|
||||
let s:red2 = '#ff5370'
|
||||
let s:yellow = '#ffcb6b'
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
|
||||
if &background ==# 'light'
|
||||
" Light variant
|
||||
let s:bg = '#ffffff'
|
||||
let s:gray1 = '#2e3c43'
|
||||
let s:gray2 = '#eeffff'
|
||||
let s:gray3 = '#546e7a'
|
||||
|
||||
let s:p.normal.left = [ [ s:bg, s:blue, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
let s:p.normal.middle = [ [ s:gray1, s:gray2 ] ]
|
||||
let s:p.inactive.left = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
|
||||
let s:p.inactive.middle = [ [ s:gray3, s:gray2 ] ]
|
||||
let s:p.inactive.right = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
|
||||
let s:p.insert.left = [ [ s:bg, s:green, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
else
|
||||
" Dark variant
|
||||
let s:bg = '#263238'
|
||||
let s:gray1 = '#314549'
|
||||
let s:gray2 = '#2E3C43'
|
||||
let s:gray3 = '#314549'
|
||||
|
||||
let s:p.normal.left = [ [ s:bg, s:blue, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
let s:p.normal.middle = [ [ s:fg, s:gray2 ] ]
|
||||
let s:p.inactive.left = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
|
||||
let s:p.inactive.middle = [ [ s:gray1, s:gray2 ] ]
|
||||
let s:p.inactive.right = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
|
||||
let s:p.insert.left = [ [ s:bg, s:green, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
endif
|
||||
|
||||
" Common
|
||||
let s:p.normal.right = [ [ s:bg, s:blue, 'bold' ], [ s:bg, s:blue, 'bold' ] ]
|
||||
let s:p.normal.error = [ [ s:red2, s:bg ] ]
|
||||
let s:p.normal.warning = [ [ s:yellow, s:bg ] ]
|
||||
let s:p.insert.right = [ [ s:bg, s:green, 'bold' ], [ s:bg, s:green, 'bold' ] ]
|
||||
let s:p.replace.right = [ [ s:bg, s:red1, 'bold' ], [ s:bg, s:red1, 'bold' ] ]
|
||||
let s:p.visual.right = [ [ s:bg, s:purple, 'bold' ], [ s:bg, s:purple, 'bold' ] ]
|
||||
let s:p.tabline.left = [ [ s:fg, s:gray3 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:bg, s:purple, 'bold' ] ]
|
||||
let s:p.tabline.middle = [ [ s:gray3, s:gray2 ] ]
|
||||
let s:p.tabline.right = [ [ s:bg, s:red1, 'bold' ] ]
|
||||
|
||||
let g:lightline#colorscheme#material#palette = lightline#colorscheme#fill(s:p)
|
|
@ -0,0 +1,36 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/molokai.vim
|
||||
" Author: challsted
|
||||
" License: MIT License
|
||||
" Last Change: 2016/11/17 00:27:58.
|
||||
" =============================================================================
|
||||
"
|
||||
let s:black = [ '#232526', 233 ]
|
||||
let s:gray = [ '#808080', 244 ]
|
||||
let s:white = [ '#f8f8f2', 234 ]
|
||||
let s:cyan = [ '#66d9ef', 81 ]
|
||||
let s:green = [ '#a6e22e', 118 ]
|
||||
let s:orange = [ '#ef5939', 166 ]
|
||||
let s:pink = [ '#f92672', 161 ]
|
||||
let s:red = [ '#ff0000', 160 ]
|
||||
let s:yellow = [ '#e6db74', 229 ]
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
|
||||
let s:p.normal.left = [ [ s:black, s:cyan ], [ s:orange, s:black ] ]
|
||||
let s:p.normal.middle = [ [ s:orange, s:black ] ]
|
||||
let s:p.normal.right = [ [ s:pink, s:black ], [ s:black, s:pink ] ]
|
||||
let s:p.normal.error = [ [ s:pink, s:black ] ]
|
||||
let s:p.normal.warning = [ [ s:yellow, s:black ] ]
|
||||
let s:p.insert.left = [ [ s:black, s:green ], [ s:green, s:black ] ]
|
||||
let s:p.visual.left = [ [ s:black, s:yellow ], [ s:yellow, s:black ] ]
|
||||
let s:p.replace.left = [ [ s:black, s:red ], [ s:red, s:black ] ]
|
||||
let s:p.inactive.left = [ [ s:pink, s:black ], [ s:white, s:black ] ]
|
||||
let s:p.inactive.middle = [ [ s:gray, s:black ] ]
|
||||
let s:p.inactive.right = [ [ s:white, s:pink ], [ s:pink, s:black ] ]
|
||||
let s:p.tabline.left = [ [ s:pink, s:black ] ]
|
||||
let s:p.tabline.middle = [ [ s:pink, s:black] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
let s:p.tabline.tabsel = [ [ s:black, s:pink ] ]
|
||||
|
||||
let g:lightline#colorscheme#molokai#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -0,0 +1,46 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/nord.vim
|
||||
" Author: arcticicestudio
|
||||
" License: MIT
|
||||
" Last Change: 2017/11/12 20:27:51
|
||||
" =============================================================================
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
|
||||
let s:nord0 = ["#2E3440", "NONE"]
|
||||
let s:nord1 = ["#3B4252", 0]
|
||||
let s:nord2 = ["#434C5E", "NONE"]
|
||||
let s:nord3 = ["#4C566A", 8]
|
||||
let s:nord4 = ["#D8DEE9", "NONE"]
|
||||
let s:nord5 = ["#E5E9F0", 7]
|
||||
let s:nord6 = ["#ECEFF4", 15]
|
||||
let s:nord7 = ["#8FBCBB", 14]
|
||||
let s:nord8 = ["#88C0D0", 6]
|
||||
let s:nord9 = ["#81A1C1", 4]
|
||||
let s:nord10 = ["#5E81AC", 12]
|
||||
let s:nord11 = ["#BF616A", 1]
|
||||
let s:nord12 = ["#D08770", 11]
|
||||
let s:nord13 = ["#EBCB8B", 3]
|
||||
let s:nord14 = ["#A3BE8C", 2]
|
||||
let s:nord15 = ["#B48EAD", 5]
|
||||
|
||||
let s:p.normal.left = [ [ s:nord1, s:nord8 ], [ s:nord5, s:nord1 ] ]
|
||||
let s:p.normal.middle = [ [ s:nord5, s:nord3 ] ]
|
||||
let s:p.normal.right = [ [ s:nord5, s:nord1 ], [ s:nord5, s:nord1 ] ]
|
||||
let s:p.normal.warning = [ [ s:nord1, s:nord13 ] ]
|
||||
let s:p.normal.error = [ [ s:nord1, s:nord11 ] ]
|
||||
|
||||
let s:p.inactive.left = [ [ s:nord1, s:nord8 ], [ s:nord5, s:nord1 ] ]
|
||||
let s:p.inactive.middle = [ [ s:nord5, s:nord0 ] ]
|
||||
let s:p.inactive.right = [ [ s:nord5, s:nord1 ], [ s:nord5, s:nord1 ] ]
|
||||
|
||||
let s:p.insert.left = [ [ s:nord1, s:nord6 ], [ s:nord5, s:nord1 ] ]
|
||||
let s:p.replace.left = [ [ s:nord1, s:nord13 ], [ s:nord5, s:nord1 ] ]
|
||||
let s:p.visual.left = [ [ s:nord1, s:nord7 ], [ s:nord5, s:nord1 ] ]
|
||||
|
||||
let s:p.tabline.left = [ [ s:nord5, s:nord3 ] ]
|
||||
let s:p.tabline.middle = [ [ s:nord5, s:nord3 ] ]
|
||||
let s:p.tabline.right = [ [ s:nord5, s:nord3 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:nord1, s:nord8 ] ]
|
||||
|
||||
let g:lightline#colorscheme#nord#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -0,0 +1,63 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/one.vim
|
||||
" Author: Zoltan Dalmadi
|
||||
" License: MIT License
|
||||
" Last Change: 2016/11/2 17:34:27.
|
||||
" =============================================================================
|
||||
|
||||
" Common colors
|
||||
let s:fg = '#abb2bf'
|
||||
let s:blue = '#61afef'
|
||||
let s:green = '#98c379'
|
||||
let s:purple = '#c678dd'
|
||||
let s:red1 = '#e06c75'
|
||||
let s:red2 = '#be5046'
|
||||
let s:yellow = '#e5c07b'
|
||||
|
||||
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||
|
||||
if &background ==# 'light'
|
||||
" Light variant
|
||||
let s:bg = '#fafafa'
|
||||
let s:gray1 = '#494b53'
|
||||
let s:gray2 = '#f0f0f0'
|
||||
let s:gray3 = '#d0d0d0'
|
||||
|
||||
let s:p.normal.left = [ [ s:bg, s:green, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
let s:p.normal.middle = [ [ s:gray1, s:gray2 ] ]
|
||||
let s:p.inactive.left = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
|
||||
let s:p.inactive.middle = [ [ s:gray3, s:gray2 ] ]
|
||||
let s:p.inactive.right = [ [ s:bg, s:gray3 ], [ s:bg, s:gray3 ] ]
|
||||
let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:gray1, s:gray3 ] ]
|
||||
else
|
||||
" Dark variant
|
||||
let s:bg = '#282c34'
|
||||
let s:gray1 = '#5c6370'
|
||||
let s:gray2 = '#2c323d'
|
||||
let s:gray3 = '#3e4452'
|
||||
|
||||
let s:p.normal.left = [ [ s:bg, s:green, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
let s:p.normal.middle = [ [ s:fg, s:gray2 ] ]
|
||||
let s:p.inactive.left = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
|
||||
let s:p.inactive.middle = [ [ s:gray1, s:gray2 ] ]
|
||||
let s:p.inactive.right = [ [ s:gray1, s:bg ], [ s:gray1, s:bg ] ]
|
||||
let s:p.insert.left = [ [ s:bg, s:blue, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
let s:p.replace.left = [ [ s:bg, s:red1, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
let s:p.visual.left = [ [ s:bg, s:purple, 'bold' ], [ s:fg, s:gray3 ] ]
|
||||
endif
|
||||
|
||||
" Common
|
||||
let s:p.normal.right = [ [ s:bg, s:green, 'bold' ], [ s:bg, s:green, 'bold' ] ]
|
||||
let s:p.normal.error = [ [ s:red2, s:bg ] ]
|
||||
let s:p.normal.warning = [ [ s:yellow, s:bg ] ]
|
||||
let s:p.insert.right = [ [ s:bg, s:blue, 'bold' ], [ s:bg, s:blue, 'bold' ] ]
|
||||
let s:p.replace.right = [ [ s:bg, s:red1, 'bold' ], [ s:bg, s:red1, 'bold' ] ]
|
||||
let s:p.visual.right = [ [ s:bg, s:purple, 'bold' ], [ s:bg, s:purple, 'bold' ] ]
|
||||
let s:p.tabline.left = [ [ s:bg, s:gray3 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:bg, s:purple, 'bold' ] ]
|
||||
let s:p.tabline.middle = [ [ s:gray3, s:gray2 ] ]
|
||||
let s:p.tabline.right = copy(s:p.normal.right)
|
||||
|
||||
let g:lightline#colorscheme#one#palette = lightline#colorscheme#fill(s:p)
|
|
@ -2,10 +2,79 @@
|
|||
" Filename: autoload/lightline/colorscheme/solarized.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2013/08/27 10:24:28.
|
||||
" Last Change: 2016/08/08 10:31:00.
|
||||
" =============================================================================
|
||||
if &background ==# 'light'
|
||||
let g:lightline#colorscheme#solarized#palette = g:lightline#colorscheme#solarized_light#palette
|
||||
|
||||
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 g:lightline#colorscheme#solarized#palette = g:lightline#colorscheme#solarized_dark#palette
|
||||
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)
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/solarized_dark.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2014/05/31 01:04:15.
|
||||
" =============================================================================
|
||||
|
||||
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] ]
|
||||
|
||||
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:base1, s:base00 ] ]
|
||||
let s:p.tabline.tabsel = [ [ s:base3, s:base0 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base01, s:base02 ] ]
|
||||
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#solarized_dark#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -1,80 +0,0 @@
|
|||
" =============================================================================
|
||||
" Filename: autoload/lightline/colorscheme/solarized_light.vim
|
||||
" Author: itchyny
|
||||
" License: MIT License
|
||||
" Last Change: 2014/05/31 01:04:21.
|
||||
" =============================================================================
|
||||
|
||||
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] ]
|
||||
|
||||
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]
|
||||
|
||||
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:base03 ] ]
|
||||
let s:p.tabline.middle = [ [ s:base1, s:base02 ] ]
|
||||
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:base01 ] ]
|
||||
let s:p.normal.error = [ [ s:base02, s:red ] ]
|
||||
let s:p.normal.warning = [ [ s:base2, s:yellow ] ]
|
||||
|
||||
let g:lightline#colorscheme#solarized_light#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -1,10 +1,10 @@
|
|||
*lightline.txt* A light and configurable statusline/tabline for Vim
|
||||
|
||||
Version: 0.0
|
||||
Version: 0.1
|
||||
Author: itchyny (https://github.com/itchyny)
|
||||
License: MIT License
|
||||
Repository: https://github.com/itchyny/lightline.vim
|
||||
Last Change: 2016/05/26 21:57:34.
|
||||
Last Change: 2017/11/18 20:07:05.
|
||||
|
||||
CONTENTS *lightline-contents*
|
||||
|
||||
|
@ -19,7 +19,6 @@ Examples |lightline-examples|
|
|||
Nice Examples |lightline-nice-examples|
|
||||
Powerful Example |lightline-powerful-example|
|
||||
Troubleshooting |lightline-troubleshooting|
|
||||
Changelog |lightline-changelog|
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *lightline-introduction*
|
||||
|
@ -30,39 +29,40 @@ The *lightline* plugin is a light and configurable statusline/tabline for Vim.
|
|||
SPIRIT *lightline-spirit*
|
||||
|
||||
Minimalism
|
||||
The core script is very small.
|
||||
The core script is very small to achive enough functions as a
|
||||
statusline plugin.
|
||||
|
||||
Configurability
|
||||
You can create your own component and easily add to the
|
||||
statusline/tabline.
|
||||
You can create your own component and easily add to the statusline
|
||||
and the tabline.
|
||||
|
||||
Orthogonality
|
||||
Any plugin should not change the settings of another plugin.
|
||||
Such plugin-crossing settings should be written by users in
|
||||
.vimrc.
|
||||
The plugin does not rely on the implementation of other plugins.
|
||||
Such plugin crossing settings should be configured by users.
|
||||
|
||||
You might find this plugin is not so useful by default. This plugin
|
||||
does not provide the branch information, which is a very basic
|
||||
component in existing plugins. The reason is that branch component is
|
||||
one of plugin-crossing settings so users should write the settings
|
||||
using the APIs of the both plugins. Hospitality makes a plugin messy.
|
||||
Good APIs keep a plugin clean.
|
||||
You find this plugin does not integrate with other plugins by default.
|
||||
This plugin does not provide branch information, which is a basic
|
||||
component in existing statusline plugins. It is a design of
|
||||
lightline.vim that such plugin crossing configuration should be
|
||||
written by users. Once a plugin starts to integrate with some famous
|
||||
plugins, it should be kept updated to follow the changes of the
|
||||
plugins and should accept integration requests with new plugins.
|
||||
Instead, lightline.vim is designed very carefully so that users can
|
||||
easily integrate with other plugins. Good APIs keep a plugin clean.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
OPTIONS *lightline-option*
|
||||
|
||||
g:lightline *g:lightline*
|
||||
All the options are stored into this global variable.
|
||||
All the configurations are stored in this global variable.
|
||||
|
||||
g:lightline.active *g:lightline.active*
|
||||
g:lightline.inactive *g:lightline.inactive*
|
||||
g:lightline.tabline *g:lightline.tabline*
|
||||
Dictionaries to specify the statusline/tabline components.
|
||||
The components are gathered from either |g:lightline.component|,
|
||||
|g:lightline.component_function| or
|
||||
|g:lightline.component_expand|.
|
||||
Dictionaries to store the statusline/tabline components.
|
||||
Note that right groups of components are stored from right to
|
||||
left. The default values are:
|
||||
left.
|
||||
The default values are:
|
||||
>
|
||||
let g:lightline.active = {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
|
@ -79,10 +79,7 @@ OPTIONS *lightline-option*
|
|||
\ 'right': [ [ 'close' ] ] }
|
||||
<
|
||||
g:lightline.tab *g:lightline.tab*
|
||||
Dictionaries to specify the components in each tabs.
|
||||
The components are gathered from either
|
||||
|g:lightline.tab_component| or
|
||||
|g:lightline.tab_component_function|.
|
||||
A dictionary to store the tab components in each tabs.
|
||||
The default values are:
|
||||
>
|
||||
let g:lightline.tab = {
|
||||
|
@ -90,7 +87,7 @@ OPTIONS *lightline-option*
|
|||
\ 'inactive': [ 'tabnum', 'filename', 'modified' ] }
|
||||
<
|
||||
g:lightline.component *g:lightline.component*
|
||||
Dictionary for statusline/tabline components.
|
||||
A dictionary for statusline/tabline components.
|
||||
The default value is:
|
||||
>
|
||||
let g:lightline.component = {
|
||||
|
@ -112,13 +109,17 @@ OPTIONS *lightline-option*
|
|||
\ 'spell': '%{&spell?&spelllang:""}',
|
||||
\ 'lineinfo': '%3l:%-2v',
|
||||
\ 'line': '%l',
|
||||
\ 'column': '%c'
|
||||
\ 'close': '%999X X ' }
|
||||
\ 'column': '%c',
|
||||
\ 'close': '%999X X ',
|
||||
\ 'winnr': '%{winnr()}' }
|
||||
<
|
||||
g:lightline.component_visible_condition *g:lightline.component_visible_condition*
|
||||
Dictionary of boolean expressions for the components.
|
||||
Each expression should correspond to the condition each
|
||||
component have non-zero length.
|
||||
g:lightline.component_visible_condition
|
||||
*g:lightline.component_visible_condition*
|
||||
A dictionary to store the visible condition of the components.
|
||||
Note that this configuration is used to control the visibility
|
||||
of the subseparators, not to control the visibility of the
|
||||
components themselves. Each expression should correspond to
|
||||
the condition on which each component is not empty.
|
||||
The default value is:
|
||||
>
|
||||
let g:lightline.component_visible_condition = {
|
||||
|
@ -127,34 +128,47 @@ OPTIONS *lightline-option*
|
|||
\ 'paste': '&paste',
|
||||
\ 'spell': '&spell' }
|
||||
<
|
||||
Users are recommended to set this option together with the
|
||||
component itself.
|
||||
|
||||
g:lightline.component_function *g:lightline.component_function*
|
||||
Another dictionary for components. This is more convenient
|
||||
because the user does not have to set both component and
|
||||
component_visible_condition. If a component set to both component and
|
||||
component_function, the setting of component_function has priority.
|
||||
For example, if you want a component for read-only mark, which
|
||||
disappears in help windows:
|
||||
A dictionary to store the function components.
|
||||
This is useful to write a complex component configuration and
|
||||
to integrate with other plugins. If a component set in both
|
||||
component and component_function, the configuration of
|
||||
component_function has priority.
|
||||
|
||||
The default value is:
|
||||
>
|
||||
let g:lightline.component_function = {}
|
||||
<
|
||||
For example, if you want to display the name of the git branch,
|
||||
install |vim-fugitive| plugin and then configure as:
|
||||
>
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'myreadonly', 'filename', 'modified' ] ],
|
||||
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'myreadonly': 'LightLineReadonly'
|
||||
\ 'gitbranch': 'fugitive#head'
|
||||
\ },
|
||||
\ }
|
||||
function! LightLineReadonly()
|
||||
return &ft !~? 'help' && &readonly ? 'RO' : ''
|
||||
endfunction
|
||||
<
|
||||
g:lightline.component_function_visible_condition
|
||||
*g:lightline.component_function_visible_condition*
|
||||
A dictionary to store the visible conditions of the function
|
||||
components. Each expression should correspond to the condition
|
||||
each component is not empty. This configuration is used to
|
||||
control the visibility of the subseparators. You can use this
|
||||
configuration to reduce the number of function calls for
|
||||
performance improvement by setting the value 1 (to tell lightline
|
||||
that the component is always visible).
|
||||
The default value is:
|
||||
>
|
||||
let g:lightline.component_function_visible_condition = {}
|
||||
<
|
||||
g:lightline.component_expand *g:lightline.component_expand*
|
||||
Another dictionary for components. You can create a component
|
||||
which has a special color. For example, error components or
|
||||
warning components. The functions should return one of:
|
||||
A dictionary to store expanding components. You can create
|
||||
warning and critical components. The values should be the name
|
||||
of functions should return either one of:
|
||||
+ a string
|
||||
+ an array of three elements:
|
||||
[[ left ], [ middle ], [ right ]]
|
||||
|
@ -175,11 +189,22 @@ OPTIONS *lightline-option*
|
|||
|g:lightline.component_expand|. The types are used to specify
|
||||
the color. Specifically, the type raw is used to specify a
|
||||
component which should not be wrapped by item group: %(...%).
|
||||
If you want to specify the type of a raw component, please use
|
||||
|g:lightline.component_raw|.
|
||||
The default value is: >
|
||||
|
||||
let g:lightline.component_type = {
|
||||
\ 'tabs': 'tabsel',
|
||||
\ 'close': 'raw' }
|
||||
<
|
||||
g:lightline.component_raw *g:lightline.component_raw*
|
||||
A dictionary to specify the raw type components. When you
|
||||
register a component to this dictionary (like >
|
||||
let g:lightline.component_raw = { 'example': 1 }
|
||||
< ), the example component is not wrapped by item group: %(...%).
|
||||
The default value is: >
|
||||
|
||||
let g:lightline.component_raw = {}
|
||||
<
|
||||
g:lightline.tab_component *g:lightline.tab_component*
|
||||
A dictionary for components in one tab.
|
||||
|
@ -203,7 +228,8 @@ OPTIONS *lightline-option*
|
|||
The colorscheme for lightline.vim.
|
||||
Currently, wombat, solarized, powerline, jellybeans, Tomorrow,
|
||||
Tomorrow_Night, Tomorrow_Night_Blue, Tomorrow_Night_Eighties,
|
||||
PaperColor, seoul256, landscape and 16color are available.
|
||||
PaperColor, seoul256, landscape, one, Dracula, darcula,
|
||||
molokai, materia, material, OldHope, nord and 16color are available.
|
||||
The default value is:
|
||||
>
|
||||
let g:lightline.colorscheme = 'default'
|
||||
|
@ -260,7 +286,6 @@ OPTIONS *lightline-option*
|
|||
\ 'tabline': 1
|
||||
\ }
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
FONT *lightline-font*
|
||||
You can use the patched font you used for |vim-powerline| and |powerline|.
|
||||
|
@ -279,16 +304,16 @@ nice.
|
|||
\ 'lineinfo': ' %3l:%-2v',
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'readonly': 'LightLineReadonly',
|
||||
\ 'fugitive': 'LightLineFugitive'
|
||||
\ 'readonly': 'LightlineReadonly',
|
||||
\ 'fugitive': 'LightlineFugitive'
|
||||
\ },
|
||||
\ 'separator': { 'left': '', 'right': '' },
|
||||
\ 'subseparator': { 'left': '', 'right': '' }
|
||||
\ }
|
||||
function! LightLineReadonly()
|
||||
function! LightlineReadonly()
|
||||
return &readonly ? '' : ''
|
||||
endfunction
|
||||
function! LightLineFugitive()
|
||||
function! LightlineFugitive()
|
||||
if exists('*fugitive#head')
|
||||
let branch = fugitive#head()
|
||||
return branch !=# '' ? ''.branch : ''
|
||||
|
@ -304,16 +329,16 @@ look nice.
|
|||
\ 'lineinfo': '⭡ %3l:%-2v',
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'readonly': 'LightLineReadonly',
|
||||
\ 'fugitive': 'LightLineFugitive'
|
||||
\ 'readonly': 'LightlineReadonly',
|
||||
\ 'fugitive': 'LightlineFugitive'
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
function! LightLineReadonly()
|
||||
function! LightlineReadonly()
|
||||
return &readonly ? '⭤' : ''
|
||||
endfunction
|
||||
function! LightLineFugitive()
|
||||
function! LightlineFugitive()
|
||||
if exists('*fugitive#head')
|
||||
let branch = fugitive#head()
|
||||
return branch !=# '' ? '⭠ '.branch : ''
|
||||
|
@ -616,6 +641,16 @@ compiled version of your colorscheme.
|
|||
<
|
||||
Then copy and paste the result to the colorscheme file.
|
||||
|
||||
If you want to contribute a new colorscheme that is not currently available
|
||||
please follow the following rules:
|
||||
*) All hex codes should be lowercase only
|
||||
*) Use 2 space soft tabs
|
||||
*) If your colorscheme has both light and dark variants, use a single file
|
||||
*) Normal Mode should default to Cyan
|
||||
*) Insert Mode should default to Green
|
||||
*) Visual Mode should default to Yellow
|
||||
*) Replace Mode should default to Red
|
||||
|
||||
==============================================================================
|
||||
EXAMPLES *lightline-examples*
|
||||
You can configure the appearance of statusline.
|
||||
|
@ -635,22 +670,22 @@ In order to define your own component:
|
|||
\ 'left': [ [ 'mode', 'paste' ], [ 'myfilename' ] ]
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'myfilename': 'LightLineFilename',
|
||||
\ 'myreadonly': 'LightLineReadonly',
|
||||
\ 'mymodified': 'LightLineModified',
|
||||
\ 'myfilename': 'LightlineFilename',
|
||||
\ 'myreadonly': 'LightlineReadonly',
|
||||
\ 'mymodified': 'LightlineModified',
|
||||
\ }
|
||||
\ }
|
||||
function! LightLineFilename()
|
||||
return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
|
||||
function! LightlineFilename()
|
||||
return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
|
||||
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
|
||||
\ &ft == 'unite' ? unite#get_status_string() :
|
||||
\ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
|
||||
\ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
|
||||
\ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
|
||||
endfunction
|
||||
function! LightLineReadonly()
|
||||
function! LightlineReadonly()
|
||||
return &ft !~? 'help' && &readonly ? 'RO' : ''
|
||||
endfunction
|
||||
function! LightLineModified()
|
||||
function! LightlineModified()
|
||||
return &modifiable && &modified ? '+' : ''
|
||||
endfunction
|
||||
<
|
||||
|
@ -690,25 +725,25 @@ A nice example for non-patched font users.
|
|||
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'fugitive': 'LightLineFugitive',
|
||||
\ 'filename': 'LightLineFilename'
|
||||
\ 'fugitive': 'LightlineFugitive',
|
||||
\ 'filename': 'LightlineFilename'
|
||||
\ }
|
||||
\ }
|
||||
function! LightLineModified()
|
||||
function! LightlineModified()
|
||||
return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
||||
endfunction
|
||||
function! LightLineReadonly()
|
||||
function! LightlineReadonly()
|
||||
return &ft !~? 'help\|vimfiler' && &readonly ? 'RO' : ''
|
||||
endfunction
|
||||
function! LightLineFilename()
|
||||
return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
|
||||
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() : '')
|
||||
\ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
|
||||
endfunction
|
||||
function! LightLineFugitive()
|
||||
function! LightlineFugitive()
|
||||
if &ft !~? 'vimfiler' && exists('*fugitive#head')
|
||||
return fugitive#head()
|
||||
endif
|
||||
|
@ -723,27 +758,27 @@ A nice example for |vim-powerline| font users:
|
|||
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'fugitive': 'LightLineFugitive',
|
||||
\ 'filename': 'LightLineFilename'
|
||||
\ 'fugitive': 'LightlineFugitive',
|
||||
\ 'filename': 'LightlineFilename'
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
function! LightLineModified()
|
||||
function! LightlineModified()
|
||||
return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
||||
endfunction
|
||||
function! LightLineReadonly()
|
||||
function! LightlineReadonly()
|
||||
return &ft !~? 'help\|vimfiler' && &readonly ? '⭤' : ''
|
||||
endfunction
|
||||
function! LightLineFilename()
|
||||
return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
|
||||
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() : '')
|
||||
\ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
|
||||
endfunction
|
||||
function! LightLineFugitive()
|
||||
function! LightlineFugitive()
|
||||
if &ft !~? 'vimfiler' && exists('*fugitive#head')
|
||||
let branch = fugitive#head()
|
||||
return branch !=# '' ? '⭠ '.branch : ''
|
||||
|
@ -764,12 +799,12 @@ For users who uses lots of plugins:
|
|||
\ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ]
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'fugitive': 'LightLineFugitive',
|
||||
\ 'filename': 'LightLineFilename',
|
||||
\ 'fileformat': 'LightLineFileformat',
|
||||
\ 'filetype': 'LightLineFiletype',
|
||||
\ 'fileencoding': 'LightLineFileencoding',
|
||||
\ 'mode': 'LightLineMode',
|
||||
\ 'fugitive': 'LightlineFugitive',
|
||||
\ 'filename': 'LightlineFilename',
|
||||
\ 'fileformat': 'LightlineFileformat',
|
||||
\ 'filetype': 'LightlineFiletype',
|
||||
\ 'fileencoding': 'LightlineFileencoding',
|
||||
\ 'mode': 'LightlineMode',
|
||||
\ 'ctrlpmark': 'CtrlPMark',
|
||||
\ },
|
||||
\ 'component_expand': {
|
||||
|
@ -781,15 +816,15 @@ For users who uses lots of plugins:
|
|||
\ 'subseparator': { 'left': '|', 'right': '|' }
|
||||
\ }
|
||||
|
||||
function! LightLineModified()
|
||||
function! LightlineModified()
|
||||
return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
||||
endfunction
|
||||
|
||||
function! LightLineReadonly()
|
||||
function! LightlineReadonly()
|
||||
return &ft !~? 'help' && &readonly ? 'RO' : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFilename()
|
||||
function! LightlineFilename()
|
||||
let fname = expand('%:t')
|
||||
return fname == 'ControlP' && has_key(g:lightline, 'ctrlp_item') ? g:lightline.ctrlp_item :
|
||||
\ fname == '__Tagbar__' ? g:lightline.fname :
|
||||
|
@ -797,12 +832,12 @@ For users who uses lots of plugins:
|
|||
\ &ft == 'vimfiler' ? vimfiler#get_status_string() :
|
||||
\ &ft == 'unite' ? unite#get_status_string() :
|
||||
\ &ft == 'vimshell' ? vimshell#get_status_string() :
|
||||
\ ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .
|
||||
\ ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
|
||||
\ ('' != fname ? fname : '[No Name]') .
|
||||
\ ('' != LightLineModified() ? ' ' . LightLineModified() : '')
|
||||
\ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
|
||||
endfunction
|
||||
|
||||
function! LightLineFugitive()
|
||||
function! LightlineFugitive()
|
||||
try
|
||||
if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head')
|
||||
let mark = '' " edit here for cool mark
|
||||
|
@ -814,19 +849,19 @@ For users who uses lots of plugins:
|
|||
return ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFileformat()
|
||||
function! LightlineFileformat()
|
||||
return winwidth(0) > 70 ? &fileformat : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFiletype()
|
||||
function! LightlineFiletype()
|
||||
return winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : 'no ft') : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineFileencoding()
|
||||
function! LightlineFileencoding()
|
||||
return winwidth(0) > 70 ? (&fenc !=# '' ? &fenc : &enc) : ''
|
||||
endfunction
|
||||
|
||||
function! LightLineMode()
|
||||
function! LightlineMode()
|
||||
let fname = expand('%:t')
|
||||
return fname == '__Tagbar__' ? 'Tagbar' :
|
||||
\ fname == 'ControlP' ? 'CtrlP' :
|
||||
|
@ -1126,7 +1161,7 @@ Problem 9: *lightline-problem-9*
|
|||
subseparator.right '|' '' (\ue0b3) '⮃' (\u2b83)
|
||||
branch symbol -- '' (\ue0a0) '⭠' (\u2b60)
|
||||
readonly symbol -- '' (\ue0a2) '⭤' (\u2b64)
|
||||
linecolumn symbol -- '' (\ue0a1) '⭡' (\u2b81)
|
||||
linecolumn symbol -- '' (\ue0a1) '⭡' (\u2b61)
|
||||
|
||||
Problem 10: *lightline-problem-10*
|
||||
Cool statusline disappears on |unite|, |vimfiler| and |vimshell|
|
||||
|
@ -1169,10 +1204,10 @@ Problem 12: *lightline-problem-12*
|
|||
>
|
||||
let g:lightline = {
|
||||
\ 'component': {
|
||||
\ 'modified': '%#ModifiedColor#%{LightLineModified()}',
|
||||
\ 'modified': '%#ModifiedColor#%{LightlineModified()}',
|
||||
\ }
|
||||
\ }
|
||||
function! LightLineModified()
|
||||
function! LightlineModified()
|
||||
let map = { 'V': 'n', "\<C-v>": 'n', 's': 'n', 'v': 'n', "\<C-s>": 'n', 'c': 'n', 'R': 'n'}
|
||||
let mode = get(map, mode()[0], mode()[0])
|
||||
let bgcolor = {'n': [240, '#585858'], 'i': [31, '#0087af']}
|
||||
|
@ -1189,9 +1224,11 @@ Problem 12: *lightline-problem-12*
|
|||
Problem 13: *lightline-problem-13*
|
||||
How to change the lightline colorscheme on the fly.
|
||||
|
||||
Add the following settings to your .vimrc(_vimrc).
|
||||
To update your lightline colorscheme in sync with your vim
|
||||
colorscheme (only for select colorschemes which exist for
|
||||
both), add the following settings to your .vimrc(_vimrc).
|
||||
>
|
||||
augroup LightLineColorscheme
|
||||
augroup LightlineColorscheme
|
||||
autocmd!
|
||||
autocmd ColorScheme * call s:lightline_update()
|
||||
augroup END
|
||||
|
@ -1202,8 +1239,7 @@ Problem 13: *lightline-problem-13*
|
|||
try
|
||||
if g:colors_name =~# 'wombat\|solarized\|landscape\|jellybeans\|seoul256\|Tomorrow'
|
||||
let g:lightline.colorscheme =
|
||||
\ substitute(substitute(g:colors_name, '-', '_', 'g'), '256.*', '', '') .
|
||||
\ (g:colors_name ==# 'solarized' ? '_' . &background : '')
|
||||
\ substitute(substitute(g:colors_name, '-', '_', 'g'), '256.*', '', '')
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#update()
|
||||
|
@ -1211,6 +1247,27 @@ Problem 13: *lightline-problem-13*
|
|||
catch
|
||||
endtry
|
||||
endfunction
|
||||
<
|
||||
If you have not settled on a single lightline colorscheme, you
|
||||
can easily switch between lightline colorschemes by adding the
|
||||
following LightlineColorscheme command to your .vimrc(_vimrc).
|
||||
>
|
||||
function! s:set_lightline_colorscheme(name) abort
|
||||
let g:lightline.colorscheme = a:name
|
||||
call lightline#init()
|
||||
call lightline#colorscheme()
|
||||
call lightline#update()
|
||||
endfunction
|
||||
|
||||
function! s:lightline_colorschemes(...) abort
|
||||
return join(map(
|
||||
\ globpath(&rtp,"autoload/lightline/colorscheme/*.vim",1,1),
|
||||
\ "fnamemodify(v:val,':t:r')"),
|
||||
\ "\n")
|
||||
endfunction
|
||||
|
||||
command! -nargs=1 -complete=custom,s:lightline_colorschemes LightlineColorscheme
|
||||
\ call s:set_lightline_colorscheme(<q-args>)
|
||||
<
|
||||
Problem 14: *lightline-problem-14*
|
||||
The 'E541' warning appears on the right hand side.
|
||||
|
@ -1271,11 +1328,5 @@ Problem 17: *lightline-problem-17*
|
|||
Report/Request the issue/feature at
|
||||
https://github.com/itchyny/lightline.vim/issues.
|
||||
|
||||
==============================================================================
|
||||
CHANGELOG *lightline-changelog*
|
||||
|
||||
0.0 2013-08-21, ...
|
||||
- Initial commit and implementation
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:sw=4:ts=8:ft=help:norl:noet:
|
||||
|
|
|
@ -45,6 +45,32 @@ function! s:suite.custom_type()
|
|||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.raw_type()
|
||||
function! Custom()
|
||||
return [ ['left'], ['middle'], ['right'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'raw' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left', 'middle', 'right'], ['modified']], [[0, 0], [2, 2, 2], [0]], ['0', '1', '2', '3']])
|
||||
call s:assert.equals(s:expand([['readonly', 'filename', 'custom', 'modified']]),
|
||||
\ [[['readonly', 'filename', 'left', 'middle', 'right', 'modified']], [[0, 0, 2, 2, 2, 0]], ['0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.component_raw()
|
||||
function! Custom()
|
||||
return [ ['left'], ['middle'], ['right'] ]
|
||||
endfunction
|
||||
let g:lightline = { 'component_expand': { 'custom': 'Custom' }, 'component_type': { 'custom': 'custom' }, 'component_raw': { 'custom': 1 } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:expand([['readonly', 'filename'], ['custom'], ['modified']]),
|
||||
\ [[['readonly', 'filename'], ['left'], ['middle'], ['right'], ['modified']], [[0, 0], [2], [2], [2], [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, 2], [2], [2, 0]], ['0', 'custom', '0', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.multiple()
|
||||
function! Custom()
|
||||
return [ ['x0', 'x1', 'x2'], ['y0', 'y1', 'y2'], ['z0', 'z1', 'z2'] ]
|
||||
|
@ -610,3 +636,15 @@ function! s:suite.duplicated_type_both_nil_right_most()
|
|||
\ [[['filename'], ['y0', 'y1', 'y0', 'y1']], [[0], [1, 1, 1, 1]], ['0', 'custom', '1']])
|
||||
delfunction Custom
|
||||
endfunction
|
||||
|
||||
function! s:suite.dictionary_function()
|
||||
let g:lightline = { 'component_expand': { 'custom': 'g:lightline.Custom' } }
|
||||
function! g:lightline.Custom()
|
||||
return [ ['left'], ['middle'], ['right'] ]
|
||||
endfunction
|
||||
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']])
|
||||
endfunction
|
||||
|
|
|
@ -23,14 +23,14 @@ function! s:suite.highlight()
|
|||
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]))
|
||||
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()
|
||||
|
@ -39,14 +39,14 @@ function! s:suite.insert()
|
|||
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]))
|
||||
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
|
||||
|
||||
|
||||
|
@ -56,14 +56,14 @@ function! s:suite.visual()
|
|||
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]))
|
||||
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()
|
||||
|
@ -72,14 +72,14 @@ function! s:suite.replace()
|
|||
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]))
|
||||
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()
|
||||
|
@ -92,18 +92,18 @@ function! s:suite.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'), 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]))
|
||||
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()
|
||||
|
@ -120,11 +120,11 @@ function! s:suite.no_components()
|
|||
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]))
|
||||
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()
|
||||
|
@ -140,9 +140,9 @@ function! s:suite.subseparator()
|
|||
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])))
|
||||
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')
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_normal_%s_%s', i, j)), 'E411: highlight group not found\|cleared')
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
@ -154,18 +154,18 @@ function! s:suite.component_type()
|
|||
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')
|
||||
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]))
|
||||
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
|
||||
|
|
|
@ -17,50 +17,50 @@ 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')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
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()
|
||||
|
@ -73,18 +73,18 @@ function! s:suite.left_right()
|
|||
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')
|
||||
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()
|
||||
|
@ -100,9 +100,9 @@ function! s:suite.subseparator()
|
|||
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))
|
||||
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')
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_%s_%s', i, j)), 'E411: highlight group not found')
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
@ -114,18 +114,18 @@ function! s:suite.component_type()
|
|||
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')
|
||||
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))
|
||||
call s:assert.match(s:hi(printf('LightlineLeft_active_%s_%s', type1, type2)), printf('LightlineLeft_normal_%s_%s', type1, type2))
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
|
|
@ -177,6 +177,111 @@ function! s:suite.subseparator_component_function_7()
|
|||
delfunction Custom3
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_1()
|
||||
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' }, 'component_function_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_function_visible_condition_2()
|
||||
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' }, 'component_function_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_function_visible_condition_3()
|
||||
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' }, 'component_function_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_function_visible_condition_4()
|
||||
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' }, 'component_function_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_function_visible_condition_5()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return ''
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom1': '0' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_function_visible_condition_6()
|
||||
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' }, 'component_function_visible_condition': { '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_function_visible_condition_7()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
endfunction
|
||||
function! Custom2()
|
||||
return ''
|
||||
endfunction
|
||||
function! Custom3()
|
||||
return 'custom3'
|
||||
endfunction
|
||||
let g:lightline = { 'component_function': { 'custom1': 'Custom1', 'custom2': 'Custom2', 'custom3': 'Custom3' }, 'component_function_visible_condition': { 'custom3': '1' } }
|
||||
call lightline#init()
|
||||
call s:assert.equals(s:subseparator(['custom1', 'custom2', 'custom3'], '|', [0, 0, 0]), '|')
|
||||
endfunction
|
||||
|
||||
function! s:suite.subseparator_component_expand()
|
||||
function! Custom1()
|
||||
return 'custom1'
|
||||
|
|
|
@ -61,7 +61,7 @@ function! s:suite.tabnew_20_tabfirst()
|
|||
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)]])
|
||||
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()
|
||||
|
@ -70,7 +70,7 @@ function! s:suite.tabnew_20_tabfirst_tabnext()
|
|||
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)]])
|
||||
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()
|
||||
|
@ -78,7 +78,7 @@ function! s:suite.tabnew_20_tabnext_10()
|
|||
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)]])
|
||||
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()
|
||||
|
|
|
@ -14,6 +14,10 @@ Vim, then you should use an older version of the MRU plugin.
|
|||
The recently used filenames are stored in a file specified by the Vim
|
||||
MRU_File variable.
|
||||
|
||||
The Github repository for the MRU plugin is available at:
|
||||
|
||||
http://github.com/yegappan/mru
|
||||
|
||||
Usage
|
||||
|
||||
To list and edit files from the MRU list, you can use the ":MRU" command.
|
||||
|
@ -36,7 +40,8 @@ previous window has a modified buffer or is the preview window or is used by
|
|||
some other plugin, then the file is opened in a new window.
|
||||
|
||||
You can press the 'o' key to open the file name under the cursor in the
|
||||
MRU window in a new window.
|
||||
MRU window in a new window. You can also press <Shift-Enter> instead of 'o'
|
||||
to open the file in a new window.
|
||||
|
||||
To open a file from the MRU window in read-only mode (view), press the 'v'
|
||||
key.
|
||||
|
@ -46,19 +51,20 @@ file is already opened in a window in the current or in another tab, then
|
|||
the cursor is moved to that tab. Otherwise, a new tab is opened.
|
||||
|
||||
You can open multiple files from the MRU window by specifying a count before
|
||||
pressing '<Enter>' or 'v' or 'o' or 't'. You can also visually select
|
||||
multiple filenames and invoke the commands to open the files. Each selected
|
||||
file will be opened in a separate window or tab.
|
||||
pressing '<Enter>' or 'v' or 'o' or 't'. You can also visually (using
|
||||
linewise visual mode) select multiple filenames and invoke the commands to
|
||||
open the files. Each selected file will be opened in a separate window or
|
||||
tab.
|
||||
|
||||
You can press the 'u' key in the MRU window to update the file list. This is
|
||||
useful if you keep the MRU window open always.
|
||||
|
||||
You can close the MRU window by pressing the 'q' key or using one of the Vim
|
||||
window commands.
|
||||
You can close the MRU window by pressing the 'q' key or the <Esc> key or
|
||||
using one of the Vim window commands.
|
||||
|
||||
To display only files matching a pattern from the MRU list in the MRU
|
||||
window, you can specify a pattern to the ":MRU" command. For example, to
|
||||
display only file names containing "vim" in them, you can use the following
|
||||
display only file names matching "vim" in them, you can use the following
|
||||
command ":MRU vim". When you specify a partial file name and only one
|
||||
matching filename is found, then the ":MRU" command will edit that file.
|
||||
|
||||
|
@ -79,6 +85,16 @@ Whenever the MRU list changes, the MRU file is updated with the latest MRU
|
|||
list. When you have multiple instances of Vim running at the same time, the
|
||||
latest MRU list will show up in all the instances of Vim.
|
||||
|
||||
The MRUFilename syntax group is used to highlight the file names in the MRU
|
||||
window. By default, this syntax group is linked to the Identifier highlight
|
||||
group. You can change the highlight group by adding the following line in
|
||||
your .vimrc:
|
||||
|
||||
highlight link MRUFileName LineNr
|
||||
|
||||
The MRU buffer uses the 'mru file type. You can use this file type to add
|
||||
custom auto commands, syntax highlighting, etc.
|
||||
|
||||
Configuration
|
||||
|
||||
By changing the following variables you can configure the behavior of this
|
||||
|
@ -164,3 +180,13 @@ number of file names displayed in a single sub-menu:
|
|||
|
||||
let MRU_Max_Submenu_Entries = 15
|
||||
|
||||
In the MRU window, the filenames are displayed in two parts. The first part
|
||||
contains the file name without the path and the second part contains the
|
||||
full path to the file in parenthesis. This format is controlled by the
|
||||
MRU_Filename_Format variable. If you prefer to change this to some other
|
||||
format, then you can modify the MRU_Filename_Format variable. For example,
|
||||
to display the full path without splitting it, you can set this variable
|
||||
as shown below:
|
||||
|
||||
let MRU_Filename_Format={'formatter':'v:val', 'parser':'.*'}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
" File: mru.vim
|
||||
" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
|
||||
" Version: 3.4
|
||||
" Last Modified: April 13, 2012
|
||||
" Copyright: Copyright (C) 2003-2012 Yegappan Lakshmanan
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" Version: 3.9
|
||||
" Last Modified: Feb 3, 2015
|
||||
" Copyright: Copyright (C) 2003-2015 Yegappan Lakshmanan
|
||||
" License: Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
" mru.vim is provided *as is* and comes with no warranty of any
|
||||
" kind, either expressed or implied. In no event will the copyright
|
||||
" holder be liable for any damamges resulting from the use of this
|
||||
" holder be liable for any damages resulting from the use of this
|
||||
" software.
|
||||
"
|
||||
" Overview
|
||||
|
@ -25,27 +25,19 @@
|
|||
" The recently used filenames are stored in a file specified by the Vim
|
||||
" MRU_File variable.
|
||||
"
|
||||
" The Github repository for the MRU plugin is available at:
|
||||
"
|
||||
" http://github.com/yegappan/mru
|
||||
"
|
||||
" Installation
|
||||
" ------------
|
||||
" 1. Copy the mru.vim file to one of the following directories:
|
||||
"
|
||||
" $HOME/.vim/plugin - Unix like systems
|
||||
" $HOME/vimfiles/plugin - MS-Windows
|
||||
" $VIM:vimfiles:plugin - Macintosh
|
||||
" $VIM/vimfiles/plugin - All
|
||||
"
|
||||
" Refer to the following Vim help topics for more information about Vim
|
||||
" plugins:
|
||||
"
|
||||
" :help add-plugin
|
||||
" :help add-global-plugin
|
||||
" :help runtimepath
|
||||
"
|
||||
" 2. Set the MRU_File Vim variable in the .vimrc file to the location of a
|
||||
" file to store the most recently edited file names. This step is needed
|
||||
" only if you want to change the default MRU filename.
|
||||
" 3. Restart Vim.
|
||||
" 4. You can use the ":MRU" command to list and edit the recently used files.
|
||||
" 2. Restart Vim.
|
||||
" 3. You can use the ":MRU" command to list and edit the recently used files.
|
||||
" In GUI Vim, you can use the 'File->Recent Files' menu to access the
|
||||
" recently used files.
|
||||
"
|
||||
|
@ -75,7 +67,8 @@
|
|||
" some other plugin, then the file is opened in a new window.
|
||||
"
|
||||
" You can press the 'o' key to open the file name under the cursor in the
|
||||
" MRU window in a new window.
|
||||
" MRU window in a new window. You can also press <Shift-Enter> instead of 'o'
|
||||
" to open the file in a new window.
|
||||
"
|
||||
" To open a file from the MRU window in read-only mode (view), press the 'v'
|
||||
" key.
|
||||
|
@ -85,15 +78,16 @@
|
|||
" the cursor is moved to that tab. Otherwise, a new tab is opened.
|
||||
"
|
||||
" You can open multiple files from the MRU window by specifying a count before
|
||||
" pressing '<Enter>' or 'v' or 'o' or 't'. You can also visually select
|
||||
" multiple filenames and invoke the commands to open the files. Each selected
|
||||
" file will be opened in a separate window or tab.
|
||||
" pressing '<Enter>' or 'v' or 'o' or 't'. You can also visually (using
|
||||
" linewise visual mode) select multiple filenames and invoke the commands to
|
||||
" open the files. Each selected file will be opened in a separate window or
|
||||
" tab.
|
||||
"
|
||||
" You can press the 'u' key in the MRU window to update the file list. This is
|
||||
" useful if you keep the MRU window open always.
|
||||
"
|
||||
" You can close the MRU window by pressing the 'q' key or using one of the Vim
|
||||
" window commands.
|
||||
" You can close the MRU window by pressing the 'q' key or the <Esc> key or
|
||||
" using one of the Vim window commands.
|
||||
"
|
||||
" To display only files matching a pattern from the MRU list in the MRU
|
||||
" window, you can specify a pattern to the ":MRU" command. For example, to
|
||||
|
@ -118,6 +112,16 @@
|
|||
" list. When you have multiple instances of Vim running at the same time, the
|
||||
" latest MRU list will show up in all the instances of Vim.
|
||||
"
|
||||
" The MRUFilename syntax group is used to highlight the file names in the MRU
|
||||
" window. By default, this syntax group is linked to the Identifier highlight
|
||||
" group. You can change the highlight group by adding the following line in
|
||||
" your .vimrc:
|
||||
"
|
||||
" highlight link MRUFileName LineNr
|
||||
"
|
||||
" The MRU buffer uses the 'mru file type. You can use this file type to add
|
||||
" custom auto commands, syntax highlighting, etc.
|
||||
"
|
||||
" Configuration
|
||||
" -------------
|
||||
" By changing the following variables you can configure the behavior of this
|
||||
|
@ -203,6 +207,17 @@
|
|||
"
|
||||
" let MRU_Max_Submenu_Entries = 15
|
||||
"
|
||||
" In the MRU window, the filenames are displayed in two parts. The first part
|
||||
" contains the file name without the path and the second part contains the
|
||||
" full path to the file in parenthesis. This format is controlled by the
|
||||
" MRU_Filename_Format variable. If you prefer to change this to some other
|
||||
" format, then you can modify the MRU_Filename_Format variable. For example,
|
||||
" to display the full path without splitting it, you can set this variable
|
||||
" as shown below:
|
||||
"
|
||||
" let MRU_Filename_Format =
|
||||
" \ {'formatter':'v:val', 'parser':'.*', 'syntax': '[^/\\]\+$'}
|
||||
"
|
||||
" ****************** Do not modify after this line ************************
|
||||
if exists('loaded_mru')
|
||||
finish
|
||||
|
@ -296,6 +311,21 @@ if !exists('MRU_Open_File_Use_Tabs')
|
|||
let MRU_Open_File_Use_Tabs = 0
|
||||
endif
|
||||
|
||||
" Format of the file names displayed in the MRU window.
|
||||
" The default is to display the filename followed by the complete path to the
|
||||
" file in parenthesis. This variable controls the expressions used to format
|
||||
" and parse the path. This can be changed to display the filenames in a
|
||||
" different format. The 'formatter' specifies how to split/format the filename
|
||||
" and 'parser' specifies how to read the filename back; 'syntax' matches the
|
||||
" part to be highlighted.
|
||||
if !exists('MRU_Filename_Format')
|
||||
let MRU_Filename_Format = {
|
||||
\ 'formatter': 'fnamemodify(v:val, ":t") . " (" . v:val . ")"',
|
||||
\ 'parser': '(\zs.*\ze)',
|
||||
\ 'syntax': '^.\{-}\ze('
|
||||
\}
|
||||
endif
|
||||
|
||||
" Control to temporarily lock the MRU list. Used to prevent files from
|
||||
" getting added to the MRU list when the ':vimgrep' command is executed.
|
||||
let s:mru_list_locked = 0
|
||||
|
@ -419,7 +449,11 @@ endfunction
|
|||
" that should be escaped (for security reasons)
|
||||
let s:esc_filename_chars = ' *?[{`$%#"|!<>();&' . "'\t\n"
|
||||
function! s:MRU_escape_filename(fname)
|
||||
return escape(a:fname, s:esc_filename_chars)
|
||||
if exists("*fnameescape")
|
||||
return fnameescape(a:fname)
|
||||
else
|
||||
return escape(a:fname, s:esc_filename_chars)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" MRU_Edit_File {{{1
|
||||
|
@ -449,11 +483,13 @@ function! s:MRU_Edit_File(filename, sanitized)
|
|||
exe winnum . 'wincmd w'
|
||||
endif
|
||||
else
|
||||
if &modified || &buftype != '' || &previewwindow
|
||||
if !&hidden && (&modified || &buftype != '' || &previewwindow)
|
||||
" Current buffer has unsaved changes or is a special buffer or is
|
||||
" the preview window. So open the file in a new window
|
||||
" the preview window. The 'hidden' option is also not set.
|
||||
" So open the file in a new window.
|
||||
exe 'split ' . esc_fname
|
||||
else
|
||||
" The current file can be replaced with the selected file.
|
||||
exe 'edit ' . esc_fname
|
||||
endif
|
||||
endif
|
||||
|
@ -484,7 +520,7 @@ function! s:MRU_Open_File_In_Tab(fname, esc_fname)
|
|||
exe 'tabnext ' . i
|
||||
else
|
||||
" Open a new tab as the last tab page
|
||||
exe '999tabnew ' . a:esc_fname
|
||||
exe '$tabnew ' . a:esc_fname
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -503,8 +539,7 @@ endfunction
|
|||
" 'edit' - Edit the file as a regular file
|
||||
" multi : Specifies whether a single file or multiple files need to be
|
||||
" opened.
|
||||
" open_type : Specifies where to open the file. Can be one of 'useopen' or
|
||||
" 'newwin' or 'newtab'.
|
||||
" open_type : Specifies where to open the file.
|
||||
" useopen - If the file is already present in a window, then
|
||||
" jump to that window. Otherwise, open the file in
|
||||
" the previous window.
|
||||
|
@ -512,21 +547,25 @@ endfunction
|
|||
" newwin_vert - Open the file in a new vertical window.
|
||||
" newtab - Open the file in a new tab. If the file is already
|
||||
" opened in a tab, then jump to that tab.
|
||||
" preview - Open the file in the preview window
|
||||
function! s:MRU_Window_Edit_File(fname, multi, edit_type, open_type)
|
||||
let esc_fname = s:MRU_escape_filename(a:fname)
|
||||
|
||||
if a:open_type == 'newwin_horiz'
|
||||
if a:open_type ==# 'newwin_horiz'
|
||||
" Edit the file in a new horizontally split window above the previous
|
||||
" window
|
||||
wincmd p
|
||||
exe 'belowright new ' . esc_fname
|
||||
elseif a:open_type == 'newwin_vert'
|
||||
elseif a:open_type ==# 'newwin_vert'
|
||||
" Edit the file in a new vertically split window above the previous
|
||||
" window
|
||||
wincmd p
|
||||
exe 'belowright vnew ' . esc_fname
|
||||
elseif a:open_type == 'newtab' || g:MRU_Open_File_Use_Tabs
|
||||
elseif a:open_type ==# 'newtab' || g:MRU_Open_File_Use_Tabs
|
||||
call s:MRU_Open_File_In_Tab(a:fname, esc_fname)
|
||||
elseif a:open_type ==# 'preview'
|
||||
" Edit the file in the preview window
|
||||
exe 'topleft pedit ' . esc_fname
|
||||
else
|
||||
" If the selected file is already open in one of the windows,
|
||||
" jump to it
|
||||
|
@ -553,7 +592,7 @@ function! s:MRU_Window_Edit_File(fname, multi, edit_type, open_type)
|
|||
|
||||
let split_window = 0
|
||||
|
||||
if &modified || &previewwindow || a:multi
|
||||
if (!&hidden && (&modified || &previewwindow)) || a:multi
|
||||
" Current buffer has unsaved changes or is the preview window
|
||||
" or the user is opening multiple files
|
||||
" So open the file in a new window
|
||||
|
@ -572,13 +611,13 @@ function! s:MRU_Window_Edit_File(fname, multi, edit_type, open_type)
|
|||
if split_window
|
||||
" Current buffer has unsaved changes or is a special buffer or
|
||||
" is the preview window. So open the file in a new window
|
||||
if a:edit_type == 'edit'
|
||||
if a:edit_type ==# 'edit'
|
||||
exe 'split ' . esc_fname
|
||||
else
|
||||
exe 'sview ' . esc_fname
|
||||
endif
|
||||
else
|
||||
if a:edit_type == 'edit'
|
||||
if a:edit_type ==# 'edit'
|
||||
exe 'edit ' . esc_fname
|
||||
else
|
||||
exe 'view ' . esc_fname
|
||||
|
@ -619,7 +658,7 @@ function! s:MRU_Select_File_Cmd(opt) range
|
|||
endif
|
||||
|
||||
" The text in the MRU window contains the filename in parenthesis
|
||||
let file = matchstr(f, '(\zs.*\ze)')
|
||||
let file = matchstr(f, g:MRU_Filename_Format.parser)
|
||||
|
||||
call s:MRU_Window_Edit_File(file, multi, edit_type, open_type)
|
||||
|
||||
|
@ -707,17 +746,20 @@ function! s:MRU_Open_Window(...)
|
|||
endif
|
||||
endif
|
||||
|
||||
setlocal modifiable
|
||||
|
||||
" Mark the buffer as scratch
|
||||
setlocal buftype=nofile
|
||||
setlocal bufhidden=delete
|
||||
setlocal noswapfile
|
||||
setlocal nowrap
|
||||
setlocal nobuflisted
|
||||
" Set the 'filetype' to 'mru'. This allows the user to apply custom
|
||||
" syntax highlighting or other changes to the MRU bufer.
|
||||
setlocal filetype=mru
|
||||
" Use fixed height for the MRU window
|
||||
setlocal winfixheight
|
||||
|
||||
call MRU_SetupSyntax()
|
||||
|
||||
" Setup the cpoptions properly for the maps to work
|
||||
let old_cpoptions = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
@ -731,6 +773,10 @@ function! s:MRU_Open_Window(...)
|
|||
\ :call <SID>MRU_Select_File_Cmd('edit,newwin_horiz')<CR>
|
||||
vnoremap <buffer> <silent> o
|
||||
\ :call <SID>MRU_Select_File_Cmd('edit,newwin_horiz')<CR>
|
||||
nnoremap <buffer> <silent> <S-CR>
|
||||
\ :call <SID>MRU_Select_File_Cmd('edit,newwin_horiz')<CR>
|
||||
vnoremap <buffer> <silent> <S-CR>
|
||||
\ :call <SID>MRU_Select_File_Cmd('edit,newwin_horiz')<CR>
|
||||
nnoremap <buffer> <silent> O
|
||||
\ :call <SID>MRU_Select_File_Cmd('edit,newwin_vert')<CR>
|
||||
vnoremap <buffer> <silent> O
|
||||
|
@ -741,6 +787,14 @@ function! s:MRU_Open_Window(...)
|
|||
\ :call <SID>MRU_Select_File_Cmd('edit,newtab')<CR>
|
||||
nnoremap <buffer> <silent> v
|
||||
\ :call <SID>MRU_Select_File_Cmd('view,useopen')<CR>
|
||||
nnoremap <buffer> <silent> p
|
||||
\ :call <SID>MRU_Select_File_Cmd('view,preview')<CR>
|
||||
vnoremap <buffer> <silent> p
|
||||
\ :<C-u>if line("'<") == line("'>")<Bar>
|
||||
\ call <SID>MRU_Select_File_Cmd('open,preview')<Bar>
|
||||
\ else<Bar>
|
||||
\ echoerr "Only a single file can be previewed"<Bar>
|
||||
\ endif<CR>
|
||||
nnoremap <buffer> <silent> u :MRU<CR>
|
||||
nnoremap <buffer> <silent> <2-LeftMouse>
|
||||
\ :call <SID>MRU_Select_File_Cmd('edit,useopen')<CR>
|
||||
|
@ -764,16 +818,22 @@ function! s:MRU_Open_Window(...)
|
|||
endif
|
||||
|
||||
" Get the tail part of the file name (without the directory) and display
|
||||
" it along with the full path
|
||||
let output = map(m, 'fnamemodify(v:val, ":t") . " (" . v:val . ")"')
|
||||
" it along with the full path in parenthesis.
|
||||
let output = map(m, g:MRU_Filename_Format.formatter)
|
||||
silent! 0put =output
|
||||
|
||||
" Delete the empty line at the end of the buffer
|
||||
$delete
|
||||
silent! $delete _
|
||||
|
||||
" Move the cursor to the beginning of the file
|
||||
normal! gg
|
||||
|
||||
" Add syntax highlighting for the file names
|
||||
if has_key(g:MRU_Filename_Format, 'syntax')
|
||||
exe "syntax match MRUFileName '" . g:MRU_Filename_Format.syntax . "'"
|
||||
highlight default link MRUFileName Identifier
|
||||
endif
|
||||
|
||||
setlocal nomodifiable
|
||||
endfunction
|
||||
|
||||
|
@ -921,7 +981,7 @@ function! s:MRU_Refresh_Menu()
|
|||
let entry_cnt = len(s:MRU_files)
|
||||
if entry_cnt > g:MRU_Max_Menu_Entries
|
||||
" Show only MRU_Max_Menu_Entries file names in the menu
|
||||
let mru_list = s:MRU_files[1 : g:MRU_Max_Menu_Entries]
|
||||
let mru_list = s:MRU_files[0 : g:MRU_Max_Menu_Entries - 1]
|
||||
let entry_cnt = g:MRU_Max_Menu_Entries
|
||||
else
|
||||
let mru_list = s:MRU_files
|
||||
|
@ -949,16 +1009,6 @@ function! s:MRU_Refresh_Menu()
|
|||
let &cpoptions = old_cpoptions
|
||||
endfunction
|
||||
|
||||
" Setup syntax highlight
|
||||
function! MRU_SetupSyntax()
|
||||
if has("syntax")
|
||||
syn match mruName /.\+\s/
|
||||
syn match mruDir /(.\+)/
|
||||
hi def link mruDir Folded
|
||||
hi def link mruName String
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Load the MRU list on plugin startup
|
||||
call s:MRU_LoadList()
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
_To assist in resolving your issue, provide as much information as possible, in place of the ellipses (`…`) below._
|
||||
|
||||
---
|
||||
**Environment:** _Describe your Vim/NERDTree setup._
|
||||
|
||||
>* Operating System: …
|
||||
>* Vim version `:version`: …
|
||||
>* NERDTree version `git rev-parse --short HEAD`: …
|
||||
>* NERDTree settings applied in your vimrc, if any:
|
||||
>
|
||||
> ```
|
||||
> …
|
||||
> ```
|
||||
|
||||
**Process:** _List the steps that will recreate the issue._
|
||||
|
||||
>1. …
|
||||
|
||||
**Current Result:** _Describe what you you currently experience from this process._
|
||||
|
||||
>…
|
||||
|
||||
**Expected Result:** _Describe what you would expect to have resulted from this process._
|
||||
|
||||
>…
|
||||
|
||||
---
|
||||
**Optional**
|
||||
|
||||
**Screenshot(s):**
|
||||
|
||||
>…
|
||||
|
||||
**Possible Fix:** _(Have you poked around in the code?)_
|
||||
|
||||
>…
|
||||
|
|
@ -1,4 +1,30 @@
|
|||
Next
|
||||
- Fix broken "t" and "T" mappings, tabs now open at end (lifecrisis) #759
|
||||
- Update doc with already existing mapping variables (asnr) #699
|
||||
- Fix the broken g:NERDTreeBookmarksSort setting (lifecrisis) #696
|
||||
- Correct NERDTreeIgnore pattern in doc (cntoplolicon) #648
|
||||
- Remove empty segments when splitting path (sooth-sayer) #574
|
||||
- Suppress autocmds less agressively (wincent) #578 #691
|
||||
- Add an Issues template to ask for more info initially.
|
||||
- Fix markdown headers in readme (josephfrazier) #676
|
||||
- Don't touch @o and @h registers when rendering
|
||||
- Fix bug with files and directories with dollar signs (alegen) #649
|
||||
- Reuse/reopen existing window trees where possible #244
|
||||
- Remove NERDTree.previousBuf()
|
||||
- Change color of arrow (Leeiio) #630
|
||||
- Improved a tip in README.markdown (ggicci) #628
|
||||
- Shorten delete confimration of empty directory to 'y' (mikeperri) #530
|
||||
- Fix API call to open directory tree in window (devm33) #533
|
||||
- Change default arrows on non-Windows platforms (gwilk) #546
|
||||
- Update to README - combine cd and git clone (zwhitchcox) #584
|
||||
- Update to README - Tip: start NERDTree when vim starts (therealplato) #593
|
||||
- Escape filename when moving an open buffer (zacharyvoase) #595
|
||||
- Fixed incorrect :helptags command in README (curran) #619
|
||||
- Fixed incomplete escaping of folder arrows (adityanatraj) #548
|
||||
- Added NERDTreeCascadeSingleChildDir option (juanibiapina) #558
|
||||
- Replace strchars() with backward compatible workaround.
|
||||
- Add support for copy command in Windows (SkylerLipthay) #231
|
||||
- Fixed typo in README.markdown - :Helptags -> :helptags
|
||||
- Rename "primary" and "secondary" trees to "tab" and "window" trees.
|
||||
- Move a bunch of buffer level variables into the NERDTree and UI classes.
|
||||
- Display cascading dirs on one line to save vertical/horizontal space (@matt-gardner: brainstorming/testing)
|
||||
|
|
|
@ -1,76 +1,35 @@
|
|||
The NERD Tree
|
||||
The NERDTree
|
||||
=============
|
||||
|
||||
Intro
|
||||
-----
|
||||
Introduction
|
||||
------------
|
||||
|
||||
The NERD tree allows you to explore your filesystem and to open files and
|
||||
directories. It presents the filesystem to you in the form of a tree which you
|
||||
manipulate with the keyboard and/or mouse. It also allows you to perform
|
||||
simple filesystem operations.
|
||||
The NERDTree is a file system explorer for the Vim editor. Using this plugin,
|
||||
users can visually browse complex directory hierarchies, quickly open files for
|
||||
reading or editing, and perform basic file system operations.
|
||||
|
||||
The following features and functionality are provided by the NERD tree:
|
||||
This plugin can also be extended with custom mappings using a special API. The
|
||||
details of this API and of other NERDTree features are described in the
|
||||
included documentation.
|
||||
|
||||
* Files and directories are displayed in a hierarchical tree structure
|
||||
* Different highlighting is provided for the following types of nodes:
|
||||
* files
|
||||
* directories
|
||||
* sym-links
|
||||
* windows .lnk files
|
||||
* read-only files
|
||||
* executable files
|
||||
* Many (customisable) mappings are provided to manipulate the tree:
|
||||
* Mappings to open/close/explore directory nodes
|
||||
* Mappings to open files in new/existing windows/tabs
|
||||
* Mappings to change the current root of the tree
|
||||
* Mappings to navigate around the tree
|
||||
* ...
|
||||
* Directories and files can be bookmarked.
|
||||
* Most NERD tree navigation can also be done with the mouse
|
||||
* Filtering of tree content (can be toggled at runtime)
|
||||
* custom file filters to prevent e.g. vim backup files being displayed
|
||||
* optional displaying of hidden files (. files)
|
||||
* files can be "turned off" so that only directories are displayed
|
||||
* The position and size of the NERD tree window can be customised
|
||||
* The order in which the nodes in the tree are listed can be customised.
|
||||
* A model of your filesystem is created/maintained as you explore it. This
|
||||
has several advantages:
|
||||
* All filesystem information is cached and is only re-read on demand
|
||||
* If you revisit a part of the tree that you left earlier in your
|
||||
session, the directory nodes will be opened/closed as you left them
|
||||
* The script remembers the cursor position and window position in the NERD
|
||||
tree so you can toggle it off (or just close the tree window) and then
|
||||
reopen it (with NERDTreeToggle) the NERD tree window will appear exactly
|
||||
as you left it
|
||||
* You can have a separate NERD tree for each tab, share trees across tabs,
|
||||
or a mix of both.
|
||||
* By default the script overrides the default file browser (netrw), so if
|
||||
you :edit a directory a (slightly modified) NERD tree will appear in the
|
||||
current window
|
||||
* A programmable menu system is provided (simulates right clicking on a node)
|
||||
* one default menu plugin is provided to perform basic filesystem
|
||||
operations (create/delete/move/copy files/directories)
|
||||
* There's an API for adding your own keymappings
|
||||
![NERDTree Screenshot](https://github.com/scrooloose/nerdtree/raw/master/screenshot.png)
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
####[pathogen.vim](https://github.com/tpope/vim-pathogen)
|
||||
#### [pathogen.vim](https://github.com/tpope/vim-pathogen)
|
||||
|
||||
cd ~/.vim/bundle
|
||||
git clone https://github.com/scrooloose/nerdtree.git
|
||||
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
|
||||
|
||||
Then reload vim, run `:Helptags`, and check out `:help NERD_tree.txt`.
|
||||
Then reload Vim, run `:helptags ~/.vim/bundle/nerdtree/doc/`, and check out `:help NERDTree.txt`.
|
||||
|
||||
|
||||
####[apt-vim](https://github.com/egalpin/apt-vim)
|
||||
#### [apt-vim](https://github.com/egalpin/apt-vim)
|
||||
|
||||
apt-vim install -y https://github.com/scrooloose/nerdtree.git
|
||||
|
||||
|
||||
|
||||
Faq
|
||||
---
|
||||
F.A.Q.
|
||||
------
|
||||
|
||||
> Is there any support for `git` flags?
|
||||
|
||||
|
@ -101,6 +60,14 @@ Stick this in your vimrc:
|
|||
|
||||
Note: Now start vim with plain `vim`, not `vim .`
|
||||
|
||||
---
|
||||
> How can I open NERDTree automatically when vim starts up on opening a directory?
|
||||
|
||||
autocmd StdinReadPre * let s:std_in=1
|
||||
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
|
||||
|
||||
This window is tab-specific, meaning it's used by all windows in the tab. This trick also prevents NERDTree from hiding when first selecting a file.
|
||||
|
||||
---
|
||||
> How can I map a specific key or shortcut to open NERDTree?
|
||||
|
||||
|
|
|
@ -13,9 +13,37 @@ endfunction
|
|||
"FUNCTION: nerdtree#checkForBrowse(dir) {{{2
|
||||
"inits a window tree in the current buffer if appropriate
|
||||
function! nerdtree#checkForBrowse(dir)
|
||||
if a:dir != '' && isdirectory(a:dir)
|
||||
call g:NERDTreeCreator.CreateWindowTree(a:dir)
|
||||
if !isdirectory(a:dir)
|
||||
return
|
||||
endif
|
||||
|
||||
if s:reuseWin(a:dir)
|
||||
return
|
||||
endif
|
||||
|
||||
call g:NERDTreeCreator.CreateWindowTree(a:dir)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:reuseWin(dir) {{{2
|
||||
"finds a NERDTree buffer with root of dir, and opens it.
|
||||
function! s:reuseWin(dir) abort
|
||||
let path = g:NERDTreePath.New(fnamemodify(a:dir, ":p"))
|
||||
|
||||
for i in range(1, bufnr("$"))
|
||||
unlet! nt
|
||||
let nt = getbufvar(i, "NERDTree")
|
||||
if empty(nt)
|
||||
continue
|
||||
endif
|
||||
|
||||
if nt.isWinTree() && nt.root.path.equals(path)
|
||||
call nt.setPreviousBuf(bufnr("#"))
|
||||
exec "buffer " . i
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" FUNCTION: nerdtree#completeBookmarks(A,L,P) {{{2
|
||||
|
@ -24,11 +52,6 @@ function! nerdtree#completeBookmarks(A,L,P)
|
|||
return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
|
||||
endfunction
|
||||
|
||||
"FUNCTION: nerdtree#compareBookmarks(dir) {{{2
|
||||
function! nerdtree#compareBookmarks(first, second)
|
||||
return a:first.compareTo(a:second)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: nerdtree#compareNodes(dir) {{{2
|
||||
function! nerdtree#compareNodes(n1, n2)
|
||||
return a:n1.path.compareTo(a:n2.path)
|
||||
|
@ -36,9 +59,33 @@ endfunction
|
|||
|
||||
"FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2
|
||||
function! nerdtree#compareNodesBySortKey(n1, n2)
|
||||
if a:n1.path.getSortKey() <# a:n2.path.getSortKey()
|
||||
let sortKey1 = a:n1.path.getSortKey()
|
||||
let sortKey2 = a:n2.path.getSortKey()
|
||||
|
||||
let i = 0
|
||||
while i < min([len(sortKey1), len(sortKey2)])
|
||||
" Compare chunks upto common length.
|
||||
" If chunks have different type, the one which has
|
||||
" integer type is the lesser.
|
||||
if type(sortKey1[i]) == type(sortKey2[i])
|
||||
if sortKey1[i] <# sortKey2[i]
|
||||
return - 1
|
||||
elseif sortKey1[i] ># sortKey2[i]
|
||||
return 1
|
||||
endif
|
||||
elseif sortKey1[i] == type(0)
|
||||
return -1
|
||||
elseif sortKey2[i] == type(0)
|
||||
return 1
|
||||
endif
|
||||
let i = i + 1
|
||||
endwhile
|
||||
|
||||
" Keys are identical upto common length.
|
||||
" The key which has smaller chunks is the lesser one.
|
||||
if len(sortKey1) < len(sortKey2)
|
||||
return -1
|
||||
elseif a:n1.path.getSortKey() ># a:n2.path.getSortKey()
|
||||
elseif len(sortKey1) > len(sortKey2)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
@ -61,10 +108,12 @@ function! nerdtree#deprecated(func, ...)
|
|||
endfunction
|
||||
|
||||
" FUNCTION: nerdtree#exec(cmd) {{{2
|
||||
" same as :exec cmd but eventignore=all is set for the duration
|
||||
" Same as :exec cmd but with eventignore set for the duration
|
||||
" to disable the autocommands used by NERDTree (BufEnter,
|
||||
" BufLeave and VimEnter)
|
||||
function! nerdtree#exec(cmd)
|
||||
let old_ei = &ei
|
||||
set ei=all
|
||||
set ei=BufEnter,BufLeave,VimEnter
|
||||
exec a:cmd
|
||||
let &ei = old_ei
|
||||
endfunction
|
||||
|
@ -106,6 +155,11 @@ function! nerdtree#runningWindows()
|
|||
return has("win16") || has("win32") || has("win64")
|
||||
endfunction
|
||||
|
||||
"FUNCTION: nerdtree#runningCygwin(dir) {{{2
|
||||
function! nerdtree#runningCygwin()
|
||||
return has("win32unix")
|
||||
endfunction
|
||||
|
||||
" SECTION: View Functions {{{1
|
||||
"============================================================
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ let g:loaded_nerdtree_ui_glue_autoload = 1
|
|||
function! nerdtree#ui_glue#createDefaultBindings()
|
||||
let s = '<SNR>' . s:SID() . '_'
|
||||
|
||||
call NERDTreeAddKeyMap({ 'key': '<MiddleRelease>', 'scope': "all", 'callback': s."handleMiddleMouse" })
|
||||
call NERDTreeAddKeyMap({ 'key': '<MiddleMouse>', 'scope': 'all', 'callback': s . 'handleMiddleMouse' })
|
||||
call NERDTreeAddKeyMap({ 'key': '<LeftRelease>', 'scope': "all", 'callback': s."handleLeftClick" })
|
||||
call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "DirNode", 'callback': s."activateDirNode" })
|
||||
call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."activateFileNode" })
|
||||
|
@ -68,10 +68,10 @@ function! nerdtree#ui_glue#createDefaultBindings()
|
|||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': "Node", 'callback': s."jumpToNextSibling" })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': "Node", 'callback': s."jumpToPrevSibling" })
|
||||
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Node", 'callback': s."openInNewTab" })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Node", 'callback': s."openInNewTabSilent" })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Bookmark", 'callback': s."openInNewTab" })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Bookmark", 'callback': s."openInNewTabSilent" })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Node', 'callback': s . 'openInNewTab' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Node', 'callback': s . 'openInNewTabSilent' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Bookmark', 'callback': s . 'openInNewTab' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Bookmark', 'callback': s . 'openInNewTabSilent' })
|
||||
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "DirNode", 'callback': s."openExplorer" })
|
||||
|
||||
|
@ -90,10 +90,15 @@ function! s:activateAll()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:activateDirNode() {{{1
|
||||
"handle the user activating a tree node
|
||||
function! s:activateDirNode(node)
|
||||
call a:node.activate()
|
||||
" FUNCTION: s:activateDirNode(directoryNode) {{{1
|
||||
function! s:activateDirNode(directoryNode)
|
||||
|
||||
if a:directoryNode.isRoot() && a:directoryNode.isOpen
|
||||
call nerdtree#echo('cannot close tree root')
|
||||
return
|
||||
endif
|
||||
|
||||
call a:directoryNode.activate()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:activateFileNode() {{{1
|
||||
|
@ -184,24 +189,28 @@ function! s:closeChildren(node)
|
|||
endfunction
|
||||
|
||||
" FUNCTION: s:closeCurrentDir(node) {{{1
|
||||
" closes the parent dir of the current node
|
||||
" Close the parent directory of the current node.
|
||||
function! s:closeCurrentDir(node)
|
||||
let parent = a:node.parent
|
||||
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)
|
||||
|
||||
if a:node.isRoot()
|
||||
call nerdtree#echo('cannot close parent of tree root')
|
||||
return
|
||||
endif
|
||||
|
||||
let l:parent = a:node.parent
|
||||
|
||||
while l:parent.isCascadable()
|
||||
let l:parent = l:parent.parent
|
||||
endwhile
|
||||
|
||||
if l:parent.isRoot()
|
||||
call nerdtree#echo('cannot close tree root')
|
||||
return
|
||||
endif
|
||||
|
||||
call l:parent.close()
|
||||
call b:NERDTree.render()
|
||||
call l:parent.putCursorHere(0, 0)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:closeTreeWindow() {{{1
|
||||
|
@ -336,16 +345,22 @@ endfunction
|
|||
|
||||
" FUNCTION: s:handleMiddleMouse() {{{1
|
||||
function! s:handleMiddleMouse()
|
||||
let curNode = g:NERDTreeFileNode.GetSelected()
|
||||
if curNode ==# {}
|
||||
call nerdtree#echo("Put the cursor on a node first" )
|
||||
|
||||
" A middle mouse click does not automatically position the cursor as one
|
||||
" would expect. Forcing the execution of a regular left mouse click here
|
||||
" fixes this problem.
|
||||
execute "normal! \<LeftMouse>"
|
||||
|
||||
let l:currentNode = g:NERDTreeFileNode.GetSelected()
|
||||
if empty(l:currentNode)
|
||||
call nerdtree#echoError('use the pointer to select a node')
|
||||
return
|
||||
endif
|
||||
|
||||
if curNode.path.isDirectory
|
||||
call nerdtree#openExplorer(curNode)
|
||||
if l:currentNode.path.isDirectory
|
||||
call l:currentNode.openExplorer()
|
||||
else
|
||||
call curNode.open({'where': 'h'})
|
||||
call l:currentNode.open({'where': 'h'})
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -398,13 +413,27 @@ function! s:jumpToLastChild(node)
|
|||
endfunction
|
||||
|
||||
" FUNCTION: s:jumpToParent(node) {{{1
|
||||
" moves the cursor to the parent of the current node
|
||||
" Move the cursor to the parent of the specified node. For a cascade, move to
|
||||
" the parent of the cascade's highest node. At the root, do nothing.
|
||||
function! s:jumpToParent(node)
|
||||
if !empty(a:node.parent)
|
||||
call a:node.parent.putCursorHere(1, 0)
|
||||
let l:parent = a:node.parent
|
||||
|
||||
" If "a:node" represents a directory, back out of its cascade.
|
||||
if a:node.path.isDirectory
|
||||
while !empty(l:parent) && !l:parent.isRoot()
|
||||
if index(l:parent.getCascade(), a:node) >= 0
|
||||
let l:parent = l:parent.parent
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endif
|
||||
|
||||
if !empty(l:parent)
|
||||
call l:parent.putCursorHere(1, 0)
|
||||
call b:NERDTree.ui.centerView()
|
||||
else
|
||||
call nerdtree#echo("cannot jump to parent")
|
||||
call nerdtree#echo('could not jump to parent node')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -441,21 +470,19 @@ function! s:jumpToSibling(currentNode, forward)
|
|||
endfunction
|
||||
|
||||
" FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1
|
||||
" put the cursor on the given bookmark and, if its a file, open it
|
||||
" Open the Bookmark that has the specified name. This function provides the
|
||||
" implementation for the ":OpenBookmark" command.
|
||||
function! nerdtree#ui_glue#openBookmark(name)
|
||||
try
|
||||
let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
|
||||
call targetNode.putCursorHere(0, 1)
|
||||
redraw!
|
||||
catch /^NERDTree.BookmarkedNodeNotFoundError/
|
||||
call nerdtree#echo("note - target node is not cached")
|
||||
let bookmark = g:NERDTreeBookmark.BookmarkFor(a:name)
|
||||
let targetNode = g:NERDTreeFileNode.New(bookmark.path, b:NERDTree)
|
||||
let l:bookmark = g:NERDTreeBookmark.BookmarkFor(a:name)
|
||||
catch /^NERDTree.BookmarkNotFoundError/
|
||||
call nerdtree#echoError('bookmark "' . a:name . '" not found')
|
||||
return
|
||||
endtry
|
||||
if targetNode.path.isDirectory
|
||||
call targetNode.openExplorer()
|
||||
if l:bookmark.path.isDirectory
|
||||
call l:bookmark.open(b:NERDTree)
|
||||
else
|
||||
call targetNode.open({'where': 'p'})
|
||||
call l:bookmark.open(b:NERDTree, {'where': 'p'})
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -476,12 +503,14 @@ endfunction
|
|||
|
||||
" FUNCTION: s:openInNewTab(target) {{{1
|
||||
function! s:openInNewTab(target)
|
||||
call a:target.activate({'where': 't'})
|
||||
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't'})
|
||||
call l:opener.open(a:target)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:openInNewTabSilent(target) {{{1
|
||||
function! s:openInNewTabSilent(target)
|
||||
call a:target.activate({'where': 't', 'stay': 1})
|
||||
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'stay': 1})
|
||||
call l:opener.open(a:target)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:openNodeRecursively(node) {{{1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
*NERD_tree.txt* A tree explorer plugin that owns your momma!
|
||||
*NERDTree.txt* A tree explorer plugin that owns your momma!
|
||||
|
||||
|
||||
|
||||
|
@ -117,6 +117,10 @@ The following features and functionality are provided by the NERD tree:
|
|||
again. If no NERD tree exists for this tab then this command acts the
|
||||
same as the |:NERDTree| command.
|
||||
|
||||
:NERDTreeFocus *:NERDTreeFocus*
|
||||
Opens (or reopens) the NERD Tree if it is not currently visible;
|
||||
otherwise, the cursor is moved to the already-open NERD Tree.
|
||||
|
||||
:NERDTreeMirror *:NERDTreeMirror*
|
||||
Shares an existing NERD tree, from another tab, in the current tab.
|
||||
Changes made to one tree are reflected in both as they are actually the
|
||||
|
@ -158,7 +162,7 @@ click bookmarks or use the |NERDTree-o| mapping to activate them. See also,
|
|||
------------------------------------------------------------------------------
|
||||
2.2.2. Bookmark commands *NERDTreeBookmarkCommands*
|
||||
|
||||
Note that the following commands are only available in the NERD tree buffer.
|
||||
Note: The following commands are only available within the NERDTree buffer.
|
||||
|
||||
:Bookmark [<name>]
|
||||
Bookmark the current node as <name>. If there is already a <name>
|
||||
|
@ -178,10 +182,11 @@ Note that the following commands are only available in the NERD tree buffer.
|
|||
(i.e. directory nodes above it will be opened) and the cursor will be
|
||||
placed on it.
|
||||
|
||||
:OpenBookmark <bookmark>
|
||||
<bookmark> must point to a file. The file is opened as though |NERDTree-o|
|
||||
was applied. If the node is cached under the current root then it will be
|
||||
revealed and the cursor will be placed on it.
|
||||
:OpenBookmark <name>
|
||||
The Bookmark named <name> is opened as if |NERDTree-o| was applied to
|
||||
its entry in the Bookmark table. If the Bookmark points to a directory,
|
||||
it is made the new root of the current NERDTree. If the Bookmark points
|
||||
to a file, that file is opened for editing in another window.
|
||||
|
||||
:ClearBookmarks [<bookmarks>]
|
||||
Remove all the given bookmarks. If no bookmarks are given then remove all
|
||||
|
@ -282,13 +287,13 @@ previous window.
|
|||
------------------------------------------------------------------------------
|
||||
*NERDTree-go*
|
||||
Default key: go
|
||||
Map option: None
|
||||
Map option: NERDTreeMapPreview
|
||||
Applies to: files.
|
||||
|
||||
If a file node is selected, it is opened in the previous window, but the
|
||||
cursor does not move.
|
||||
|
||||
The key combo for this mapping is always "g" + NERDTreeMapActivateNode (see
|
||||
The default key combo for this mapping is "g" + NERDTreeMapActivateNode (see
|
||||
|NERDTree-o|).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
@ -324,12 +329,12 @@ window.
|
|||
------------------------------------------------------------------------------
|
||||
*NERDTree-gi*
|
||||
Default key: gi
|
||||
Map option: None
|
||||
Map option: NERDTreeMapPreviewSplit
|
||||
Applies to: files.
|
||||
|
||||
The same as |NERDTree-i| except that the cursor is not moved.
|
||||
|
||||
The key combo for this mapping is always "g" + NERDTreeMapOpenSplit (see
|
||||
The default key combo for this mapping is "g" + NERDTreeMapOpenSplit (see
|
||||
|NERDTree-i|).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
@ -344,12 +349,12 @@ the new window.
|
|||
------------------------------------------------------------------------------
|
||||
*NERDTree-gs*
|
||||
Default key: gs
|
||||
Map option: None
|
||||
Map option: NERDTreeMapPreviewVSplit
|
||||
Applies to: files.
|
||||
|
||||
The same as |NERDTree-s| except that the cursor is not moved.
|
||||
|
||||
The key combo for this mapping is always "g" + NERDTreeMapOpenVSplit (see
|
||||
The default key combo for this mapping is "g" + NERDTreeMapOpenVSplit (see
|
||||
|NERDTree-s|).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
@ -618,6 +623,9 @@ NERD tree. These options should be set in your vimrc.
|
|||
|'NERDTreeCaseSensitiveSort'| Tells the NERD tree whether to be case
|
||||
sensitive or not when sorting nodes.
|
||||
|
||||
|'NERDTreeNaturalSort'| Tells the NERD tree whether to use
|
||||
natural sort order or not when sorting nodes.
|
||||
|
||||
|'NERDTreeSortHiddenFirst'| Tells the NERD tree whether to take the dot
|
||||
at the beginning of the hidden file names
|
||||
into account when sorting nodes.
|
||||
|
@ -637,11 +645,11 @@ NERD tree. These options should be set in your vimrc.
|
|||
|
||||
|'NERDTreeBookmarksFile'| Where the bookmarks are stored.
|
||||
|
||||
|'NERDTreeBookmarksSort'| Whether the bookmarks list is sorted on
|
||||
display.
|
||||
|'NERDTreeBookmarksSort'| Control how the Bookmark table is sorted.
|
||||
|
||||
|'NERDTreeMouseMode'| Tells the NERD tree how to handle mouse
|
||||
clicks.
|
||||
|'NERDTreeMarkBookmarks'| Render bookmarked nodes with markers.
|
||||
|
||||
|'NERDTreeMouseMode'| Manage the interpretation of mouse clicks.
|
||||
|
||||
|'NERDTreeQuitOnOpen'| Closes the tree window after opening a file.
|
||||
|
||||
|
@ -668,14 +676,18 @@ NERD tree. These options should be set in your vimrc.
|
|||
|'NERDTreeWinSize'| Sets the window size when the NERD tree is
|
||||
opened.
|
||||
|
||||
|'NERDTreeMinimalUI'| Disables display of the 'Bookmarks' label and
|
||||
|'NERDTreeMinimalUI'| Disables display of the 'Bookmarks' label and
|
||||
'Press ? for help' text.
|
||||
|
||||
|'NERDTreeCascadeSingleChildDir'|
|
||||
Collapses on the same line directories that
|
||||
have only one child directory.
|
||||
|
||||
|'NERDTreeCascadeOpenSingleChildDir'|
|
||||
Cascade open while selected directory has only
|
||||
one child that also is a directory.
|
||||
|
||||
|'NERDTreeAutoDeleteBuffer'| Tells the NERD tree to automatically remove
|
||||
|'NERDTreeAutoDeleteBuffer'| Tells the NERD tree to automatically remove
|
||||
a buffer when a file is being deleted or renamed
|
||||
via a context menu command.
|
||||
|
||||
|
@ -737,6 +749,33 @@ account. The above nodes would then be sorted like this: >
|
|||
blarg.c
|
||||
boner.c
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeNaturalSort'*
|
||||
Values: 0 or 1.
|
||||
Default: 0.
|
||||
|
||||
By default the NERD tree does not sort nodes in natural sort order, i.e. nodes
|
||||
could appear like this: >
|
||||
z1.txt
|
||||
z10.txt
|
||||
z100.txt
|
||||
z11.txt
|
||||
z110.txt
|
||||
z2.txt
|
||||
z20.txt
|
||||
z3.txt
|
||||
<
|
||||
But if you set this option to 1 then the natural sort order will be used. The
|
||||
above nodes would then be sorted like this: >
|
||||
z1.txt
|
||||
z2.txt
|
||||
z3.txt
|
||||
z10.txt
|
||||
z11.txt
|
||||
z20.txt
|
||||
z100.txt
|
||||
z110.txt
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeChDirMode'*
|
||||
|
||||
|
@ -802,7 +841,7 @@ then all files ending in .vim or ~ will be ignored.
|
|||
There are 2 magic flags that can be appended to the end of each regular
|
||||
expression to specify that the regex should match only files or only dirs.
|
||||
These flags are "[[dir]]" and "[[file]]". Example: >
|
||||
let NERDTreeIgnore=['.d$[[dir]]', '.o$[[file]]']
|
||||
let NERDTreeIgnore=['\.d$[[dir]]', '\.o$[[file]]']
|
||||
<
|
||||
This will cause all dirs ending in ".d" to be ignored and all files ending in
|
||||
".o" to be ignored.
|
||||
|
@ -831,11 +870,24 @@ This is where bookmarks are saved. See |NERDTreeBookmarkCommands|.
|
|||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeBookmarksSort'*
|
||||
Values: 0, 1, or 2
|
||||
Default: 1
|
||||
|
||||
This option controls the method by which the list of user bookmarks is
|
||||
sorted. When sorted, bookmarks will render in alphabetical order by name.
|
||||
|
||||
If set to 0, the bookmarks list is not sorted.
|
||||
If set to 1, the bookmarks list is sorted in a case-insensitive manner.
|
||||
If set to 2, the bookmarks list is sorted in a case-sensitive manner.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeMarkBookmarks'*
|
||||
Values: 0 or 1
|
||||
Default: 1
|
||||
|
||||
If set to 0 then the bookmarks list is not sorted.
|
||||
If set to 1 the bookmarks list is sorted.
|
||||
If set to 1, Bookmarks will be specially marked whenever the NERDTree is
|
||||
rendered. Users of the |'NERDTreeMinimalUI'| setting may prefer to disable
|
||||
this setting for even less visual clutter.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeMouseMode'*
|
||||
|
@ -987,7 +1039,18 @@ of the following lines to set this option: >
|
|||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeCascadeOpenSingleChildDir'*
|
||||
*'NERDTreeCascadeSingleChildDir'*
|
||||
Values: 0 or 1
|
||||
Default: 1.
|
||||
|
||||
When displaying dir nodes, this option tells NERDTree to collapse dirs that
|
||||
have only one child. Use one of the follow lines to set this option: >
|
||||
let NERDTreeCascadeSingleChildDir=0
|
||||
let NERDTreeCascadeSingleChildDir=1
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeCascadeOpenSingleChildDir'*
|
||||
Values: 0 or 1
|
||||
Default: 1.
|
||||
|
||||
|
@ -1001,7 +1064,7 @@ useful for Java projects. Use one of the follow lines to set this option: >
|
|||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeAutoDeleteBuffer'*
|
||||
*'NERDTreeAutoDeleteBuffer'*
|
||||
Values: 0 or 1
|
||||
Default: 0.
|
||||
|
|
@ -1,5 +1,13 @@
|
|||
"CLASS: Bookmark
|
||||
"============================================================
|
||||
" ============================================================================
|
||||
" CLASS: Bookmark
|
||||
"
|
||||
" The Bookmark class serves two purposes:
|
||||
" (1) It is the top-level prototype for new, concrete Bookmark objects.
|
||||
" (2) It provides an interface for client code to query and manipulate the
|
||||
" global list of Bookmark objects within the current Vim session.
|
||||
" ============================================================================
|
||||
|
||||
|
||||
let s:Bookmark = {}
|
||||
let g:NERDTreeBookmark = s:Bookmark
|
||||
|
||||
|
@ -19,12 +27,9 @@ function! s:Bookmark.AddBookmark(name, path)
|
|||
endif
|
||||
endfor
|
||||
call add(s:Bookmark.Bookmarks(), s:Bookmark.New(a:name, a:path))
|
||||
if g:NERDTreeBookmarksSort ==# 1
|
||||
call s:Bookmark.Sort()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.Bookmarks() {{{1
|
||||
" FUNCTION: Bookmark.Bookmarks() {{{1
|
||||
" Class method to get all bookmarks. Lazily initializes the bookmarks global
|
||||
" variable
|
||||
function! s:Bookmark.Bookmarks()
|
||||
|
@ -34,7 +39,7 @@ function! s:Bookmark.Bookmarks()
|
|||
return g:NERDTreeBookmarks
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.BookmarkExistsFor(name) {{{1
|
||||
" FUNCTION: Bookmark.BookmarkExistsFor(name) {{{1
|
||||
" class method that returns 1 if a bookmark with the given name is found, 0
|
||||
" otherwise
|
||||
function! s:Bookmark.BookmarkExistsFor(name)
|
||||
|
@ -46,19 +51,24 @@ function! s:Bookmark.BookmarkExistsFor(name)
|
|||
endtry
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.BookmarkFor(name) {{{1
|
||||
" Class method to get the bookmark that has the given name. {} is return if no
|
||||
" bookmark is found
|
||||
" FUNCTION: Bookmark.BookmarkFor(name) {{{1
|
||||
" Class method that returns the Bookmark object having the specified name.
|
||||
" Throws "NERDTree.BookmarkNotFoundError" if no Bookmark is found.
|
||||
function! s:Bookmark.BookmarkFor(name)
|
||||
for i in s:Bookmark.Bookmarks()
|
||||
if i.name ==# a:name
|
||||
return i
|
||||
let l:result = {}
|
||||
for l:bookmark in s:Bookmark.Bookmarks()
|
||||
if l:bookmark.name ==# a:name
|
||||
let l:result = l:bookmark
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
throw "NERDTree.BookmarkNotFoundError: no bookmark found for name: \"". a:name .'"'
|
||||
if empty(l:result)
|
||||
throw 'NERDTree.BookmarkNotFoundError: "' . a:name . '" not found'
|
||||
endif
|
||||
return l:result
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.BookmarkNames() {{{1
|
||||
" FUNCTION: Bookmark.BookmarkNames() {{{1
|
||||
" Class method to return an array of all bookmark names
|
||||
function! s:Bookmark.BookmarkNames()
|
||||
let names = []
|
||||
|
@ -104,17 +114,31 @@ function! s:Bookmark.CacheBookmarks(silent)
|
|||
call nerdtree#echo(invalidBookmarksFound . " invalid bookmarks were read. See :help NERDTreeInvalidBookmarks for info.")
|
||||
endif
|
||||
endif
|
||||
if g:NERDTreeBookmarksSort ==# 1
|
||||
call s:Bookmark.Sort()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.compareTo(otherbookmark) {{{1
|
||||
" Compare these two bookmarks for sorting purposes
|
||||
function! s:Bookmark.compareTo(otherbookmark)
|
||||
return a:otherbookmark.name < self.name
|
||||
" FUNCTION: Bookmark.CompareBookmarksByName(firstBookmark, secondBookmark) {{{1
|
||||
" Class method that indicates the relative position of two bookmarks when
|
||||
" placed in alphabetical order by name. Case-sensitivity is determined by an
|
||||
" option. Supports the "s:Bookmark.SortBookmarksList()" method.
|
||||
function! s:Bookmark.CompareBookmarksByName(firstBookmark, secondBookmark)
|
||||
let l:result = 0
|
||||
if g:NERDTreeBookmarksSort == 1
|
||||
if a:firstBookmark.name <? a:secondBookmark.name
|
||||
let l:result = -1
|
||||
elseif a:firstBookmark.name >? a:secondBookmark.name
|
||||
let l:result = 1
|
||||
endif
|
||||
elseif g:NERDTreeBookmarksSort == 2
|
||||
if a:firstBookmark.name <# a:secondBookmark.name
|
||||
let l:result = -1
|
||||
elseif a:firstBookmark.name ># a:secondBookmark.name
|
||||
let l:result = 1
|
||||
endif
|
||||
endif
|
||||
return l:result
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.ClearAll() {{{1
|
||||
" Class method to delete all bookmarks.
|
||||
function! s:Bookmark.ClearAll()
|
||||
|
@ -133,26 +157,33 @@ function! s:Bookmark.delete()
|
|||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.getNode(nerdtree, searchFromAbsoluteRoot) {{{1
|
||||
" Gets the treenode for this bookmark
|
||||
" Returns the tree node object associated with this Bookmark.
|
||||
" Throws "NERDTree.BookmarkedNodeNotFoundError" if the node is not found.
|
||||
"
|
||||
" Args:
|
||||
" searchFromAbsoluteRoot: specifies whether we should search from the current
|
||||
" tree root, or the highest cached node
|
||||
" searchFromAbsoluteRoot: boolean flag, search from the highest cached node
|
||||
" if true and from the current tree root if false
|
||||
function! s:Bookmark.getNode(nerdtree, searchFromAbsoluteRoot)
|
||||
let searchRoot = a:searchFromAbsoluteRoot ? a:nerdtree.root.AbsoluteTreeRoot() : a:nerdtree.root
|
||||
let targetNode = searchRoot.findNode(self.path)
|
||||
if empty(targetNode)
|
||||
throw "NERDTree.BookmarkedNodeNotFoundError: no node was found for bookmark: " . self.name
|
||||
if a:searchFromAbsoluteRoot
|
||||
let l:searchRoot = a:nerdtree.root.AbsoluteTreeRoot()
|
||||
else
|
||||
let l:searchRoot = a:nerdtree.root
|
||||
endif
|
||||
return targetNode
|
||||
let l:targetNode = l:searchRoot.findNode(self.path)
|
||||
if empty(l:targetNode)
|
||||
throw 'NERDTree.BookmarkedNodeNotFoundError: node for bookmark "' . self.name . '" not found'
|
||||
endif
|
||||
return l:targetNode
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree) {{{1
|
||||
" Class method that finds the bookmark with the given name and returns the
|
||||
" treenode for it.
|
||||
" Class method that returns the tree node object for the Bookmark with the
|
||||
" given name. Throws "NERDTree.BookmarkNotFoundError" if a Bookmark with the
|
||||
" name does not exist. Throws "NERDTree.BookmarkedNodeNotFoundError" if a
|
||||
" tree node for the named Bookmark could not be found.
|
||||
function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree)
|
||||
let bookmark = s:Bookmark.BookmarkFor(a:name)
|
||||
return bookmark.getNode(nerdtree, a:searchFromAbsoluteRoot)
|
||||
let l:bookmark = s:Bookmark.BookmarkFor(a:name)
|
||||
return l:bookmark.getNode(a:nerdtree, a:searchFromAbsoluteRoot)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.GetSelected() {{{1
|
||||
|
@ -170,7 +201,7 @@ function! s:Bookmark.GetSelected()
|
|||
return {}
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.InvalidBookmarks() {{{1
|
||||
" FUNCTION: Bookmark.InvalidBookmarks() {{{1
|
||||
" Class method to get all invalid bookmark strings read from the bookmarks
|
||||
" file
|
||||
function! s:Bookmark.InvalidBookmarks()
|
||||
|
@ -233,20 +264,20 @@ function! s:Bookmark.openInNewTab(options)
|
|||
call self.open(a:options)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.setPath(path) {{{1
|
||||
" FUNCTION: Bookmark.setPath(path) {{{1
|
||||
" makes this bookmark point to the given path
|
||||
function! s:Bookmark.setPath(path)
|
||||
let self.path = a:path
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.Sort() {{{1
|
||||
" Class method that sorts all bookmarks
|
||||
function! s:Bookmark.Sort()
|
||||
let CompareFunc = function("nerdtree#compareBookmarks")
|
||||
call sort(s:Bookmark.Bookmarks(), CompareFunc)
|
||||
" FUNCTION: Bookmark.SortBookmarksList() {{{1
|
||||
" Class method that sorts the global list of bookmarks alphabetically by name.
|
||||
" Note that case-sensitivity is determined by a user option.
|
||||
function! s:Bookmark.SortBookmarksList()
|
||||
call sort(s:Bookmark.Bookmarks(), s:Bookmark.CompareBookmarksByName, s:Bookmark)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.str() {{{1
|
||||
" FUNCTION: Bookmark.str() {{{1
|
||||
" Get the string that should be rendered in the view for this bookmark
|
||||
function! s:Bookmark.str()
|
||||
let pathStrMaxLen = winwidth(g:NERDTree.GetWinNum()) - 4 - len(self.name)
|
||||
|
@ -262,23 +293,26 @@ function! s:Bookmark.str()
|
|||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.toRoot(nerdtree) {{{1
|
||||
" Make the node for this bookmark the new tree root
|
||||
" Set the root of the given NERDTree to the node for this Bookmark. If a node
|
||||
" for this Bookmark does not exist, a new one is initialized.
|
||||
function! s:Bookmark.toRoot(nerdtree)
|
||||
if self.validate()
|
||||
try
|
||||
let targetNode = self.getNode(a:nerdtree, 1)
|
||||
let l:targetNode = self.getNode(a:nerdtree, 1)
|
||||
call l:targetNode.closeChildren()
|
||||
catch /^NERDTree.BookmarkedNodeNotFoundError/
|
||||
let targetNode = g:NERDTreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path, a:nerdtree)
|
||||
let l:targetNode = g:NERDTreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path, a:nerdtree)
|
||||
endtry
|
||||
call a:nerdtree.changeRoot(targetNode)
|
||||
call a:nerdtree.changeRoot(l:targetNode)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.ToRoot(name, nerdtree) {{{1
|
||||
" Make the node for this bookmark the new tree root
|
||||
" Class method that makes the Bookmark with the given name the root of
|
||||
" specified NERDTree.
|
||||
function! s:Bookmark.ToRoot(name, nerdtree)
|
||||
let bookmark = s:Bookmark.BookmarkFor(a:name)
|
||||
call bookmark.toRoot(a:nerdtree)
|
||||
let l:bookmark = s:Bookmark.BookmarkFor(a:name)
|
||||
call l:bookmark.toRoot(a:nerdtree)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.validate() {{{1
|
||||
|
@ -292,7 +326,7 @@ function! s:Bookmark.validate()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Bookmark.Write() {{{1
|
||||
" FUNCTION: Bookmark.Write() {{{1
|
||||
" Class method to write all bookmarks to the bookmarks file
|
||||
function! s:Bookmark.Write()
|
||||
let bookmarkStrings = []
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
"CLASS: Creator
|
||||
"Creates tab/window/mirror nerdtree windows. Sets up all the window and
|
||||
"buffer options and key mappings etc.
|
||||
"============================================================
|
||||
" ============================================================================
|
||||
" CLASS: Creator
|
||||
"
|
||||
" This class is responsible for creating NERDTree instances. The new NERDTree
|
||||
" may be a tab tree, a window tree, or a mirrored tree. In the process of
|
||||
" creating a NERDTree, it sets up all of the window and buffer options and key
|
||||
" mappings etc.
|
||||
" ============================================================================
|
||||
|
||||
|
||||
let s:Creator = {}
|
||||
let g:NERDTreeCreator = s:Creator
|
||||
|
||||
"FUNCTION: s:Creator._bindMappings() {{{1
|
||||
" FUNCTION: s:Creator._bindMappings() {{{1
|
||||
function! s:Creator._bindMappings()
|
||||
"make <cr> do the same as the activate node mapping
|
||||
nnoremap <silent> <buffer> <cr> :call nerdtree#ui_glue#invokeKeyMap(g:NERDTreeMapActivateNode)<cr>
|
||||
|
@ -14,7 +20,7 @@ function! s:Creator._bindMappings()
|
|||
|
||||
command! -buffer -nargs=? Bookmark :call nerdtree#ui_glue#bookmarkNode('<args>')
|
||||
command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 RevealBookmark :call nerdtree#ui_glue#revealBookmark('<args>')
|
||||
command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 OpenBookmark :call nerdtree#ui_glue#openBookmark('<args>')
|
||||
command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 OpenBookmark call nerdtree#ui_glue#openBookmark('<args>')
|
||||
command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=* ClearBookmarks call nerdtree#ui_glue#clearBookmarks('<args>')
|
||||
command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=+ BookmarkToRoot call g:NERDTreeBookmark.ToRoot('<args>', b:NERDTree)
|
||||
command! -buffer -nargs=0 ClearAllBookmarks call g:NERDTreeBookmark.ClearAll() <bar> call b:NERDTree.render()
|
||||
|
@ -22,7 +28,7 @@ function! s:Creator._bindMappings()
|
|||
command! -buffer -nargs=0 WriteBookmarks call g:NERDTreeBookmark.Write()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator._broadcastInitEvent() {{{1
|
||||
" FUNCTION: s:Creator._broadcastInitEvent() {{{1
|
||||
function! s:Creator._broadcastInitEvent()
|
||||
silent doautocmd User NERDTreeInit
|
||||
endfunction
|
||||
|
@ -32,55 +38,48 @@ function! s:Creator.BufNamePrefix()
|
|||
return 'NERD_tree_'
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator.CreateTabTree(a:name) {{{1
|
||||
" FUNCTION: s:Creator.CreateTabTree(a:name) {{{1
|
||||
function! s:Creator.CreateTabTree(name)
|
||||
let creator = s:Creator.New()
|
||||
call creator.createTabTree(a:name)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator.createTabTree(a:name) {{{1
|
||||
"name: the name of a bookmark or a directory
|
||||
" FUNCTION: s:Creator.createTabTree(a:name) {{{1
|
||||
" name: the name of a bookmark or a directory
|
||||
function! s:Creator.createTabTree(name)
|
||||
let path = self._pathForString(a:name)
|
||||
let l:path = self._pathForString(a:name)
|
||||
|
||||
"abort if exception was thrown (bookmark/dir doesn't exist)
|
||||
if empty(path)
|
||||
" Abort if an exception was thrown (i.e., if the bookmark or directory
|
||||
" does not exist).
|
||||
if empty(l:path)
|
||||
return
|
||||
endif
|
||||
|
||||
if path == {}
|
||||
return
|
||||
endif
|
||||
|
||||
"if instructed to, then change the vim CWD to the dir the NERDTree is
|
||||
"inited in
|
||||
" Obey the user's preferences for changing the working directory.
|
||||
if g:NERDTreeChDirMode != 0
|
||||
call path.changeToDir()
|
||||
call l:path.changeToDir()
|
||||
endif
|
||||
|
||||
if g:NERDTree.ExistsForTab()
|
||||
if g:NERDTree.IsOpen()
|
||||
call g:NERDTree.Close()
|
||||
endif
|
||||
|
||||
call g:NERDTree.Close()
|
||||
call self._removeTreeBufForTab()
|
||||
endif
|
||||
|
||||
call self._createTreeWin()
|
||||
call self._createNERDTree(path, "tab")
|
||||
call self._createNERDTree(l:path, 'tab')
|
||||
call b:NERDTree.render()
|
||||
call b:NERDTree.root.putCursorHere(0, 0)
|
||||
|
||||
call self._broadcastInitEvent()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator.CreateWindowTree(dir) {{{1
|
||||
" FUNCTION: s:Creator.CreateWindowTree(dir) {{{1
|
||||
function! s:Creator.CreateWindowTree(dir)
|
||||
let creator = s:Creator.New()
|
||||
call creator.createWindowTree(a:dir)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator.createWindowTree(dir) {{{1
|
||||
" FUNCTION: s:Creator.createWindowTree(dir) {{{1
|
||||
function! s:Creator.createWindowTree(dir)
|
||||
try
|
||||
let path = g:NERDTreePath.New(a:dir)
|
||||
|
@ -110,9 +109,10 @@ endfunction
|
|||
" FUNCTION: s:Creator._createNERDTree(path) {{{1
|
||||
function! s:Creator._createNERDTree(path, type)
|
||||
let b:NERDTree = g:NERDTree.New(a:path, a:type)
|
||||
"TODO: This is kept for compatability only since many things use
|
||||
"b:NERDTreeRoot instead of the new NERDTree.root
|
||||
"Remove this one day
|
||||
|
||||
" TODO: This assignment is kept for compatibility reasons. Many other
|
||||
" plugins use "b:NERDTreeRoot" instead of "b:NERDTree.root". Remove this
|
||||
" assignment in the future.
|
||||
let b:NERDTreeRoot = b:NERDTree.root
|
||||
|
||||
call b:NERDTree.root.open()
|
||||
|
@ -177,9 +177,9 @@ function! s:Creator.createMirror()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator._createTreeWin() {{{1
|
||||
"Inits the NERD tree window. ie. opens it, sizes it, sets all the local
|
||||
"options etc
|
||||
" FUNCTION: s:Creator._createTreeWin() {{{1
|
||||
" Inits the NERD tree window. ie. opens it, sizes it, sets all the local
|
||||
" options etc
|
||||
function! s:Creator._createTreeWin()
|
||||
"create the nerd tree window
|
||||
let splitLocation = g:NERDTreeWinPos ==# "left" ? "topleft " : "botright "
|
||||
|
@ -198,7 +198,7 @@ function! s:Creator._createTreeWin()
|
|||
call self._setCommonBufOptions()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator._isBufHidden(nr) {{{1
|
||||
" FUNCTION: s:Creator._isBufHidden(nr) {{{1
|
||||
function! s:Creator._isBufHidden(nr)
|
||||
redir => bufs
|
||||
silent ls!
|
||||
|
@ -207,7 +207,7 @@ function! s:Creator._isBufHidden(nr)
|
|||
return bufs =~ a:nr . '..h'
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator.New() {{{1
|
||||
" FUNCTION: s:Creator.New() {{{1
|
||||
function! s:Creator.New()
|
||||
let newCreator = copy(self)
|
||||
return newCreator
|
||||
|
@ -232,8 +232,8 @@ function! s:Creator._nextBufferNumber()
|
|||
return s:Creator._NextBufNum
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator._pathForString(str) {{{1
|
||||
"find a bookmark or adirectory for the given string
|
||||
" FUNCTION: s:Creator._pathForString(str) {{{1
|
||||
" find a bookmark or adirectory for the given string
|
||||
function! s:Creator._pathForString(str)
|
||||
let path = {}
|
||||
if g:NERDTreeBookmark.BookmarkExistsFor(a:str)
|
||||
|
@ -278,7 +278,7 @@ function! s:Creator._removeTreeBufForTab()
|
|||
unlet t:NERDTreeBufName
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator._setCommonBufOptions() {{{1
|
||||
" FUNCTION: s:Creator._setCommonBufOptions() {{{1
|
||||
function! s:Creator._setCommonBufOptions()
|
||||
"throwaway buffer options
|
||||
setlocal noswapfile
|
||||
|
@ -310,7 +310,7 @@ function! s:Creator._setCommonBufOptions()
|
|||
setlocal filetype=nerdtree
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator._setupStatusline() {{{1
|
||||
" FUNCTION: s:Creator._setupStatusline() {{{1
|
||||
function! s:Creator._setupStatusline()
|
||||
if g:NERDTreeStatusline != -1
|
||||
let &l:statusline = g:NERDTreeStatusline
|
||||
|
@ -335,19 +335,19 @@ function! s:Creator._tabpagevar(tabnr, var)
|
|||
return v
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator.ToggleTabTree(dir) {{{1
|
||||
" FUNCTION: s:Creator.ToggleTabTree(dir) {{{1
|
||||
function! s:Creator.ToggleTabTree(dir)
|
||||
let creator = s:Creator.New()
|
||||
call creator.toggleTabTree(a:dir)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Creator.toggleTabTree(dir) {{{1
|
||||
"Toggles the NERD tree. I.e the NERD tree is open, it is closed, if it is
|
||||
"closed it is restored or initialized (if it doesnt exist)
|
||||
" FUNCTION: s:Creator.toggleTabTree(dir) {{{1
|
||||
" Toggles the NERD tree. I.e the NERD tree is open, it is closed, if it is
|
||||
" closed it is restored or initialized (if it doesnt exist)
|
||||
"
|
||||
"Args:
|
||||
"dir: the full path for the root node (is only used if the NERD tree is being
|
||||
"initialized.
|
||||
" Args:
|
||||
" dir: the full path for the root node (is only used if the NERD tree is being
|
||||
" initialized.
|
||||
function! s:Creator.toggleTabTree(dir)
|
||||
if g:NERDTree.ExistsForTab()
|
||||
if !g:NERDTree.IsOpen()
|
||||
|
|
|
@ -21,7 +21,7 @@ function! s:NERDTree.changeRoot(node)
|
|||
|
||||
"change dir to the dir of the new root if instructed to
|
||||
if g:NERDTreeChDirMode ==# 2
|
||||
exec "cd " . self.root.path.str({'format': 'Edit'})
|
||||
call self.root.path.changeToDir()
|
||||
endif
|
||||
|
||||
call self.render()
|
||||
|
@ -186,6 +186,10 @@ function! s:NERDTree.previousBuf()
|
|||
return self._previousBuf
|
||||
endfunction
|
||||
|
||||
function! s:NERDTree.setPreviousBuf(bnum)
|
||||
let self._previousBuf = a:bnum
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:NERDTree.render() {{{1
|
||||
"A convenience function - since this is called often
|
||||
function! s:NERDTree.render()
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
"CLASS: Opener
|
||||
"============================================================
|
||||
" ============================================================================
|
||||
" CLASS: Opener
|
||||
"
|
||||
" The Opener class defines an API for "opening" operations.
|
||||
" ============================================================================
|
||||
|
||||
|
||||
let s:Opener = {}
|
||||
let g:NERDTreeOpener = s:Opener
|
||||
|
||||
"FUNCTION: s:Opener._bufInWindows(bnum){{{1
|
||||
"[[STOLEN FROM VTREEEXPLORER.VIM]]
|
||||
"Determine the number of windows open to this buffer number.
|
||||
"Care of Yegappan Lakshman. Thanks!
|
||||
" FUNCTION: s:Opener._bufInWindows(bnum) {{{1
|
||||
" [[STOLEN FROM VTREEEXPLORER.VIM]]
|
||||
" Determine the number of windows open to this buffer number.
|
||||
" Care of Yegappan Lakshman. Thanks!
|
||||
"
|
||||
"Args:
|
||||
"bnum: the subject buffers buffer number
|
||||
" Args:
|
||||
" bnum: the subject buffers buffer number
|
||||
function! s:Opener._bufInWindows(bnum)
|
||||
let cnt = 0
|
||||
let winnum = 1
|
||||
|
@ -26,14 +31,15 @@ function! s:Opener._bufInWindows(bnum)
|
|||
|
||||
return cnt
|
||||
endfunction
|
||||
"FUNCTION: Opener._checkToCloseTree(newtab) {{{1
|
||||
"Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see
|
||||
"if the tree should be closed now.
|
||||
|
||||
" FUNCTION: Opener._checkToCloseTree(newtab) {{{1
|
||||
" Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see
|
||||
" if the tree should be closed now.
|
||||
"
|
||||
"Args:
|
||||
"a:newtab - boolean. If set, only close the tree now if we are opening the
|
||||
"target in a new tab. This is needed because we have to close tree before we
|
||||
"leave the tab
|
||||
" Args:
|
||||
" a:newtab - boolean. If set, only close the tree now if we are opening the
|
||||
" target in a new tab. This is needed because we have to close tree before we
|
||||
" leave the tab
|
||||
function! s:Opener._checkToCloseTree(newtab)
|
||||
if self._keepopen
|
||||
return
|
||||
|
@ -44,9 +50,8 @@ function! s:Opener._checkToCloseTree(newtab)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
"FUNCTION: s:Opener._firstUsableWindow(){{{1
|
||||
"find the window number of the first normal window
|
||||
" FUNCTION: s:Opener._firstUsableWindow() {{{1
|
||||
" find the window number of the first normal window
|
||||
function! s:Opener._firstUsableWindow()
|
||||
let i = 1
|
||||
while i <= winnr("$")
|
||||
|
@ -62,7 +67,7 @@ function! s:Opener._firstUsableWindow()
|
|||
return -1
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Opener._gotoTargetWin() {{{1
|
||||
" FUNCTION: Opener._gotoTargetWin() {{{1
|
||||
function! s:Opener._gotoTargetWin()
|
||||
if b:NERDTree.isWinTree()
|
||||
if self._where == 'v'
|
||||
|
@ -89,12 +94,12 @@ function! s:Opener._gotoTargetWin()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:Opener._isWindowUsable(winnumber) {{{1
|
||||
"Returns 0 if opening a file from the tree in the given window requires it to
|
||||
"be split, 1 otherwise
|
||||
" FUNCTION: s:Opener._isWindowUsable(winnumber) {{{1
|
||||
" Returns 0 if opening a file from the tree in the given window requires it to
|
||||
" be split, 1 otherwise
|
||||
"
|
||||
"Args:
|
||||
"winnumber: the number of the window in question
|
||||
" Args:
|
||||
" winnumber: the number of the window in question
|
||||
function! s:Opener._isWindowUsable(winnumber)
|
||||
"gotta split if theres only one window (i.e. the NERD tree)
|
||||
if winnr("$") ==# 1
|
||||
|
@ -120,42 +125,33 @@ function! s:Opener._isWindowUsable(winnumber)
|
|||
return !modified || self._bufInWindows(winbufnr(a:winnumber)) >= 2
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Opener.New(path, opts) {{{1
|
||||
"Args:
|
||||
"
|
||||
"a:path: The path object that is to be opened.
|
||||
"
|
||||
"a:opts:
|
||||
"
|
||||
"A dictionary containing the following keys (all optional):
|
||||
" 'where': Specifies whether the node should be opened in new split/tab or in
|
||||
" the previous window. Can be either 'v' or 'h' or 't' (for open in
|
||||
" new tab)
|
||||
" 'reuse': if a window is displaying the file then jump the cursor there. Can
|
||||
" 'all', 'currenttab' or empty to not reuse.
|
||||
" 'keepopen': dont close the tree window
|
||||
" 'stay': open the file, but keep the cursor in the tree win
|
||||
" FUNCTION: Opener.New(path, opts) {{{1
|
||||
" Instantiate a new NERDTreeOpener object.
|
||||
" Args:
|
||||
" a:path: the path object that is to be opened
|
||||
" a:opts: a dictionary containing the following optional keys...
|
||||
" 'where': specifies whether the node should be opened in new split, in
|
||||
" a new tab or, in the last window; takes values "v", "h", or "t"
|
||||
" 'reuse': if file is already shown in a window, jump there; takes values
|
||||
" "all", "currenttab", or empty
|
||||
" 'keepopen': boolean (0 or 1); if true, the tree window will not be closed
|
||||
" 'stay': boolean (0 or 1); if true, remain in tree window after opening
|
||||
function! s:Opener.New(path, opts)
|
||||
let newObj = copy(self)
|
||||
let l:newOpener = copy(self)
|
||||
|
||||
let newObj._path = a:path
|
||||
let newObj._stay = nerdtree#has_opt(a:opts, 'stay')
|
||||
let l:newOpener._keepopen = nerdtree#has_opt(a:opts, 'keepopen')
|
||||
let l:newOpener._nerdtree = b:NERDTree
|
||||
let l:newOpener._path = a:path
|
||||
let l:newOpener._reuse = has_key(a:opts, 'reuse') ? a:opts['reuse'] : ''
|
||||
let l:newOpener._stay = nerdtree#has_opt(a:opts, 'stay')
|
||||
let l:newOpener._where = has_key(a:opts, 'where') ? a:opts['where'] : ''
|
||||
|
||||
if has_key(a:opts, 'reuse')
|
||||
let newObj._reuse = a:opts['reuse']
|
||||
else
|
||||
let newObj._reuse = ''
|
||||
endif
|
||||
call l:newOpener._saveCursorPos()
|
||||
|
||||
let newObj._keepopen = nerdtree#has_opt(a:opts, 'keepopen')
|
||||
let newObj._where = has_key(a:opts, 'where') ? a:opts['where'] : ''
|
||||
let newObj._nerdtree = b:NERDTree
|
||||
call newObj._saveCursorPos()
|
||||
|
||||
return newObj
|
||||
return l:newOpener
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Opener._newSplit() {{{1
|
||||
" FUNCTION: Opener._newSplit() {{{1
|
||||
function! s:Opener._newSplit()
|
||||
" Save the user's settings for splitbelow and splitright
|
||||
let savesplitbelow=&splitbelow
|
||||
|
@ -215,51 +211,62 @@ function! s:Opener._newSplit()
|
|||
let &splitright=savesplitright
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Opener._newVSplit() {{{1
|
||||
" FUNCTION: Opener._newVSplit() {{{1
|
||||
function! s:Opener._newVSplit()
|
||||
let winwidth = winwidth(".")
|
||||
if winnr("$")==#1
|
||||
let winwidth = g:NERDTreeWinSize
|
||||
let l:winwidth = winwidth('.')
|
||||
|
||||
if winnr('$') == 1
|
||||
let l:winwidth = g:NERDTreeWinSize
|
||||
endif
|
||||
|
||||
call nerdtree#exec("wincmd p")
|
||||
call nerdtree#exec('wincmd p')
|
||||
vnew
|
||||
|
||||
"resize the nerd tree back to the original size
|
||||
let l:currentWindowNumber = winnr()
|
||||
|
||||
" Restore the NERDTree to its original width.
|
||||
call g:NERDTree.CursorToTreeWin()
|
||||
exec("silent vertical resize ". winwidth)
|
||||
call nerdtree#exec('wincmd p')
|
||||
execute 'silent vertical resize ' . l:winwidth
|
||||
|
||||
call nerdtree#exec(l:currentWindowNumber . 'wincmd w')
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Opener.open(target) {{{1
|
||||
" FUNCTION: Opener.open(target) {{{1
|
||||
function! s:Opener.open(target)
|
||||
|
||||
if self._path.isDirectory
|
||||
call self._openDirectory(a:target)
|
||||
else
|
||||
call self._openFile()
|
||||
return
|
||||
endif
|
||||
|
||||
call self._openFile()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Opener._openFile() {{{1
|
||||
" FUNCTION: Opener._openFile() {{{1
|
||||
function! s:Opener._openFile()
|
||||
|
||||
if self._reuseWindow()
|
||||
return
|
||||
endif
|
||||
|
||||
call self._gotoTargetWin()
|
||||
call self._path.edit()
|
||||
|
||||
if self._stay
|
||||
silent call self._path.edit()
|
||||
call self._restoreCursorPos()
|
||||
return
|
||||
endif
|
||||
|
||||
call self._path.edit()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Opener._openDirectory(node) {{{1
|
||||
" FUNCTION: Opener._openDirectory(node) {{{1
|
||||
function! s:Opener._openDirectory(node)
|
||||
call self._gotoTargetWin()
|
||||
|
||||
if self._nerdtree.isWinTree()
|
||||
call self._gotoTargetWin()
|
||||
call g:NERDTreeCreator.CreateWindow(a:node.path.str())
|
||||
call g:NERDTreeCreator.CreateWindowTree(a:node.path.str())
|
||||
else
|
||||
call self._gotoTargetWin()
|
||||
if empty(self._where)
|
||||
call b:NERDTree.changeRoot(a:node)
|
||||
elseif self._where == 't'
|
||||
|
@ -274,7 +281,7 @@ function! s:Opener._openDirectory(node)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Opener._previousWindow() {{{1
|
||||
" FUNCTION: Opener._previousWindow() {{{1
|
||||
function! s:Opener._previousWindow()
|
||||
if !self._isWindowUsable(winnr("#")) && self._firstUsableWindow() ==# -1
|
||||
call self._newSplit()
|
||||
|
@ -294,16 +301,16 @@ function! s:Opener._previousWindow()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Opener._restoreCursorPos(){{{1
|
||||
" FUNCTION: Opener._restoreCursorPos() {{{1
|
||||
function! s:Opener._restoreCursorPos()
|
||||
call nerdtree#exec('normal ' . self._tabnr . 'gt')
|
||||
call nerdtree#exec(bufwinnr(self._bufnr) . 'wincmd w')
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Opener._reuseWindow(){{{1
|
||||
"put the cursor in the first window we find for this file
|
||||
" FUNCTION: Opener._reuseWindow() {{{1
|
||||
" put the cursor in the first window we find for this file
|
||||
"
|
||||
"return 1 if we were successful
|
||||
" return 1 if we were successful
|
||||
function! s:Opener._reuseWindow()
|
||||
if empty(self._reuse)
|
||||
return 0
|
||||
|
@ -334,7 +341,7 @@ function! s:Opener._reuseWindow()
|
|||
return 0
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Opener._saveCursorPos(){{{1
|
||||
" FUNCTION: Opener._saveCursorPos() {{{1
|
||||
function! s:Opener._saveCursorPos()
|
||||
let self._bufnr = bufnr("")
|
||||
let self._tabnr = tabpagenr()
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
"we need to use this number many times for sorting... so we calculate it only
|
||||
"once here
|
||||
let s:NERDTreeSortStarIndex = index(g:NERDTreeSortOrder, '*')
|
||||
" used in formating sortKey, e.g. '%04d'
|
||||
if exists("log10")
|
||||
let s:sortKeyFormat = "%0" . float2nr(ceil(log10(len(g:NERDTreeSortOrder)))) . "d"
|
||||
else
|
||||
let s:sortKeyFormat = "%04d"
|
||||
endif
|
||||
" ============================================================================
|
||||
" CLASS: Path
|
||||
"
|
||||
" The Path class provides an abstracted representation of a file system
|
||||
" pathname. Various operations on pathnames are provided and a number of
|
||||
" representations of a given path name can be accessed here.
|
||||
" ============================================================================
|
||||
|
||||
|
||||
" This constant is used throughout this script for sorting purposes.
|
||||
let s:NERDTreeSortStarIndex = index(g:NERDTreeSortOrder, '*')
|
||||
lockvar s:NERDTreeSortStarIndex
|
||||
|
||||
"CLASS: Path
|
||||
"============================================================
|
||||
let s:Path = {}
|
||||
let g:NERDTreePath = s:Path
|
||||
|
||||
"FUNCTION: Path.AbsolutePathFor(str) {{{1
|
||||
" FUNCTION: Path.AbsolutePathFor(str) {{{1
|
||||
function! s:Path.AbsolutePathFor(str)
|
||||
let prependCWD = 0
|
||||
if nerdtree#runningWindows()
|
||||
|
@ -30,7 +31,7 @@ function! s:Path.AbsolutePathFor(str)
|
|||
return toReturn
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.bookmarkNames() {{{1
|
||||
" FUNCTION: Path.bookmarkNames() {{{1
|
||||
function! s:Path.bookmarkNames()
|
||||
if !exists("self._bookmarkNames")
|
||||
call self.cacheDisplayString()
|
||||
|
@ -38,7 +39,7 @@ function! s:Path.bookmarkNames()
|
|||
return self._bookmarkNames
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.cacheDisplayString() {{{1
|
||||
" FUNCTION: Path.cacheDisplayString() {{{1
|
||||
function! s:Path.cacheDisplayString() abort
|
||||
let self.cachedDisplayString = self.getLastPathComponent(1)
|
||||
|
||||
|
@ -52,7 +53,7 @@ function! s:Path.cacheDisplayString() abort
|
|||
call add(self._bookmarkNames, i.name)
|
||||
endif
|
||||
endfor
|
||||
if !empty(self._bookmarkNames)
|
||||
if !empty(self._bookmarkNames) && g:NERDTreeMarkBookmarks == 1
|
||||
let self.cachedDisplayString .= ' {' . join(self._bookmarkNames) . '}'
|
||||
endif
|
||||
|
||||
|
@ -65,7 +66,7 @@ function! s:Path.cacheDisplayString() abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.changeToDir() {{{1
|
||||
" FUNCTION: Path.changeToDir() {{{1
|
||||
function! s:Path.changeToDir()
|
||||
let dir = self.str({'format': 'Cd'})
|
||||
if self.isDirectory ==# 0
|
||||
|
@ -80,16 +81,16 @@ function! s:Path.changeToDir()
|
|||
endtry
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.compareTo() {{{1
|
||||
" FUNCTION: Path.compareTo() {{{1
|
||||
"
|
||||
"Compares this Path to the given path and returns 0 if they are equal, -1 if
|
||||
"this Path is "less than" the given path, or 1 if it is "greater".
|
||||
" Compares this Path to the given path and returns 0 if they are equal, -1 if
|
||||
" this Path is "less than" the given path, or 1 if it is "greater".
|
||||
"
|
||||
"Args:
|
||||
"path: the path object to compare this to
|
||||
" Args:
|
||||
" path: the path object to compare this to
|
||||
"
|
||||
"Return:
|
||||
"1, -1 or 0
|
||||
" Return:
|
||||
" 1, -1 or 0
|
||||
function! s:Path.compareTo(path)
|
||||
let thisPath = self.getLastPathComponent(1)
|
||||
let thatPath = a:path.getLastPathComponent(1)
|
||||
|
@ -124,16 +125,16 @@ function! s:Path.compareTo(path)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.Create(fullpath) {{{1
|
||||
" FUNCTION: Path.Create(fullpath) {{{1
|
||||
"
|
||||
"Factory method.
|
||||
" Factory method.
|
||||
"
|
||||
"Creates a path object with the given path. The path is also created on the
|
||||
"filesystem. If the path already exists, a NERDTree.Path.Exists exception is
|
||||
"thrown. If any other errors occur, a NERDTree.Path exception is thrown.
|
||||
" Creates a path object with the given path. The path is also created on the
|
||||
" filesystem. If the path already exists, a NERDTree.Path.Exists exception is
|
||||
" thrown. If any other errors occur, a NERDTree.Path exception is thrown.
|
||||
"
|
||||
"Args:
|
||||
"fullpath: the full filesystem path to the file/dir to create
|
||||
" Args:
|
||||
" fullpath: the full filesystem path to the file/dir to create
|
||||
function! s:Path.Create(fullpath)
|
||||
"bail if the a:fullpath already exists
|
||||
if isdirectory(a:fullpath) || filereadable(a:fullpath)
|
||||
|
@ -161,12 +162,12 @@ function! s:Path.Create(fullpath)
|
|||
return s:Path.New(a:fullpath)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.copy(dest) {{{1
|
||||
" FUNCTION: Path.copy(dest) {{{1
|
||||
"
|
||||
"Copies the file/dir represented by this Path to the given location
|
||||
" Copies the file/dir represented by this Path to the given location
|
||||
"
|
||||
"Args:
|
||||
"dest: the location to copy this dir/file to
|
||||
" Args:
|
||||
" dest: the location to copy this dir/file to
|
||||
function! s:Path.copy(dest)
|
||||
if !s:Path.CopyingSupported()
|
||||
throw "NERDTree.CopyingNotSupportedError: Copying is not supported on this OS"
|
||||
|
@ -174,29 +175,33 @@ function! s:Path.copy(dest)
|
|||
|
||||
call s:Path.createParentDirectories(a:dest)
|
||||
|
||||
let dest = s:Path.WinToUnixPath(a:dest)
|
||||
if exists('g:NERDTreeCopyCmd')
|
||||
let cmd_prefix = g:NERDTreeCopyCmd
|
||||
else
|
||||
let cmd_prefix = (self.isDirectory ? g:NERDTreeCopyDirCmd : g:NERDTreeCopyFileCmd)
|
||||
endif
|
||||
|
||||
let cmd = g:NERDTreeCopyCmd . " " . escape(self.str(), self._escChars()) . " " . escape(dest, self._escChars())
|
||||
let cmd = cmd_prefix . " " . escape(self.str(), self._escChars()) . " " . escape(a:dest, self._escChars())
|
||||
let success = system(cmd)
|
||||
if success != 0
|
||||
if v:shell_error != 0
|
||||
throw "NERDTree.CopyError: Could not copy ''". self.str() ."'' to: '" . a:dest . "'"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.CopyingSupported() {{{1
|
||||
" FUNCTION: Path.CopyingSupported() {{{1
|
||||
"
|
||||
"returns 1 if copying is supported for this OS
|
||||
" returns 1 if copying is supported for this OS
|
||||
function! s:Path.CopyingSupported()
|
||||
return exists('g:NERDTreeCopyCmd')
|
||||
return exists('g:NERDTreeCopyCmd') || (exists('g:NERDTreeCopyDirCmd') && exists('g:NERDTreeCopyFileCmd'))
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.copyingWillOverwrite(dest) {{{1
|
||||
" FUNCTION: Path.copyingWillOverwrite(dest) {{{1
|
||||
"
|
||||
"returns 1 if copy this path to the given location will cause files to
|
||||
"overwritten
|
||||
" returns 1 if copy this path to the given location will cause files to
|
||||
" overwritten
|
||||
"
|
||||
"Args:
|
||||
"dest: the location this path will be copied to
|
||||
" Args:
|
||||
" dest: the location this path will be copied to
|
||||
function! s:Path.copyingWillOverwrite(dest)
|
||||
if filereadable(a:dest)
|
||||
return 1
|
||||
|
@ -210,13 +215,13 @@ function! s:Path.copyingWillOverwrite(dest)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.createParentDirectories(path) {{{1
|
||||
" FUNCTION: Path.createParentDirectories(path) {{{1
|
||||
"
|
||||
"create parent directories for this path if needed
|
||||
"without throwing any errors is those directories already exist
|
||||
" create parent directories for this path if needed
|
||||
" without throwing any errors if those directories already exist
|
||||
"
|
||||
"Args:
|
||||
"path: full path of the node whose parent directories may need to be created
|
||||
" Args:
|
||||
" path: full path of the node whose parent directories may need to be created
|
||||
function! s:Path.createParentDirectories(path)
|
||||
let dir_path = fnamemodify(a:path, ':h')
|
||||
if !isdirectory(dir_path)
|
||||
|
@ -224,12 +229,11 @@ function! s:Path.createParentDirectories(path)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.delete() {{{1
|
||||
" FUNCTION: Path.delete() {{{1
|
||||
"
|
||||
"Deletes the file represented by this path.
|
||||
"Deletion of directories is not supported
|
||||
" Deletes the file or directory represented by this path.
|
||||
"
|
||||
"Throws NERDTree.Path.Deletion exceptions
|
||||
" Throws NERDTree.Path.Deletion exceptions
|
||||
function! s:Path.delete()
|
||||
if self.isDirectory
|
||||
|
||||
|
@ -253,10 +257,10 @@ function! s:Path.delete()
|
|||
endfor
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.displayString() {{{1
|
||||
" FUNCTION: Path.displayString() {{{1
|
||||
"
|
||||
"Returns a string that specifies how the path should be represented as a
|
||||
"string
|
||||
" Returns a string that specifies how the path should be represented as a
|
||||
" string
|
||||
function! s:Path.displayString()
|
||||
if self.cachedDisplayString ==# ""
|
||||
call self.cacheDisplayString()
|
||||
|
@ -265,14 +269,14 @@ function! s:Path.displayString()
|
|||
return self.cachedDisplayString
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.edit() {{{1
|
||||
" FUNCTION: Path.edit() {{{1
|
||||
function! s:Path.edit()
|
||||
exec "edit " . self.str({'format': 'Edit'})
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.extractDriveLetter(fullpath) {{{1
|
||||
" FUNCTION: Path.extractDriveLetter(fullpath) {{{1
|
||||
"
|
||||
"If running windows, cache the drive letter for this path
|
||||
" If running windows, cache the drive letter for this path
|
||||
function! s:Path.extractDriveLetter(fullpath)
|
||||
if nerdtree#runningWindows()
|
||||
if a:fullpath =~ '^\(\\\\\|\/\/\)'
|
||||
|
@ -288,28 +292,28 @@ function! s:Path.extractDriveLetter(fullpath)
|
|||
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.exists() {{{1
|
||||
"return 1 if this path points to a location that is readable or is a directory
|
||||
" FUNCTION: Path.exists() {{{1
|
||||
" return 1 if this path points to a location that is readable or is a directory
|
||||
function! s:Path.exists()
|
||||
let p = self.str()
|
||||
return filereadable(p) || isdirectory(p)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path._escChars() {{{1
|
||||
" FUNCTION: Path._escChars() {{{1
|
||||
function! s:Path._escChars()
|
||||
if nerdtree#runningWindows()
|
||||
return " `\|\"#%&,?()\*^<>"
|
||||
return " `\|\"#%&,?()\*^<>$"
|
||||
endif
|
||||
|
||||
return " \\`\|\"#%&,?()\*^<>[]"
|
||||
return " \\`\|\"#%&,?()\*^<>[]$"
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.getDir() {{{1
|
||||
" FUNCTION: Path.getDir() {{{1
|
||||
"
|
||||
"Returns this path if it is a directory, else this paths parent.
|
||||
" Returns this path if it is a directory, else this paths parent.
|
||||
"
|
||||
"Return:
|
||||
"a Path object
|
||||
" Return:
|
||||
" a Path object
|
||||
function! s:Path.getDir()
|
||||
if self.isDirectory
|
||||
return self
|
||||
|
@ -318,12 +322,12 @@ function! s:Path.getDir()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.getParent() {{{1
|
||||
" FUNCTION: Path.getParent() {{{1
|
||||
"
|
||||
"Returns a new path object for this paths parent
|
||||
" Returns a new path object for this paths parent
|
||||
"
|
||||
"Return:
|
||||
"a new Path object
|
||||
" Return:
|
||||
" a new Path object
|
||||
function! s:Path.getParent()
|
||||
if nerdtree#runningWindows()
|
||||
let path = self.drive . '\' . join(self.pathSegments[0:-2], '\')
|
||||
|
@ -334,13 +338,13 @@ function! s:Path.getParent()
|
|||
return s:Path.New(path)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.getLastPathComponent(dirSlash) {{{1
|
||||
" FUNCTION: Path.getLastPathComponent(dirSlash) {{{1
|
||||
"
|
||||
"Gets the last part of this path.
|
||||
" Gets the last part of this path.
|
||||
"
|
||||
"Args:
|
||||
"dirSlash: if 1 then a trailing slash will be added to the returned value for
|
||||
"directory nodes.
|
||||
" Args:
|
||||
" dirSlash: if 1 then a trailing slash will be added to the returned value for
|
||||
" directory nodes.
|
||||
function! s:Path.getLastPathComponent(dirSlash)
|
||||
if empty(self.pathSegments)
|
||||
return ''
|
||||
|
@ -352,8 +356,8 @@ function! s:Path.getLastPathComponent(dirSlash)
|
|||
return toReturn
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.getSortOrderIndex() {{{1
|
||||
"returns the index of the pattern in g:NERDTreeSortOrder that this path matches
|
||||
" FUNCTION: Path.getSortOrderIndex() {{{1
|
||||
" returns the index of the pattern in g:NERDTreeSortOrder that this path matches
|
||||
function! s:Path.getSortOrderIndex()
|
||||
let i = 0
|
||||
while i < len(g:NERDTreeSortOrder)
|
||||
|
@ -365,8 +369,23 @@ function! s:Path.getSortOrderIndex()
|
|||
return s:NERDTreeSortStarIndex
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.getSortKey() {{{1
|
||||
"returns a string used in compare function for sorting
|
||||
" FUNCTION: Path._splitChunks(path) {{{1
|
||||
" returns a list of path chunks
|
||||
function! s:Path._splitChunks(path)
|
||||
let chunks = split(a:path, '\(\D\+\|\d\+\)\zs')
|
||||
let i = 0
|
||||
while i < len(chunks)
|
||||
"convert number literals to numbers
|
||||
if match(chunks[i], '^\d\+$') == 0
|
||||
let chunks[i] = str2nr(chunks[i])
|
||||
endif
|
||||
let i = i + 1
|
||||
endwhile
|
||||
return chunks
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Path.getSortKey() {{{1
|
||||
" returns a key used in compare function for sorting
|
||||
function! s:Path.getSortKey()
|
||||
if !exists("self._sortKey")
|
||||
let path = self.getLastPathComponent(1)
|
||||
|
@ -376,21 +395,25 @@ function! s:Path.getSortKey()
|
|||
if !g:NERDTreeCaseSensitiveSort
|
||||
let path = tolower(path)
|
||||
endif
|
||||
let self._sortKey = printf(s:sortKeyFormat, self.getSortOrderIndex()) . path
|
||||
if !g:NERDTreeNaturalSort
|
||||
let self._sortKey = [self.getSortOrderIndex(), path]
|
||||
else
|
||||
let self._sortKey = [self.getSortOrderIndex()] + self._splitChunks(path)
|
||||
endif
|
||||
endif
|
||||
|
||||
return self._sortKey
|
||||
endfunction
|
||||
|
||||
|
||||
"FUNCTION: Path.isUnixHiddenFile() {{{1
|
||||
"check for unix hidden files
|
||||
" FUNCTION: Path.isUnixHiddenFile() {{{1
|
||||
" check for unix hidden files
|
||||
function! s:Path.isUnixHiddenFile()
|
||||
return self.getLastPathComponent(0) =~# '^\.'
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.isUnixHiddenPath() {{{1
|
||||
"check for unix path with hidden components
|
||||
" FUNCTION: Path.isUnixHiddenPath() {{{1
|
||||
" check for unix path with hidden components
|
||||
function! s:Path.isUnixHiddenPath()
|
||||
if self.getLastPathComponent(0) =~# '^\.'
|
||||
return 1
|
||||
|
@ -404,8 +427,8 @@ function! s:Path.isUnixHiddenPath()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.ignore(nerdtree) {{{1
|
||||
"returns true if this path should be ignored
|
||||
" FUNCTION: Path.ignore(nerdtree) {{{1
|
||||
" returns true if this path should be ignored
|
||||
function! s:Path.ignore(nerdtree)
|
||||
"filter out the user specified paths to ignore
|
||||
if a:nerdtree.ui.isIgnoreFilterEnabled()
|
||||
|
@ -434,8 +457,8 @@ function! s:Path.ignore(nerdtree)
|
|||
return 0
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path._ignorePatternMatches(pattern) {{{1
|
||||
"returns true if this path matches the given ignore pattern
|
||||
" FUNCTION: Path._ignorePatternMatches(pattern) {{{1
|
||||
" returns true if this path matches the given ignore pattern
|
||||
function! s:Path._ignorePatternMatches(pattern)
|
||||
let pat = a:pattern
|
||||
if strpart(pat,len(pat)-7) == '[[dir]]'
|
||||
|
@ -453,10 +476,10 @@ function! s:Path._ignorePatternMatches(pattern)
|
|||
return self.getLastPathComponent(0) =~# pat
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.isAncestor(path) {{{1
|
||||
"return 1 if this path is somewhere above the given path in the filesystem.
|
||||
" FUNCTION: Path.isAncestor(path) {{{1
|
||||
" return 1 if this path is somewhere above the given path in the filesystem.
|
||||
"
|
||||
"a:path should be a dir
|
||||
" a:path should be a dir
|
||||
function! s:Path.isAncestor(path)
|
||||
if !self.isDirectory
|
||||
return 0
|
||||
|
@ -467,8 +490,8 @@ function! s:Path.isAncestor(path)
|
|||
return stridx(that, this) == 0
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.isUnder(path) {{{1
|
||||
"return 1 if this path is somewhere under the given path in the filesystem.
|
||||
" FUNCTION: Path.isUnder(path) {{{1
|
||||
" return 1 if this path is somewhere under the given path in the filesystem.
|
||||
function! s:Path.isUnder(path)
|
||||
if a:path.isDirectory == 0
|
||||
return 0
|
||||
|
@ -479,7 +502,7 @@ function! s:Path.isUnder(path)
|
|||
return stridx(this, that . s:Path.Slash()) == 0
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.JoinPathStrings(...) {{{1
|
||||
" FUNCTION: Path.JoinPathStrings(...) {{{1
|
||||
function! s:Path.JoinPathStrings(...)
|
||||
let components = []
|
||||
for i in a:000
|
||||
|
@ -488,19 +511,19 @@ function! s:Path.JoinPathStrings(...)
|
|||
return '/' . join(components, '/')
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.equals() {{{1
|
||||
" FUNCTION: Path.equals() {{{1
|
||||
"
|
||||
"Determines whether 2 path objects are "equal".
|
||||
"They are equal if the paths they represent are the same
|
||||
" Determines whether 2 path objects are "equal".
|
||||
" They are equal if the paths they represent are the same
|
||||
"
|
||||
"Args:
|
||||
"path: the other path obj to compare this with
|
||||
" Args:
|
||||
" path: the other path obj to compare this with
|
||||
function! s:Path.equals(path)
|
||||
return self.str() ==# a:path.str()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.New() {{{1
|
||||
"The Constructor for the Path object
|
||||
" FUNCTION: Path.New() {{{1
|
||||
" The Constructor for the Path object
|
||||
function! s:Path.New(path)
|
||||
let newPath = copy(self)
|
||||
|
||||
|
@ -512,26 +535,37 @@ function! s:Path.New(path)
|
|||
return newPath
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.Slash() {{{1
|
||||
"return the slash to use for the current OS
|
||||
" FUNCTION: Path.Slash() {{{1
|
||||
" Return the path separator used by the underlying file system. Special
|
||||
" consideration is taken for the use of the 'shellslash' option on Windows
|
||||
" systems.
|
||||
function! s:Path.Slash()
|
||||
return nerdtree#runningWindows() ? '\' : '/'
|
||||
|
||||
if nerdtree#runningWindows()
|
||||
if exists('+shellslash') && &shellslash
|
||||
return '/'
|
||||
endif
|
||||
|
||||
return '\'
|
||||
endif
|
||||
|
||||
return '/'
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.Resolve() {{{1
|
||||
"Invoke the vim resolve() function and return the result
|
||||
"This is necessary because in some versions of vim resolve() removes trailing
|
||||
"slashes while in other versions it doesn't. This always removes the trailing
|
||||
"slash
|
||||
" FUNCTION: Path.Resolve() {{{1
|
||||
" Invoke the vim resolve() function and return the result
|
||||
" This is necessary because in some versions of vim resolve() removes trailing
|
||||
" slashes while in other versions it doesn't. This always removes the trailing
|
||||
" slash
|
||||
function! s:Path.Resolve(path)
|
||||
let tmp = resolve(a:path)
|
||||
return tmp =~# '.\+/$' ? substitute(tmp, '/$', '', '') : tmp
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.readInfoFromDisk(fullpath) {{{1
|
||||
" FUNCTION: Path.readInfoFromDisk(fullpath) {{{1
|
||||
"
|
||||
"
|
||||
"Throws NERDTree.Path.InvalidArguments exception.
|
||||
" Throws NERDTree.Path.InvalidArguments exception.
|
||||
function! s:Path.readInfoFromDisk(fullpath)
|
||||
call self.extractDriveLetter(a:fullpath)
|
||||
|
||||
|
@ -541,7 +575,7 @@ function! s:Path.readInfoFromDisk(fullpath)
|
|||
throw "NERDTree.InvalidFiletypeError: Cant handle FIFO files: " . a:fullpath
|
||||
endif
|
||||
|
||||
let self.pathSegments = split(fullpath, '/')
|
||||
let self.pathSegments = filter(split(fullpath, '/'), '!empty(v:val)')
|
||||
|
||||
let self.isReadOnly = 0
|
||||
if isdirectory(a:fullpath)
|
||||
|
@ -582,22 +616,22 @@ function! s:Path.readInfoFromDisk(fullpath)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.refresh(nerdtree) {{{1
|
||||
" FUNCTION: Path.refresh(nerdtree) {{{1
|
||||
function! s:Path.refresh(nerdtree)
|
||||
call self.readInfoFromDisk(self.str())
|
||||
call g:NERDTreePathNotifier.NotifyListeners('refresh', self, a:nerdtree, {})
|
||||
call self.cacheDisplayString()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.refreshFlags(nerdtree) {{{1
|
||||
" FUNCTION: Path.refreshFlags(nerdtree) {{{1
|
||||
function! s:Path.refreshFlags(nerdtree)
|
||||
call g:NERDTreePathNotifier.NotifyListeners('refreshFlags', self, a:nerdtree, {})
|
||||
call self.cacheDisplayString()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.rename() {{{1
|
||||
" FUNCTION: Path.rename() {{{1
|
||||
"
|
||||
"Renames this node on the filesystem
|
||||
" Renames this node on the filesystem
|
||||
function! s:Path.rename(newPath)
|
||||
if a:newPath ==# ''
|
||||
throw "NERDTree.InvalidArgumentsError: Invalid newPath for renaming = ". a:newPath
|
||||
|
@ -616,28 +650,28 @@ function! s:Path.rename(newPath)
|
|||
call g:NERDTreeBookmark.Write()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.str() {{{1
|
||||
" FUNCTION: Path.str() {{{1
|
||||
" Return a string representation of this Path object.
|
||||
"
|
||||
"Returns a string representation of this Path
|
||||
" Args:
|
||||
" This function takes a single dictionary (optional) with keys and values that
|
||||
" specify how the returned pathname should be formatted.
|
||||
"
|
||||
"Takes an optional dictionary param to specify how the output should be
|
||||
"formatted.
|
||||
"
|
||||
"The dict may have the following keys:
|
||||
" The dictionary may have the following keys:
|
||||
" 'format'
|
||||
" 'escape'
|
||||
" 'truncateTo'
|
||||
"
|
||||
"The 'format' key may have a value of:
|
||||
" 'Cd' - a string to be used with the :cd command
|
||||
" 'Edit' - a string to be used with :e :sp :new :tabedit etc
|
||||
" 'UI' - a string used in the NERD tree UI
|
||||
" The 'format' key may have a value of:
|
||||
" 'Cd' - a string to be used with ":cd" and similar commands
|
||||
" 'Edit' - a string to be used with ":edit" and similar commands
|
||||
" 'UI' - a string to be displayed in the NERDTree user interface
|
||||
"
|
||||
"The 'escape' key, if specified will cause the output to be escaped with
|
||||
"shellescape()
|
||||
" The 'escape' key, if specified, will cause the output to be escaped with
|
||||
" Vim's internal "shellescape()" function.
|
||||
"
|
||||
"The 'truncateTo' key causes the resulting string to be truncated to the value
|
||||
"'truncateTo' maps to. A '<' char will be prepended.
|
||||
" The 'truncateTo' key shortens the length of the path to that given by the
|
||||
" value associated with 'truncateTo'. A '<' is prepended.
|
||||
function! s:Path.str(...)
|
||||
let options = a:0 ? a:1 : {}
|
||||
let toReturn = ""
|
||||
|
@ -672,7 +706,7 @@ function! s:Path.str(...)
|
|||
return toReturn
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path._strForUI() {{{1
|
||||
" FUNCTION: Path._strForUI() {{{1
|
||||
function! s:Path._strForUI()
|
||||
let toReturn = '/' . join(self.pathSegments, '/')
|
||||
if self.isDirectory && toReturn != '/'
|
||||
|
@ -681,37 +715,37 @@ function! s:Path._strForUI()
|
|||
return toReturn
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path._strForCd() {{{1
|
||||
"
|
||||
" returns a string that can be used with :cd
|
||||
" FUNCTION: Path._strForCd() {{{1
|
||||
" Return a string representation of this Path that is suitable for use as an
|
||||
" argument to Vim's internal ":cd" command.
|
||||
function! s:Path._strForCd()
|
||||
return escape(self.str(), self._escChars())
|
||||
return fnameescape(self.str())
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path._strForEdit() {{{1
|
||||
"
|
||||
"Return: the string for this path that is suitable to be used with the :edit
|
||||
"command
|
||||
" FUNCTION: Path._strForEdit() {{{1
|
||||
" Return a string representation of this Path that is suitable for use as an
|
||||
" argument to Vim's internal ":edit" command.
|
||||
function! s:Path._strForEdit()
|
||||
let p = escape(self.str(), self._escChars())
|
||||
|
||||
"make it relative
|
||||
let p = fnamemodify(p, ':.')
|
||||
" Make the path relative to the current working directory, if possible.
|
||||
let l:result = fnamemodify(self.str(), ':.')
|
||||
|
||||
"handle the edge case where the file begins with a + (vim interprets
|
||||
"the +foo in `:e +foo` as an option to :edit)
|
||||
if p[0] == "+"
|
||||
let p = '\' . p
|
||||
" On Windows, the drive letter may be removed by "fnamemodify()". Add it
|
||||
" back, if necessary.
|
||||
if nerdtree#runningWindows() && l:result[0] == s:Path.Slash()
|
||||
let l:result = self.drive . l:result
|
||||
endif
|
||||
|
||||
if p ==# ''
|
||||
let p = '.'
|
||||
let l:result = fnameescape(l:result)
|
||||
|
||||
if empty(l:result)
|
||||
let l:result = '.'
|
||||
endif
|
||||
|
||||
return p
|
||||
return l:result
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path._strForGlob() {{{1
|
||||
" FUNCTION: Path._strForGlob() {{{1
|
||||
function! s:Path._strForGlob()
|
||||
let lead = s:Path.Slash()
|
||||
|
||||
|
@ -728,24 +762,22 @@ function! s:Path._strForGlob()
|
|||
return toReturn
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path._str() {{{1
|
||||
"
|
||||
"Gets the string path for this path object that is appropriate for the OS.
|
||||
"EG, in windows c:\foo\bar
|
||||
" in *nix /foo/bar
|
||||
" FUNCTION: Path._str() {{{1
|
||||
" Return the absolute pathname associated with this Path object. The pathname
|
||||
" returned is appropriate for the underlying file system.
|
||||
function! s:Path._str()
|
||||
let lead = s:Path.Slash()
|
||||
let l:separator = s:Path.Slash()
|
||||
let l:leader = l:separator
|
||||
|
||||
"if we are running windows then slap a drive letter on the front
|
||||
if nerdtree#runningWindows()
|
||||
let lead = self.drive . '\'
|
||||
let l:leader = self.drive . l:separator
|
||||
endif
|
||||
|
||||
return lead . join(self.pathSegments, s:Path.Slash())
|
||||
return l:leader . join(self.pathSegments, l:separator)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.strTrunk() {{{1
|
||||
"Gets the path without the last segment on the end.
|
||||
" FUNCTION: Path.strTrunk() {{{1
|
||||
" Gets the path without the last segment on the end.
|
||||
function! s:Path.strTrunk()
|
||||
return self.drive . '/' . join(self.pathSegments[0:-2], '/')
|
||||
endfunction
|
||||
|
@ -766,13 +798,13 @@ function! s:Path.tabnr()
|
|||
return 0
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.WinToUnixPath(pathstr){{{1
|
||||
"Takes in a windows path and returns the unix equiv
|
||||
" FUNCTION: Path.WinToUnixPath(pathstr){{{1
|
||||
" Takes in a windows path and returns the unix equiv
|
||||
"
|
||||
"A class level method
|
||||
" A class level method
|
||||
"
|
||||
"Args:
|
||||
"pathstr: the windows path to convert
|
||||
" Args:
|
||||
" pathstr: the windows path to convert
|
||||
function! s:Path.WinToUnixPath(pathstr)
|
||||
if !nerdtree#runningWindows()
|
||||
return a:pathstr
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
"CLASS: TreeDirNode
|
||||
"A subclass of NERDTreeFileNode.
|
||||
" ============================================================================
|
||||
" CLASS: TreeDirNode
|
||||
"
|
||||
"The 'composite' part of the file/dir composite.
|
||||
"============================================================
|
||||
" A subclass of NERDTreeFileNode.
|
||||
"
|
||||
" The 'composite' part of the file/dir composite.
|
||||
" ============================================================================
|
||||
|
||||
|
||||
let s:TreeDirNode = copy(g:NERDTreeFileNode)
|
||||
let g:NERDTreeDirNode = s:TreeDirNode
|
||||
|
||||
"FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{1
|
||||
"class method that returns the highest cached ancestor of the current root
|
||||
" FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{1
|
||||
" Class method that returns the highest cached ancestor of the current root.
|
||||
function! s:TreeDirNode.AbsoluteTreeRoot()
|
||||
let currentNode = b:NERDTree.root
|
||||
while currentNode.parent != {}
|
||||
|
@ -16,21 +20,28 @@ function! s:TreeDirNode.AbsoluteTreeRoot()
|
|||
return currentNode
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.activate([options]) {{{1
|
||||
unlet s:TreeDirNode.activate
|
||||
" FUNCTION: TreeDirNode.activate([options]) {{{1
|
||||
function! s:TreeDirNode.activate(...)
|
||||
let opts = a:0 ? a:1 : {}
|
||||
call self.toggleOpen(opts)
|
||||
call self.getNerdtree().render()
|
||||
call self.putCursorHere(0, 0)
|
||||
let l:options = (a:0 > 0) ? a:1 : {}
|
||||
|
||||
call self.toggleOpen(l:options)
|
||||
|
||||
" Note that we only re-render the NERDTree for this node if we did NOT
|
||||
" create a new node and render it in a new window or tab. In the latter
|
||||
" case, rendering the NERDTree for this node could overwrite the text of
|
||||
" the new NERDTree!
|
||||
if !has_key(l:options, 'where') || empty(l:options['where'])
|
||||
call self.getNerdtree().render()
|
||||
call self.putCursorHere(0, 0)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.addChild(treenode, inOrder) {{{1
|
||||
"Adds the given treenode to the list of children for this node
|
||||
" FUNCTION: TreeDirNode.addChild(treenode, inOrder) {{{1
|
||||
" Adds the given treenode to the list of children for this node
|
||||
"
|
||||
"Args:
|
||||
"-treenode: the node to add
|
||||
"-inOrder: 1 if the new node should be inserted in sorted order
|
||||
" Args:
|
||||
" -treenode: the node to add
|
||||
" -inOrder: 1 if the new node should be inserted in sorted order
|
||||
function! s:TreeDirNode.addChild(treenode, inOrder)
|
||||
call add(self.children, a:treenode)
|
||||
let a:treenode.parent = self
|
||||
|
@ -40,60 +51,75 @@ function! s:TreeDirNode.addChild(treenode, inOrder)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.close() {{{1
|
||||
"Closes this directory
|
||||
" FUNCTION: TreeDirNode.close() {{{1
|
||||
" Mark this TreeDirNode as closed.
|
||||
function! s:TreeDirNode.close()
|
||||
let self.isOpen = 0
|
||||
|
||||
" Close all directories in this directory node's cascade. This is
|
||||
" necessary to ensure consistency when cascades are rendered.
|
||||
for l:dirNode in self.getCascade()
|
||||
let l:dirNode.isOpen = 0
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.closeChildren() {{{1
|
||||
"Closes all the child dir nodes of this node
|
||||
" FUNCTION: TreeDirNode.closeChildren() {{{1
|
||||
" Recursively close any directory nodes that are descendants of this node.
|
||||
function! s:TreeDirNode.closeChildren()
|
||||
for i in self.children
|
||||
if i.path.isDirectory
|
||||
call i.close()
|
||||
call i.closeChildren()
|
||||
for l:child in self.children
|
||||
if l:child.path.isDirectory
|
||||
call l:child.close()
|
||||
call l:child.closeChildren()
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.createChild(path, inOrder) {{{1
|
||||
"Instantiates a new child node for this node with the given path. The new
|
||||
"nodes parent is set to this node.
|
||||
" FUNCTION: TreeDirNode.createChild(path, inOrder) {{{1
|
||||
" Instantiates a new child node for this node with the given path. The new
|
||||
" nodes parent is set to this node.
|
||||
"
|
||||
"Args:
|
||||
"path: a Path object that this node will represent/contain
|
||||
"inOrder: 1 if the new node should be inserted in sorted order
|
||||
" Args:
|
||||
" path: a Path object that this node will represent/contain
|
||||
" inOrder: 1 if the new node should be inserted in sorted order
|
||||
"
|
||||
"Returns:
|
||||
"the newly created node
|
||||
" Returns:
|
||||
" the newly created node
|
||||
function! s:TreeDirNode.createChild(path, inOrder)
|
||||
let newTreeNode = g:NERDTreeFileNode.New(a:path, self.getNerdtree())
|
||||
call self.addChild(newTreeNode, a:inOrder)
|
||||
return newTreeNode
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.displayString() {{{1
|
||||
unlet s:TreeDirNode.displayString
|
||||
" FUNCTION: TreeDirNode.displayString() {{{1
|
||||
" Assemble and return a string that can represent this TreeDirNode object in
|
||||
" the NERDTree window.
|
||||
function! s:TreeDirNode.displayString()
|
||||
let cascade = self.getCascade()
|
||||
let rv = ""
|
||||
for node in cascade
|
||||
let rv = rv . node.path.displayString()
|
||||
let l:result = ''
|
||||
|
||||
" Build a label that identifies this TreeDirNode.
|
||||
let l:label = ''
|
||||
let l:cascade = self.getCascade()
|
||||
for l:dirNode in l:cascade
|
||||
let l:label .= l:dirNode.path.displayString()
|
||||
endfor
|
||||
|
||||
let sym = cascade[-1].isOpen ? g:NERDTreeDirArrowCollapsible : g:NERDTreeDirArrowExpandable
|
||||
" Select the appropriate open/closed status indicator symbol.
|
||||
if l:cascade[-1].isOpen
|
||||
let l:symbol = g:NERDTreeDirArrowCollapsible
|
||||
else
|
||||
let l:symbol = g:NERDTreeDirArrowExpandable
|
||||
endif
|
||||
|
||||
let flags = cascade[-1].path.flagSet.renderToString()
|
||||
let l:flags = l:cascade[-1].path.flagSet.renderToString()
|
||||
|
||||
return sym . ' ' . flags . rv
|
||||
let l:result = l:symbol . ' ' . l:flags . l:label
|
||||
return l:result
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.findNode(path) {{{1
|
||||
"Will find one of the children (recursively) that has the given path
|
||||
" FUNCTION: TreeDirNode.findNode(path) {{{1
|
||||
" Will find one of the children (recursively) that has the given path
|
||||
"
|
||||
"Args:
|
||||
"path: a path object
|
||||
" Args:
|
||||
" path: a path object
|
||||
unlet s:TreeDirNode.findNode
|
||||
function! s:TreeDirNode.findNode(path)
|
||||
if a:path.equals(self.path)
|
||||
|
@ -114,47 +140,33 @@ function! s:TreeDirNode.findNode(path)
|
|||
return {}
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.getCascade() {{{1
|
||||
"Return an array of dir nodes (starting from self) that can be cascade opened.
|
||||
" FUNCTION: TreeDirNode.getCascade() {{{1
|
||||
" Return an array of dir nodes (starting from self) that can be cascade opened.
|
||||
function! s:TreeDirNode.getCascade()
|
||||
if !self.isCascadable()
|
||||
return [self]
|
||||
endif
|
||||
|
||||
let rv = [self]
|
||||
let node = self
|
||||
let vc = self.getVisibleChildren()
|
||||
let visChild = vc[0]
|
||||
|
||||
while 1
|
||||
let vc = node.getVisibleChildren()
|
||||
if len(vc) != 1
|
||||
break
|
||||
endif
|
||||
|
||||
let visChild = vc[0]
|
||||
|
||||
"TODO: optimize
|
||||
if !visChild.path.isDirectory
|
||||
break
|
||||
endif
|
||||
|
||||
call add(rv, visChild)
|
||||
let node = visChild
|
||||
endwhile
|
||||
|
||||
return rv
|
||||
return [self] + visChild.getCascade()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.getChildCount() {{{1
|
||||
"Returns the number of children this node has
|
||||
" FUNCTION: TreeDirNode.getChildCount() {{{1
|
||||
" Returns the number of children this node has
|
||||
function! s:TreeDirNode.getChildCount()
|
||||
return len(self.children)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.getChild(path) {{{1
|
||||
"Returns child node of this node that has the given path or {} if no such node
|
||||
"exists.
|
||||
" FUNCTION: TreeDirNode.getChild(path) {{{1
|
||||
" Returns child node of this node that has the given path or {} if no such node
|
||||
" exists.
|
||||
"
|
||||
"This function doesnt not recurse into child dir nodes
|
||||
" This function doesnt not recurse into child dir nodes
|
||||
"
|
||||
"Args:
|
||||
"path: a path object
|
||||
" Args:
|
||||
" path: a path object
|
||||
function! s:TreeDirNode.getChild(path)
|
||||
if stridx(a:path.str(), self.path.str(), 0) ==# -1
|
||||
return {}
|
||||
|
@ -169,12 +181,13 @@ function! s:TreeDirNode.getChild(path)
|
|||
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.getChildByIndex(indx, visible) {{{1
|
||||
"returns the child at the given index
|
||||
"Args:
|
||||
"indx: the index to get the child from
|
||||
"visible: 1 if only the visible children array should be used, 0 if all the
|
||||
"children should be searched.
|
||||
" FUNCTION: TreeDirNode.getChildByIndex(indx, visible) {{{1
|
||||
" returns the child at the given index
|
||||
"
|
||||
" Args:
|
||||
" indx: the index to get the child from
|
||||
" visible: 1 if only the visible children array should be used, 0 if all the
|
||||
" children should be searched.
|
||||
function! s:TreeDirNode.getChildByIndex(indx, visible)
|
||||
let array_to_search = a:visible? self.getVisibleChildren() : self.children
|
||||
if a:indx > len(array_to_search)
|
||||
|
@ -183,14 +196,14 @@ function! s:TreeDirNode.getChildByIndex(indx, visible)
|
|||
return array_to_search[a:indx]
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.getChildIndex(path) {{{1
|
||||
"Returns the index of the child node of this node that has the given path or
|
||||
"-1 if no such node exists.
|
||||
" FUNCTION: TreeDirNode.getChildIndex(path) {{{1
|
||||
" Returns the index of the child node of this node that has the given path or
|
||||
" -1 if no such node exists.
|
||||
"
|
||||
"This function doesnt not recurse into child dir nodes
|
||||
" This function doesnt not recurse into child dir nodes
|
||||
"
|
||||
"Args:
|
||||
"path: a path object
|
||||
" Args:
|
||||
" path: a path object
|
||||
function! s:TreeDirNode.getChildIndex(path)
|
||||
if stridx(a:path.str(), self.path.str(), 0) ==# -1
|
||||
return -1
|
||||
|
@ -214,15 +227,81 @@ function! s:TreeDirNode.getChildIndex(path)
|
|||
return -1
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.getDirChildren() {{{1
|
||||
"Get all children that are directories
|
||||
function! s:TreeDirNode.getDirChildren()
|
||||
return filter(self.children, 'v:val.path.isDirectory == 1')
|
||||
" FUNCTION: TreeDirNode._glob(pattern, all) {{{1
|
||||
" Return a list of strings naming the descendants of the directory in this
|
||||
" TreeDirNode object that match the specified glob pattern.
|
||||
"
|
||||
" Args:
|
||||
" pattern: (string) the glob pattern to apply
|
||||
" all: (0 or 1) if 1, include "." and ".." if they match "pattern"; if 0,
|
||||
" always exclude them
|
||||
"
|
||||
" Note: If the pathnames in the result list are below the working directory,
|
||||
" they are returned as pathnames relative to that directory. This is because
|
||||
" this function, internally, attempts to obey 'wildignore' rules that use
|
||||
" relative paths.
|
||||
function! s:TreeDirNode._glob(pattern, all)
|
||||
|
||||
" Construct a path specification such that "globpath()" will return
|
||||
" relative pathnames, if possible.
|
||||
if self.path.str() == getcwd()
|
||||
let l:pathSpec = ','
|
||||
else
|
||||
let l:pathSpec = fnamemodify(self.path.str({'format': 'Glob'}), ':.')
|
||||
|
||||
" On Windows, the drive letter may be removed by "fnamemodify()".
|
||||
if nerdtree#runningWindows() && l:pathSpec[0] == g:NERDTreePath.Slash()
|
||||
let l:pathSpec = self.path.drive . l:pathSpec
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:globList = []
|
||||
|
||||
" See ":h version7.txt" and ":h version8.txt" for details on the
|
||||
" development of the "glob()" and "globpath()" functions.
|
||||
if v:version > 704 || (v:version == 704 && has('patch654'))
|
||||
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1, 0)
|
||||
elseif v:version == 704 && has('patch279')
|
||||
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1)
|
||||
elseif v:version > 702 || (v:version == 702 && has('patch051'))
|
||||
let l:globString = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore)
|
||||
let l:globList = split(l:globString, "\n")
|
||||
else
|
||||
let l:globString = globpath(l:pathSpec, a:pattern)
|
||||
let l:globList = split(l:globString, "\n")
|
||||
endif
|
||||
|
||||
" If "a:all" is false, filter "." and ".." from the output.
|
||||
if !a:all
|
||||
let l:toRemove = []
|
||||
|
||||
for l:file in l:globList
|
||||
let l:tail = fnamemodify(l:file, ':t')
|
||||
|
||||
" Double the modifier if only a separator was stripped.
|
||||
if l:tail == ''
|
||||
let l:tail = fnamemodify(l:file, ':t:t')
|
||||
endif
|
||||
|
||||
if l:tail == '.' || l:tail == '..'
|
||||
call add(l:toRemove, l:file)
|
||||
if len(l:toRemove) == 2
|
||||
break
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
for l:file in l:toRemove
|
||||
call remove(l:globList, index(l:globList, l:file))
|
||||
endfor
|
||||
endif
|
||||
|
||||
return l:globList
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.GetSelected() {{{1
|
||||
"Returns the current node if it is a dir node, or else returns the current
|
||||
"nodes parent
|
||||
" FUNCTION: TreeDirNode.GetSelected() {{{1
|
||||
" Returns the current node if it is a dir node, or else returns the current
|
||||
" nodes parent
|
||||
unlet s:TreeDirNode.GetSelected
|
||||
function! s:TreeDirNode.GetSelected()
|
||||
let currentDir = g:NERDTreeFileNode.GetSelected()
|
||||
|
@ -234,17 +313,17 @@ function! s:TreeDirNode.GetSelected()
|
|||
return currentDir
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.getVisibleChildCount() {{{1
|
||||
"Returns the number of visible children this node has
|
||||
" FUNCTION: TreeDirNode.getVisibleChildCount() {{{1
|
||||
" Returns the number of visible children this node has
|
||||
function! s:TreeDirNode.getVisibleChildCount()
|
||||
return len(self.getVisibleChildren())
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.getVisibleChildren() {{{1
|
||||
"Returns a list of children to display for this node, in the correct order
|
||||
" FUNCTION: TreeDirNode.getVisibleChildren() {{{1
|
||||
" Returns a list of children to display for this node, in the correct order
|
||||
"
|
||||
"Return:
|
||||
"an array of treenodes
|
||||
" Return:
|
||||
" an array of treenodes
|
||||
function! s:TreeDirNode.getVisibleChildren()
|
||||
let toReturn = []
|
||||
for i in self.children
|
||||
|
@ -255,42 +334,36 @@ function! s:TreeDirNode.getVisibleChildren()
|
|||
return toReturn
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.hasVisibleChildren() {{{1
|
||||
"returns 1 if this node has any childre, 0 otherwise..
|
||||
" FUNCTION: TreeDirNode.hasVisibleChildren() {{{1
|
||||
" returns 1 if this node has any childre, 0 otherwise..
|
||||
function! s:TreeDirNode.hasVisibleChildren()
|
||||
return self.getVisibleChildCount() != 0
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.isCascadable() {{{1
|
||||
"true if this dir has only one visible child - which is also a dir
|
||||
" FUNCTION: TreeDirNode.isCascadable() {{{1
|
||||
" true if this dir has only one visible child - which is also a dir
|
||||
function! s:TreeDirNode.isCascadable()
|
||||
if g:NERDTreeCascadeSingleChildDir == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let c = self.getVisibleChildren()
|
||||
return len(c) == 1 && c[0].path.isDirectory
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode._initChildren() {{{1
|
||||
"Removes all childen from this node and re-reads them
|
||||
" FUNCTION: TreeDirNode._initChildren() {{{1
|
||||
" Removes all childen from this node and re-reads them
|
||||
"
|
||||
"Args:
|
||||
"silent: 1 if the function should not echo any "please wait" messages for
|
||||
"large directories
|
||||
" Args:
|
||||
" silent: 1 if the function should not echo any "please wait" messages for
|
||||
" large directories
|
||||
"
|
||||
"Return: the number of child nodes read
|
||||
" Return: the number of child nodes read
|
||||
function! s:TreeDirNode._initChildren(silent)
|
||||
"remove all the current child nodes
|
||||
let self.children = []
|
||||
|
||||
"get an array of all the files in the nodes dir
|
||||
let dir = self.path
|
||||
let globDir = dir.str({'format': 'Glob'})
|
||||
|
||||
if version >= 703
|
||||
let filesStr = globpath(globDir, '*', !g:NERDTreeRespectWildIgnore) . "\n" . globpath(globDir, '.*', !g:NERDTreeRespectWildIgnore)
|
||||
else
|
||||
let filesStr = globpath(globDir, '*') . "\n" . globpath(globDir, '.*')
|
||||
endif
|
||||
|
||||
let files = split(filesStr, "\n")
|
||||
let files = self._glob('*', 1) + self._glob('.*', 0)
|
||||
|
||||
if !a:silent && len(files) > g:NERDTreeNotificationThreshold
|
||||
call nerdtree#echo("Please wait, caching a large dir ...")
|
||||
|
@ -298,21 +371,13 @@ function! s:TreeDirNode._initChildren(silent)
|
|||
|
||||
let invalidFilesFound = 0
|
||||
for i in files
|
||||
|
||||
"filter out the .. and . directories
|
||||
"Note: we must match .. AND ../ since sometimes the globpath returns
|
||||
"../ for path with strange chars (eg $)
|
||||
if i[len(i)-3:2] != ".." && i[len(i)-2:2] != ".." &&
|
||||
\ i[len(i)-2:1] != "." && i[len(i)-1] != "."
|
||||
"put the next file in a new node and attach it
|
||||
try
|
||||
let path = g:NERDTreePath.New(i)
|
||||
call self.createChild(path, 0)
|
||||
call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {})
|
||||
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
||||
let invalidFilesFound += 1
|
||||
endtry
|
||||
endif
|
||||
try
|
||||
let path = g:NERDTreePath.New(i)
|
||||
call self.createChild(path, 0)
|
||||
call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {})
|
||||
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
||||
let invalidFilesFound += 1
|
||||
endtry
|
||||
endfor
|
||||
|
||||
call self.sortChildren()
|
||||
|
@ -327,12 +392,12 @@ function! s:TreeDirNode._initChildren(silent)
|
|||
return self.getChildCount()
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.New(path, nerdtree) {{{1
|
||||
"Returns a new TreeNode object with the given path and parent
|
||||
" FUNCTION: TreeDirNode.New(path, nerdtree) {{{1
|
||||
" Return a new TreeDirNode object with the given path and parent.
|
||||
"
|
||||
"Args:
|
||||
"path: dir that the node represents
|
||||
"nerdtree: the tree the node belongs to
|
||||
" Args:
|
||||
" path: dir that the node represents
|
||||
" nerdtree: the tree the node belongs to
|
||||
function! s:TreeDirNode.New(path, nerdtree)
|
||||
if a:path.isDirectory != 1
|
||||
throw "NERDTree.InvalidArgumentsError: A TreeDirNode object must be instantiated with a directory Path object."
|
||||
|
@ -350,31 +415,45 @@ function! s:TreeDirNode.New(path, nerdtree)
|
|||
return newTreeNode
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.open([opts]) {{{1
|
||||
"Open the dir in the current tree or in a new tree elsewhere.
|
||||
"
|
||||
"If opening in the current tree, return the number of cached nodes.
|
||||
unlet s:TreeDirNode.open
|
||||
" FUNCTION: TreeDirNode.open([options]) {{{1
|
||||
" Open this directory node in the current tree or elsewhere if special options
|
||||
" are provided. Return 0 if options were processed. Otherwise, return the
|
||||
" number of new cached nodes.
|
||||
function! s:TreeDirNode.open(...)
|
||||
let opts = a:0 ? a:1 : {}
|
||||
let l:options = a:0 ? a:1 : {}
|
||||
|
||||
if has_key(opts, 'where') && !empty(opts['where'])
|
||||
let opener = g:NERDTreeOpener.New(self.path, opts)
|
||||
call opener.open(self)
|
||||
else
|
||||
let self.isOpen = 1
|
||||
if self.children ==# []
|
||||
return self._initChildren(0)
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
" If special options were specified, process them and return.
|
||||
if has_key(l:options, 'where') && !empty(l:options['where'])
|
||||
let l:opener = g:NERDTreeOpener.New(self.path, l:options)
|
||||
call l:opener.open(self)
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Open any ancestors of this node that render within the same cascade.
|
||||
let l:parent = self.parent
|
||||
while !empty(l:parent) && !l:parent.isRoot()
|
||||
if index(l:parent.getCascade(), self) >= 0
|
||||
let l:parent.isOpen = 1
|
||||
let l:parent = l:parent.parent
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
let self.isOpen = 1
|
||||
|
||||
let l:numChildrenCached = 0
|
||||
if empty(self.children)
|
||||
let l:numChildrenCached = self._initChildren(0)
|
||||
endif
|
||||
|
||||
return l:numChildrenCached
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.openAlong([opts]) {{{1
|
||||
"recursive open the dir if it has only one directory child.
|
||||
" FUNCTION: TreeDirNode.openAlong([opts]) {{{1
|
||||
" recursive open the dir if it has only one directory child.
|
||||
"
|
||||
"return the level of opened directories.
|
||||
" return the level of opened directories.
|
||||
function! s:TreeDirNode.openAlong(...)
|
||||
let opts = a:0 ? a:1 : {}
|
||||
let level = 0
|
||||
|
@ -393,101 +472,65 @@ function! s:TreeDirNode.openAlong(...)
|
|||
endfunction
|
||||
|
||||
" FUNCTION: TreeDirNode.openExplorer() {{{1
|
||||
" opens an explorer window for this node in the previous window (could be a
|
||||
" nerd tree or a netrw)
|
||||
" Open an explorer window for this node in the previous window. The explorer
|
||||
" can be a NERDTree window or a netrw window.
|
||||
function! s:TreeDirNode.openExplorer()
|
||||
call self.open({'where': 'p'})
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.openInNewTab(options) {{{1
|
||||
" FUNCTION: TreeDirNode.openInNewTab(options) {{{1
|
||||
unlet s:TreeDirNode.openInNewTab
|
||||
function! s:TreeDirNode.openInNewTab(options)
|
||||
call nerdtree#deprecated('TreeDirNode.openInNewTab', 'is deprecated, use open() instead')
|
||||
call self.open({'where': 't'})
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode._openInNewTab() {{{1
|
||||
" FUNCTION: TreeDirNode._openInNewTab() {{{1
|
||||
function! s:TreeDirNode._openInNewTab()
|
||||
tabnew
|
||||
call g:NERDTreeCreator.CreateTabTree(self.path.str())
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.openRecursively() {{{1
|
||||
"Opens this treenode and all of its children whose paths arent 'ignored'
|
||||
"because of the file filters.
|
||||
"
|
||||
"This method is actually a wrapper for the OpenRecursively2 method which does
|
||||
"the work.
|
||||
" FUNCTION: TreeDirNode.openRecursively() {{{1
|
||||
" Open this directory node and any descendant directory nodes whose pathnames
|
||||
" are not ignored.
|
||||
function! s:TreeDirNode.openRecursively()
|
||||
call self._openRecursively2(1)
|
||||
endfunction
|
||||
silent call self.open()
|
||||
|
||||
"FUNCTION: TreeDirNode._openRecursively2() {{{1
|
||||
"Opens this all children of this treenode recursively if either:
|
||||
" *they arent filtered by file filters
|
||||
" *a:forceOpen is 1
|
||||
"
|
||||
"Args:
|
||||
"forceOpen: 1 if this node should be opened regardless of file filters
|
||||
function! s:TreeDirNode._openRecursively2(forceOpen)
|
||||
if self.path.ignore(self.getNerdtree()) ==# 0 || a:forceOpen
|
||||
let self.isOpen = 1
|
||||
if self.children ==# []
|
||||
call self._initChildren(1)
|
||||
for l:child in self.children
|
||||
if l:child.path.isDirectory && !l:child.path.ignore(l:child.getNerdtree())
|
||||
call l:child.openRecursively()
|
||||
endif
|
||||
|
||||
for i in self.children
|
||||
if i.path.isDirectory ==# 1
|
||||
call i._openRecursively2(0)
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.refresh() {{{1
|
||||
unlet s:TreeDirNode.refresh
|
||||
" FUNCTION: TreeDirNode.refresh() {{{1
|
||||
function! s:TreeDirNode.refresh()
|
||||
call self.path.refresh(self.getNerdtree())
|
||||
|
||||
"if this node was ever opened, refresh its children
|
||||
if self.isOpen || !empty(self.children)
|
||||
"go thru all the files/dirs under this node
|
||||
let files = self._glob('*', 1) + self._glob('.*', 0)
|
||||
let newChildNodes = []
|
||||
let invalidFilesFound = 0
|
||||
let dir = self.path
|
||||
let globDir = dir.str({'format': 'Glob'})
|
||||
let filesStr = globpath(globDir, '*') . "\n" . globpath(globDir, '.*')
|
||||
let files = split(filesStr, "\n")
|
||||
for i in files
|
||||
"filter out the .. and . directories
|
||||
"Note: we must match .. AND ../ cos sometimes the globpath returns
|
||||
"../ for path with strange chars (eg $)
|
||||
"if i !~# '\/\.\.\/\?$' && i !~# '\/\.\/\?$'
|
||||
try
|
||||
"create a new path and see if it exists in this nodes children
|
||||
let path = g:NERDTreePath.New(i)
|
||||
let newNode = self.getChild(path)
|
||||
if newNode != {}
|
||||
call newNode.refresh()
|
||||
call add(newChildNodes, newNode)
|
||||
|
||||
" Regular expression is too expensive. Use simply string comparison
|
||||
" instead
|
||||
if i[len(i)-3:2] != ".." && i[len(i)-2:2] != ".." &&
|
||||
\ i[len(i)-2:1] != "." && i[len(i)-1] != "."
|
||||
try
|
||||
"create a new path and see if it exists in this nodes children
|
||||
let path = g:NERDTreePath.New(i)
|
||||
let newNode = self.getChild(path)
|
||||
if newNode != {}
|
||||
call newNode.refresh()
|
||||
call add(newChildNodes, newNode)
|
||||
|
||||
"the node doesnt exist so create it
|
||||
else
|
||||
let newNode = g:NERDTreeFileNode.New(path, self.getNerdtree())
|
||||
let newNode.parent = self
|
||||
call add(newChildNodes, newNode)
|
||||
endif
|
||||
|
||||
|
||||
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
||||
let invalidFilesFound = 1
|
||||
endtry
|
||||
endif
|
||||
"the node doesnt exist so create it
|
||||
else
|
||||
let newNode = g:NERDTreeFileNode.New(path, self.getNerdtree())
|
||||
let newNode.parent = self
|
||||
call add(newChildNodes, newNode)
|
||||
endif
|
||||
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
||||
let invalidFilesFound = 1
|
||||
endtry
|
||||
endfor
|
||||
|
||||
"swap this nodes children out for the children we just read/refreshed
|
||||
|
@ -500,7 +543,7 @@ function! s:TreeDirNode.refresh()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.refreshFlags() {{{1
|
||||
" FUNCTION: TreeDirNode.refreshFlags() {{{1
|
||||
unlet s:TreeDirNode.refreshFlags
|
||||
function! s:TreeDirNode.refreshFlags()
|
||||
call self.path.refreshFlags(self.getNerdtree())
|
||||
|
@ -509,15 +552,15 @@ function! s:TreeDirNode.refreshFlags()
|
|||
endfor
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.refreshDirFlags() {{{1
|
||||
" FUNCTION: TreeDirNode.refreshDirFlags() {{{1
|
||||
function! s:TreeDirNode.refreshDirFlags()
|
||||
call self.path.refreshFlags(self.getNerdtree())
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.reveal(path) {{{1
|
||||
"reveal the given path, i.e. cache and open all treenodes needed to display it
|
||||
"in the UI
|
||||
"Returns the revealed node
|
||||
" FUNCTION: TreeDirNode.reveal(path) {{{1
|
||||
" reveal the given path, i.e. cache and open all treenodes needed to display it
|
||||
" in the UI
|
||||
" Returns the revealed node
|
||||
function! s:TreeDirNode.reveal(path, ...)
|
||||
let opts = a:0 ? a:1 : {}
|
||||
|
||||
|
@ -544,14 +587,12 @@ function! s:TreeDirNode.reveal(path, ...)
|
|||
return n.reveal(a:path, opts)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.removeChild(treenode) {{{1
|
||||
" FUNCTION: TreeDirNode.removeChild(treenode) {{{1
|
||||
" Remove the given treenode from "self.children".
|
||||
" Throws "NERDTree.ChildNotFoundError" if the node is not found.
|
||||
"
|
||||
"Removes the given treenode from this nodes set of children
|
||||
"
|
||||
"Args:
|
||||
"treenode: the node to remove
|
||||
"
|
||||
"Throws a NERDTree.ChildNotFoundError if the given treenode is not found
|
||||
" Args:
|
||||
" treenode: the node object to remove
|
||||
function! s:TreeDirNode.removeChild(treenode)
|
||||
for i in range(0, self.getChildCount()-1)
|
||||
if self.children[i].equals(a:treenode)
|
||||
|
@ -563,18 +604,15 @@ function! s:TreeDirNode.removeChild(treenode)
|
|||
throw "NERDTree.ChildNotFoundError: child node was not found"
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.sortChildren() {{{1
|
||||
"
|
||||
"Sorts the children of this node according to alphabetical order and the
|
||||
"directory priority.
|
||||
"
|
||||
" FUNCTION: TreeDirNode.sortChildren() {{{1
|
||||
" Sort "self.children" by alphabetical order and directory priority.
|
||||
function! s:TreeDirNode.sortChildren()
|
||||
let CompareFunc = function("nerdtree#compareNodesBySortKey")
|
||||
call sort(self.children, CompareFunc)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.toggleOpen([options]) {{{1
|
||||
"Opens this directory if it is closed and vice versa
|
||||
" FUNCTION: TreeDirNode.toggleOpen([options]) {{{1
|
||||
" Opens this directory if it is closed and vice versa
|
||||
function! s:TreeDirNode.toggleOpen(...)
|
||||
let opts = a:0 ? a:1 : {}
|
||||
if self.isOpen ==# 1
|
||||
|
@ -588,13 +626,13 @@ function! s:TreeDirNode.toggleOpen(...)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.transplantChild(newNode) {{{1
|
||||
"Replaces the child of this with the given node (where the child node's full
|
||||
"path matches a:newNode's fullpath). The search for the matching node is
|
||||
"non-recursive
|
||||
" FUNCTION: TreeDirNode.transplantChild(newNode) {{{1
|
||||
" Replaces the child of this with the given node (where the child node's full
|
||||
" path matches a:newNode's fullpath). The search for the matching node is
|
||||
" non-recursive
|
||||
"
|
||||
"Arg:
|
||||
"newNode: the node to graft into the tree
|
||||
" Arg:
|
||||
" newNode: the node to graft into the tree
|
||||
function! s:TreeDirNode.transplantChild(newNode)
|
||||
for i in range(0, self.getChildCount()-1)
|
||||
if self.children[i].equals(a:newNode)
|
||||
|
|
|
@ -20,108 +20,107 @@ endfunction
|
|||
"FUNCTION: s:UI._dumpHelp {{{1
|
||||
"prints out the quick help
|
||||
function! s:UI._dumpHelp()
|
||||
let old_h = @h
|
||||
if self.getShowHelp()
|
||||
let @h= "\" NERD tree (" . nerdtree#version() . ") quickhelp~\n"
|
||||
let @h=@h."\" ============================\n"
|
||||
let @h=@h."\" File node mappings~\n"
|
||||
let @h=@h."\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n"
|
||||
let @h=@h."\" <CR>,\n"
|
||||
let help = "\" NERDTree (" . nerdtree#version() . ") quickhelp~\n"
|
||||
let help .= "\" ============================\n"
|
||||
let help .= "\" File node mappings~\n"
|
||||
let help .= "\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n"
|
||||
let help .= "\" <CR>,\n"
|
||||
if self.nerdtree.isTabTree()
|
||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in prev window\n"
|
||||
let help .= "\" ". g:NERDTreeMapActivateNode .": open in prev window\n"
|
||||
else
|
||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in current window\n"
|
||||
let help .= "\" ". g:NERDTreeMapActivateNode .": open in current window\n"
|
||||
endif
|
||||
if self.nerdtree.isTabTree()
|
||||
let @h=@h."\" ". g:NERDTreeMapPreview .": preview\n"
|
||||
let help .= "\" ". g:NERDTreeMapPreview .": preview\n"
|
||||
endif
|
||||
let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||
let @h=@h."\" middle-click,\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapOpenSplit .": open split\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapPreviewSplit .": preview split\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n"
|
||||
let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||
let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||
let help .= "\" middle-click,\n"
|
||||
let help .= "\" ". g:NERDTreeMapOpenSplit .": open split\n"
|
||||
let help .= "\" ". g:NERDTreeMapPreviewSplit .": preview split\n"
|
||||
let help .= "\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n"
|
||||
let help .= "\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n"
|
||||
|
||||
let @h=@h."\"\n\" ----------------------------\n"
|
||||
let @h=@h."\" Directory node mappings~\n"
|
||||
let @h=@h."\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open & close node\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapCloseDir .": close parent of node\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n"
|
||||
let @h=@h."\" current node recursively\n"
|
||||
let @h=@h."\" middle-click,\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n"
|
||||
let help .= "\"\n\" ----------------------------\n"
|
||||
let help .= "\" Directory node mappings~\n"
|
||||
let help .= "\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n"
|
||||
let help .= "\" ". g:NERDTreeMapActivateNode .": open & close node\n"
|
||||
let help .= "\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n"
|
||||
let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||
let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||
let help .= "\" ". g:NERDTreeMapCloseDir .": close parent of node\n"
|
||||
let help .= "\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n"
|
||||
let help .= "\" current node recursively\n"
|
||||
let help .= "\" middle-click,\n"
|
||||
let help .= "\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n"
|
||||
|
||||
let @h=@h."\"\n\" ----------------------------\n"
|
||||
let @h=@h."\" Bookmark table mappings~\n"
|
||||
let @h=@h."\" double-click,\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open bookmark\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
|
||||
let help .= "\"\n\" ----------------------------\n"
|
||||
let help .= "\" Bookmark table mappings~\n"
|
||||
let help .= "\" double-click,\n"
|
||||
let help .= "\" ". g:NERDTreeMapActivateNode .": open bookmark\n"
|
||||
let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||
let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||
let help .= "\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
|
||||
|
||||
let @h=@h."\"\n\" ----------------------------\n"
|
||||
let @h=@h."\" Tree navigation mappings~\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapJumpRoot .": go to root\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapJumpParent .": go to parent\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapJumpLastChild .": go to last child\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n"
|
||||
let help .= "\"\n\" ----------------------------\n"
|
||||
let help .= "\" Tree navigation mappings~\n"
|
||||
let help .= "\" ". g:NERDTreeMapJumpRoot .": go to root\n"
|
||||
let help .= "\" ". g:NERDTreeMapJumpParent .": go to parent\n"
|
||||
let help .= "\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n"
|
||||
let help .= "\" ". g:NERDTreeMapJumpLastChild .": go to last child\n"
|
||||
let help .= "\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n"
|
||||
let help .= "\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n"
|
||||
|
||||
let @h=@h."\"\n\" ----------------------------\n"
|
||||
let @h=@h."\" Filesystem mappings~\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n"
|
||||
let @h=@h."\" selected dir\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n"
|
||||
let @h=@h."\" but leave old root open\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapMenu .": Show menu\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapChdir .":change the CWD to the\n"
|
||||
let @h=@h."\" selected dir\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapCWD .":change tree root to CWD\n"
|
||||
let help .= "\"\n\" ----------------------------\n"
|
||||
let help .= "\" Filesystem mappings~\n"
|
||||
let help .= "\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n"
|
||||
let help .= "\" selected dir\n"
|
||||
let help .= "\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n"
|
||||
let help .= "\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n"
|
||||
let help .= "\" but leave old root open\n"
|
||||
let help .= "\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n"
|
||||
let help .= "\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n"
|
||||
let help .= "\" ". g:NERDTreeMapMenu .": Show menu\n"
|
||||
let help .= "\" ". g:NERDTreeMapChdir .":change the CWD to the\n"
|
||||
let help .= "\" selected dir\n"
|
||||
let help .= "\" ". g:NERDTreeMapCWD .":change tree root to CWD\n"
|
||||
|
||||
let @h=@h."\"\n\" ----------------------------\n"
|
||||
let @h=@h."\" Tree filtering mappings~\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (self.getShowHidden() ? "on" : "off") . ")\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapToggleFilters .": file filters (" . (self.isIgnoreFilterEnabled() ? "on" : "off") . ")\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n"
|
||||
let help .= "\"\n\" ----------------------------\n"
|
||||
let help .= "\" Tree filtering mappings~\n"
|
||||
let help .= "\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (self.getShowHidden() ? "on" : "off") . ")\n"
|
||||
let help .= "\" ". g:NERDTreeMapToggleFilters .": file filters (" . (self.isIgnoreFilterEnabled() ? "on" : "off") . ")\n"
|
||||
let help .= "\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n"
|
||||
let help .= "\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n"
|
||||
|
||||
"add quickhelp entries for each custom key map
|
||||
let @h=@h."\"\n\" ----------------------------\n"
|
||||
let @h=@h."\" Custom mappings~\n"
|
||||
let help .= "\"\n\" ----------------------------\n"
|
||||
let help .= "\" Custom mappings~\n"
|
||||
for i in g:NERDTreeKeyMap.All()
|
||||
if !empty(i.quickhelpText)
|
||||
let @h=@h."\" ". i.key .": ". i.quickhelpText ."\n"
|
||||
let help .= "\" ". i.key .": ". i.quickhelpText ."\n"
|
||||
endif
|
||||
endfor
|
||||
|
||||
let @h=@h."\"\n\" ----------------------------\n"
|
||||
let @h=@h."\" Other mappings~\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n"
|
||||
let @h=@h."\" the NERDTree window\n"
|
||||
let @h=@h."\" ". g:NERDTreeMapHelp .": toggle help\n"
|
||||
let @h=@h."\"\n\" ----------------------------\n"
|
||||
let @h=@h."\" Bookmark commands~\n"
|
||||
let @h=@h."\" :Bookmark [<name>]\n"
|
||||
let @h=@h."\" :BookmarkToRoot <name>\n"
|
||||
let @h=@h."\" :RevealBookmark <name>\n"
|
||||
let @h=@h."\" :OpenBookmark <name>\n"
|
||||
let @h=@h."\" :ClearBookmarks [<names>]\n"
|
||||
let @h=@h."\" :ClearAllBookmarks\n"
|
||||
silent! put h
|
||||
let help .= "\"\n\" ----------------------------\n"
|
||||
let help .= "\" Other mappings~\n"
|
||||
let help .= "\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n"
|
||||
let help .= "\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n"
|
||||
let help .= "\" the NERDTree window\n"
|
||||
let help .= "\" ". g:NERDTreeMapHelp .": toggle help\n"
|
||||
let help .= "\"\n\" ----------------------------\n"
|
||||
let help .= "\" Bookmark commands~\n"
|
||||
let help .= "\" :Bookmark [<name>]\n"
|
||||
let help .= "\" :BookmarkToRoot <name>\n"
|
||||
let help .= "\" :RevealBookmark <name>\n"
|
||||
let help .= "\" :OpenBookmark <name>\n"
|
||||
let help .= "\" :ClearBookmarks [<names>]\n"
|
||||
let help .= "\" :ClearAllBookmarks\n"
|
||||
silent! put =help
|
||||
elseif !self.isMinimal()
|
||||
let @h="\" Press ". g:NERDTreeMapHelp ." for help\n"
|
||||
silent! put h
|
||||
let help ="\" Press ". g:NERDTreeMapHelp ." for help\n"
|
||||
silent! put =help
|
||||
endif
|
||||
|
||||
let @h = old_h
|
||||
endfunction
|
||||
|
||||
|
||||
|
@ -282,7 +281,8 @@ endfunction
|
|||
function! s:UI._indentLevelFor(line)
|
||||
"have to do this work around because match() returns bytes, not chars
|
||||
let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']')
|
||||
let leadChars = strchars(a:line[0:numLeadBytes-1])
|
||||
" The next line is a backward-compatible workaround for strchars(a:line(0:numLeadBytes-1]). strchars() is in 7.3+
|
||||
let leadChars = len(split(a:line[0:numLeadBytes-1], '\zs'))
|
||||
|
||||
return leadChars / s:UI.IndentWid()
|
||||
endfunction
|
||||
|
@ -315,6 +315,10 @@ function! s:UI._renderBookmarks()
|
|||
call cursor(line(".")+1, col("."))
|
||||
endif
|
||||
|
||||
if g:NERDTreeBookmarksSort == 1 || g:NERDTreeBookmarksSort == 2
|
||||
call g:NERDTreeBookmark.SortBookmarksList()
|
||||
endif
|
||||
|
||||
for i in g:NERDTreeBookmark.Bookmarks()
|
||||
call setline(line(".")+1, i.str())
|
||||
call cursor(line(".")+1, col("."))
|
||||
|
@ -439,10 +443,7 @@ function! s:UI.render()
|
|||
call cursor(line(".")+1, col("."))
|
||||
|
||||
"draw the tree
|
||||
let old_o = @o
|
||||
let @o = self.nerdtree.root.renderToString()
|
||||
silent put o
|
||||
let @o = old_o
|
||||
silent put =self.nerdtree.root.renderToString()
|
||||
|
||||
"delete the blank line at the top of the buffer
|
||||
silent 1,1delete _
|
||||
|
|
|
@ -55,7 +55,22 @@ function! s:promptToDelBuffer(bufnum, msg)
|
|||
" Is not it better to close single tabs with this file only ?
|
||||
let s:originalTabNumber = tabpagenr()
|
||||
let s:originalWindowNumber = winnr()
|
||||
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':enew! ' | endif"
|
||||
" Go to the next buffer in buffer list if at least one extra buffer is listed
|
||||
" Otherwise open a new empty buffer
|
||||
if v:version >= 800
|
||||
let l:listedBufferCount = len(getbufinfo({'buflisted':1}))
|
||||
elseif v:version >= 702
|
||||
let l:listedBufferCount = len(filter(range(1, bufnr('$')), 'buflisted(v:val)'))
|
||||
else
|
||||
" Ignore buffer count in this case to make sure we keep the old
|
||||
" behavior
|
||||
let l:listedBufferCount = 0
|
||||
endif
|
||||
if l:listedBufferCount > 1
|
||||
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':bnext! ' | endif"
|
||||
else
|
||||
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':enew! ' | endif"
|
||||
endif
|
||||
exec "tabnext " . s:originalTabNumber
|
||||
exec s:originalWindowNumber . "wincmd w"
|
||||
" 3. We don't need a previous buffer anymore
|
||||
|
@ -74,7 +89,7 @@ endfunction
|
|||
function! s:promptToRenameBuffer(bufnum, msg, newFileName)
|
||||
echo a:msg
|
||||
if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y'
|
||||
let quotedFileName = "'" . a:newFileName . "'"
|
||||
let quotedFileName = fnameescape(a:newFileName)
|
||||
" 1. ensure that a new buffer is loaded
|
||||
exec "badd " . quotedFileName
|
||||
" 2. ensure that all windows which display the just deleted filename
|
||||
|
@ -160,10 +175,10 @@ function! NERDTreeDeleteNode()
|
|||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||
let confirmed = 0
|
||||
|
||||
if currentNode.path.isDirectory
|
||||
if currentNode.path.isDirectory && currentNode.getChildCount() > 0
|
||||
let choice =input("Delete the current node\n" .
|
||||
\ "==========================================================\n" .
|
||||
\ "STOP! To delete this entire directory, type 'yes'\n" .
|
||||
\ "STOP! Directory is not empty! To delete, type 'yes'\n" .
|
||||
\ "" . currentNode.path.str() . ": ")
|
||||
let confirmed = choice ==# 'yes'
|
||||
else
|
||||
|
@ -202,24 +217,60 @@ endfunction
|
|||
" FUNCTION: NERDTreeListNode() {{{1
|
||||
function! NERDTreeListNode()
|
||||
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||
if treenode != {}
|
||||
let metadata = split(system('ls -ld ' . shellescape(treenode.path.str())), '\n')
|
||||
if !empty(treenode)
|
||||
if has("osx")
|
||||
let stat_cmd = 'stat -f "%z" '
|
||||
else
|
||||
let stat_cmd = 'stat -c "%s" '
|
||||
endif
|
||||
|
||||
let cmd = 'size=$(' . stat_cmd . shellescape(treenode.path.str()) . ') && ' .
|
||||
\ 'size_with_commas=$(echo $size | sed -e :a -e "s/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta") && ' .
|
||||
\ 'ls -ld ' . shellescape(treenode.path.str()) . ' | sed -e "s/ $size / $size_with_commas /"'
|
||||
|
||||
let metadata = split(system(cmd),'\n')
|
||||
call nerdtree#echo(metadata[0])
|
||||
else
|
||||
call nerdtree#echo("No information avaialable")
|
||||
call nerdtree#echo("No information available")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" FUNCTION: NERDTreeListNodeWin32() {{{1
|
||||
function! NERDTreeListNodeWin32()
|
||||
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||
if treenode != {}
|
||||
let metadata = split(system('DIR /Q ' . shellescape(treenode.path.str()) . ' | FINDSTR "^[012][0-9]/[0-3][0-9]/[12][0-9][0-9][0-9]"'), '\n')
|
||||
call nerdtree#echo(metadata[0])
|
||||
else
|
||||
call nerdtree#echo("No information avaialable")
|
||||
let l:node = g:NERDTreeFileNode.GetSelected()
|
||||
|
||||
if !empty(l:node)
|
||||
|
||||
let l:save_shell = &shell
|
||||
set shell&
|
||||
|
||||
if exists('+shellslash')
|
||||
let l:save_shellslash = &shellslash
|
||||
set noshellslash
|
||||
endif
|
||||
|
||||
let l:command = 'DIR /Q '
|
||||
\ . shellescape(l:node.path.str())
|
||||
\ . ' | FINDSTR "^[012][0-9]/[0-3][0-9]/[12][0-9][0-9][0-9]"'
|
||||
|
||||
let l:metadata = split(system(l:command), "\n")
|
||||
|
||||
if v:shell_error == 0
|
||||
call nerdtree#echo(l:metadata[0])
|
||||
else
|
||||
call nerdtree#echoError('shell command failed')
|
||||
endif
|
||||
|
||||
let &shell = l:save_shell
|
||||
|
||||
if exists('l:save_shellslash')
|
||||
let &shellslash = l:save_shellslash
|
||||
endif
|
||||
|
||||
return
|
||||
endif
|
||||
|
||||
call nerdtree#echo('node not recognized')
|
||||
endfunction
|
||||
|
||||
" FUNCTION: NERDTreeCopyNode() {{{1
|
||||
|
|
|
@ -46,6 +46,7 @@ endfunction
|
|||
call s:initVariable("g:NERDTreeAutoCenter", 1)
|
||||
call s:initVariable("g:NERDTreeAutoCenterThreshold", 3)
|
||||
call s:initVariable("g:NERDTreeCaseSensitiveSort", 0)
|
||||
call s:initVariable("g:NERDTreeNaturalSort", 0)
|
||||
call s:initVariable("g:NERDTreeSortHiddenFirst", 1)
|
||||
call s:initVariable("g:NERDTreeChDirMode", 0)
|
||||
call s:initVariable("g:NERDTreeCreatePrefix", "silent")
|
||||
|
@ -57,6 +58,7 @@ call s:initVariable("g:NERDTreeBookmarksFile", expand('$HOME') . '/.NERDTreeBook
|
|||
call s:initVariable("g:NERDTreeBookmarksSort", 1)
|
||||
call s:initVariable("g:NERDTreeHighlightCursorline", 1)
|
||||
call s:initVariable("g:NERDTreeHijackNetrw", 1)
|
||||
call s:initVariable('g:NERDTreeMarkBookmarks', 1)
|
||||
call s:initVariable("g:NERDTreeMouseMode", 1)
|
||||
call s:initVariable("g:NERDTreeNotificationThreshold", 100)
|
||||
call s:initVariable("g:NERDTreeQuitOnOpen", 0)
|
||||
|
@ -67,7 +69,7 @@ call s:initVariable("g:NERDTreeShowHidden", 0)
|
|||
call s:initVariable("g:NERDTreeShowLineNumbers", 0)
|
||||
call s:initVariable("g:NERDTreeSortDirs", 1)
|
||||
|
||||
if !nerdtree#runningWindows()
|
||||
if !nerdtree#runningWindows() && !nerdtree#runningCygwin()
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "▸")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾")
|
||||
else
|
||||
|
@ -75,6 +77,7 @@ else
|
|||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "~")
|
||||
endif
|
||||
call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1)
|
||||
call s:initVariable("g:NERDTreeCascadeSingleChildDir", 1)
|
||||
|
||||
if !exists("g:NERDTreeSortOrder")
|
||||
let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$']
|
||||
|
@ -103,6 +106,8 @@ call s:initVariable("g:NERDTreeWinSize", 31)
|
|||
"Note: the space after the command is important
|
||||
if nerdtree#runningWindows()
|
||||
call s:initVariable("g:NERDTreeRemoveDirCmd", 'rmdir /s /q ')
|
||||
call s:initVariable("g:NERDTreeCopyDirCmd", 'xcopy /s /e /i /y /q ')
|
||||
call s:initVariable("g:NERDTreeCopyFileCmd", 'copy /y ')
|
||||
else
|
||||
call s:initVariable("g:NERDTreeRemoveDirCmd", 'rm -rf ')
|
||||
call s:initVariable("g:NERDTreeCopyCmd", 'cp -r ')
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 86 KiB |
|
@ -8,7 +8,7 @@ execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
|
|||
"quickhelp syntax elements
|
||||
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#ms=s+2,me=e-1
|
||||
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#ms=s+2,me=e-1
|
||||
syn match NERDTreeHelpTitle #" .*\~#ms=s+2,me=e-1
|
||||
syn match NERDTreeHelpTitle #" .*\~$#ms=s+2,me=e-1
|
||||
syn match NERDTreeToggleOn #(on)#ms=s+1,he=e-1
|
||||
syn match NERDTreeToggleOff #(off)#ms=e-3,me=e-1
|
||||
syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
|
||||
|
@ -22,10 +22,10 @@ syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
|
|||
"highlighing for directory nodes and file nodes
|
||||
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
|
||||
|
||||
exec 'syn match NERDTreeClosable #'.escape(g:NERDTreeDirArrowCollapsible, '~').'# containedin=NERDTreeDir,NERDTreeFile'
|
||||
exec 'syn match NERDTreeOpenable #'.escape(g:NERDTreeDirArrowExpandable, '~').'# containedin=NERDTreeDir,NERDTreeFile'
|
||||
exec 'syn match NERDTreeClosable #' . escape(g:NERDTreeDirArrowCollapsible, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
|
||||
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
|
||||
|
||||
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~').escape(g:NERDTreeDirArrowExpandable, '~')
|
||||
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
|
||||
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
|
||||
syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark
|
||||
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
|
||||
|
@ -72,8 +72,8 @@ hi def link NERDTreeDir Directory
|
|||
hi def link NERDTreeUp Directory
|
||||
hi def link NERDTreeFile Normal
|
||||
hi def link NERDTreeCWD Statement
|
||||
hi def link NERDTreeOpenable Title
|
||||
hi def link NERDTreeClosable Title
|
||||
hi def link NERDTreeOpenable Directory
|
||||
hi def link NERDTreeClosable Directory
|
||||
hi def link NERDTreeIgnore ignore
|
||||
hi def link NERDTreeRO WarningMsg
|
||||
hi def link NERDTreeBookmark Statement
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
# nginx syntax files for Vim.
|
||||
|
||||
*NOTE*: As of Dec. 2013, these scripts are maintained in the "contrib" directory of the Nginx source:
|
||||
|
||||
* http://hg.nginx.org/nginx/rev/f38043bd15f5
|
||||
|
||||
You can see the original vim.org version here:
|
||||
|
||||
* http://www.vim.org/scripts/script.php?script_id=1886
|
||||
|
|
@ -1,703 +0,0 @@
|
|||
" Vim syntax file
|
||||
" Language: nginx.conf
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
end
|
||||
|
||||
setlocal iskeyword+=.
|
||||
setlocal iskeyword+=/
|
||||
setlocal iskeyword+=:
|
||||
|
||||
syn match ngxVariable '\$\(\w\+\|{\w\+}\)'
|
||||
syn match ngxVariableBlock '\$\(\w\+\|{\w\+}\)' contained
|
||||
syn match ngxVariableString '\$\(\w\+\|{\w\+}\)' contained
|
||||
syn region ngxBlock start=+^+ end=+{+ skip=+\${+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
|
||||
syn region ngxString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString
|
||||
syn match ngxComment ' *#.*$'
|
||||
|
||||
syn keyword ngxBoolean on
|
||||
syn keyword ngxBoolean off
|
||||
|
||||
syn keyword ngxDirectiveBlock http contained
|
||||
syn keyword ngxDirectiveBlock mail contained
|
||||
syn keyword ngxDirectiveBlock events contained
|
||||
syn keyword ngxDirectiveBlock server contained
|
||||
syn keyword ngxDirectiveBlock types contained
|
||||
syn keyword ngxDirectiveBlock location contained
|
||||
syn keyword ngxDirectiveBlock upstream contained
|
||||
syn keyword ngxDirectiveBlock charset_map contained
|
||||
syn keyword ngxDirectiveBlock limit_except contained
|
||||
syn keyword ngxDirectiveBlock if contained
|
||||
syn keyword ngxDirectiveBlock geo contained
|
||||
syn keyword ngxDirectiveBlock map contained
|
||||
|
||||
syn keyword ngxDirectiveImportant include
|
||||
syn keyword ngxDirectiveImportant root
|
||||
syn keyword ngxDirectiveImportant server
|
||||
syn keyword ngxDirectiveImportant server_name
|
||||
syn keyword ngxDirectiveImportant listen
|
||||
syn keyword ngxDirectiveImportant internal
|
||||
syn keyword ngxDirectiveImportant proxy_pass
|
||||
syn keyword ngxDirectiveImportant memcached_pass
|
||||
syn keyword ngxDirectiveImportant fastcgi_pass
|
||||
syn keyword ngxDirectiveImportant try_files
|
||||
|
||||
syn keyword ngxDirectiveControl break
|
||||
syn keyword ngxDirectiveControl return
|
||||
syn keyword ngxDirectiveControl rewrite
|
||||
syn keyword ngxDirectiveControl set
|
||||
|
||||
syn keyword ngxDirectiveError error_page
|
||||
syn keyword ngxDirectiveError post_action
|
||||
|
||||
syn keyword ngxDirectiveDeprecated connections
|
||||
syn keyword ngxDirectiveDeprecated imap
|
||||
syn keyword ngxDirectiveDeprecated open_file_cache_retest
|
||||
syn keyword ngxDirectiveDeprecated optimize_server_names
|
||||
syn keyword ngxDirectiveDeprecated satisfy_any
|
||||
|
||||
syn keyword ngxDirective accept_mutex
|
||||
syn keyword ngxDirective accept_mutex_delay
|
||||
syn keyword ngxDirective access_log
|
||||
syn keyword ngxDirective add_after_body
|
||||
syn keyword ngxDirective add_before_body
|
||||
syn keyword ngxDirective add_header
|
||||
syn keyword ngxDirective addition_types
|
||||
syn keyword ngxDirective aio
|
||||
syn keyword ngxDirective alias
|
||||
syn keyword ngxDirective allow
|
||||
syn keyword ngxDirective ancient_browser
|
||||
syn keyword ngxDirective ancient_browser_value
|
||||
syn keyword ngxDirective auth_basic
|
||||
syn keyword ngxDirective auth_basic_user_file
|
||||
syn keyword ngxDirective auth_http
|
||||
syn keyword ngxDirective auth_http_header
|
||||
syn keyword ngxDirective auth_http_timeout
|
||||
syn keyword ngxDirective autoindex
|
||||
syn keyword ngxDirective autoindex_exact_size
|
||||
syn keyword ngxDirective autoindex_localtime
|
||||
syn keyword ngxDirective charset
|
||||
syn keyword ngxDirective charset_types
|
||||
syn keyword ngxDirective client_body_buffer_size
|
||||
syn keyword ngxDirective client_body_in_file_only
|
||||
syn keyword ngxDirective client_body_in_single_buffer
|
||||
syn keyword ngxDirective client_body_temp_path
|
||||
syn keyword ngxDirective client_body_timeout
|
||||
syn keyword ngxDirective client_header_buffer_size
|
||||
syn keyword ngxDirective client_header_timeout
|
||||
syn keyword ngxDirective client_max_body_size
|
||||
syn keyword ngxDirective connection_pool_size
|
||||
syn keyword ngxDirective create_full_put_path
|
||||
syn keyword ngxDirective daemon
|
||||
syn keyword ngxDirective dav_access
|
||||
syn keyword ngxDirective dav_methods
|
||||
syn keyword ngxDirective debug_connection
|
||||
syn keyword ngxDirective debug_points
|
||||
syn keyword ngxDirective default_type
|
||||
syn keyword ngxDirective degradation
|
||||
syn keyword ngxDirective degrade
|
||||
syn keyword ngxDirective deny
|
||||
syn keyword ngxDirective devpoll_changes
|
||||
syn keyword ngxDirective devpoll_events
|
||||
syn keyword ngxDirective directio
|
||||
syn keyword ngxDirective directio_alignment
|
||||
syn keyword ngxDirective empty_gif
|
||||
syn keyword ngxDirective env
|
||||
syn keyword ngxDirective epoll_events
|
||||
syn keyword ngxDirective error_log
|
||||
syn keyword ngxDirective eventport_events
|
||||
syn keyword ngxDirective expires
|
||||
syn keyword ngxDirective fastcgi_bind
|
||||
syn keyword ngxDirective fastcgi_buffer_size
|
||||
syn keyword ngxDirective fastcgi_buffers
|
||||
syn keyword ngxDirective fastcgi_busy_buffers_size
|
||||
syn keyword ngxDirective fastcgi_cache
|
||||
syn keyword ngxDirective fastcgi_cache_key
|
||||
syn keyword ngxDirective fastcgi_cache_methods
|
||||
syn keyword ngxDirective fastcgi_cache_min_uses
|
||||
syn keyword ngxDirective fastcgi_cache_path
|
||||
syn keyword ngxDirective fastcgi_cache_use_stale
|
||||
syn keyword ngxDirective fastcgi_cache_valid
|
||||
syn keyword ngxDirective fastcgi_catch_stderr
|
||||
syn keyword ngxDirective fastcgi_connect_timeout
|
||||
syn keyword ngxDirective fastcgi_hide_header
|
||||
syn keyword ngxDirective fastcgi_ignore_client_abort
|
||||
syn keyword ngxDirective fastcgi_ignore_headers
|
||||
syn keyword ngxDirective fastcgi_index
|
||||
syn keyword ngxDirective fastcgi_intercept_errors
|
||||
syn keyword ngxDirective fastcgi_max_temp_file_size
|
||||
syn keyword ngxDirective fastcgi_next_upstream
|
||||
syn keyword ngxDirective fastcgi_param
|
||||
syn keyword ngxDirective fastcgi_pass_header
|
||||
syn keyword ngxDirective fastcgi_pass_request_body
|
||||
syn keyword ngxDirective fastcgi_pass_request_headers
|
||||
syn keyword ngxDirective fastcgi_read_timeout
|
||||
syn keyword ngxDirective fastcgi_send_lowat
|
||||
syn keyword ngxDirective fastcgi_send_timeout
|
||||
syn keyword ngxDirective fastcgi_split_path_info
|
||||
syn keyword ngxDirective fastcgi_store
|
||||
syn keyword ngxDirective fastcgi_store_access
|
||||
syn keyword ngxDirective fastcgi_temp_file_write_size
|
||||
syn keyword ngxDirective fastcgi_temp_path
|
||||
syn keyword ngxDirective fastcgi_upstream_fail_timeout
|
||||
syn keyword ngxDirective fastcgi_upstream_max_fails
|
||||
syn keyword ngxDirective flv
|
||||
syn keyword ngxDirective geoip_city
|
||||
syn keyword ngxDirective geoip_country
|
||||
syn keyword ngxDirective google_perftools_profiles
|
||||
syn keyword ngxDirective gzip
|
||||
syn keyword ngxDirective gzip_buffers
|
||||
syn keyword ngxDirective gzip_comp_level
|
||||
syn keyword ngxDirective gzip_disable
|
||||
syn keyword ngxDirective gzip_hash
|
||||
syn keyword ngxDirective gzip_http_version
|
||||
syn keyword ngxDirective gzip_min_length
|
||||
syn keyword ngxDirective gzip_no_buffer
|
||||
syn keyword ngxDirective gzip_proxied
|
||||
syn keyword ngxDirective gzip_static
|
||||
syn keyword ngxDirective gzip_types
|
||||
syn keyword ngxDirective gzip_vary
|
||||
syn keyword ngxDirective gzip_window
|
||||
syn keyword ngxDirective if_modified_since
|
||||
syn keyword ngxDirective ignore_invalid_headers
|
||||
syn keyword ngxDirective image_filter
|
||||
syn keyword ngxDirective image_filter_buffer
|
||||
syn keyword ngxDirective image_filter_jpeg_quality
|
||||
syn keyword ngxDirective image_filter_transparency
|
||||
syn keyword ngxDirective imap_auth
|
||||
syn keyword ngxDirective imap_capabilities
|
||||
syn keyword ngxDirective imap_client_buffer
|
||||
syn keyword ngxDirective index
|
||||
syn keyword ngxDirective ip_hash
|
||||
syn keyword ngxDirective keepalive_requests
|
||||
syn keyword ngxDirective keepalive_timeout
|
||||
syn keyword ngxDirective kqueue_changes
|
||||
syn keyword ngxDirective kqueue_events
|
||||
syn keyword ngxDirective large_client_header_buffers
|
||||
syn keyword ngxDirective limit_conn
|
||||
syn keyword ngxDirective limit_conn_log_level
|
||||
syn keyword ngxDirective limit_rate
|
||||
syn keyword ngxDirective limit_rate_after
|
||||
syn keyword ngxDirective limit_req
|
||||
syn keyword ngxDirective limit_req_log_level
|
||||
syn keyword ngxDirective limit_req_zone
|
||||
syn keyword ngxDirective limit_zone
|
||||
syn keyword ngxDirective lingering_time
|
||||
syn keyword ngxDirective lingering_timeout
|
||||
syn keyword ngxDirective lock_file
|
||||
syn keyword ngxDirective log_format
|
||||
syn keyword ngxDirective log_not_found
|
||||
syn keyword ngxDirective log_subrequest
|
||||
syn keyword ngxDirective map_hash_bucket_size
|
||||
syn keyword ngxDirective map_hash_max_size
|
||||
syn keyword ngxDirective master_process
|
||||
syn keyword ngxDirective memcached_bind
|
||||
syn keyword ngxDirective memcached_buffer_size
|
||||
syn keyword ngxDirective memcached_connect_timeout
|
||||
syn keyword ngxDirective memcached_next_upstream
|
||||
syn keyword ngxDirective memcached_read_timeout
|
||||
syn keyword ngxDirective memcached_send_timeout
|
||||
syn keyword ngxDirective memcached_upstream_fail_timeout
|
||||
syn keyword ngxDirective memcached_upstream_max_fails
|
||||
syn keyword ngxDirective merge_slashes
|
||||
syn keyword ngxDirective min_delete_depth
|
||||
syn keyword ngxDirective modern_browser
|
||||
syn keyword ngxDirective modern_browser_value
|
||||
syn keyword ngxDirective msie_padding
|
||||
syn keyword ngxDirective msie_refresh
|
||||
syn keyword ngxDirective multi_accept
|
||||
syn keyword ngxDirective open_file_cache
|
||||
syn keyword ngxDirective open_file_cache_errors
|
||||
syn keyword ngxDirective open_file_cache_events
|
||||
syn keyword ngxDirective open_file_cache_min_uses
|
||||
syn keyword ngxDirective open_file_cache_valid
|
||||
syn keyword ngxDirective open_log_file_cache
|
||||
syn keyword ngxDirective output_buffers
|
||||
syn keyword ngxDirective override_charset
|
||||
syn keyword ngxDirective perl
|
||||
syn keyword ngxDirective perl_modules
|
||||
syn keyword ngxDirective perl_require
|
||||
syn keyword ngxDirective perl_set
|
||||
syn keyword ngxDirective pid
|
||||
syn keyword ngxDirective pop3_auth
|
||||
syn keyword ngxDirective pop3_capabilities
|
||||
syn keyword ngxDirective port_in_redirect
|
||||
syn keyword ngxDirective postpone_gzipping
|
||||
syn keyword ngxDirective postpone_output
|
||||
syn keyword ngxDirective protocol
|
||||
syn keyword ngxDirective proxy
|
||||
syn keyword ngxDirective proxy_bind
|
||||
syn keyword ngxDirective proxy_buffer
|
||||
syn keyword ngxDirective proxy_buffer_size
|
||||
syn keyword ngxDirective proxy_buffering
|
||||
syn keyword ngxDirective proxy_buffers
|
||||
syn keyword ngxDirective proxy_busy_buffers_size
|
||||
syn keyword ngxDirective proxy_cache
|
||||
syn keyword ngxDirective proxy_cache_key
|
||||
syn keyword ngxDirective proxy_cache_methods
|
||||
syn keyword ngxDirective proxy_cache_min_uses
|
||||
syn keyword ngxDirective proxy_cache_path
|
||||
syn keyword ngxDirective proxy_cache_use_stale
|
||||
syn keyword ngxDirective proxy_cache_valid
|
||||
syn keyword ngxDirective proxy_connect_timeout
|
||||
syn keyword ngxDirective proxy_headers_hash_bucket_size
|
||||
syn keyword ngxDirective proxy_headers_hash_max_size
|
||||
syn keyword ngxDirective proxy_hide_header
|
||||
syn keyword ngxDirective proxy_ignore_client_abort
|
||||
syn keyword ngxDirective proxy_ignore_headers
|
||||
syn keyword ngxDirective proxy_intercept_errors
|
||||
syn keyword ngxDirective proxy_max_temp_file_size
|
||||
syn keyword ngxDirective proxy_method
|
||||
syn keyword ngxDirective proxy_next_upstream
|
||||
syn keyword ngxDirective proxy_pass_error_message
|
||||
syn keyword ngxDirective proxy_pass_header
|
||||
syn keyword ngxDirective proxy_pass_request_body
|
||||
syn keyword ngxDirective proxy_pass_request_headers
|
||||
syn keyword ngxDirective proxy_read_timeout
|
||||
syn keyword ngxDirective proxy_redirect
|
||||
syn keyword ngxDirective proxy_send_lowat
|
||||
syn keyword ngxDirective proxy_send_timeout
|
||||
syn keyword ngxDirective proxy_set_body
|
||||
syn keyword ngxDirective proxy_set_header
|
||||
syn keyword ngxDirective proxy_ssl_session_reuse
|
||||
syn keyword ngxDirective proxy_store
|
||||
syn keyword ngxDirective proxy_store_access
|
||||
syn keyword ngxDirective proxy_temp_file_write_size
|
||||
syn keyword ngxDirective proxy_temp_path
|
||||
syn keyword ngxDirective proxy_timeout
|
||||
syn keyword ngxDirective proxy_upstream_fail_timeout
|
||||
syn keyword ngxDirective proxy_upstream_max_fails
|
||||
syn keyword ngxDirective random_index
|
||||
syn keyword ngxDirective read_ahead
|
||||
syn keyword ngxDirective real_ip_header
|
||||
syn keyword ngxDirective recursive_error_pages
|
||||
syn keyword ngxDirective request_pool_size
|
||||
syn keyword ngxDirective reset_timedout_connection
|
||||
syn keyword ngxDirective resolver
|
||||
syn keyword ngxDirective resolver_timeout
|
||||
syn keyword ngxDirective rewrite_log
|
||||
syn keyword ngxDirective rtsig_overflow_events
|
||||
syn keyword ngxDirective rtsig_overflow_test
|
||||
syn keyword ngxDirective rtsig_overflow_threshold
|
||||
syn keyword ngxDirective rtsig_signo
|
||||
syn keyword ngxDirective satisfy
|
||||
syn keyword ngxDirective secure_link_secret
|
||||
syn keyword ngxDirective send_lowat
|
||||
syn keyword ngxDirective send_timeout
|
||||
syn keyword ngxDirective sendfile
|
||||
syn keyword ngxDirective sendfile_max_chunk
|
||||
syn keyword ngxDirective server_name_in_redirect
|
||||
syn keyword ngxDirective server_names_hash_bucket_size
|
||||
syn keyword ngxDirective server_names_hash_max_size
|
||||
syn keyword ngxDirective server_tokens
|
||||
syn keyword ngxDirective set_real_ip_from
|
||||
syn keyword ngxDirective smtp_auth
|
||||
syn keyword ngxDirective smtp_capabilities
|
||||
syn keyword ngxDirective smtp_client_buffer
|
||||
syn keyword ngxDirective smtp_greeting_delay
|
||||
syn keyword ngxDirective so_keepalive
|
||||
syn keyword ngxDirective source_charset
|
||||
syn keyword ngxDirective ssi
|
||||
syn keyword ngxDirective ssi_ignore_recycled_buffers
|
||||
syn keyword ngxDirective ssi_min_file_chunk
|
||||
syn keyword ngxDirective ssi_silent_errors
|
||||
syn keyword ngxDirective ssi_types
|
||||
syn keyword ngxDirective ssi_value_length
|
||||
syn keyword ngxDirective ssl
|
||||
syn keyword ngxDirective ssl_certificate
|
||||
syn keyword ngxDirective ssl_certificate_key
|
||||
syn keyword ngxDirective ssl_ciphers
|
||||
syn keyword ngxDirective ssl_client_certificate
|
||||
syn keyword ngxDirective ssl_crl
|
||||
syn keyword ngxDirective ssl_dhparam
|
||||
syn keyword ngxDirective ssl_engine
|
||||
syn keyword ngxDirective ssl_prefer_server_ciphers
|
||||
syn keyword ngxDirective ssl_protocols
|
||||
syn keyword ngxDirective ssl_session_cache
|
||||
syn keyword ngxDirective ssl_session_timeout
|
||||
syn keyword ngxDirective ssl_verify_client
|
||||
syn keyword ngxDirective ssl_verify_depth
|
||||
syn keyword ngxDirective starttls
|
||||
syn keyword ngxDirective stub_status
|
||||
syn keyword ngxDirective sub_filter
|
||||
syn keyword ngxDirective sub_filter_once
|
||||
syn keyword ngxDirective sub_filter_types
|
||||
syn keyword ngxDirective tcp_nodelay
|
||||
syn keyword ngxDirective tcp_nopush
|
||||
syn keyword ngxDirective thread_stack_size
|
||||
syn keyword ngxDirective timeout
|
||||
syn keyword ngxDirective timer_resolution
|
||||
syn keyword ngxDirective types_hash_bucket_size
|
||||
syn keyword ngxDirective types_hash_max_size
|
||||
syn keyword ngxDirective underscores_in_headers
|
||||
syn keyword ngxDirective uninitialized_variable_warn
|
||||
syn keyword ngxDirective use
|
||||
syn keyword ngxDirective user
|
||||
syn keyword ngxDirective userid
|
||||
syn keyword ngxDirective userid_domain
|
||||
syn keyword ngxDirective userid_expires
|
||||
syn keyword ngxDirective userid_mark
|
||||
syn keyword ngxDirective userid_name
|
||||
syn keyword ngxDirective userid_p3p
|
||||
syn keyword ngxDirective userid_path
|
||||
syn keyword ngxDirective userid_service
|
||||
syn keyword ngxDirective valid_referers
|
||||
syn keyword ngxDirective variables_hash_bucket_size
|
||||
syn keyword ngxDirective variables_hash_max_size
|
||||
syn keyword ngxDirective worker_connections
|
||||
syn keyword ngxDirective worker_cpu_affinity
|
||||
syn keyword ngxDirective worker_priority
|
||||
syn keyword ngxDirective worker_processes
|
||||
syn keyword ngxDirective worker_rlimit_core
|
||||
syn keyword ngxDirective worker_rlimit_nofile
|
||||
syn keyword ngxDirective worker_rlimit_sigpending
|
||||
syn keyword ngxDirective worker_threads
|
||||
syn keyword ngxDirective working_directory
|
||||
syn keyword ngxDirective xclient
|
||||
syn keyword ngxDirective xml_entities
|
||||
syn keyword ngxDirective xslt_stylesheet
|
||||
syn keyword ngxDirective xslt_types
|
||||
|
||||
" 3rd party module list:
|
||||
" http://wiki.nginx.org/Nginx3rdPartyModules
|
||||
|
||||
" Accept Language Module <http://wiki.nginx.org/NginxAcceptLanguageModule>
|
||||
" Parses the Accept-Language header and gives the most suitable locale from a list of supported locales.
|
||||
syn keyword ngxDirectiveThirdParty set_from_accept_language
|
||||
|
||||
" Access Key Module <http://wiki.nginx.org/NginxHttpAccessKeyModule>
|
||||
" Denies access unless the request URL contains an access key.
|
||||
syn keyword ngxDirectiveThirdParty accesskey
|
||||
syn keyword ngxDirectiveThirdParty accesskey_arg
|
||||
syn keyword ngxDirectiveThirdParty accesskey_hashmethod
|
||||
syn keyword ngxDirectiveThirdParty accesskey_signature
|
||||
|
||||
" Auth PAM Module <http://web.iti.upv.es/~sto/nginx/>
|
||||
" HTTP Basic Authentication using PAM.
|
||||
syn keyword ngxDirectiveThirdParty auth_pam
|
||||
syn keyword ngxDirectiveThirdParty auth_pam_service_name
|
||||
|
||||
" Cache Purge Module <http://labs.frickle.com/nginx_ngx_cache_purge/>
|
||||
" Module adding ability to purge content from FastCGI and proxy caches.
|
||||
syn keyword ngxDirectiveThirdParty fastcgi_cache_purge
|
||||
syn keyword ngxDirectiveThirdParty proxy_cache_purge
|
||||
|
||||
" Chunkin Module <http://wiki.nginx.org/NginxHttpChunkinModule>
|
||||
" HTTP 1.1 chunked-encoding request body support for Nginx.
|
||||
syn keyword ngxDirectiveThirdParty chunkin
|
||||
syn keyword ngxDirectiveThirdParty chunkin_keepalive
|
||||
syn keyword ngxDirectiveThirdParty chunkin_max_chunks_per_buf
|
||||
syn keyword ngxDirectiveThirdParty chunkin_resume
|
||||
|
||||
" Circle GIF Module <http://wiki.nginx.org/NginxHttpCircleGifModule>
|
||||
" Generates simple circle images with the colors and size specified in the URL.
|
||||
syn keyword ngxDirectiveThirdParty circle_gif
|
||||
syn keyword ngxDirectiveThirdParty circle_gif_max_radius
|
||||
syn keyword ngxDirectiveThirdParty circle_gif_min_radius
|
||||
syn keyword ngxDirectiveThirdParty circle_gif_step_radius
|
||||
|
||||
" Drizzle Module <http://github.com/chaoslawful/drizzle-nginx-module>
|
||||
" Make nginx talk directly to mysql, drizzle, and sqlite3 by libdrizzle.
|
||||
syn keyword ngxDirectiveThirdParty drizzle_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_dbname
|
||||
syn keyword ngxDirectiveThirdParty drizzle_keepalive
|
||||
syn keyword ngxDirectiveThirdParty drizzle_module_header
|
||||
syn keyword ngxDirectiveThirdParty drizzle_pass
|
||||
syn keyword ngxDirectiveThirdParty drizzle_query
|
||||
syn keyword ngxDirectiveThirdParty drizzle_recv_cols_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_recv_rows_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_send_query_timeout
|
||||
syn keyword ngxDirectiveThirdParty drizzle_server
|
||||
|
||||
" Echo Module <http://wiki.nginx.org/NginxHttpEchoModule>
|
||||
" Brings 'echo', 'sleep', 'time', 'exec' and more shell-style goodies to Nginx config file.
|
||||
syn keyword ngxDirectiveThirdParty echo
|
||||
syn keyword ngxDirectiveThirdParty echo_after_body
|
||||
syn keyword ngxDirectiveThirdParty echo_before_body
|
||||
syn keyword ngxDirectiveThirdParty echo_blocking_sleep
|
||||
syn keyword ngxDirectiveThirdParty echo_duplicate
|
||||
syn keyword ngxDirectiveThirdParty echo_end
|
||||
syn keyword ngxDirectiveThirdParty echo_exec
|
||||
syn keyword ngxDirectiveThirdParty echo_flush
|
||||
syn keyword ngxDirectiveThirdParty echo_foreach_split
|
||||
syn keyword ngxDirectiveThirdParty echo_location
|
||||
syn keyword ngxDirectiveThirdParty echo_location_async
|
||||
syn keyword ngxDirectiveThirdParty echo_read_request_body
|
||||
syn keyword ngxDirectiveThirdParty echo_request_body
|
||||
syn keyword ngxDirectiveThirdParty echo_reset_timer
|
||||
syn keyword ngxDirectiveThirdParty echo_sleep
|
||||
syn keyword ngxDirectiveThirdParty echo_subrequest
|
||||
syn keyword ngxDirectiveThirdParty echo_subrequest_async
|
||||
|
||||
" Events Module <http://docs.dutov.org/nginx_modules_events_en.html>
|
||||
" Privides options for start/stop events.
|
||||
syn keyword ngxDirectiveThirdParty on_start
|
||||
syn keyword ngxDirectiveThirdParty on_stop
|
||||
|
||||
" EY Balancer Module <http://github.com/ry/nginx-ey-balancer>
|
||||
" Adds a request queue to Nginx that allows the limiting of concurrent requests passed to the upstream.
|
||||
syn keyword ngxDirectiveThirdParty max_connections
|
||||
syn keyword ngxDirectiveThirdParty max_connections_max_queue_length
|
||||
syn keyword ngxDirectiveThirdParty max_connections_queue_timeout
|
||||
|
||||
" Fancy Indexes Module <https://connectical.com/projects/ngx-fancyindex/wiki>
|
||||
" Like the built-in autoindex module, but fancier.
|
||||
syn keyword ngxDirectiveThirdParty fancyindex
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_exact_size
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_footer
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_header
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_localtime
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_readme
|
||||
syn keyword ngxDirectiveThirdParty fancyindex_readme_mode
|
||||
|
||||
" GeoIP Module (DEPRECATED) <http://wiki.nginx.org/NginxHttp3rdPartyGeoIPModule>
|
||||
" Country code lookups via the MaxMind GeoIP API.
|
||||
syn keyword ngxDirectiveThirdParty geoip_country_file
|
||||
|
||||
" Headers More Module <http://wiki.nginx.org/NginxHttpHeadersMoreModule>
|
||||
" Set and clear input and output headers...more than "add"!
|
||||
syn keyword ngxDirectiveThirdParty more_clear_headers
|
||||
syn keyword ngxDirectiveThirdParty more_clear_input_headers
|
||||
syn keyword ngxDirectiveThirdParty more_set_headers
|
||||
syn keyword ngxDirectiveThirdParty more_set_input_headers
|
||||
|
||||
" HTTP Push Module <http://pushmodule.slact.net/>
|
||||
" Turn Nginx into an adept long-polling HTTP Push (Comet) server.
|
||||
syn keyword ngxDirectiveThirdParty push_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty push_listener
|
||||
syn keyword ngxDirectiveThirdParty push_message_timeout
|
||||
syn keyword ngxDirectiveThirdParty push_queue_messages
|
||||
syn keyword ngxDirectiveThirdParty push_sender
|
||||
|
||||
" HTTP Redis Module <http://people.FreeBSD.ORG/~osa/ngx_http_redis-0.3.1.tar.gz>>
|
||||
" Redis <http://code.google.com/p/redis/> support.>
|
||||
syn keyword ngxDirectiveThirdParty redis_bind
|
||||
syn keyword ngxDirectiveThirdParty redis_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty redis_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty redis_next_upstream
|
||||
syn keyword ngxDirectiveThirdParty redis_pass
|
||||
syn keyword ngxDirectiveThirdParty redis_read_timeout
|
||||
syn keyword ngxDirectiveThirdParty redis_send_timeout
|
||||
|
||||
" HTTP JavaScript Module <http://wiki.github.com/kung-fu-tzu/ngx_http_js_module>
|
||||
" Embedding SpiderMonkey. Nearly full port on Perl module.
|
||||
syn keyword ngxDirectiveThirdParty js
|
||||
syn keyword ngxDirectiveThirdParty js_filter
|
||||
syn keyword ngxDirectiveThirdParty js_filter_types
|
||||
syn keyword ngxDirectiveThirdParty js_load
|
||||
syn keyword ngxDirectiveThirdParty js_maxmem
|
||||
syn keyword ngxDirectiveThirdParty js_require
|
||||
syn keyword ngxDirectiveThirdParty js_set
|
||||
syn keyword ngxDirectiveThirdParty js_utf8
|
||||
|
||||
" Log Request Speed <http://wiki.nginx.org/NginxHttpLogRequestSpeed>
|
||||
" Log the time it took to process each request.
|
||||
syn keyword ngxDirectiveThirdParty log_request_speed_filter
|
||||
syn keyword ngxDirectiveThirdParty log_request_speed_filter_timeout
|
||||
|
||||
" Memc Module <http://wiki.nginx.org/NginxHttpMemcModule>
|
||||
" An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands.
|
||||
syn keyword ngxDirectiveThirdParty memc_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty memc_cmds_allowed
|
||||
syn keyword ngxDirectiveThirdParty memc_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_flags_to_last_modified
|
||||
syn keyword ngxDirectiveThirdParty memc_next_upstream
|
||||
syn keyword ngxDirectiveThirdParty memc_pass
|
||||
syn keyword ngxDirectiveThirdParty memc_read_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_send_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_upstream_fail_timeout
|
||||
syn keyword ngxDirectiveThirdParty memc_upstream_max_fails
|
||||
|
||||
" Mogilefs Module <http://www.grid.net.ru/nginx/mogilefs.en.html>
|
||||
" Implements a MogileFS client, provides a replace to the Perlbal reverse proxy of the original MogileFS.
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_domain
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_methods
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_noverify
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_pass
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_read_timeout
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_send_timeout
|
||||
syn keyword ngxDirectiveThirdParty mogilefs_tracker
|
||||
|
||||
" MP4 Streaming Lite Module <http://wiki.nginx.org/NginxMP4StreamingLite>
|
||||
" Will seek to a certain time within H.264/MP4 files when provided with a 'start' parameter in the URL.
|
||||
syn keyword ngxDirectiveThirdParty mp4
|
||||
|
||||
" Nginx Notice Module <http://xph.us/software/nginx-notice/>
|
||||
" Serve static file to POST requests.
|
||||
syn keyword ngxDirectiveThirdParty notice
|
||||
syn keyword ngxDirectiveThirdParty notice_type
|
||||
|
||||
" Phusion Passenger <http://www.modrails.com/documentation.html>
|
||||
" Easy and robust deployment of Ruby on Rails application on Apache and Nginx webservers.
|
||||
syn keyword ngxDirectiveThirdParty passenger_base_uri
|
||||
syn keyword ngxDirectiveThirdParty passenger_default_user
|
||||
syn keyword ngxDirectiveThirdParty passenger_enabled
|
||||
syn keyword ngxDirectiveThirdParty passenger_log_level
|
||||
syn keyword ngxDirectiveThirdParty passenger_max_instances_per_app
|
||||
syn keyword ngxDirectiveThirdParty passenger_max_pool_size
|
||||
syn keyword ngxDirectiveThirdParty passenger_pool_idle_time
|
||||
syn keyword ngxDirectiveThirdParty passenger_root
|
||||
syn keyword ngxDirectiveThirdParty passenger_ruby
|
||||
syn keyword ngxDirectiveThirdParty passenger_use_global_queue
|
||||
syn keyword ngxDirectiveThirdParty passenger_user_switching
|
||||
syn keyword ngxDirectiveThirdParty rack_env
|
||||
syn keyword ngxDirectiveThirdParty rails_app_spawner_idle_time
|
||||
syn keyword ngxDirectiveThirdParty rails_env
|
||||
syn keyword ngxDirectiveThirdParty rails_framework_spawner_idle_time
|
||||
syn keyword ngxDirectiveThirdParty rails_spawn_method
|
||||
|
||||
" RDS JSON Module <http://github.com/agentzh/rds-json-nginx-module>
|
||||
" Help ngx_drizzle and other DBD modules emit JSON data.
|
||||
syn keyword ngxDirectiveThirdParty rds_json
|
||||
syn keyword ngxDirectiveThirdParty rds_json_content_type
|
||||
syn keyword ngxDirectiveThirdParty rds_json_format
|
||||
syn keyword ngxDirectiveThirdParty rds_json_ret
|
||||
|
||||
" RRD Graph Module <http://wiki.nginx.org/NginxNgx_rrd_graph>
|
||||
" This module provides an HTTP interface to RRDtool's graphing facilities.
|
||||
syn keyword ngxDirectiveThirdParty rrd_graph
|
||||
syn keyword ngxDirectiveThirdParty rrd_graph_root
|
||||
|
||||
" Secure Download <http://wiki.nginx.org/NginxHttpSecureDownload>
|
||||
" Create expiring links.
|
||||
syn keyword ngxDirectiveThirdParty secure_download
|
||||
syn keyword ngxDirectiveThirdParty secure_download_fail_location
|
||||
syn keyword ngxDirectiveThirdParty secure_download_path_mode
|
||||
syn keyword ngxDirectiveThirdParty secure_download_secret
|
||||
|
||||
" SlowFS Cache Module <http://labs.frickle.com/nginx_ngx_slowfs_cache/>
|
||||
" Module adding ability to cache static files.
|
||||
syn keyword ngxDirectiveThirdParty slowfs_big_file_size
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_key
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_min_uses
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_path
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_purge
|
||||
syn keyword ngxDirectiveThirdParty slowfs_cache_valid
|
||||
syn keyword ngxDirectiveThirdParty slowfs_temp_path
|
||||
|
||||
" Strip Module <http://wiki.nginx.org/NginxHttpStripModule>
|
||||
" Whitespace remover.
|
||||
syn keyword ngxDirectiveThirdParty strip
|
||||
|
||||
" Substitutions Module <http://wiki.nginx.org/NginxHttpSubsModule>
|
||||
" A filter module which can do both regular expression and fixed string substitutions on response bodies.
|
||||
syn keyword ngxDirectiveThirdParty subs_filter
|
||||
syn keyword ngxDirectiveThirdParty subs_filter_types
|
||||
|
||||
" Supervisord Module <http://labs.frickle.com/nginx_ngx_supervisord/>
|
||||
" Module providing nginx with API to communicate with supervisord and manage (start/stop) backends on-demand.
|
||||
syn keyword ngxDirectiveThirdParty supervisord
|
||||
syn keyword ngxDirectiveThirdParty supervisord_inherit_backend_status
|
||||
syn keyword ngxDirectiveThirdParty supervisord_name
|
||||
syn keyword ngxDirectiveThirdParty supervisord_start
|
||||
syn keyword ngxDirectiveThirdParty supervisord_stop
|
||||
|
||||
" Upload Module <http://www.grid.net.ru/nginx/upload.en.html>
|
||||
" Parses multipart/form-data allowing arbitrary handling of uploaded files.
|
||||
syn keyword ngxDirectiveThirdParty upload_aggregate_form_field
|
||||
syn keyword ngxDirectiveThirdParty upload_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty upload_cleanup
|
||||
syn keyword ngxDirectiveThirdParty upload_limit_rate
|
||||
syn keyword ngxDirectiveThirdParty upload_max_file_size
|
||||
syn keyword ngxDirectiveThirdParty upload_max_output_body_len
|
||||
syn keyword ngxDirectiveThirdParty upload_max_part_header_len
|
||||
syn keyword ngxDirectiveThirdParty upload_pass
|
||||
syn keyword ngxDirectiveThirdParty upload_pass_args
|
||||
syn keyword ngxDirectiveThirdParty upload_pass_form_field
|
||||
syn keyword ngxDirectiveThirdParty upload_set_form_field
|
||||
syn keyword ngxDirectiveThirdParty upload_store
|
||||
syn keyword ngxDirectiveThirdParty upload_store_access
|
||||
|
||||
" Upload Progress Module <http://wiki.nginx.org/NginxHttpUploadProgressModule>
|
||||
" Tracks and reports upload progress.
|
||||
syn keyword ngxDirectiveThirdParty report_uploads
|
||||
syn keyword ngxDirectiveThirdParty track_uploads
|
||||
syn keyword ngxDirectiveThirdParty upload_progress
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_content_type
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_header
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_json_output
|
||||
syn keyword ngxDirectiveThirdParty upload_progress_template
|
||||
|
||||
" Upstream Fair Balancer <http://wiki.nginx.org/NginxHttpUpstreamFairModule>
|
||||
" Sends an incoming request to the least-busy backend server, rather than distributing requests round-robin.
|
||||
syn keyword ngxDirectiveThirdParty fair
|
||||
syn keyword ngxDirectiveThirdParty upstream_fair_shm_size
|
||||
|
||||
" Upstream Consistent Hash <http://wiki.nginx.org/NginxHttpUpstreamConsistentHash>
|
||||
" Select backend based on Consistent hash ring.
|
||||
syn keyword ngxDirectiveThirdParty consistent_hash
|
||||
|
||||
" Upstream Hash Module <http://wiki.nginx.org/NginxHttpUpstreamRequestHashModule>
|
||||
" Provides simple upstream load distribution by hashing a configurable variable.
|
||||
syn keyword ngxDirectiveThirdParty hash
|
||||
syn keyword ngxDirectiveThirdParty hash_again
|
||||
|
||||
" XSS Module <http://github.com/agentzh/xss-nginx-module>
|
||||
" Native support for cross-site scripting (XSS) in an nginx.
|
||||
syn keyword ngxDirectiveThirdParty xss_callback_arg
|
||||
syn keyword ngxDirectiveThirdParty xss_get
|
||||
syn keyword ngxDirectiveThirdParty xss_input_types
|
||||
syn keyword ngxDirectiveThirdParty xss_output_type
|
||||
|
||||
" uWSGI Module <http://wiki.nginx.org/HttpUwsgiModule>
|
||||
" Allows Nginx to interact with uWSGI processes and control what parameters are passed to the process.
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_bind
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_buffer_size
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_buffering
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_buffers
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_busy_buffers_size
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_cache
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_cache_bypass
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_cache_key
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_cache_lock
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_cache_lock_timeout
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_cache_methods
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_cache_min_uses
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_cache_path
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_cache_use_stale
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_cache_valid
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_connect_timeout
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_hide_header
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_ignore_client_abort
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_ignore_headers
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_intercept_errors
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_max_temp_file_size
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_modifier1
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_modifier2
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_next_upstream
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_no_cache
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_param
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_pass
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_pass_header
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_pass_request_body
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_pass_request_headers
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_read_timeout
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_send_timeout
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_store
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_store_access
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_string
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_temp_file_write_size
|
||||
syn keyword ngxDirectiveThirdParty uwsgi_temp_path
|
||||
|
||||
" highlight
|
||||
|
||||
hi link ngxComment Comment
|
||||
hi link ngxVariable Identifier
|
||||
hi link ngxVariableBlock Identifier
|
||||
hi link ngxVariableString PreProc
|
||||
hi link ngxBlock Normal
|
||||
hi link ngxString String
|
||||
|
||||
hi link ngxBoolean Boolean
|
||||
hi link ngxDirectiveBlock Statement
|
||||
hi link ngxDirectiveImportant Type
|
||||
hi link ngxDirectiveControl Keyword
|
||||
hi link ngxDirectiveError Constant
|
||||
hi link ngxDirectiveDeprecated Error
|
||||
hi link ngxDirective Identifier
|
||||
hi link ngxDirectiveThirdParty Special
|
||||
|
||||
let b:current_syntax = "nginx"
|
|
@ -0,0 +1,19 @@
|
|||
nginx.vim CHANGELOG
|
||||
=====================
|
||||
|
||||
This file is used to list changes made in each version of the [nginx](https://github.com/chr4/nginx.vim) plugin for the [Vim](http://www.vim.org/) editor.
|
||||
|
||||
1.1.0
|
||||
-----
|
||||
|
||||
- Do not highlight `SHA` ciphers, as usage as HMAC is still considered secure
|
||||
|
||||
1.0.1
|
||||
-----
|
||||
|
||||
- Highlight `gzip on` as insecure (as it might be vulnerable to BREACH/ CRIME)
|
||||
|
||||
1.0.0
|
||||
-----
|
||||
|
||||
- Initial release
|
|
@ -0,0 +1,675 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
Vim plugin that highlights insecure SSL/TLS cipher suites and protocols.
|
||||
Copyright (C) 2017 Chris Aumann
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
nginx.vim Copyright (C) 2017 Chris Aumann
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
# nginx.vim
|
||||
|
||||
## Description
|
||||
[Vim](http://www.vim.org/) plugin for [Nginx](http://www.nginx.org)
|
||||
|
||||
## Features
|
||||
The plugin is based on the recent vim-plugin distributed with `nginx-1.12.0` and additionally features the following syntax improvements:
|
||||
|
||||
- Highlight IPv4 and IPv6 addresses
|
||||
- Mark insecure `ssl_protocols` as errors
|
||||
- Inline template syntax highlight for **ERB** and **Jinja**
|
||||
- Inline syntax highlight for **LUA**
|
||||
- Improve integer matching
|
||||
- Syntax highlighting for `proxy_next_upstream` options
|
||||
- Syntax highlighting for `sticky` options
|
||||
- Syntax highlighting for `upstream` `server` options
|
||||
- More to come!
|
||||
|
||||
Furthermore:
|
||||
|
||||
- Remove annoying delimiters, resulting in strange word-boundaries
|
||||
|
||||
*Note: Also check out [sslsecure.vim](https://github.com/chr4/sslsecure.vim): it supports highlighting insecure SSL/TLS cipher suites and protocols in all your files!*
|
||||
|
||||
|
||||
## Screenshots
|
||||
A `server` block with highlighting of insecure `ssl_protocol` options:
|
||||
![nginx server block with SSL configuration](https://chr4.org/images/nginx_ssl.png)
|
||||
|
||||
An `upstream` block with highlighted options:
|
||||
![nginx upstream configuration](https://chr4.org/images/nginx_upstream.png)
|
||||
|
||||
Embedded highlighting for ERB and Jinja templates:
|
||||
![Embedded highlighting for ERB and Jinja templates](https://chr4.org/images/nginx_templating.png)
|
||||
|
||||
Embedded LUA syntax highlighting:
|
||||
![Embedded LUA syntax highlighting](https://chr4.org/images/nginx_lua.png)
|
||||
|
||||
|
||||
## Snippets
|
||||
The plugin comes with useful snippets which can be accessed using e.g. [vim-snipmate](https://github.com/garbas/vim-snipmate).
|
||||
|
||||
Select a decent cipher for your requirements (all of them can provide [SSLLabs A+ ratings](https://www.ssllabs.com/ssltest/analyze.html))
|
||||
|
||||
- `ciphers-paranoid<tab>`: Even-more-secure ciphers (elliptic curves, no GCM), not compatible with IE < 11, OpenSSL-0.9.8, Safari < 7, Android != 4.4
|
||||
- **`ciphers-modern<tab>`: High-security ciphers (elliptic curves), not compatible with IE < 11, OpenSSL-0.9.8, Safari < 7, Android < 4.4 (recommended)**
|
||||
- `ciphers-compat<tab>`: Medium-security ciphers with good compatibility (No IE on WinXP) but TLSv1 and SHA required
|
||||
- `ciphers-old<tab>`: Low-security ciphers (using weak DES and SHA ciphers, TLSv1), but compatible with everything but IE6 and Java6
|
||||
- `ssl-options<tab>`: Bootstrap secure SSL options
|
||||
|
||||
Example:
|
||||
```nginx
|
||||
# High-security ciphers (elliptic curves), less compatibility
|
||||
# No IE < 10, OpenSSL-0.9.8, Safari < 7, Android < 4.4
|
||||
ssl_protocols TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
|
||||
```
|
||||
|
||||
Or add a robots.txt file with `robots.txt<tab>`:
|
||||
```nginx
|
||||
# Tell bots to not index this site
|
||||
location /robots.txt {
|
||||
default_type text/plain;
|
||||
return 200 'User-agent: *\nDisallow: /\n';
|
||||
}
|
||||
```
|
||||
|
||||
It also has auto-completion for location and server blocks with `location<tab>` resp. `server<tab>`, and [many more](https://github.com/chr4/nginx.vim/blob/master/snippets/nginx.snippets)!
|
||||
|
||||
- Add useful [snippets](https://github.com/chr4/nginx.vim/blob/master/snippets/nginx.snippets)
|
||||
|
||||
## References
|
||||
- Based on the original `nginx-1.12.0/contrib/vim`
|
||||
- IPv4 and IPv6 address highlighting, based on expressions found in [this forum post](http://vim.1045645.n5.nabble.com/IPv6-support-for-quot-dns-quot-zonefile-syntax-highlighting-td1197292.html)
|
||||
- [Blog post](https://chr4.org/blog/2017/04/14/better-syntax-highlighting-and-snippets-for-nginx-in-vim/) introducing this plugin including some more examples
|
||||
|
||||
## Installation
|
||||
|
||||
Just plug it into your favorite Vim package manager:
|
||||
|
||||
```vim
|
||||
" Plug
|
||||
Plug 'chr4/nginx.vim'
|
||||
|
||||
" Dein.vim
|
||||
call dein#add('chr4/nginx.vim')
|
||||
|
||||
" Vundle
|
||||
Plugin 'chr4/nginx.vim'
|
||||
```
|
||||
|
||||
Optionally, if you like [Jinja](http://jinja.pocoo.org/) template syntax highlighting, install `lepture/vim-jinja`, too.
|
|
@ -1,4 +1,5 @@
|
|||
au BufRead,BufNewFile *.nginx set ft=nginx
|
||||
au BufRead,BufNewFile nginx*.conf set ft=nginx
|
||||
au BufRead,BufNewFile *nginx.conf set ft=nginx
|
||||
au BufRead,BufNewFile */etc/nginx/* set ft=nginx
|
||||
au BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx
|
||||
au BufRead,BufNewFile nginx.conf set ft=nginx
|
|
@ -0,0 +1 @@
|
|||
setlocal commentstring=#\ %s
|
|
@ -0,0 +1,166 @@
|
|||
# vim: ft=nginx
|
||||
snippet l80
|
||||
listen [::]:80 ipv6only=off;
|
||||
$0
|
||||
|
||||
# Listen statements when using multiple http server blocks
|
||||
snippet l80-multi
|
||||
listen [::]:80 default_server;
|
||||
listen 80 default_server;
|
||||
$0
|
||||
|
||||
snippet l443
|
||||
listen [::]:443 ipv6only=off ssl http2 default_server;
|
||||
$0
|
||||
|
||||
# Listen statements when using multiple ssl server blocks
|
||||
snippet l443-multi
|
||||
listen [::]:443 ssl http2 default_server;
|
||||
listen 443 ssl http2 default_server;
|
||||
$0
|
||||
|
||||
# Cipher suites are taken and adapted from Mozilla's recommendations
|
||||
# https://wiki.mozilla.org/Security/Server_Side_TLS
|
||||
#
|
||||
# Paranoid mode
|
||||
snippet ciphers-paranoid
|
||||
# Paranoid ciphers, 256bit minimum, prefer ChaCha20/ Poly1305, bad compatibility
|
||||
# No Android 5+6 (4.4 works), Chrome < 51, Firefox < 49, IE < 11, Java 6-8, GoogleBot
|
||||
ssl_protocols TLSv1.2;
|
||||
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384';
|
||||
$0
|
||||
|
||||
# Mozilla modern
|
||||
snippet ciphers-modern
|
||||
# High-security ciphers (elliptic curves), less compatibility
|
||||
# No IE < 10, OpenSSL-0.9.8, Safari < 7, Android < 4.4
|
||||
ssl_protocols TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
|
||||
$0
|
||||
|
||||
# Mozilla intermediate (Removed DES for more security)
|
||||
snippet ciphers-compat
|
||||
# Medium-security ciphers with good compatibility (Weak: SHA)
|
||||
# No IE on WinXP
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:!DSS';
|
||||
$0
|
||||
|
||||
# Mozilla old (Removed DSS, HIGH, SEED for more security)
|
||||
snippet ciphers-low
|
||||
# Low-security ciphers (Weak: DES, SHA)
|
||||
# No IE6, Java6
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:DES-CBC3-SHA:!SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!KRB5-DES-CBC3-SHA:!SRP:!DSS';
|
||||
$0
|
||||
|
||||
snippet ssl-options
|
||||
# SSL certificate
|
||||
ssl_certificate /etc/nginx/certs/${4:www.example.com}.crt;
|
||||
ssl_certificate_key /etc/nginx/certs/${5:www.example.com}.key;
|
||||
# ssl_dhparam /etc/nginx/certs/dhparam.pem;
|
||||
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_stapling off;
|
||||
ssl_stapling_verify off;
|
||||
ssl_session_cache 'shared:SSL:10m';
|
||||
ssl_session_tickets off;
|
||||
|
||||
# Enable HSTS (1 year) and some security options
|
||||
add_header Strict-Transport-Security 'max-age=31536000 includeSubDomains; preload;';
|
||||
$0
|
||||
|
||||
snippet security-headers
|
||||
add_header X-Frame-Options 'DENY';
|
||||
add_header X-Content-Type-Options 'nosniff';
|
||||
add_header X-Frame-Options 'SAMEORIGIN';
|
||||
add_header X-XSS-Protection '1; mode=block';
|
||||
add_header X-Robots-Tag 'none';
|
||||
add_header X-Download-Options 'noopen';
|
||||
add_header X-Permitted-Cross-Domain-Policies 'none';
|
||||
$0
|
||||
|
||||
snippet robots.txt
|
||||
# Tell bots to not index this site
|
||||
location /robots.txt {
|
||||
default_type text/plain;
|
||||
return 200 'User-agent: *\nDisallow: /\n';
|
||||
}
|
||||
$0
|
||||
|
||||
snippet basic-auth
|
||||
auth_basic 'Restricted';
|
||||
auth_basic_user_file ${1:/etc/nginx/htpasswd};
|
||||
$0
|
||||
|
||||
snippet proxy_pass
|
||||
proxy_pass_header Date;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://${1:backend};
|
||||
$0
|
||||
|
||||
snippet php-fpm
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_pass ${1:127.0.0.1:9000};
|
||||
}
|
||||
$0
|
||||
|
||||
snippet php-uwsgi
|
||||
location ~ \.php$ {
|
||||
include uwsgi_params;
|
||||
uwsgi_max_temp_file_size 4096m;
|
||||
uwsgi_modifier1 14;
|
||||
uwsgi_read_timeout 900;
|
||||
uwsgi_send_timeout 900;
|
||||
uwsgi_pass ${1:unix:///run/uwsgi/php.sock};
|
||||
}
|
||||
$0
|
||||
|
||||
snippet redirect-ssl
|
||||
location / {
|
||||
return 301 https://$http_host$request_uri;
|
||||
}
|
||||
$0
|
||||
|
||||
snippet redirect-other
|
||||
# Redirect other requested hosts
|
||||
if ($host != '${1:DOMAIN}') {
|
||||
return 301 https://${2:DOMAIN}$request_uri;
|
||||
}
|
||||
$0
|
||||
|
||||
snippet letsencrypt
|
||||
listen [::]:80 ipv6only=off;
|
||||
|
||||
# Serve well-known path for letsencrypt
|
||||
location /.well-known/acme-challenge {
|
||||
root /etc/nginx/certs/acme;
|
||||
default_type text/plain;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$http_host$request_uri;
|
||||
}
|
||||
$0
|
||||
|
||||
snippet cut-trailing-slash
|
||||
rewrite ^/(.*)/$ $scheme://$http_host:$server_port/$1 permanent;
|
||||
$0
|
||||
|
||||
snippet location
|
||||
location ${1:/} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet server
|
||||
server {
|
||||
${0:${VISUAL}}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -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/vim-syntastic/syntastic/issues
|
||||
[manual]: https://github.com/vim-syntastic/syntastic/blob/master/doc/syntastic.txt
|
||||
[github]: https://github.com/vim-syntastic/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/vim-syntastic/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.2. [Syntastic supports several checkers for my filetype, how do I tell it which one(s) to use?](#faqcheckers)
|
||||
4.3. [How can I run checkers for "foreign" filetypes against the current file?](#faqforeign)
|
||||
4.4. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
|
||||
4.5. [How can I pass additional arguments to a checker?](#faqargs)
|
||||
4.6. [I run a checker and the location list is not updated...](#faqloclist)
|
||||
4.6. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
|
||||
4.7. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
|
||||
4.8. [The error window is closed automatically when I `:quit` the current buffer but not when I `:bdelete` it?](#faqbdelete)
|
||||
4.9. [My favourite checker needs to load a configuration file from the project's root rather than the current directory...](#faqconfig)
|
||||
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.11. [How can I check scripts written for different versions of Python?](#faqpython)
|
||||
4.12. [How can I check scripts written for different versions of Ruby?](#faqruby)
|
||||
4.13. [The `perl` checker has stopped working...](#faqperl)
|
||||
4.14. [What happened to the `rustc` checker?](#faqrust)
|
||||
4.15. [What happened to the `tsc` checker?](#faqtsc)
|
||||
4.16. [What happened to the `xcrun` checker?](#faqxcrun)
|
||||
5. [Resources](#otherresources)
|
||||
|
||||
- - -
|
||||
|
@ -46,37 +49,39 @@
|
|||
|
||||
## 1\. Introduction
|
||||
|
||||
Syntastic is a syntax checking plugin for [Vim][13] 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.
|
||||
Syntastic is a syntax checking plugin for [Vim][vim] created by
|
||||
[Martin Grenfell][scrooloose]. It 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, RDF TriG, RDF Turtle, 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,
|
||||
YANG data models, 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, CMake, 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, Julia, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown,
|
||||
MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl
|
||||
6, 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,
|
||||
Vim help, VimL, Vue.js, 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.
|
||||
|
@ -94,17 +99,17 @@ 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
|
||||
version 7 or later with the "normal", "big", or "huge" feature sets should be
|
||||
fine.
|
||||
`reltime`, `statusline`, and `user_commands`. Not all possible combinations of
|
||||
features that include the ones above make equal sense on all operating systems,
|
||||
but Vim 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
|
||||
included below for completeness.
|
||||
[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
|
||||
standard mechanism of packages, without the help of third-party plugin managers
|
||||
|
@ -115,20 +120,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
|
||||
|
@ -148,14 +154,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/vim-syntastic/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.
|
||||
|
@ -192,10 +198,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
|
||||
|
@ -222,115 +229,24 @@ 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.
|
||||
|
||||
<a name="faqpython3"></a>
|
||||
|
||||
__4.2. Q. The `python` checker complains about syntactically valid Python 3 constructs...__
|
||||
|
||||
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 name="faqhtml5"></a>
|
||||
|
||||
__4.3. 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
|
||||
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]:
|
||||
```sh
|
||||
$ java -Xss512k -cp /path/to/vnu.jar nu.validator.servlet.Main 8888
|
||||
```
|
||||
Then you can [configure][22] 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...__
|
||||
|
||||
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
|
||||
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.
|
||||
To (re-)enable it, make sure the `g:syntastic_perl_checkers` list includes
|
||||
`perl`, and set `g:syntastic_enable_perl_checker` to 1 in your `vimrc`:
|
||||
```vim
|
||||
let g:syntastic_enable_perl_checker = 1
|
||||
```
|
||||
|
||||
<a name="faqrust"></a>
|
||||
|
||||
__4.5. Q. What happened to the `rustc` checker?__
|
||||
|
||||
A. It is now part of the [rust.vim][12] plugin. 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?__
|
||||
|
||||
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
|
||||
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...__
|
||||
|
||||
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
|
||||
location list to always be updated when you run the checkers, add this line to
|
||||
your `vimrc`:
|
||||
```vim
|
||||
let g:syntastic_always_populate_loc_list = 1
|
||||
```
|
||||
|
||||
<a name="faqargs"></a>
|
||||
|
||||
__4.8. 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
|
||||
global `args` variables is `syntastic_<filetype>_<checker>_args`.
|
||||
|
||||
So, If you wanted to pass `--my --args --here` to the ruby mri checker you
|
||||
would add this line to your `vimrc`:
|
||||
```vim
|
||||
let g:syntastic_ruby_mri_args = "--my --args --here"
|
||||
```
|
||||
|
||||
See `:help syntastic-checker-options` for more information.
|
||||
fails then post an [issue][bug_tracker] - or better yet, create a pull request.
|
||||
|
||||
<a name="faqcheckers"></a>
|
||||
|
||||
__4.9. Q. Syntastic supports several checkers for my filetype - how do I tell it
|
||||
__4.2. 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`:
|
||||
A. Add a line like this to your `vimrc`:
|
||||
```vim
|
||||
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.
|
||||
|
||||
To tell syntastic to use `pylint`, you would use this setting:
|
||||
For example, Python has the following checkers, among others: `flake8`,
|
||||
`pyflakes`, `pylint` and a native `python` checker. To tell syntastic to use
|
||||
`pylint`, you would use this setting:
|
||||
```vim
|
||||
let g:syntastic_python_checkers = ['pylint']
|
||||
```
|
||||
|
@ -344,16 +260,131 @@ This is telling syntastic to run the `php` checker first, and if no errors are
|
|||
found, run `phpcs`, and then `phpmd`.
|
||||
|
||||
You can also run checkers explicitly by calling `:SyntasticCheck <checker>`.
|
||||
|
||||
e.g. to run `phpcs` and `phpmd`:
|
||||
For example to run `phpcs` and `phpmd`:
|
||||
```vim
|
||||
:SyntasticCheck phpcs phpmd
|
||||
```
|
||||
|
||||
This works for any checkers available for the current filetype, even if they
|
||||
aren't listed in `g:syntastic_<filetype>_checkers`. You can't run checkers for
|
||||
"foreign" filetypes though (e.g. you can't run, say, a Python checker if the
|
||||
filetype of the current file is `php`).
|
||||
aren't listed in `g:syntastic_<filetype>_checkers`.
|
||||
|
||||
<a name="faqforeign"></a>
|
||||
|
||||
__4.3. Q. How can I run checkers for "foreign" filetypes against the current
|
||||
file?__
|
||||
|
||||
A. You need to qualify the name of the "foreign" checker with the name
|
||||
of its filetype. For example to check `tex` files with the checker
|
||||
`language_check` (which normally acts only on files of type `text`), you can
|
||||
add `text/language_check` to the list fo checkers for `tex`:
|
||||
```vim
|
||||
let g:syntastic_tex_checkers = ['lacheck', 'text/language_check']
|
||||
```
|
||||
|
||||
This also works with `:SyntasticCheck`, e.g. the following command runs
|
||||
`text/language_check` against the current file regardless of the current
|
||||
filetype:
|
||||
```vim
|
||||
:SyntasticCheck text/language_check
|
||||
```
|
||||
|
||||
Of course, the checkers specified this way need to be known to syntastic, and
|
||||
they need to be shown as available when you run `:SyntasticInfo`. You can't
|
||||
just make up a combination of a filetype and a program name and expect it to
|
||||
work as a checker.
|
||||
|
||||
<a name="faqaggregate"></a>
|
||||
|
||||
__4.4. 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`:
|
||||
```vim
|
||||
let g:syntastic_aggregate_errors = 1
|
||||
```
|
||||
|
||||
See `:help syntastic-aggregating-errors` for more details.
|
||||
|
||||
<a name="faqargs"></a>
|
||||
|
||||
__4.5. Q. How can I pass additional arguments to a checker?__
|
||||
|
||||
A. In most cases a command line is constructed using an internal function
|
||||
named `makeprgBuild()`, which provides a number of options that allow you to
|
||||
customise every part of the command that gets run. You can set these options
|
||||
using global variables.
|
||||
|
||||
The general form of the global `args` variable is
|
||||
`syntastic_<filetype>_<checker>_args`. Thus if you wanted to pass
|
||||
`--my --args --here` to the Ruby `mri` checker you would add this line to your
|
||||
`vimrc`:
|
||||
```vim
|
||||
let g:syntastic_ruby_mri_args = "--my --args --here"
|
||||
```
|
||||
|
||||
See `:help syntastic-checker-options` for more information.
|
||||
|
||||
A number of checkers don't use the `makeprgBuild()` function mentioned above,
|
||||
or have additional options that can be configured. For these checkers the exact
|
||||
list of options should be included in the [manual][checkers]
|
||||
(`:help syntastic-checkers` in Vim).
|
||||
|
||||
<a name="faqloclist"></a>
|
||||
|
||||
__4.6. Q. I run a checker and the location list is not updated...__
|
||||
__4.6. 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
|
||||
location list to always be updated when you run the checkers, add this line to
|
||||
your `vimrc`:
|
||||
```vim
|
||||
let g:syntastic_always_populate_loc_list = 1
|
||||
```
|
||||
|
||||
<a name="faqlnext"></a>
|
||||
|
||||
__4.7. 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][unimpaired], which provides such
|
||||
mappings (among other things).
|
||||
|
||||
<a name="faqbdelete"></a>
|
||||
|
||||
__4.8. 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
|
||||
work around it:
|
||||
```vim
|
||||
nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
|
||||
cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd')<CR>
|
||||
```
|
||||
|
||||
<a name="faqconfig"></a>
|
||||
|
||||
__4.9. 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="faqstyle"></a>
|
||||
|
||||
|
@ -367,13 +398,13 @@ to syntax, and messages produced by style checkers to be _mostly_ about style.
|
|||
But there can be no formal guarantee that, say, a style checker that runs into
|
||||
a syntax error wouldn't die with a fatal message, nor that a syntax checker
|
||||
wouldn't give you warnings against using some constructs as being bad practice.
|
||||
There is also no guarantee that messages marked as "style" are less severe than
|
||||
the ones marked as "syntax" (whatever that might mean). And there are even a
|
||||
There is also no guarantee that messages marked as `style` are less severe than
|
||||
the ones marked as `syntax` (whatever that might mean). And there are even a
|
||||
few Frankenstein checkers (for example `flake8` and `pylama`) that, by their
|
||||
nature, produce both kinds of messages. Syntastic is not smart enough to be
|
||||
able to sort out these things by itself.
|
||||
|
||||
In fact it's more useful to look at this from the perspective of filtering
|
||||
Generally it's more useful to look at this from the perspective of filtering
|
||||
unwanted messages, rather than as an indicator of severity levels. The
|
||||
distinction between syntax and style is orthogonal to the distinction between
|
||||
errors and warnings, and thus you can turn off messages based on level, on
|
||||
|
@ -383,94 +414,131 @@ e.g. To disable all style messages:
|
|||
```vim
|
||||
let g:syntastic_quiet_messages = { "type": "style" }
|
||||
```
|
||||
See `:help syntastic_quiet_messages` for details.
|
||||
See `:help syntastic_quiet_messages` for more information.
|
||||
|
||||
<a name="faqaggregate"></a>
|
||||
<a name="faqpython"></a>
|
||||
|
||||
__4.11. Q. I have enabled multiple checkers for the current filetype. How can I
|
||||
display all errors from all checkers together?__
|
||||
__4.11. Q. How can I check scripts written for different versions of Python?__
|
||||
|
||||
A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`:
|
||||
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.12. 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 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] under the relevant Ruby version.
|
||||
|
||||
If you're starting Vim from a desktop manager rather than from a terminal
|
||||
and depending on the version manager you use you might need to write wrapper
|
||||
scripts around your checkers, to activate the relevant version of Ruby
|
||||
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="faqperl"></a>
|
||||
|
||||
__4.13. 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][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.
|
||||
To (re-)enable it, make sure the `g:syntastic_perl_checkers` list includes
|
||||
`perl`, and set `g:syntastic_enable_perl_checker` to 1 in your `vimrc`:
|
||||
```vim
|
||||
let g:syntastic_aggregate_errors = 1
|
||||
let g:syntastic_enable_perl_checker = 1
|
||||
```
|
||||
|
||||
See `:help syntastic-aggregating-errors` for more details.
|
||||
<a name="faqrust"></a>
|
||||
|
||||
<a name="faqlnext"></a>
|
||||
__4.14. Q. What happened to the `rustc` checker?__
|
||||
|
||||
__4.12. Q. How can I jump between the different errors without using the location
|
||||
list at the bottom of the window?__
|
||||
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. Vim provides several built-in commands for this. See `:help :lnext` and
|
||||
`:help :lprevious`.
|
||||
<a name="faqtsc"></a>
|
||||
|
||||
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
|
||||
mappings (among other things).
|
||||
__4.15. Q. What happened to the `tsc` checker?__
|
||||
|
||||
<a name="faqbdelete"></a>
|
||||
A. It didn't meet people's expectations and it has been removed. The plugin
|
||||
[tsuquyomi][tsuquyomi] comes packaged with a checker for TypeScript. If you
|
||||
install this plugin the checker should be picked up automatically by syntastic.
|
||||
|
||||
__4.13. Q. The error window is closed automatically when I :quit the current buffer
|
||||
but not when I :bdelete it?__
|
||||
<a name="faqxcrun"></a>
|
||||
|
||||
A. There is no safe way to handle that situation automatically, but you can
|
||||
work around it:
|
||||
__4.16. Q. What happened to the `xcrun` checker?__
|
||||
|
||||
```vim
|
||||
nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
|
||||
cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd')<CR>
|
||||
```
|
||||
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][swift] plugin. If you
|
||||
install this plugin the checker should be picked up automatically by syntastic.
|
||||
|
||||
<a name="otherresources"></a>
|
||||
|
||||
## 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
|
||||
[scrooloose]: https://github.com/scrooloose
|
||||
[screenshot]: https://github.com/vim-syntastic/syntastic/raw/master/_assets/screenshot_1.png
|
||||
|
||||
[bug_tracker]: https://github.com/vim-syntastic/syntastic/issues
|
||||
[checkers]: https://github.com/vim-syntastic/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/vim-syntastic/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
|
||||
[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:
|
||||
|
|
|
@ -21,7 +21,7 @@ function! syntastic#log#warn(msg) abort " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#error(msg) abort " {{{2
|
||||
execute "normal \<Esc>"
|
||||
execute 'normal! \<Esc>'
|
||||
echohl ErrorMsg
|
||||
echomsg 'syntastic: error: ' . a:msg
|
||||
echohl None
|
||||
|
@ -68,7 +68,7 @@ function! syntastic#log#debug(level, msg, ...) abort " {{{2
|
|||
let leader = s:_log_timestamp()
|
||||
call s:_logRedirect(1)
|
||||
|
||||
if a:0 > 0
|
||||
if a:0
|
||||
" filter out dictionary functions
|
||||
echomsg leader . a:msg . ' ' .
|
||||
\ strtrans(string(type(a:1) == type({}) || type(a:1) == type([]) ?
|
||||
|
|
|
@ -65,6 +65,17 @@ function! syntastic#postprocess#guards(errors) abort " {{{2
|
|||
return a:errors
|
||||
endfunction " }}}2
|
||||
|
||||
" convert error messages from UTF-8 to the current encoding
|
||||
function! syntastic#postprocess#iconv(errors) abort " {{{2
|
||||
if has('iconv') && &encoding !=# '' && &encoding !=# 'utf-8'
|
||||
for e in a:errors
|
||||
let e['text'] = iconv(e['text'], "utf-8", &encoding)
|
||||
endfor
|
||||
endif
|
||||
|
||||
return a:errors
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
|
|
@ -8,6 +8,37 @@ set cpo&vim
|
|||
|
||||
" Public functions {{{1
|
||||
|
||||
function! syntastic#preprocess#bandit(errors) abort " {{{2
|
||||
let out = []
|
||||
let json = s:_decode_JSON(join(a:errors, ''))
|
||||
|
||||
if type(json) == type({}) && has_key(json, 'results') && type(json['results']) == type([])
|
||||
for issue in json['results']
|
||||
if type(issue) == type({})
|
||||
try
|
||||
call add(out,
|
||||
\ issue['filename'] . ':' .
|
||||
\ issue['line_number'] . ':' .
|
||||
\ { 'LOW': 'I', 'MEDIUM': 'W', 'HIGH': 'E' }[issue['issue_severity']] . ':' .
|
||||
\ issue['test_id'][1:] . ':' .
|
||||
\ issue['issue_text'] .
|
||||
\ ' [' . issue['test_name'] . '] (confidence: ' . issue['issue_confidence'] . ')')
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker python/bandit: unrecognized error item ' . string(issue))
|
||||
let out = []
|
||||
break
|
||||
endtry
|
||||
else
|
||||
call syntastic#log#warn('checker python/bandit: unrecognized error item ' . string(issue))
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker python/bandit: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#cabal(errors) abort " {{{2
|
||||
let out = []
|
||||
let star = 0
|
||||
|
@ -89,15 +120,44 @@ 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
|
||||
|
||||
function! syntastic#preprocess#dscanner(errors) abort " {{{2
|
||||
let idx = 0
|
||||
while idx < len(a:errors) && a:errors[idx][0] !=# '{'
|
||||
let idx += 1
|
||||
endwhile
|
||||
let errs = s:_decode_JSON(join(a:errors[idx :], ''))
|
||||
|
||||
let out = []
|
||||
if type(errs) == type({}) && has_key(errs, 'issues') && type(errs['issues']) == type([])
|
||||
for issue in errs['issues']
|
||||
try
|
||||
call add(out,
|
||||
\ issue['fileName'] . ':' .
|
||||
\ issue['line'] . ':' .
|
||||
\ issue['column'] . ':' .
|
||||
\ issue['message'] . ' [' . issue['key'] . ']')
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker d/dscanner: unrecognized error item ' . string(issue))
|
||||
let out = []
|
||||
break
|
||||
endtry
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker d/dscanner: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#flow(errors) abort " {{{2
|
||||
let idx = 0
|
||||
while idx < len(a:errors) && a:errors[idx][0] !=# '{'
|
||||
|
@ -132,18 +192,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 +238,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
|
||||
|
@ -204,13 +264,55 @@ function! syntastic#preprocess#perl(errors) abort " {{{2
|
|||
return syntastic#util#unique(out)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#prospector(errors) abort " {{{2
|
||||
function! syntastic#preprocess#perl6(errors) abort " {{{2
|
||||
if a:errors[0] ==# 'Syntax OK'
|
||||
return []
|
||||
endif
|
||||
|
||||
let errs = s:_decode_JSON(join(a:errors, ''))
|
||||
|
||||
let out = []
|
||||
if type(errs) == type({}) && has_key(errs, 'messages')
|
||||
if type(errs['messages']) == type([])
|
||||
for e in errs['messages']
|
||||
if type(errs) == type({})
|
||||
try
|
||||
for val in values(errs)
|
||||
let line = get(val, 'line', 0)
|
||||
let pos = get(val, 'pos', 0)
|
||||
if pos && has('byte_offset')
|
||||
let line_pos = byte2line(pos + 1)
|
||||
let column = line_pos > 0 ? pos - line2byte(line_pos) + 2 : 0
|
||||
else
|
||||
let column = 0
|
||||
endif
|
||||
|
||||
call add(out, join([
|
||||
\ get(val, 'filename', ''),
|
||||
\ line,
|
||||
\ column,
|
||||
\ get(val, 'message', '') ], ':'))
|
||||
endfor
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker perl6/perl6: unrecognized error item ' . string(val))
|
||||
let out = []
|
||||
endtry
|
||||
else
|
||||
call syntastic#log#warn('checker perl6/perl6: unrecognized error format')
|
||||
endif
|
||||
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#prospector(errors) abort " {{{2
|
||||
let errs = join(a:errors, '')
|
||||
if errs ==# ''
|
||||
return []
|
||||
endif
|
||||
|
||||
let json = s:_decode_JSON(errs)
|
||||
|
||||
let out = []
|
||||
if type(json) == type({}) && has_key(json, 'messages')
|
||||
if type(json['messages']) == type([])
|
||||
for e in json['messages']
|
||||
if type(e) == type({})
|
||||
try
|
||||
if e['source'] ==# 'pylint'
|
||||
|
@ -238,8 +340,10 @@ 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
|
||||
else
|
||||
call syntastic#log#warn('checker python/prospector: unrecognized error format (crashed checker?)')
|
||||
endif
|
||||
|
||||
return out
|
||||
|
@ -311,11 +415,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,14 +455,62 @@ 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'', "")')
|
||||
return map(copy(a:errors), 'substitute(v:val, ''\v^((ERROR|WARNING): )?\zs(\([^)]+\))\s(.+)$'', ''\4 \3'', "")')
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#validator(errors) abort " {{{2
|
||||
|
@ -405,7 +557,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,8 +37,24 @@ function! syntastic#util#system(command) abort " {{{2
|
|||
let $LC_MESSAGES = 'C'
|
||||
let $LC_ALL = ''
|
||||
|
||||
let crashed = 0
|
||||
let cmd_start = reltime()
|
||||
let out = system(a:command)
|
||||
try
|
||||
let out = system(a:command)
|
||||
catch
|
||||
let crashed = 1
|
||||
call syntastic#log#error('exception running system(' . string(a:command) . '): ' . v:exception)
|
||||
if syntastic#util#isRunningWindows()
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TMP = ' . string($TMP) . ', $TEMP = ' . string($TEMP))
|
||||
else
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TERM = ' . string($TERM))
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TMPDIR = ' . string($TMPDIR))
|
||||
endif
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, '$PATH = ' . string($PATH))
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . string(getcwd()))
|
||||
call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, g:_SYNTASTIC_SHELL_OPTIONS)
|
||||
let out = ''
|
||||
endtry
|
||||
let cmd_time = split(reltimestr(reltime(cmd_start)))[0]
|
||||
|
||||
let $LC_ALL = old_lc_all
|
||||
|
@ -46,7 +62,7 @@ function! syntastic#util#system(command) abort " {{{2
|
|||
|
||||
let &shell = old_shell
|
||||
|
||||
if exists('g:_SYNTASTIC_DEBUG_TRACE')
|
||||
if !crashed && exists('g:_SYNTASTIC_DEBUG_TRACE')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'system: command run in ' . cmd_time . 's')
|
||||
endif
|
||||
|
||||
|
@ -60,7 +76,7 @@ function! syntastic#util#tmpdir() abort " {{{2
|
|||
if (has('unix') || has('mac')) && executable('mktemp') && !has('win32unix')
|
||||
" TODO: option "-t" to mktemp(1) is not portable
|
||||
let tmp = $TMPDIR !=# '' ? $TMPDIR : $TMP !=# '' ? $TMP : '/tmp'
|
||||
let out = split(syntastic#util#system('mktemp -q -d ' . tmp . '/vim-syntastic-' . getpid() . '-XXXXXXXX'), "\n")
|
||||
let out = split(syntastic#util#system('mktemp -q -d ' . tmp . '/vim-syntastic-' . s:_fuzz() . '-XXXXXXXX'), "\n")
|
||||
if v:shell_error == 0 && len(out) == 1
|
||||
let tempdir = out[0]
|
||||
endif
|
||||
|
@ -68,13 +84,13 @@ function! syntastic#util#tmpdir() abort " {{{2
|
|||
|
||||
if tempdir ==# ''
|
||||
if has('win32') || has('win64')
|
||||
let tempdir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-' . getpid()
|
||||
let tempdir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-' . s:_fuzz()
|
||||
elseif has('win32unix')
|
||||
let tempdir = syntastic#util#CygwinPath('/tmp/vim-syntastic-' . getpid())
|
||||
let tempdir = syntastic#util#CygwinPath('/tmp/vim-syntastic-' . s:_fuzz())
|
||||
elseif $TMPDIR !=# ''
|
||||
let tempdir = $TMPDIR . '/vim-syntastic-' . getpid()
|
||||
let tempdir = $TMPDIR . '/vim-syntastic-' . s:_fuzz()
|
||||
else
|
||||
let tempdir = '/tmp/vim-syntastic-' . getpid()
|
||||
let tempdir = '/tmp/vim-syntastic-' . s:_fuzz()
|
||||
endif
|
||||
|
||||
try
|
||||
|
@ -102,6 +118,10 @@ function! syntastic#util#rmrf(what) abort " {{{2
|
|||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#getbufvar(buf, name, ...) abort " {{{2
|
||||
return a:0 ? s:_getbufvar(a:buf, a:name, a:1) : getbufvar(a:buf, a:name)
|
||||
endfunction " }}}2
|
||||
|
||||
" Search the first 5 lines of the file for a magic number and return a map
|
||||
" containing the args and the executable
|
||||
"
|
||||
|
@ -112,9 +132,9 @@ endfunction " }}}2
|
|||
" returns
|
||||
"
|
||||
" {'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
|
||||
function! syntastic#util#parseShebang() abort " {{{2
|
||||
function! syntastic#util#parseShebang(buf) abort " {{{2
|
||||
for lnum in range(1, 5)
|
||||
let line = getline(lnum)
|
||||
let line = get(getbufline(a:buf, lnum), 0, '')
|
||||
if line =~# '^#!'
|
||||
let line = substitute(line, '\v^#!\s*(\S+/env(\s+-\S+)*\s+)?', '', '')
|
||||
let exe = matchstr(line, '\m^\S*\ze')
|
||||
|
@ -126,9 +146,19 @@ function! syntastic#util#parseShebang() abort " {{{2
|
|||
return { 'exe': '', 'args': [] }
|
||||
endfunction " }}}2
|
||||
|
||||
" Get the value of a Vim variable. Allow buffer variables to override global ones.
|
||||
function! syntastic#util#bufRawVar(buf, name, ...) abort " {{{2
|
||||
return s:_getbufvar(a:buf, a:name, get(g:, a:name, a:0 ? a:1 : ''))
|
||||
endfunction "}}}2
|
||||
|
||||
" Get the value of a syntastic variable. Allow buffer variables to override global ones.
|
||||
function! syntastic#util#bufVar(buf, name, ...) abort " {{{2
|
||||
return call('syntastic#util#bufRawVar', [a:buf, 'syntastic_' . a:name] + a:000)
|
||||
endfunction "}}}2
|
||||
|
||||
" 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 : ''))
|
||||
return get(b:, a:name, get(g:, a:name, a:0 ? a:1 : ''))
|
||||
endfunction " }}}2
|
||||
|
||||
" Get the value of a syntastic variable. Allow local variables to override global ones.
|
||||
|
@ -165,11 +195,6 @@ function! syntastic#util#compareLexi(a, b) abort " {{{2
|
|||
return 0
|
||||
endfunction " }}}2
|
||||
|
||||
" strwidth() was added in Vim 7.3; if it doesn't exist, we use strlen()
|
||||
" and hope for the best :)
|
||||
let s:_width = function(exists('*strwidth') ? 'strwidth' : 'strlen')
|
||||
lockvar s:_width
|
||||
|
||||
function! syntastic#util#screenWidth(str, tabstop) abort " {{{2
|
||||
let chunks = split(a:str, "\t", 1)
|
||||
let width = s:_width(chunks[-1])
|
||||
|
@ -228,7 +253,7 @@ endfunction " }}}2
|
|||
function! syntastic#util#findFileInParent(what, where) abort " {{{2
|
||||
let old_suffixesadd = &suffixesadd
|
||||
let &suffixesadd = ''
|
||||
let file = findfile(a:what, escape(a:where, ' ') . ';')
|
||||
let file = findfile(a:what, escape(a:where, ' ,') . ';')
|
||||
let &suffixesadd = old_suffixesadd
|
||||
return file
|
||||
endfunction " }}}2
|
||||
|
@ -271,6 +296,42 @@ function! syntastic#util#findGlobInParent(what, where) abort " {{{2
|
|||
return ''
|
||||
endfunction " }}}2
|
||||
|
||||
" Returns the buffer number of a filename
|
||||
" @vimlint(EVL104, 1, l:old_shellslash)
|
||||
function! syntastic#util#fname2buf(fname) abort " {{{2
|
||||
if exists('+shellslash')
|
||||
" bufnr() can't cope with backslashes
|
||||
let old_shellslash = &shellslash
|
||||
let &shellslash = 1
|
||||
endif
|
||||
|
||||
" this is a best-effort attempt to escape file patterns (cf. :h file-pattern)
|
||||
" XXX it fails for filenames containing something like \{2,3}
|
||||
let buf = -1
|
||||
for md in [':~:.', ':~', ':p']
|
||||
try
|
||||
" Older versions of Vim can throw E94 here
|
||||
let buf = bufnr('^' . escape(fnamemodify(a:fname, md), '\*?,{}[') . '$')
|
||||
catch
|
||||
" catch everything
|
||||
endtry
|
||||
if buf != -1
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
if buf == -1
|
||||
" XXX definitely wrong, but hope is the last thing to die :)
|
||||
let buf = bufnr(fnamemodify(a:fname, ':p'))
|
||||
endif
|
||||
|
||||
if exists('+shellslash')
|
||||
let &shellslash = old_shellslash
|
||||
endif
|
||||
|
||||
return buf
|
||||
endfunction " }}}2
|
||||
" @vimlint(EVL104, 0, l:old_shellslash)
|
||||
|
||||
" Returns unique elements in a list
|
||||
function! syntastic#util#unique(list) abort " {{{2
|
||||
let seen = {}
|
||||
|
@ -342,15 +403,10 @@ function! syntastic#util#stamp() abort " {{{2
|
|||
return split( split(reltimestr(reltime(g:_SYNTASTIC_START)))[0], '\.' )
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#setChangedtick() abort " {{{2
|
||||
unlockvar! b:syntastic_changedtick
|
||||
let b:syntastic_changedtick = b:changedtick
|
||||
lockvar! b:syntastic_changedtick
|
||||
function! syntastic#util#setLastTick(buf) abort " {{{2
|
||||
call setbufvar(a:buf, 'syntastic_lasttick', getbufvar(a:buf, 'changedtick'))
|
||||
endfunction " }}}2
|
||||
|
||||
let s:_wid_base = 'syntastic_' . getpid() . '_' . reltimestr(g:_SYNTASTIC_START) . '_'
|
||||
let s:_wid_pool = 0
|
||||
|
||||
" Add unique IDs to windows
|
||||
function! syntastic#util#setWids() abort " {{{2
|
||||
for tab in range(1, tabpagenr('$'))
|
||||
|
@ -363,9 +419,6 @@ function! syntastic#util#setWids() abort " {{{2
|
|||
endfor
|
||||
endfunction " }}}2
|
||||
|
||||
let s:_str2float = function(exists('*str2float') ? 'str2float' : 'str2nr')
|
||||
lockvar s:_str2float
|
||||
|
||||
function! syntastic#util#str2float(val) abort " {{{2
|
||||
return s:_str2float(a:val)
|
||||
endfunction " }}}2
|
||||
|
@ -487,6 +540,11 @@ function! s:_translateElement(key, term) abort " {{{2
|
|||
return ret
|
||||
endfunction " }}}2
|
||||
|
||||
" strwidth() was added in Vim 7.3; if it doesn't exist, we use strlen()
|
||||
" and hope for the best :)
|
||||
let s:_width = function(exists('*strwidth') ? 'strwidth' : 'strlen')
|
||||
lockvar s:_width
|
||||
|
||||
" @vimlint(EVL103, 1, a:flags)
|
||||
function! s:_delete_dumb(what, flags) abort " {{{2
|
||||
if !exists('s:rmrf')
|
||||
|
@ -533,6 +591,9 @@ function! s:_rmrf(what) abort " {{{2
|
|||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
let s:_str2float = function(exists('*str2float') ? 'str2float' : 'str2nr')
|
||||
lockvar s:_str2float
|
||||
|
||||
function! s:_float2str_smart(val) abort " {{{2
|
||||
return printf('%.1f', a:val)
|
||||
endfunction " }}}2
|
||||
|
@ -544,8 +605,30 @@ endfunction " }}}2
|
|||
let s:_float2str = function(has('float') ? 's:_float2str_smart' : 's:_float2str_dumb')
|
||||
lockvar s:_float2str
|
||||
|
||||
function! s:_getbufvar_dumb(buf, name, ...) abort " {{{2
|
||||
let ret = getbufvar(a:buf, a:name)
|
||||
if a:0 && type(ret) == type('') && ret ==# ''
|
||||
unlet! ret
|
||||
let ret = a:1
|
||||
endif
|
||||
return ret
|
||||
endfunction "}}}2
|
||||
|
||||
let s:_getbufvar = function(v:version > 703 || (v:version == 703 && has('patch831')) ? 'getbufvar' : 's:_getbufvar_dumb')
|
||||
lockvar s:_getbufvar
|
||||
|
||||
function! s:_fuzz_dumb() abort " {{{2
|
||||
return 'tmp'
|
||||
endfunction " }}}2
|
||||
|
||||
let s:_fuzz = function(exists('*getpid') ? 'getpid' : 's:_fuzz_dumb')
|
||||
lockvar s:_fuzz
|
||||
|
||||
" }}}1
|
||||
|
||||
let s:_wid_base = 'syntastic_' . s:_fuzz() . '_' . reltimestr(g:_SYNTASTIC_START) . '_'
|
||||
let s:_wid_pool = 0
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -44,20 +44,24 @@ 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|
|
||||
7.3.The fish shell.........................|syntastic-fish|
|
||||
7.4.The fizsh shell........................|syntastic-fizsh|
|
||||
7.5.flagship...............................|syntastic-flagship|
|
||||
7.6.powerline..............................|syntastic-powerline|
|
||||
7.7.The PowerShell shell...................|syntastic-powershell|
|
||||
7.8.python-mode............................|syntastic-pymode|
|
||||
7.9.vim-auto-save..........................|syntastic-vim-auto-save|
|
||||
7.10.vim-go................................|syntastic-vim-go|
|
||||
7.11.vim-virtualenv........................|syntastic-vim-virtualenv|
|
||||
7.12.YouCompleteMe.........................|syntastic-ycm|
|
||||
7.13.The zsh shell and MacVim..............|syntastic-zsh|
|
||||
7.1.airline................................|syntastic-airline|
|
||||
7.2.The csh and tcsh shells................|syntastic-csh|
|
||||
7.3.EasyGrep...............................|syntastic-easygrep|
|
||||
7.4.Eclim..................................|syntastic-eclim|
|
||||
7.5.ferret.................................|syntastic-ferret|
|
||||
7.6.The fish shell.........................|syntastic-fish|
|
||||
7.7.The fizsh shell........................|syntastic-fizsh|
|
||||
7.8.flagship...............................|syntastic-flagship|
|
||||
7.9.powerline..............................|syntastic-powerline|
|
||||
7.10.The PowerShell shell..................|syntastic-powershell|
|
||||
7.11.python-mode...........................|syntastic-pymode|
|
||||
7.12.vim-auto-save.........................|syntastic-vim-auto-save|
|
||||
7.13.vim-go................................|syntastic-vim-go|
|
||||
7.14.vim-virtualenv........................|syntastic-vim-virtualenv|
|
||||
7.15.YouCompleteMe.........................|syntastic-ycm|
|
||||
7.16.The zsh shell and MacVim..............|syntastic-zsh|
|
||||
8.About........................................|syntastic-about|
|
||||
9.License......................................|syntastic-license|
|
||||
|
||||
|
@ -66,7 +70,7 @@ CONTENTS *syntastic-contents*
|
|||
1. Intro *syntastic-intro*
|
||||
|
||||
Syntastic is a syntax checking plugin that runs files through external syntax
|
||||
checkers. This can be done on demand, or automatically as files are saved
|
||||
linters. This can be done on demand, or automatically as files are saved
|
||||
and opened. 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.
|
||||
|
@ -76,14 +80,12 @@ 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:
|
||||
checker integrations see the guide on the GitHub wiki:
|
||||
|
||||
https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
|
||||
https://github.com/vim-syntastic/syntastic/wiki/Syntax-Checker-Guide
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1.1. Quick start *syntastic-quickstart*
|
||||
|
@ -96,7 +98,7 @@ You can see the list of checkers available for the current filetype with the
|
|||
`:SyntasticInfo` command.
|
||||
|
||||
You probably want to override the configured list of checkers for the
|
||||
filetypes you use, and also change the arguments passed to specific checkers
|
||||
filetypes you use, and also change the arguments passed to specific linters
|
||||
to suit your needs. See |syntastic-checker-options| below for details.
|
||||
|
||||
Use `:SyntasticCheck` to manually check right now. Use `:Errors` to open the
|
||||
|
@ -141,7 +143,7 @@ activate/deactivate these features.
|
|||
* The |location-list| can be populated with the errors for the associated
|
||||
buffer
|
||||
* Erroneous parts of lines can be highlighted (this functionality is only
|
||||
provided by some syntax checkers)
|
||||
provided by some checkers)
|
||||
* Balloons (if the |+balloon_eval| feature is compiled in) can be used to
|
||||
display error messages for erroneous lines when hovering the mouse over
|
||||
them
|
||||
|
@ -159,12 +161,17 @@ Something like this could be more useful: >
|
|||
set statusline+=%*
|
||||
<
|
||||
When syntax errors are detected a flag will be shown. The content of the flag
|
||||
is derived from the |syntastic_stl_format| option.
|
||||
is derived from the |'syntastic_stl_format'| option.
|
||||
|
||||
Please note that these settings might conflict with other Vim plugins that
|
||||
change the way statusline works. Refer to these plugins' documentation for
|
||||
possible solutions. See also |syntastic-powerline| below if you're using the
|
||||
"powerline" Vim plugin (https://github.com/powerline/powerline).
|
||||
change the way 'statusline' works. Refer to the |syntastic-compatibility| notes
|
||||
below and to the respective plugins' documentation for possible solutions.
|
||||
|
||||
In particular see |syntastic-airline| below if you're using the "airline" Vim
|
||||
plugin (https://github.com/vim-airline/vim-airline). See |syntastic-flagship|
|
||||
if you're using "flagship" (https://github.com/tpope/vim-flagship). See also
|
||||
|syntastic-powerline| if you're using the "powerline" Vim plugin
|
||||
(https://github.com/powerline/powerline).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.2. Error signs *syntastic-error-signs*
|
||||
|
@ -196,6 +203,10 @@ following highlight groups:
|
|||
Example: >
|
||||
highlight SyntasticErrorLine guibg=#2f0000
|
||||
<
|
||||
With Vim 8.0 or later you can ask Vim not to turn off the sign column when no
|
||||
errors are found, by setting 'signcolumn' to "yes": >
|
||||
set signcolumn=yes
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
2.3. The error window *syntastic-error-window*
|
||||
|
||||
|
@ -213,7 +224,7 @@ update the |location-list| automatically.
|
|||
------------------------------------------------------------------------------
|
||||
2.4. Error highlighting *syntastic-highlighting*
|
||||
|
||||
Some checkers provide enough information for syntastic to be able to highlight
|
||||
Some linters provide enough information for syntastic to be able to highlight
|
||||
errors. By default the SpellBad syntax highlight group is used to color errors,
|
||||
and the SpellCap group is used for warnings. If you wish to customize the
|
||||
colors for highlighting you can use the following groups:
|
||||
|
@ -249,7 +260,7 @@ grouped together, and sorting within each group is decided by the variables
|
|||
|'syntastic_<filetype>_<checker>_sort'|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.6 Filtering errors *syntastic-filtering-errors*
|
||||
2.6. Filtering errors *syntastic-filtering-errors*
|
||||
|
||||
You can selectively disable some of the errors found by checkers either
|
||||
using |'syntastic_quiet_messages'|, or by specifying a list of patterns in
|
||||
|
@ -291,12 +302,22 @@ the order specified. The set by |'syntastic_aggregate_errors'| still apply.
|
|||
Example: >
|
||||
:SyntasticCheck flake8 pylint
|
||||
<
|
||||
You can also run checkers for filetypes different from the current filetype
|
||||
by qualifying their names with their respective filetypes, like this:
|
||||
"<filetype>/<checker>".
|
||||
|
||||
Example: >
|
||||
:SyntasticCheck lacheck text/language_check
|
||||
<
|
||||
:SyntasticInfo *:SyntasticInfo*
|
||||
|
||||
The command takes an optional argument, and outputs information about the
|
||||
checkers available for the filetype named by said argument, or for the current
|
||||
filetype if no argument was provided.
|
||||
|
||||
Example: >
|
||||
:SyntasticInfo python
|
||||
<
|
||||
:SyntasticReset *:SyntasticReset*
|
||||
|
||||
Resets the list of errors and turns off all error notifiers.
|
||||
|
@ -563,7 +584,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|).
|
||||
|
@ -590,8 +611,8 @@ There are also checker-specific variants of this option, providing finer
|
|||
control. They are named |'syntastic_<filetype>_<checker>_quiet_messages'|.
|
||||
|
||||
For a particular checker, if both a |'syntastic_quiet_messages'| filter and
|
||||
a checker-specific filter are present, they are both applied (to the list of
|
||||
errors produced by the said checker). In case of conflicting values for the
|
||||
a checker-specific filter are present, they are both applied to the list of
|
||||
errors produced by the said checker. In case of conflicting values for the
|
||||
same keys, the values of the checker-specific filters take precedence.
|
||||
|
||||
*filter-overrides*
|
||||
|
@ -664,15 +685,15 @@ should be safe.
|
|||
*'syntastic_exit_checks'*
|
||||
Type: boolean
|
||||
Default: 0 when running under "cmd.exe" on Windows, 1 otherwise
|
||||
Syntastic attempts to catch abnormal termination conditions from checkers by
|
||||
Syntastic attempts to catch abnormal termination conditions from linters by
|
||||
looking at their exit codes. The "cmd.exe" shell on Windows make these checks
|
||||
meaningless, by returning 1 to Vim when the checkers exit with non-zero codes.
|
||||
meaningless, by returning 1 to Vim when the linters exit with non-zero codes.
|
||||
The above variable can be used to disable exit code checks in syntastic.
|
||||
|
||||
*'syntastic_shell'*
|
||||
Type: string
|
||||
Default: Vim's 'shell'
|
||||
This is the (full path to) the shell syntastic will use to run the checkers.
|
||||
This is the (full path to) the shell syntastic will use to run the linters.
|
||||
On UNIX and Mac OS-X this shell must accept Bourne-compatible syntax for
|
||||
file "stdout" and "stderr" redirections ">file" and "2>file". Examples of
|
||||
compatible shells are "zsh", "bash", "ksh", and of course the original Bourne
|
||||
|
@ -680,7 +701,7 @@ compatible shells are "zsh", "bash", "ksh", and of course the original Bourne
|
|||
|
||||
This shell is independent of Vim's 'shell', and it isn't used for interactive
|
||||
operations. It must take care to initialize all environment variables needed
|
||||
by the checkers you're using. Example: >
|
||||
by the linters you're using. Example: >
|
||||
let g:syntastic_shell = "/bin/sh"
|
||||
<
|
||||
*'syntastic_nested_autocommands'*
|
||||
|
@ -733,7 +754,7 @@ filetypes.
|
|||
5. Checker Options *syntastic-checker-options*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5.1 Choosing which checkers to use *syntastic-filetype-checkers*
|
||||
5.1. Choosing which checkers to use *syntastic-filetype-checkers*
|
||||
|
||||
*'g:syntastic_<filetype>_checkers'*
|
||||
You can tell syntastic which checkers to run for a given filetype by setting a
|
||||
|
@ -748,18 +769,20 @@ use this in an autocmd to configure specific checkers for particular paths: >
|
|||
\ let b:syntastic_checkers = ["pylint"] | endif
|
||||
<
|
||||
If neither |'g:syntastic_<filetype>_checkers'| nor |'b:syntastic_checkers'|
|
||||
is set, a default list of checker is used. Beware however that this list
|
||||
is set a default list of checkers is used. Beware however that this list is
|
||||
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
|
||||
You can specify checkers for other filetypes anywhere in these lists, by
|
||||
qualifying their names with their respective filetypes: >
|
||||
let g:syntastic_tex_checkers = ["lacheck", "text/language_check"]
|
||||
<
|
||||
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.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5.2 Choosing the executable *syntastic-config-exec*
|
||||
5.2. Choosing the executable *syntastic-config-exec*
|
||||
|
||||
*'syntastic_<filetype>_<checker>_exec'*
|
||||
The executable run by a checker is normally defined automatically, when the
|
||||
|
@ -776,9 +799,9 @@ takes precedence over both 'b:syntastic_<filetype>_<checker>_exec' and
|
|||
'g:syntastic_<filetype>_<checker>_exec' in the buffers where it is defined.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5.3 Configuring specific checkers *syntastic-config-makeprg*
|
||||
5.3. Configuring specific checkers *syntastic-config-makeprg*
|
||||
|
||||
Checkers are run by constructing a command line and by passing it to a shell
|
||||
Linters are run by constructing a command line and by passing it to a shell
|
||||
(see |'shell'| and |'syntastic_shell'|). In most cases this command line is
|
||||
built using an internal function named "makeprgBuild()", which provides a
|
||||
number of options that allow you to customise every part of the command that
|
||||
|
@ -800,7 +823,7 @@ The result is a command line of the form: >
|
|||
All fields above are optional, and can be overridden by setting global
|
||||
variables 'g:syntastic_<filetype>_<checker-name>_<option-name>' - even
|
||||
parameters not specified in the call to "makeprgBuild()". For example to
|
||||
override the argguments and the tail: >
|
||||
override the arguments and the tail: >
|
||||
let g:syntastic_c_pc_lint_args = "-w5 -Iz:/usr/include/linux"
|
||||
let g:syntastic_c_pc_lint_tail = "2>/dev/null"
|
||||
<
|
||||
|
@ -832,7 +855,7 @@ empty, you can set it to an empty string, e.g.: >
|
|||
*'syntastic_<filetype>_<checker>_exe'*
|
||||
The 'exe' option is special. Normally it is the same as the 'exec' attribute
|
||||
described above, but you can use it to add environment variables to the
|
||||
command line, or to change the way the checker is run. For example this setup
|
||||
command line, or to change the way the linter is run. For example this setup
|
||||
allows you to run PC-Lint on Linux, under Wine emulation: >
|
||||
let g:syntastic_c_pc_lint_exec = "wine"
|
||||
let g:syntastic_c_pc_lint_exe = "wine c:/path/to/lint-nt.exe"
|
||||
|
@ -846,14 +869,12 @@ omitting the filename from the command line: >
|
|||
let g:syntastic_sml_smlnj_fname = ""
|
||||
<
|
||||
*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
|
||||
For checkers that do not use the "makeprgBuild()" function any specific
|
||||
options that can be set should be documented in this manual (see
|
||||
|syntastic-checkers|).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5.4 Sorting errors *syntastic-config-sort*
|
||||
5.4. Sorting errors *syntastic-config-sort*
|
||||
|
||||
*'syntastic_<filetype>_<checker>_sort'*
|
||||
Syntastic may decide to group the errors produced by some checkers by file,
|
||||
|
@ -872,7 +893,7 @@ For aggregated lists (see |syntastic-aggregating-errors|) these variables are
|
|||
ignored if |'syntastic_sort_aggregated_errors'| is set (which is the default).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5.5 Filtering errors *syntastic-config-filtering*
|
||||
5.5. Filtering errors *syntastic-config-filtering*
|
||||
|
||||
*'syntastic_<filetype>_<checker>_quiet_messages'*
|
||||
Finally, variables 'g:syntastic_<filetype>_<checker-name>_quiet_messages' can
|
||||
|
@ -886,10 +907,11 @@ from the corresponding checkers are filtered. Example: >
|
|||
The syntax is of course identical to that of |syntastic_quiet_messages|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5.6 Debugging *syntastic-config-debug*
|
||||
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
|
||||
the command line constructed by syntastic to run a linter, set the variable
|
||||
|'syntastic_debug'| to a non-zero value, run the checker, then run `:mes` to
|
||||
display the messages, and look for "makeprg" in the output.
|
||||
|
||||
|
@ -897,7 +919,7 @@ From a user's perspective, the useful values for |'syntastic_debug'| are 1, 3,
|
|||
and 33:
|
||||
|
||||
1 - logs syntastic's workflow
|
||||
3 - logs workflow, checker's output, and |location-list| manipulations
|
||||
3 - logs workflow, linter's output, and |location-list| manipulations
|
||||
33 - logs workflow and checker-specific details (such as version checks).
|
||||
|
||||
Debug logs can be saved to a file; see |'syntastic_debug_file'| for details.
|
||||
|
@ -905,7 +927,7 @@ Debug logs can be saved to a file; see |'syntastic_debug_file'| for details.
|
|||
Setting |'syntastic_debug'| to 0 turns off logging.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5.7 Profiling *syntastic-profiling*
|
||||
5.7. Profiling *syntastic-profiling*
|
||||
|
||||
A very useful tool for debugging performance problems is Vim's built-in
|
||||
|profiler|. In order to enable profiling for syntastic you need to add two lines
|
||||
|
@ -935,15 +957,15 @@ composite filetypes to simple ones using |'syntastic_filetype_map'|, e.g.: >
|
|||
let g:syntastic_filetype_map = { "handlebars.html": "handlebars" }
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
6.2 Editing files over network *syntastic-netrw*
|
||||
6.2. Editing files over network *syntastic-netrw*
|
||||
|
||||
The standard plugin |netrw| allows Vim to transparently edit files over
|
||||
network and inside archives. Currently syntastic doesn't support this mode
|
||||
of operation. It can only check files that can be accessed directly by local
|
||||
checkers, without any translation or conversion.
|
||||
linters, without any translation or conversion.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6.3 The 'shellslash' option *syntastic-shellslash*
|
||||
6.3. The 'shellslash' option *syntastic-shellslash*
|
||||
|
||||
The 'shellslash' option is relevant only on Windows systems. This option
|
||||
determines (among other things) the rules for quoting command lines, and there
|
||||
|
@ -954,7 +976,7 @@ shell. It should be turned off if your 'shell' (or |'syntastic_shell'|) is
|
|||
value.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6.4 Saving Vim sessions *syntastic-sessions*
|
||||
6.4. Saving Vim sessions *syntastic-sessions*
|
||||
|
||||
If you use `:mksession` to save Vim sessions you should probably make sure to
|
||||
remove option "blank" from 'sessionoptions': >
|
||||
|
@ -963,11 +985,51 @@ 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*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
7.1 The csh and tcsh shells *syntastic-csh*
|
||||
7.1. airline *syntastic-airline*
|
||||
|
||||
The "airline" Vim plugin (https://github.com/vim-airline/vim-airline) comes
|
||||
with an extension for showing syntastic-related flags on the |'statusline'|.
|
||||
|
||||
"airline" versions v0.8 and earlier use |'syntastic_stl_format'| to format the
|
||||
|'statusline'| flags. Newer versions ignore |'syntastic_stl_format'|, and require
|
||||
you to set variables 'airline#extensions#syntastic#stl_format_err' and
|
||||
'airline#extensions#syntastic#stl_format_warn' separately for errors and
|
||||
warnings (with the same syntax as |'syntastic_stl_format'|) if you want to
|
||||
change the flags from the defaults.
|
||||
|
||||
When using "airline" you should NOT follow the recommendation outlined in
|
||||
the |syntastic-statusline-flag| section above to modify your |'statusline'|.
|
||||
"airline" shall make all necessary changes automatically.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
7.2. The csh and tcsh shells *syntastic-csh*
|
||||
|
||||
The "csh" and "tcsh" shells are mostly compatible with syntastic. However,
|
||||
some checkers assume Bourne shell syntax for redirecting "stderr". For this
|
||||
|
@ -976,7 +1038,16 @@ such as "zsh", "bash", "ksh", or even the original Bourne "sh": >
|
|||
let g:syntastic_shell = "/bin/sh"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
7.2. Eclim *syntastic-eclim*
|
||||
7.3. EasyGrep *syntastic-easygrep*
|
||||
|
||||
The "EasyGrep" Vim plugin (https://github.com/dkprice/vim-easygrep) can use
|
||||
either |quickfix| lists, or location lists (see |location-list|). Syntastic can
|
||||
be run along with "EasyGrep" provided that the latter is configured to use
|
||||
|quickfix| lists (which is the default at the time of this writing): >
|
||||
let g:EasyGrepWindow = 0
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
7.4. Eclim *syntastic-eclim*
|
||||
|
||||
Syntastic can be used together with "Eclim" (see http://eclim.org/). However,
|
||||
by default Eclim disables syntastic's checks for the filetypes it supports, in
|
||||
|
@ -989,7 +1060,15 @@ run Eclim's validation for others. Please consult Eclim's documentation for
|
|||
details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
7.3 The fish shell *syntastic-fish*
|
||||
7.5. ferret *syntastic-ferret*
|
||||
|
||||
At the time of this writing syntastic conflicts with the "ferret" Vim plugin
|
||||
(https://github.com/wincent/ferret). The "ferret" plugin assumes control over
|
||||
loclist windows even when configured to use |quickfix| lists. This interferes
|
||||
with syntastic's functioning.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
7.6. The fish shell *syntastic-fish*
|
||||
|
||||
At the time of this writing the "fish" shell (see http://fishshell.com/)
|
||||
doesn't support the standard UNIX syntax for file redirections, and thus it
|
||||
|
@ -999,7 +1078,7 @@ original Bourne "sh": >
|
|||
let g:syntastic_shell = "/bin/sh"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
7.4. The fizsh shell *syntastic-fizsh*
|
||||
7.7. The fizsh shell *syntastic-fizsh*
|
||||
|
||||
Using syntastic with the "fizsh" shell (see https://github.com/zsh-users/fizsh)
|
||||
is possible, but potentially problematic. In order to do it you'll need to set
|
||||
|
@ -1012,7 +1091,7 @@ interactive features of "fizsh". Using a more traditional shell such as "zsh",
|
|||
let g:syntastic_shell = "/bin/sh"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
7.5 flagship *syntastic-flagship*
|
||||
7.8. flagship *syntastic-flagship*
|
||||
|
||||
The "flagship" Vim plugin (https://github.com/tpope/vim-flagship) has its
|
||||
own mechanism of showing flags on the |'statusline'|. To allow "flagship"
|
||||
|
@ -1022,7 +1101,7 @@ described in the |syntastic-statusline-flag| section above: >
|
|||
autocmd User Flags call Hoist("window", "SyntasticStatuslineFlag")
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
7.6. powerline *syntastic-powerline*
|
||||
7.9. powerline *syntastic-powerline*
|
||||
|
||||
The "powerline" Vim plugin (https://github.com/powerline/powerline) comes
|
||||
packaged with a syntastic segment. To customize this segment create a file
|
||||
|
@ -1039,16 +1118,18 @@ packaged with a syntastic segment. To customize this segment create a file
|
|||
}
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
7.7. The PowerShell shell *syntastic-powershell*
|
||||
7.10. The PowerShell shell *syntastic-powershell*
|
||||
|
||||
At the time of this writing, syntastic is not compatible with using "Windows
|
||||
PowerShell" (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's
|
||||
'shell'. You may still run Vim from 'PowerShell', but you do have to point
|
||||
Vim's 'shell' to a more traditional program, such as "cmd.exe": >
|
||||
set shell=cmd.exe
|
||||
At the time of this writing syntastic is not compatible with using
|
||||
"PowerShell" (https://msdn.microsoft.com/en-us/powershell) as Vim's 'shell'.
|
||||
You may still run Vim from "PowerShell", but you do have to point Vim's
|
||||
'shell' to a more traditional program, such as "cmd.exe" on Windows, or
|
||||
"/bin/sh" on UNIX: >
|
||||
set shell=c:\Windows\system32\cmd.exe
|
||||
set shell=/bin/sh
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
7.8 python-mode *syntastic-pymode*
|
||||
7.11. python-mode *syntastic-pymode*
|
||||
|
||||
Syntastic can be used along with the "python-mode" Vim plugin (see
|
||||
https://github.com/klen/python-mode). However, they both run syntax checks by
|
||||
|
@ -1059,14 +1140,14 @@ for python in syntastic (see |'syntastic_mode_map'|), or disable lint checks in
|
|||
let g:pymode_lint_on_write = 0
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
7.9. vim-auto-save *syntastic-vim-auto-save*
|
||||
7.12. vim-auto-save *syntastic-vim-auto-save*
|
||||
|
||||
Syntastic can be used together with the "vim-auto-save" Vim plugin (see
|
||||
https://github.com/907th/vim-auto-save). However, syntastic checks in active
|
||||
mode only work with "vim-auto-save" version 0.1.7 or later.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
7.10. vim-go *syntastic-vim-go*
|
||||
7.13. vim-go *syntastic-vim-go*
|
||||
|
||||
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
|
||||
|
@ -1083,15 +1164,15 @@ stick with |quickfix| lists: >
|
|||
let g:go_list_type = "quickfix"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
7.11. vim-virtualenv *syntastic-vim-virtualenv*
|
||||
7.14. vim-virtualenv *syntastic-vim-virtualenv*
|
||||
|
||||
At the time of this writing, syntastic can't run checkers installed
|
||||
At the time of this writing, syntastic can't run linters installed
|
||||
in Python virtual environments activated by "vim-virtualenv" (see
|
||||
https://github.com/jmcantrell/vim-virtualenv). This is a limitation of
|
||||
"vim-virtualenv".
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
7.12 YouCompleteMe *syntastic-ycm*
|
||||
7.15. YouCompleteMe *syntastic-ycm*
|
||||
|
||||
Syntastic can be used together with the "YouCompleteMe" Vim plugin (see
|
||||
http://valloric.github.io/YouCompleteMe/). However, by default "YouCompleteMe"
|
||||
|
@ -1102,12 +1183,12 @@ have to set |g:ycm_show_diagnostics_ui| to 0. E.g.: >
|
|||
let g:ycm_show_diagnostics_ui = 0
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
7.13 The zsh shell and MacVim *syntastic-zsh*
|
||||
7.16. The zsh shell and MacVim *syntastic-zsh*
|
||||
|
||||
If you're running MacVim together with the "zsh" shell (http://www.zsh.org/)
|
||||
you need to be aware that MacVim does not source your .zshrc file, but will
|
||||
source a .zshenv file. Consequently you have to move any setup steps relevant
|
||||
to the checkers you're using from .zshrc to .zshenv, otherwise your checkers
|
||||
to the linters you're using from .zshrc to .zshenv, otherwise your linters
|
||||
will misbehave when run by syntastic. This is particularly important for
|
||||
programs such as "rvm" (https://rvm.io/) or "rbenv" (http://rbenv.org/), that
|
||||
rely on setting environment variables.
|
||||
|
@ -1122,7 +1203,7 @@ The core maintainers of syntastic are:
|
|||
|
||||
Find the latest version of syntastic at:
|
||||
|
||||
http://github.com/scrooloose/syntastic
|
||||
http://github.com/vim-syntastic/syntastic
|
||||
|
||||
==============================================================================
|
||||
9. License *syntastic-license*
|
||||
|
|
|
@ -19,7 +19,7 @@ if has('reltime')
|
|||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.7.0-144'
|
||||
let g:_SYNTASTIC_VERSION = '3.8.0-97'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
@ -36,7 +36,8 @@ for s:feature in [
|
|||
\ 'modify_fname',
|
||||
\ 'quickfix',
|
||||
\ 'reltime',
|
||||
\ 'user_commands'
|
||||
\ 'statusline',
|
||||
\ 'user_commands',
|
||||
\ ]
|
||||
if !has(s:feature)
|
||||
call syntastic#log#error('need Vim compiled with feature ' . s:feature)
|
||||
|
@ -57,7 +58,7 @@ elseif executable('uname')
|
|||
try
|
||||
let g:_SYNTASTIC_UNAME = split(syntastic#util#system('uname'), "\n")[0]
|
||||
catch /\m^Vim\%((\a\+)\)\=:E484/
|
||||
call syntastic#log#error("your shell " . syntastic#util#var('shell') . " can't handle traditional UNIX syntax for redirections")
|
||||
call syntastic#log#error("can't run external programs (misconfigured shell options?)")
|
||||
finish
|
||||
catch /\m^Vim\%((\a\+)\)\=:E684/
|
||||
let g:_SYNTASTIC_UNAME = 'Unknown'
|
||||
|
@ -67,6 +68,15 @@ else
|
|||
endif
|
||||
lockvar g:_SYNTASTIC_UNAME
|
||||
|
||||
" XXX Ugly hack to make g:_SYNTASTIC_UNAME available to :SyntasticInfo without
|
||||
" polluting session namespaces
|
||||
let g:syntastic_version =
|
||||
\ g:_SYNTASTIC_VERSION .
|
||||
\ ' (Vim ' . v:version . (has('nvim') ? ', Neovim' : '') . ', ' .
|
||||
\ g:_SYNTASTIC_UNAME .
|
||||
\ (has('gui') ? ', GUI' : '') . ')'
|
||||
lockvar g:syntastic_version
|
||||
|
||||
" }}}1
|
||||
|
||||
" Defaults {{{1
|
||||
|
@ -126,20 +136,26 @@ endif
|
|||
|
||||
" Debug {{{1
|
||||
|
||||
let s:_DEBUG_DUMP_OPTIONS = [
|
||||
let g:_SYNTASTIC_SHELL_OPTIONS = [
|
||||
\ 'shell',
|
||||
\ 'shellcmdflag',
|
||||
\ 'shellpipe',
|
||||
\ 'shellquote',
|
||||
\ 'shellredir',
|
||||
\ 'shellslash',
|
||||
\ 'shelltemp',
|
||||
\ 'shellxquote'
|
||||
\ ]
|
||||
if exists('+shellxescape')
|
||||
call add(s:_DEBUG_DUMP_OPTIONS, 'shellxescape')
|
||||
endif
|
||||
lockvar! s:_DEBUG_DUMP_OPTIONS
|
||||
for s:feature in [
|
||||
\ 'autochdir',
|
||||
\ 'shellslash',
|
||||
\ 'shellxescape',
|
||||
\ ]
|
||||
|
||||
if exists('+' . s:feature)
|
||||
call add(g:_SYNTASTIC_SHELL_OPTIONS, s:feature)
|
||||
endif
|
||||
endfor
|
||||
lockvar! g:_SYNTASTIC_SHELL_OPTIONS
|
||||
|
||||
" debug constants
|
||||
let g:_SYNTASTIC_DEBUG_TRACE = 1
|
||||
|
@ -163,6 +179,7 @@ let s:registry = g:SyntasticRegistry.Instance()
|
|||
let s:notifiers = g:SyntasticNotifiers.Instance()
|
||||
let s:modemap = g:SyntasticModeMap.Instance()
|
||||
|
||||
let s:_check_stack = []
|
||||
let s:_quit_pre = []
|
||||
|
||||
" Commands {{{1
|
||||
|
@ -171,11 +188,20 @@ let s:_quit_pre = []
|
|||
" @vimlint(EVL103, 1, a:cmdLine)
|
||||
" @vimlint(EVL103, 1, a:argLead)
|
||||
function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) abort " {{{2
|
||||
let checker_names = []
|
||||
for ft in s:_resolve_filetypes([])
|
||||
call extend(checker_names, s:registry.getNamesOfAvailableCheckers(ft))
|
||||
endfor
|
||||
return join(checker_names, "\n")
|
||||
let names = []
|
||||
|
||||
let sep_idx = stridx(a:argLead, '/')
|
||||
if sep_idx >= 1
|
||||
let ft = a:argLead[: sep_idx-1]
|
||||
call extend(names, map( s:registry.getNamesOfAvailableCheckers(ft), 'ft . "/" . v:val' ))
|
||||
else
|
||||
for ft in s:registry.resolveFiletypes(&filetype)
|
||||
call extend(names, s:registry.getNamesOfAvailableCheckers(ft))
|
||||
endfor
|
||||
call extend(names, map( copy(s:registry.getKnownFiletypes()), 'v:val . "/"' ))
|
||||
endif
|
||||
|
||||
return join(names, "\n")
|
||||
endfunction " }}}2
|
||||
" @vimlint(EVL103, 0, a:cursorPos)
|
||||
" @vimlint(EVL103, 0, a:cmdLine)
|
||||
|
@ -207,14 +233,16 @@ command! SyntasticJavacEditConfig runtime! syntax_checkers/java/*.vim | Synta
|
|||
" Public API {{{1
|
||||
|
||||
function! SyntasticCheck(...) abort " {{{2
|
||||
call s:UpdateErrors(0, a:000)
|
||||
call s:UpdateErrors(bufnr(''), 0, a:000)
|
||||
call syntastic#util#redraw(g:syntastic_full_redraws)
|
||||
endfunction " }}}2
|
||||
|
||||
function! SyntasticInfo(...) abort " {{{2
|
||||
call s:modemap.modeInfo(a:000)
|
||||
call s:registry.echoInfoFor(s:_resolve_filetypes(a:000))
|
||||
call s:registry.echoInfoFor(a:000)
|
||||
call s:_explain_skip(a:000)
|
||||
call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, g:_SYNTASTIC_SHELL_OPTIONS)
|
||||
call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES)
|
||||
endfunction " }}}2
|
||||
|
||||
function! SyntasticErrors() abort " {{{2
|
||||
|
@ -222,19 +250,19 @@ function! SyntasticErrors() abort " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! SyntasticReset() abort " {{{2
|
||||
call s:ClearCache()
|
||||
call s:ClearCache(bufnr(''))
|
||||
call s:notifiers.refresh(g:SyntasticLoclist.New([]))
|
||||
endfunction " }}}2
|
||||
|
||||
function! SyntasticToggleMode() abort " {{{2
|
||||
call s:modemap.toggleMode()
|
||||
call s:ClearCache()
|
||||
call s:ClearCache(bufnr(''))
|
||||
call s:notifiers.refresh(g:SyntasticLoclist.New([]))
|
||||
call s:modemap.echoMode()
|
||||
endfunction " }}}2
|
||||
|
||||
function! SyntasticSetLoclist() abort " {{{2
|
||||
call g:SyntasticLoclist.current().setloclist()
|
||||
call g:SyntasticLoclist.current().setloclist(0)
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
@ -243,54 +271,68 @@ endfunction " }}}2
|
|||
|
||||
augroup syntastic
|
||||
autocmd!
|
||||
autocmd BufEnter * call s:BufEnterHook()
|
||||
autocmd VimEnter * call s:VimEnterHook()
|
||||
autocmd BufEnter * call s:BufEnterHook(expand('<afile>', 1))
|
||||
autocmd BufWinEnter * call s:BufWinEnterHook(expand('<afile>', 1))
|
||||
augroup END
|
||||
|
||||
if g:syntastic_nested_autocommands
|
||||
augroup syntastic
|
||||
autocmd BufReadPost * nested call s:BufReadPostHook()
|
||||
autocmd BufWritePost * nested call s:BufWritePostHook()
|
||||
autocmd BufReadPost * nested call s:BufReadPostHook(expand('<afile>', 1))
|
||||
autocmd BufWritePost * nested call s:BufWritePostHook(expand('<afile>', 1))
|
||||
augroup END
|
||||
else
|
||||
augroup syntastic
|
||||
autocmd BufReadPost * call s:BufReadPostHook()
|
||||
autocmd BufWritePost * call s:BufWritePostHook()
|
||||
autocmd BufReadPost * call s:BufReadPostHook(expand('<afile>', 1))
|
||||
autocmd BufWritePost * call s:BufWritePostHook(expand('<afile>', 1))
|
||||
augroup END
|
||||
endif
|
||||
|
||||
if exists('##QuitPre')
|
||||
" QuitPre was added in Vim 7.3.544
|
||||
augroup syntastic
|
||||
autocmd QuitPre * call s:QuitPreHook(expand('<amatch>', 1))
|
||||
autocmd QuitPre * call s:QuitPreHook(expand('<afile>', 1))
|
||||
augroup END
|
||||
endif
|
||||
|
||||
function! s:BufReadPostHook() abort " {{{2
|
||||
if g:syntastic_check_on_open
|
||||
function! s:BufReadPostHook(fname) abort " {{{2
|
||||
let buf = syntastic#util#fname2buf(a:fname)
|
||||
if g:syntastic_check_on_open && buf > 0
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufReadPost, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
|
||||
call s:UpdateErrors(1, [])
|
||||
\ 'autocmd: BufReadPost, buffer ' . buf . ' = ' . string(a:fname))
|
||||
if index(s:_check_stack, buf) == -1
|
||||
call add(s:_check_stack, buf)
|
||||
endif
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:BufWritePostHook() abort " {{{2
|
||||
function! s:BufWritePostHook(fname) abort " {{{2
|
||||
let buf = syntastic#util#fname2buf(a:fname)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufWritePost, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
|
||||
call s:UpdateErrors(1, [])
|
||||
\ 'autocmd: BufWritePost, buffer ' . buf . ' = ' . string(a:fname))
|
||||
call s:UpdateErrors(buf, 1, [])
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:BufEnterHook() abort " {{{2
|
||||
function! s:BufEnterHook(fname) abort " {{{2
|
||||
let buf = syntastic#util#fname2buf(a:fname)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufEnter, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))) .
|
||||
\ ', &buftype = ' . string(&buftype))
|
||||
if &buftype ==# ''
|
||||
call s:notifiers.refresh(g:SyntasticLoclist.current())
|
||||
\ 'autocmd: BufEnter, buffer ' . buf . ' = ' . string(a:fname) . ', &buftype = ' . string(&buftype))
|
||||
if buf > 0 && getbufvar(buf, '&buftype') ==# ''
|
||||
let idx = index(reverse(copy(s:_check_stack)), buf)
|
||||
if idx >= 0
|
||||
if !has('vim_starting')
|
||||
call remove(s:_check_stack, -idx - 1)
|
||||
call s:UpdateErrors(buf, 1, [])
|
||||
endif
|
||||
elseif &buftype ==# ''
|
||||
call s:notifiers.refresh(g:SyntasticLoclist.current())
|
||||
endif
|
||||
elseif &buftype ==# 'quickfix'
|
||||
" TODO: this is needed because in recent versions of Vim lclose
|
||||
" can no longer be called from BufWinLeave
|
||||
" TODO: at this point there is no b:syntastic_loclist
|
||||
let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1')
|
||||
let owner = str2nr(getbufvar(bufnr(''), 'syntastic_owner_buffer'))
|
||||
let loclist = filter(copy(getloclist(0)), 'v:val["valid"]')
|
||||
let owner = str2nr(getbufvar(buf, 'syntastic_owner_buffer'))
|
||||
let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : []))
|
||||
if !empty(get(w:, 'syntastic_loclist_set', [])) && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' ))
|
||||
call SyntasticLoclistHide()
|
||||
|
@ -298,8 +340,32 @@ function! s:BufEnterHook() abort " {{{2
|
|||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:BufWinEnterHook(fname) abort " {{{2
|
||||
let buf = syntastic#util#fname2buf(a:fname)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufWinEnter, buffer ' . buf . ' = ' . string(a:fname) . ', &buftype = ' . string(&buftype))
|
||||
if buf > 0 && getbufvar(buf, '&buftype') ==# ''
|
||||
let idx = index(reverse(copy(s:_check_stack)), buf)
|
||||
if idx >= 0 && !has('vim_starting')
|
||||
call remove(s:_check_stack, -idx - 1)
|
||||
call s:UpdateErrors(buf, 1, [])
|
||||
endif
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:VimEnterHook() abort " {{{2
|
||||
let buf = bufnr('')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: VimEnter, buffer ' . buf . ' = ' . string(bufname(buf)) . ', &buftype = ' . string(&buftype))
|
||||
let idx = index(reverse(copy(s:_check_stack)), buf)
|
||||
if idx >= 0 && getbufvar(buf, '&buftype') ==# ''
|
||||
call remove(s:_check_stack, -idx - 1)
|
||||
call s:UpdateErrors(buf, 1, [])
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:QuitPreHook(fname) abort " {{{2
|
||||
let buf = bufnr(fnameescape(a:fname))
|
||||
let buf = syntastic#util#fname2buf(a:fname)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, 'autocmd: QuitPre, buffer ' . buf . ' = ' . string(a:fname))
|
||||
|
||||
if !syntastic#util#var('check_on_wq')
|
||||
|
@ -317,30 +383,28 @@ endfunction " }}}2
|
|||
" Main {{{1
|
||||
|
||||
"refresh and redraw all the error info for this buf when saving or reading
|
||||
function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
|
||||
function! s:UpdateErrors(buf, auto_invoked, checker_names) abort " {{{2
|
||||
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'version')
|
||||
call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, s:_DEBUG_DUMP_OPTIONS)
|
||||
call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, g:_SYNTASTIC_SHELL_OPTIONS)
|
||||
call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'UpdateErrors' . (a:auto_invoked ? ' (auto)' : '') .
|
||||
\ ': ' . (len(a:checker_names) ? join(a:checker_names) : 'default checkers'))
|
||||
|
||||
call s:modemap.synch()
|
||||
|
||||
if s:_skip_file()
|
||||
if s:_skip_file(a:buf)
|
||||
return
|
||||
endif
|
||||
|
||||
let run_checks = !a:auto_invoked || s:modemap.doAutoChecking()
|
||||
let run_checks = !a:auto_invoked || s:modemap.doAutoChecking(a:buf)
|
||||
if run_checks
|
||||
call s:CacheErrors(a:checker_names)
|
||||
call syntastic#util#setChangedtick()
|
||||
else
|
||||
if a:auto_invoked
|
||||
return
|
||||
endif
|
||||
call s:CacheErrors(a:buf, a:checker_names)
|
||||
call syntastic#util#setLastTick(a:buf)
|
||||
elseif a:auto_invoked
|
||||
return
|
||||
endif
|
||||
|
||||
let loclist = g:SyntasticLoclist.current()
|
||||
let loclist = g:SyntasticLoclist.current(a:buf)
|
||||
|
||||
if exists('*SyntasticCheckHook')
|
||||
call SyntasticCheckHook(loclist.getRaw())
|
||||
|
@ -356,14 +420,8 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
|
|||
let do_jump = 0
|
||||
endif
|
||||
|
||||
let w:syntastic_loclist_set = []
|
||||
if syntastic#util#var('always_populate_loc_list') || do_jump
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: setloclist (new)')
|
||||
call setloclist(0, loclist.getRaw())
|
||||
if !exists('b:syntastic_changedtick')
|
||||
call syntastic#util#setChangedtick()
|
||||
endif
|
||||
let w:syntastic_loclist_set = [bufnr(''), b:syntastic_changedtick]
|
||||
call loclist.setloclist(1)
|
||||
if run_checks && do_jump && !loclist.isEmpty()
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: jump')
|
||||
execute 'silent! lrewind ' . do_jump
|
||||
|
@ -383,39 +441,44 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
"clear the loc list for the buffer
|
||||
function! s:ClearCache() abort " {{{2
|
||||
call s:notifiers.reset(g:SyntasticLoclist.current())
|
||||
call b:syntastic_loclist.destroy()
|
||||
function! s:ClearCache(buf) abort " {{{2
|
||||
let loclist = g:SyntasticLoclist.current(a:buf)
|
||||
call s:notifiers.reset(loclist)
|
||||
call loclist.destroy()
|
||||
endfunction " }}}2
|
||||
|
||||
"detect and cache all syntax errors in this buffer
|
||||
function! s:CacheErrors(checker_names) abort " {{{2
|
||||
function! s:CacheErrors(buf, checker_names) abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'CacheErrors: ' .
|
||||
\ (len(a:checker_names) ? join(a:checker_names) : 'default checkers'))
|
||||
call s:ClearCache()
|
||||
call s:ClearCache(a:buf)
|
||||
let newLoclist = g:SyntasticLoclist.New([])
|
||||
call newLoclist.setOwner(a:buf)
|
||||
|
||||
if !s:_skip_file()
|
||||
if !s:_skip_file(a:buf)
|
||||
" debug logging {{{3
|
||||
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'aggregate_errors')
|
||||
if syntastic#util#isRunningWindows()
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TMP = ' . string($TMP) . ', $TEMP = ' . string($TEMP))
|
||||
else
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TERM = ' . string($TERM))
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TMPDIR = ' . string($TMPDIR))
|
||||
endif
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$PATH = ' . string($PATH))
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . string(getcwd()))
|
||||
" }}}3
|
||||
|
||||
let filetypes = s:_resolve_filetypes([])
|
||||
let aggregate_errors = syntastic#util#var('aggregate_errors') || len(filetypes) > 1
|
||||
let clist = s:registry.getCheckers(getbufvar(a:buf, '&filetype'), a:checker_names)
|
||||
|
||||
let aggregate_errors =
|
||||
\ syntastic#util#var('aggregate_errors') || len(syntastic#util#unique(map(copy(clist), 'v:val.getFiletype()'))) > 1
|
||||
let decorate_errors = aggregate_errors && syntastic#util#var('id_checkers')
|
||||
let sort_aggregated_errors = aggregate_errors && syntastic#util#var('sort_aggregated_errors')
|
||||
|
||||
let clist = []
|
||||
for type in filetypes
|
||||
call extend(clist, s:registry.getCheckers(type, a:checker_names))
|
||||
endfor
|
||||
|
||||
let names = []
|
||||
let unavailable_checkers = 0
|
||||
for checker in clist
|
||||
let cname = checker.getFiletype() . '/' . checker.getName()
|
||||
let cname = checker.getCName()
|
||||
if !checker.isAvailable()
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'CacheErrors: Checker ' . cname . ' is not available')
|
||||
let unavailable_checkers += 1
|
||||
|
@ -436,7 +499,7 @@ function! s:CacheErrors(checker_names) abort " {{{2
|
|||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'sorted:', loclist)
|
||||
endif
|
||||
|
||||
let newLoclist = newLoclist.extend(loclist)
|
||||
call newLoclist.extend(loclist)
|
||||
|
||||
if !aggregate_errors
|
||||
break
|
||||
|
@ -556,7 +619,7 @@ function! SyntasticMake(options) abort " {{{2
|
|||
let err_lines = call('syntastic#preprocess#' . a:options['preprocess'], [err_lines])
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'preprocess:', err_lines)
|
||||
endif
|
||||
lgetexpr err_lines
|
||||
noautocmd lgetexpr err_lines
|
||||
|
||||
let errors = deepcopy(getloclist(0))
|
||||
|
||||
|
@ -569,6 +632,12 @@ function! SyntasticMake(options) abort " {{{2
|
|||
catch /\m^Vim\%((\a\+)\)\=:E380/
|
||||
" E380: At bottom of quickfix stack
|
||||
call setloclist(0, [], 'r')
|
||||
try
|
||||
" Vim 7.4.2200 or later
|
||||
call setloclist(0, [], 'r', { 'title': '' })
|
||||
catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/
|
||||
" do nothing
|
||||
endtry
|
||||
catch /\m^Vim\%((\a\+)\)\=:E776/
|
||||
" E776: No location list
|
||||
" do nothing
|
||||
|
@ -630,11 +699,6 @@ endfunction " }}}2
|
|||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:_resolve_filetypes(filetypes) abort " {{{2
|
||||
let type = len(a:filetypes) ? a:filetypes[0] : &filetype
|
||||
return split( get(g:syntastic_filetype_map, type, type), '\m\.' )
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_ignore_file(filename) abort " {{{2
|
||||
let fname = fnamemodify(a:filename, ':p')
|
||||
for pattern in g:syntastic_ignore_files
|
||||
|
@ -660,10 +724,10 @@ function! s:_is_quitting(buf) abort " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
" Skip running in special buffers
|
||||
function! s:_skip_file() abort " {{{2
|
||||
let fname = expand('%', 1)
|
||||
let skip = s:_is_quitting(bufnr('%')) || get(b:, 'syntastic_skip_checks', 0) ||
|
||||
\ (&buftype !=# '') || !filereadable(fname) || getwinvar(0, '&diff') ||
|
||||
function! s:_skip_file(buf) abort " {{{2
|
||||
let fname = bufname(a:buf)
|
||||
let skip = s:_is_quitting(a:buf) || getbufvar(a:buf, 'syntastic_skip_checks') ||
|
||||
\ (getbufvar(a:buf, '&buftype') !=# '') || !filereadable(fname) || getwinvar(0, '&diff') ||
|
||||
\ getwinvar(0, '&previewwindow') || s:_ignore_file(fname) ||
|
||||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
|
||||
if skip
|
||||
|
@ -674,17 +738,19 @@ endfunction " }}}2
|
|||
|
||||
" Explain why checks will be skipped for the current file
|
||||
function! s:_explain_skip(filetypes) abort " {{{2
|
||||
if empty(a:filetypes) && s:_skip_file()
|
||||
let buf = bufnr('')
|
||||
if empty(a:filetypes) && s:_skip_file(buf)
|
||||
let why = []
|
||||
let fname = expand('%', 1)
|
||||
let fname = bufname(buf)
|
||||
let bt = getbufvar(buf, '&buftype')
|
||||
|
||||
if s:_is_quitting(bufnr('%'))
|
||||
if s:_is_quitting(buf)
|
||||
call add(why, 'quitting buffer')
|
||||
endif
|
||||
if get(b:, 'syntastic_skip_checks', 0)
|
||||
if getbufvar(buf, 'syntastic_skip_checks')
|
||||
call add(why, 'b:syntastic_skip_checks set')
|
||||
endif
|
||||
if &buftype !=# ''
|
||||
if bt !=# ''
|
||||
call add(why, 'buftype = ' . string(&buftype))
|
||||
endif
|
||||
if !filereadable(fname)
|
||||
|
|
|
@ -25,10 +25,27 @@ function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) abort " {{{2
|
|||
call a:loclist.show()
|
||||
endif
|
||||
else
|
||||
if auto_loc_list == 1 || auto_loc_list == 2
|
||||
"TODO: this will close the loc list window if one was opened by
|
||||
"something other than syntastic
|
||||
lclose
|
||||
if (auto_loc_list == 1 || auto_loc_list == 2) && !empty(get(w:, 'syntastic_loclist_set', []))
|
||||
try
|
||||
" Vim 7.4.2200 or later
|
||||
let title = get(getloclist(0, { 'title': 1 }), 'title', ':SyntasticCheck ')
|
||||
catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/
|
||||
let title = ':SyntasticCheck '
|
||||
endtry
|
||||
|
||||
if strpart(title, 0, 16) ==# ':SyntasticCheck '
|
||||
" TODO: this will close the loc list window if one was opened
|
||||
" by something other than syntastic
|
||||
call SyntasticLoclistHide()
|
||||
|
||||
try
|
||||
" Vim 7.4.2200 or later
|
||||
call setloclist(0, [], 'r', { 'title': '' })
|
||||
catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/
|
||||
" do nothing
|
||||
endtry
|
||||
let w:syntastic_loclist_set = []
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
|
|
@ -15,7 +15,7 @@ function! g:SyntasticChecker.New(args, ...) abort " {{{2
|
|||
|
||||
if a:0
|
||||
" redirected checker
|
||||
let newObj._exec = get(a:args, 'exec', a:1['_exec'])
|
||||
let newObj._exec_default = get(a:args, 'exec', a:1['_exec_default'])
|
||||
|
||||
let filetype = a:1['_filetype']
|
||||
let name = a:1['_name']
|
||||
|
@ -31,7 +31,10 @@ function! g:SyntasticChecker.New(args, ...) abort " {{{2
|
|||
let newObj._enable = a:1['_enable']
|
||||
endif
|
||||
else
|
||||
let newObj._exec = get(a:args, 'exec', newObj._name)
|
||||
let newObj._exec_default = get(a:args, 'exec', newObj._name)
|
||||
if newObj._exec_default ==# ''
|
||||
let newObj._exec_default = '<dummy>'
|
||||
endif
|
||||
let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_'
|
||||
|
||||
if has_key(a:args, 'enable')
|
||||
|
@ -62,23 +65,24 @@ function! g:SyntasticChecker.getName() abort " {{{2
|
|||
return self._name
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getCName() abort " {{{2
|
||||
return self._filetype . '/' . self._name
|
||||
endfunction " }}}2
|
||||
|
||||
" Synchronise _exec with user's setting. Force re-validation if needed.
|
||||
"
|
||||
" XXX: This function must be called at least once before calling either
|
||||
" getExec() or getExecEscaped(). Normally isAvailable() does that for you
|
||||
" automatically, but you should keep still this in mind if you change the
|
||||
" current checker workflow.
|
||||
function! g:SyntasticChecker.syncExec() abort " {{{2
|
||||
let user_exec =
|
||||
\ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec :
|
||||
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec'), 1 )
|
||||
|
||||
if user_exec !=# '' && user_exec !=# self._exec
|
||||
let self._exec = user_exec
|
||||
if has_key(self, '_available')
|
||||
" we have a new _exec on the block, it has to be validated
|
||||
call remove(self, '_available')
|
||||
endif
|
||||
function! g:SyntasticChecker.syncExec(...) abort " {{{2
|
||||
if a:0
|
||||
let self._exec = a:1
|
||||
else
|
||||
let suffix = self._name . '_exec'
|
||||
let self._exec = expand(
|
||||
\ syntastic#util#var(self._filetype . '_' . suffix,
|
||||
\ syntastic#util#var(suffix, self._exec_default)), 1 )
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
|
@ -92,7 +96,7 @@ endfunction " }}}2
|
|||
|
||||
function! g:SyntasticChecker.getLocListRaw() abort " {{{2
|
||||
let checker_start = reltime()
|
||||
let name = self._filetype . '/' . self._name
|
||||
let name = self.getCName()
|
||||
|
||||
if has_key(self, '_enable')
|
||||
let status = syntastic#util#var(self._enable, -1)
|
||||
|
@ -150,7 +154,7 @@ function! g:SyntasticChecker.getVersion(...) abort " {{{2
|
|||
call self.setVersion(parsed_ver)
|
||||
else
|
||||
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', split(version_output, "\n", 1))
|
||||
call syntastic#log#error("checker " . self._filetype . "/" . self._name . ": can't parse version string (abnormal termination?)")
|
||||
call syntastic#log#error("checker " . self.getCName() . ": can't parse version string (abnormal termination?)")
|
||||
endif
|
||||
endif
|
||||
return get(self, '_version', [])
|
||||
|
@ -164,8 +168,8 @@ function! g:SyntasticChecker.setVersion(version) abort " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.log(msg, ...) abort " {{{2
|
||||
let leader = self._filetype . '/' . self._name . ': '
|
||||
if a:0 > 0
|
||||
let leader = self.getCName() . ': '
|
||||
if a:0
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, leader . a:msg, a:1)
|
||||
else
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, leader . a:msg)
|
||||
|
@ -187,10 +191,15 @@ endfunction " }}}2
|
|||
|
||||
function! g:SyntasticChecker.isAvailable() abort " {{{2
|
||||
call self.syncExec()
|
||||
|
||||
if !has_key(self, '_available')
|
||||
let self._available = self._isAvailableFunc()
|
||||
let self._available = {}
|
||||
endif
|
||||
return self._available
|
||||
if !has_key(self._available, self._exec)
|
||||
let self._available[self._exec] = self._isAvailableFunc()
|
||||
endif
|
||||
|
||||
return self._available[self._exec]
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.isDisabled() abort " {{{2
|
||||
|
|
|
@ -10,7 +10,7 @@ let g:SyntasticLoclist = {}
|
|||
function! g:SyntasticLoclist.New(rawLoclist) abort " {{{2
|
||||
let newObj = copy(self)
|
||||
|
||||
let llist = filter(copy(a:rawLoclist), 'v:val["valid"] == 1')
|
||||
let llist = filter(copy(a:rawLoclist), 'v:val["valid"]')
|
||||
|
||||
for e in llist
|
||||
if get(e, 'type', '') ==# ''
|
||||
|
@ -27,17 +27,18 @@ function! g:SyntasticLoclist.New(rawLoclist) abort " {{{2
|
|||
return newObj
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.current() abort " {{{2
|
||||
if !exists('b:syntastic_loclist') || empty(b:syntastic_loclist)
|
||||
let b:syntastic_loclist = g:SyntasticLoclist.New([])
|
||||
function! g:SyntasticLoclist.current(...) abort " {{{2
|
||||
let buf = a:0 ? a:1 : bufnr('')
|
||||
let loclist = syntastic#util#getbufvar(buf, 'syntastic_loclist', {})
|
||||
if type(loclist) != type({}) || empty(loclist)
|
||||
unlet! loclist
|
||||
let loclist = g:SyntasticLoclist.New([])
|
||||
endif
|
||||
return b:syntastic_loclist
|
||||
return loclist
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.extend(other) abort " {{{2
|
||||
let list = self.copyRaw()
|
||||
call extend(list, a:other.copyRaw())
|
||||
return g:SyntasticLoclist.New(list)
|
||||
call extend(self._rawLoclist, a:other.copyRaw())
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.sort() abort " {{{2
|
||||
|
@ -167,7 +168,6 @@ function! g:SyntasticLoclist.setOwner(buffer) abort " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.deploy() abort " {{{2
|
||||
call self.setOwner(bufnr(''))
|
||||
let self._stamp = syntastic#util#stamp()
|
||||
for buf in self.getBuffers()
|
||||
call setbufvar(buf, 'syntastic_loclist', self)
|
||||
|
@ -281,7 +281,7 @@ endfunction " }}}2
|
|||
"
|
||||
"would return all errors for buffer 10.
|
||||
"
|
||||
"Note that all comparisons are done with ==?
|
||||
"Note that all string comparisons are done with ==?
|
||||
function! g:SyntasticLoclist.filter(filters) abort " {{{2
|
||||
let conditions = values(map(copy(a:filters), 's:_translate(v:key, v:val)'))
|
||||
let filter = len(conditions) == 1 ?
|
||||
|
@ -289,23 +289,29 @@ function! g:SyntasticLoclist.filter(filters) abort " {{{2
|
|||
return filter(copy(self._rawLoclist), filter)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.setloclist() abort " {{{2
|
||||
function! g:SyntasticLoclist.setloclist(new) abort " {{{2
|
||||
if !exists('w:syntastic_loclist_set')
|
||||
let w:syntastic_loclist_set = []
|
||||
endif
|
||||
if empty(w:syntastic_loclist_set) || w:syntastic_loclist_set != [bufnr(''), b:changedtick]
|
||||
let replace = g:syntastic_reuse_loc_lists && !empty(w:syntastic_loclist_set)
|
||||
if a:new || empty(w:syntastic_loclist_set) || w:syntastic_loclist_set != [self._owner, getbufvar(self._owner, 'changedtick')]
|
||||
let replace = !a:new && g:syntastic_reuse_loc_lists && !empty(w:syntastic_loclist_set)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)'))
|
||||
call setloclist(0, self.getRaw(), replace ? 'r' : ' ')
|
||||
call syntastic#util#setChangedtick()
|
||||
let w:syntastic_loclist_set = [bufnr(''), b:syntastic_changedtick]
|
||||
try
|
||||
" Vim 7.4.2200 or later
|
||||
call setloclist(0, [], 'r', { 'title': ':SyntasticCheck ' . self._name })
|
||||
catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/
|
||||
" do nothing
|
||||
endtry
|
||||
call syntastic#util#setLastTick(self._owner)
|
||||
let w:syntastic_loclist_set = [self._owner, getbufvar(self._owner, 'syntastic_lasttick')]
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
"display the cached errors for this buf in the location list
|
||||
function! g:SyntasticLoclist.show() abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: show')
|
||||
call self.setloclist()
|
||||
call self.setloclist(0)
|
||||
|
||||
if !self.isEmpty()
|
||||
let num = winnr()
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue