merge
This commit is contained in:
parent
f90bdd944d
commit
9a83cf01c8
347 changed files with 15761 additions and 5487 deletions
178
README.md
178
README.md
|
@ -24,32 +24,33 @@ bash ~/.vim_runtime/install_awesome_vimrc.sh
|
|||
|
||||
|
||||
|
||||
![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.c
|
||||
I would, of course, recommend using the awesome version.
|
||||
|
||||
## 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:
|
||||
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 https://github.com/amix/vimrc.git ~/.vim_runtime
|
||||
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
|
||||
sh ~/.vim_runtime/install_awesome_vimrc.sh
|
||||
|
||||
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
|
||||
I also recommend using [the Hack font](http://sourcefoundry.org/hack/) (it's a free and awesome font designed for source code). 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).
|
||||
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.
|
||||
|
||||
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 useful to install on remote servers where you don't need many plugins, and you don't do many edits.
|
||||
|
||||
git clone git://github.com/amix/vimrc.git ~/.vim_runtime
|
||||
git clone --depth=1 git://github.com/amix/vimrc.git ~/.vim_runtime
|
||||
sh ~/.vim_runtime/install_basic_vimrc.sh
|
||||
|
||||
|
||||
|
@ -64,7 +65,7 @@ If you have vim aliased as `vi` instead of `vim`, make sure to either alias it:
|
|||
|
||||
## How to update to latest version?
|
||||
|
||||
Simply just do a git rebase!
|
||||
Just do a git rebase!
|
||||
|
||||
cd ~/.vim_runtime
|
||||
git pull --rebase
|
||||
|
@ -73,49 +74,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)
|
||||
|
@ -134,37 +133,38 @@ 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 (`<leader>o`):
|
||||
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 (`<leader>f`):
|
||||
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 (`<leader>j` or `<ctrl>f`):
|
||||
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>'
|
||||
|
||||
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
|
||||
|
@ -174,6 +174,7 @@ Managing the [NERD Tree](https://github.com/scrooloose/nerdtree) plugin:
|
|||
|
||||
map <leader>z :Goyo<cr>
|
||||
|
||||
|
||||
### Normal mode mappings
|
||||
|
||||
Fast saving of a buffer (`<leader>w`):
|
||||
|
@ -186,7 +187,7 @@ 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>
|
||||
|
||||
|
@ -197,7 +198,7 @@ Smart way to move between windows (`<ctrl>j` etc.):
|
|||
map <C-h> <C-W>h
|
||||
map <C-l> <C-W>l
|
||||
|
||||
Closing of current buffer(s) (`<leader>bd` and (`<leader>ba`)):
|
||||
Closing of the current buffer(s) (`<leader>bd` and (`<leader>ba`)):
|
||||
|
||||
" Close current buffer
|
||||
map <leader>bd :Bclose<cr>
|
||||
|
@ -216,22 +217,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>
|
||||
|
@ -241,6 +234,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.:
|
||||
|
@ -258,31 +276,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:
|
||||
|
@ -298,27 +291,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:
|
||||
|
@ -327,15 +321,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>
|
||||
|
||||
## How to uninstall
|
||||
Do following:
|
||||
* Remove `~/.vim_runtime`
|
||||
* Remove any lines that refernce `.vim_runtime` in your `~/.vimrc`
|
||||
|
||||
## How to uninstall
|
||||
Just do following:
|
||||
* Remove `~/.vim_runtime`
|
||||
* 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 :-)"
|
||||
|
|
|
@ -45,6 +45,7 @@ let g:syntastic_python_checkers = ['flake8'] " 修改检查器的地方
|
|||
" let g:syntastic_python_python_exec = 'path/to/python3'
|
||||
" display all of the errors from all of the checkers together
|
||||
let g:syntastic_aggregate_errors = 1
|
||||
let g:syntastic_html_checkers=['']
|
||||
|
||||
" mapping move focus to tab* use: ,t1 ,t2 ...
|
||||
map <leader>t1 :tabnext 1<cr>
|
||||
|
@ -108,10 +109,13 @@ augroup END
|
|||
|
||||
" if use gvim then change guifont
|
||||
if has('gui_running')
|
||||
set guifont=Lucida_Console:h12
|
||||
set guifont=Source\ Code\ Pro\ for\ Powerline:h12
|
||||
endif
|
||||
|
||||
" map $t to <>
|
||||
vnoremap $t <esc>`>a><esc>`<i<<esc>
|
||||
inoremap $t <><esc>i
|
||||
|
||||
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936,big5,euc-jp,euc-kr,latin1
|
||||
set encoding=utf-8
|
||||
|
||||
|
|
0
my_plugins/.gitkeep
Normal file
0
my_plugins/.gitkeep
Normal file
|
@ -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
|
||||
|
@ -78,9 +76,9 @@ The quickfix results window is augmented with these convenience mappings:
|
|||
? a quick summary of these keys, repeat to close
|
||||
o to open (same as Enter)
|
||||
O to open and close the quickfix window
|
||||
go to preview file, open but maintain focus on ack.vim results
|
||||
go to preview file, keeping focus on the results
|
||||
t to open in new tab
|
||||
T to open in new tab without moving to it
|
||||
T to open in new tab, keeping focus on the results
|
||||
h to open in horizontal split
|
||||
H to open in horizontal split, keeping focus on the results
|
||||
v to open in vertical split
|
||||
|
@ -140,22 +138,22 @@ the convention of Vim's built-in `:grep` and `:make` commands.
|
|||
|
||||
## 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
|
||||
|
|
2
sources_non_forked/ag.vim/.gitignore
vendored
2
sources_non_forked/ag.vim/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
tags
|
||||
ag-vim.tgz
|
|
@ -1,81 +0,0 @@
|
|||
# ag.vim #
|
||||
|
||||
## Deprecated: See [this comment](https://github.com/rking/ag.vim/issues/124#issuecomment-227038003) for more info. Maybe try [ack.vim](https://github.com/mileszs/ack.vim#can-i-use-ag-the-silver-searcher-with-this) as an alternative. ##
|
||||
|
||||
This plugin is a front for ag, A.K.A.
|
||||
[the_silver_searcher](https://github.com/ggreer/the_silver_searcher). Ag can
|
||||
be used as a replacement for 153% of the uses of `ack`. This plugin will allow
|
||||
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>)
|
|
@ -303,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
|
||||
|
@ -570,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,
|
||||
|
@ -581,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
|
||||
|
@ -1197,7 +1201,7 @@ fu! s:AcceptSelection(action)
|
|||
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
|
||||
|
@ -1764,6 +1768,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
|
||||
|
@ -1873,6 +1878,11 @@ fu! s:highlight(pat, grp)
|
|||
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
|
||||
|
||||
|
@ -1995,9 +2005,14 @@ fu! s:bufnrfilpath(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
|
||||
else
|
||||
let bufnr = bufnr(a:line)
|
||||
retu [bufnr, a:line]
|
||||
en
|
||||
en
|
||||
retu [bufnr, filpath]
|
||||
endf
|
||||
|
@ -2300,7 +2315,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)
|
||||
|
@ -2380,7 +2395,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
|
||||
|
||||
|
@ -2489,7 +2504,9 @@ endf
|
|||
fu! s:getextvar(key)
|
||||
if s:itemtype >= len(s:coretypes) && len(g:ctrlp_ext_vars) > 0
|
||||
let vars = g:ctrlp_ext_vars[s:itemtype - len(s:coretypes)]
|
||||
retu has_key(vars, a:key) ? vars[a:key] : -1
|
||||
if has_key(vars, a:key)
|
||||
retu vars[a:key]
|
||||
en
|
||||
en
|
||||
retu get(g:, 'ctrlp_' . s:matchtype . '_' . a:key, -1)
|
||||
endf
|
||||
|
|
|
@ -139,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。
|
||||
|
@ -1259,7 +1278,8 @@ h) 使用?打开帮助文件。
|
|||
缓冲标签模式选项:~
|
||||
|
||||
*'g:ctrlp_buftag_ctags_bin'*
|
||||
如果ctags没有在环境变量中配置,使用该选项来指定它的位置: >
|
||||
如果ctags没有在环境变量中配置,或者一个二进制ctags文件存在于
|
||||
/opt/local/bin 或 /usr/local/bin,使用该选项来指定它的位置: >
|
||||
let g:ctrlp_buftag_ctags_bin = ''
|
||||
<
|
||||
|
||||
|
@ -1411,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|
|
||||
|
|
|
@ -148,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.
|
||||
|
||||
|
@ -847,7 +848,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
|
||||
|
||||
|
@ -1497,6 +1498,9 @@ 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.
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
'g:ctrlp_switch_buffer' ctrlp.cnx /*'g:ctrlp_switch_buffer'*
|
||||
'g:ctrlp_tabpage_position' ctrlp.cnx /*'g:ctrlp_tabpage_position'*
|
||||
'g:ctrlp_tilde_homedir' ctrlp.cnx /*'g:ctrlp_tilde_homedir'*
|
||||
'g:ctrlp_types' ctrlp.cnx /*'g:ctrlp_types'*
|
||||
'g:ctrlp_use_caching' ctrlp.cnx /*'g:ctrlp_use_caching'*
|
||||
'g:ctrlp_user_command' ctrlp.cnx /*'g:ctrlp_user_command'*
|
||||
'g:ctrlp_working_path_mode' ctrlp.cnx /*'g:ctrlp_working_path_mode'*
|
||||
|
@ -66,6 +67,8 @@
|
|||
:CtrlPChangeAll ctrlp.cnx /*:CtrlPChangeAll*
|
||||
:CtrlPClearAllCaches ctrlp.cnx /*:CtrlPClearAllCaches*
|
||||
:CtrlPClearCache ctrlp.cnx /*:CtrlPClearCache*
|
||||
:CtrlPCurFile ctrlp.cnx /*:CtrlPCurFile*
|
||||
:CtrlPCurWD ctrlp.cnx /*:CtrlPCurWD*
|
||||
:CtrlPDir ctrlp.cnx /*:CtrlPDir*
|
||||
:CtrlPLastMode ctrlp.cnx /*:CtrlPLastMode*
|
||||
:CtrlPLine ctrlp.cnx /*:CtrlPLine*
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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
|
||||
|
|
170
sources_non_forked/goyo.vim/doc/goyo.txt
Normal file
170
sources_non_forked/goyo.vim/doc/goyo.txt
Normal file
|
@ -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:
|
117
sources_non_forked/gruvbox/CHANGELOG.md
Normal file
117
sources_non_forked/gruvbox/CHANGELOG.md
Normal file
|
@ -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)*
|
110
sources_non_forked/gruvbox/README.md
Normal file
110
sources_non_forked/gruvbox/README.md
Normal file
|
@ -0,0 +1,110 @@
|
|||
<p align="center"><img src="http://imgh.us/gruvbox_logo.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 (and ES6 with [yajs.vim](https://github.com/othree/yajs.vim)), Clojure, C, Python, JavaScript, CoffeeScript, Ruby, Objective-C, Go, Lua, MoonScript, Java, Markdown, Haskell
|
||||
* Supported plugins: [EasyMotion][], [vim-sneak][], [Indent Guides][], [indentLine][], [Rainbow Parentheses][], [Airline][], [Lightline][], [GitGutter][], [Signify][], [ShowMarks][], [Signature][], [Syntastic][], [CtrlP][], [Startify][]
|
||||
|
||||
[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
|
||||
[CtrlP]: https://github.com/kien/ctrlp.vim
|
||||
[Startify]: https://github.com/mhinz/vim-startify
|
||||
|
||||
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, Purescript and I'm still dissatisfied with CSS)
|
||||
* Plugin support (MiniBufExplorer, Tagbar, Netrw, 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: 22 Aug 2014
|
||||
" -----------------------------------------------------------------------------
|
||||
|
||||
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'], ['StatusLineNC', 'fg'])
|
||||
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'], ['StatusLineNC', 'fg'])
|
||||
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'], ['ModeMsg', '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:
|
41
sources_non_forked/gruvbox/autoload/gruvbox.vim
Normal file
41
sources_non_forked/gruvbox/autoload/gruvbox.vim
Normal file
|
@ -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,53 @@
|
|||
" -----------------------------------------------------------------------------
|
||||
" File: gruvbox.vim
|
||||
" Description: Gruvbox colorscheme for Lightline (itchyny/lightline.vim)
|
||||
" Author: gmoe <me@griffinmoe.com>
|
||||
" Source: https://github.com/morhetz/gruvbox
|
||||
" Last Modified: 31 Oct 2015
|
||||
" -----------------------------------------------------------------------------
|
||||
|
||||
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:p = {'normal':{}, 'inactive':{}, 'insert':{}, 'replace':{}, 'visual':{}, 'tabline':{}}
|
||||
let s:p.normal.left = [ [ s:bg0, s:fg4 ], [ 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 ], [ 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.replace.left = [ [ s:bg0, s:aqua ], [ 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 ], [ 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
|
1239
sources_non_forked/gruvbox/colors/gruvbox.vim
Normal file
1239
sources_non_forked/gruvbox/colors/gruvbox.vim
Normal file
File diff suppressed because it is too large
Load diff
118
sources_non_forked/gruvbox/gruvbox_256palette.sh
Normal file
118
sources_non_forked/gruvbox/gruvbox_256palette.sh
Normal file
|
@ -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
|
116
sources_non_forked/gruvbox/gruvbox_256palette_osx.sh
Normal file
116
sources_non_forked/gruvbox/gruvbox_256palette_osx.sh
Normal file
|
@ -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
|
|
@ -4,19 +4,26 @@ 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
|
||||
- VIM_VERSION=7.2.051
|
||||
|
||||
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
|
@ -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)
|
|
@ -4,7 +4,7 @@ Version: 0.1
|
|||
Author: itchyny (https://github.com/itchyny)
|
||||
License: MIT License
|
||||
Repository: https://github.com/itchyny/lightline.vim
|
||||
Last Change: 2016/10/24 08:12:28.
|
||||
Last Change: 2017/05/28 01:07:02.
|
||||
|
||||
CONTENTS *lightline-contents*
|
||||
|
||||
|
@ -29,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' ],
|
||||
|
@ -78,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 = {
|
||||
|
@ -89,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 = {
|
||||
|
@ -116,11 +114,11 @@ OPTIONS *lightline-option*
|
|||
<
|
||||
g:lightline.component_visible_condition
|
||||
*g:lightline.component_visible_condition*
|
||||
Dictionary to store the visible condition of the 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 cannot use this
|
||||
configuration to control the visibility of the components.
|
||||
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 = {
|
||||
|
@ -129,52 +127,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.
|
||||
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 a component for read-only mark, which
|
||||
disappears in help windows:
|
||||
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*
|
||||
Dictionary to store the visible conditions of the function
|
||||
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
|
||||
function components by setting the value 1 (to tell lightline
|
||||
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 ]]
|
||||
|
@ -223,7 +216,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, one, Dracula, Molokai and 16color are available.
|
||||
PaperColor, seoul256, landscape, one, Dracula, darcula,
|
||||
Molokai and 16color are available.
|
||||
The default value is:
|
||||
>
|
||||
let g:lightline.colorscheme = 'default'
|
||||
|
@ -280,7 +274,6 @@ OPTIONS *lightline-option*
|
|||
\ 'tabline': 1
|
||||
\ }
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
FONT *lightline-font*
|
||||
You can use the patched font you used for |vim-powerline| and |powerline|.
|
||||
|
|
|
@ -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()
|
||||
|
37
sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE.md
vendored
Normal file
37
sources_non_forked/nerdtree/.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -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,13 @@
|
|||
Next
|
||||
- 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
|
||||
|
|
|
@ -55,14 +55,14 @@ The following features and functionality are provided by the NERD tree:
|
|||
Installation
|
||||
------------
|
||||
|
||||
####[pathogen.vim](https://github.com/tpope/vim-pathogen)
|
||||
#### [pathogen.vim](https://github.com/tpope/vim-pathogen)
|
||||
|
||||
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
|
||||
|
||||
Then reload vim, run `:helptags ~/.vim/bundle/nerdtree/doc/`, 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
|
||||
|
||||
|
|
|
@ -52,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)
|
||||
|
@ -64,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
|
||||
|
@ -89,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
|
||||
|
|
|
@ -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" })
|
||||
|
@ -336,16 +336,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 +404,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 +461,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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
@ -741,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'*
|
||||
|
||||
|
@ -806,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.
|
||||
|
@ -835,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'*
|
|
@ -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)
|
||||
|
@ -292,7 +323,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 = []
|
||||
|
|
|
@ -14,7 +14,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()
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
"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
|
||||
"============================================================
|
||||
|
@ -52,7 +46,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
|
||||
|
||||
|
@ -301,10 +295,10 @@ endfunction
|
|||
"FUNCTION: Path._escChars() {{{1
|
||||
function! s:Path._escChars()
|
||||
if nerdtree#runningWindows()
|
||||
return " `\|\"#%&,?()\*^<>"
|
||||
return " `\|\"#%&,?()\*^<>$"
|
||||
endif
|
||||
|
||||
return " \\`\|\"#%&,?()\*^<>[]"
|
||||
return " \\`\|\"#%&,?()\*^<>[]$"
|
||||
endfunction
|
||||
|
||||
"FUNCTION: Path.getDir() {{{1
|
||||
|
@ -368,8 +362,23 @@ function! s:Path.getSortOrderIndex()
|
|||
return s:NERDTreeSortStarIndex
|
||||
endfunction
|
||||
|
||||
"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 string used in compare function for sorting
|
||||
"returns a key used in compare function for sorting
|
||||
function! s:Path.getSortKey()
|
||||
if !exists("self._sortKey")
|
||||
let path = self.getLastPathComponent(1)
|
||||
|
@ -379,7 +388,11 @@ 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
|
||||
|
@ -544,7 +557,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)
|
||||
|
|
|
@ -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,7 +20,7 @@ function! s:TreeDirNode.AbsoluteTreeRoot()
|
|||
return currentNode
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.activate([options]) {{{1
|
||||
" FUNCTION: TreeDirNode.activate([options]) {{{1
|
||||
unlet s:TreeDirNode.activate
|
||||
function! s:TreeDirNode.activate(...)
|
||||
let opts = a:0 ? a:1 : {}
|
||||
|
@ -25,12 +29,12 @@ function! s:TreeDirNode.activate(...)
|
|||
call self.putCursorHere(0, 0)
|
||||
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,14 +44,19 @@ 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
|
||||
" Closes all the child dir nodes of this node
|
||||
function! s:TreeDirNode.closeChildren()
|
||||
for i in self.children
|
||||
if i.path.isDirectory
|
||||
|
@ -57,43 +66,53 @@ function! s:TreeDirNode.closeChildren()
|
|||
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,8 +133,8 @@ 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]
|
||||
|
@ -127,20 +146,20 @@ function! s:TreeDirNode.getCascade()
|
|||
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 {}
|
||||
|
@ -155,12 +174,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)
|
||||
|
@ -169,14 +189,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
|
||||
|
@ -200,15 +220,88 @@ function! s:TreeDirNode.getChildIndex(path)
|
|||
return -1
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.getDirChildren() {{{1
|
||||
"Get all children that are directories
|
||||
" FUNCTION: TreeDirNode.getDirChildren() {{{1
|
||||
" Return a list of all child nodes from "self.children" that are of type
|
||||
" TreeDirNode.
|
||||
function! s:TreeDirNode.getDirChildren()
|
||||
return filter(self.children, 'v:val.path.isDirectory == 1')
|
||||
endfunction
|
||||
|
||||
"FUNCTION: TreeDirNode.GetSelected() {{{1
|
||||
"Returns the current node if it is a dir node, or else returns the current
|
||||
"nodes parent
|
||||
" 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] == '\'
|
||||
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
|
||||
unlet s:TreeDirNode.GetSelected
|
||||
function! s:TreeDirNode.GetSelected()
|
||||
let currentDir = g:NERDTreeFileNode.GetSelected()
|
||||
|
@ -220,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
|
||||
|
@ -241,14 +334,14 @@ 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
|
||||
|
@ -258,29 +351,19 @@ function! s:TreeDirNode.isCascadable()
|
|||
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 ...")
|
||||
|
@ -288,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()
|
||||
|
@ -317,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."
|
||||
|
@ -340,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
|
||||
|
@ -383,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
|
||||
|
@ -490,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())
|
||||
|
@ -499,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 : {}
|
||||
|
||||
|
@ -534,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)
|
||||
|
@ -553,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
|
||||
|
@ -578,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,105 @@ 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 = "\" NERD tree (" . 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: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
|
||||
|
||||
|
||||
|
@ -316,6 +313,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("."))
|
||||
|
@ -440,10 +441,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 _
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -58,15 +58,15 @@ their script to find them.
|
|||
|
||||
At the time of this writing, syntastic has checking plugins for ACPI
|
||||
Source Language, ActionScript, Ada, Ansible configurations, API Blueprint,
|
||||
AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C,
|
||||
C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart,
|
||||
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, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown,
|
||||
MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl
|
||||
POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug (formerly
|
||||
Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG,
|
||||
reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity,
|
||||
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 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, xHtml, XML, XSLT, XQuery, YACC, YAML, YANG data models, z80,
|
||||
Zope page templates, and Zsh. See the [manual][checkers] for details about the
|
||||
|
@ -101,10 +101,10 @@ enabled.
|
|||
Syntastic itself has rather relaxed requirements: it doesn't have any external
|
||||
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][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam],
|
||||
|
|
|
@ -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
|
||||
|
@ -98,6 +129,35 @@ function! syntastic#preprocess#dockerfile_lint(errors) abort " {{{2
|
|||
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] !=# '{'
|
||||
|
@ -205,12 +265,17 @@ function! syntastic#preprocess#perl(errors) abort " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#prospector(errors) abort " {{{2
|
||||
let errs = s:_decode_JSON(join(a:errors, ''))
|
||||
let errs = join(a:errors, '')
|
||||
if errs ==# ''
|
||||
return []
|
||||
endif
|
||||
|
||||
let json = s:_decode_JSON(errs)
|
||||
|
||||
let out = []
|
||||
if type(errs) == type({}) && has_key(errs, 'messages')
|
||||
if type(errs['messages']) == type([])
|
||||
for e in errs['messages']
|
||||
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'
|
||||
|
@ -240,6 +305,8 @@ function! syntastic#preprocess#prospector(errors) abort " {{{2
|
|||
else
|
||||
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
|
||||
|
@ -406,7 +473,7 @@ echomsg string(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
|
||||
|
|
|
@ -76,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
|
||||
|
@ -84,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
|
||||
|
@ -132,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')
|
||||
|
@ -401,9 +401,6 @@ 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('$'))
|
||||
|
@ -614,8 +611,18 @@ 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
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang*
|
|||
C++......................................|syntastic-checkers-cpp|
|
||||
Cabal....................................|syntastic-checkers-cabal|
|
||||
Chef.....................................|syntastic-checkers-chef|
|
||||
CMake....................................|syntastic-checkers-cmake|
|
||||
COBOL....................................|syntastic-checkers-cobol|
|
||||
Coco.....................................|syntastic-checkers-co|
|
||||
CoffeeScript.............................|syntastic-checkers-coffee|
|
||||
|
@ -58,6 +59,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang*
|
|||
Java.....................................|syntastic-checkers-java|
|
||||
JavaScript...............................|syntastic-checkers-javascript|
|
||||
JSON.....................................|syntastic-checkers-json|
|
||||
Julia....................................|syntastic-checkers-julia|
|
||||
|
||||
LESS.....................................|syntastic-checkers-less|
|
||||
Lex......................................|syntastic-checkers-lex|
|
||||
|
@ -530,12 +532,14 @@ The following checkers are available for C (filetype "c"):
|
|||
3. ClangCheck...............|syntastic-c-clang_check|
|
||||
4. Clang-Tidy...............|syntastic-c-clang_tidy|
|
||||
5. Cppcheck.................|syntastic-c-cppcheck|
|
||||
6. GCC......................|syntastic-c-gcc|
|
||||
7. make.....................|syntastic-c-make|
|
||||
8. OClint...................|syntastic-c-oclint|
|
||||
9. PC-Lint..................|syntastic-c-pc_lint|
|
||||
10. Sparse..................|syntastic-c-sparse|
|
||||
11. Splint..................|syntastic-c-splint|
|
||||
6. cppclean.................|syntastic-c-cppclean|
|
||||
7. Flawfinder...............|syntastic-c-flawfinder|
|
||||
8. GCC......................|syntastic-c-gcc|
|
||||
9. make.....................|syntastic-c-make|
|
||||
10. OClint..................|syntastic-c-oclint|
|
||||
11. PC-Lint.................|syntastic-c-pc_lint|
|
||||
12. Sparse..................|syntastic-c-sparse|
|
||||
13. Splint..................|syntastic-c-splint|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. AVR-GCC *syntastic-c-avrgcc*
|
||||
|
@ -693,7 +697,57 @@ one option per line (cf. |syntastic-config-files|).
|
|||
See also: |syntastic-cpp-cppcheck|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6. GCC *syntastic-c-gcc*
|
||||
6. cppclean *syntastic-c-cppclean*
|
||||
|
||||
Name: cppclean
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
||||
"cppclean" attempts to find problems in C++ source that slow development in
|
||||
large code bases, for example various forms of unused code. See the project's
|
||||
page at GitHub for more information:
|
||||
|
||||
https://github.com/myint/cppclean
|
||||
|
||||
Installation~
|
||||
|
||||
Install it with "pip": >
|
||||
pip install cppclean
|
||||
<
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
See also: |syntastic-cpp-cppclean|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
7. Flawfinder *syntastic-c-flawfinder*
|
||||
|
||||
Name: flawfinder
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
||||
"Flawfinder" scans C/C++ source code for possible security weaknesses. See the
|
||||
project's page for more information:
|
||||
|
||||
https://www.dwheeler.com/flawfinder
|
||||
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
Additionally:
|
||||
|
||||
*'g:syntastic_c_flawfinder_thres'*
|
||||
Type: integer
|
||||
Default: 3
|
||||
Error threshold. Policy violations with a severity above this value are
|
||||
highlighted as errors, the others are considered warnings by syntastic.
|
||||
|
||||
See also: |syntastic-cpp-flawfinder|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
8. GCC *syntastic-c-gcc*
|
||||
|
||||
Name: gcc
|
||||
Maintainer: Gregor Uhlenheuer <kongo2002@gmail.com>
|
||||
|
@ -790,7 +844,7 @@ executable.
|
|||
See also: |syntastic-cpp-gcc|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
7. make *syntastic-c-make*
|
||||
9. make *syntastic-c-make*
|
||||
|
||||
Name: make
|
||||
Maintainer: Gregor Uhlenheuer <kongo2002@gmail.com>
|
||||
|
@ -801,7 +855,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
|
|||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
8. OClint *syntastic-c-oclint*
|
||||
10. OClint *syntastic-c-oclint*
|
||||
|
||||
Name: oclint
|
||||
Maintainer: "UnCO" Lin <undercooled@lavabit.com>
|
||||
|
@ -840,7 +894,7 @@ Config files pointed to by 'g:syntastic_oclint_config_file' are then ignored.
|
|||
See also: |syntastic-cpp-oclint|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
9. PC-Lint *syntastic-c-pc_lint*
|
||||
11. PC-Lint *syntastic-c-pc_lint*
|
||||
|
||||
Name: pc_lint
|
||||
Maintainer: Steve Bragg <steve@empresseffects.com>
|
||||
|
@ -867,7 +921,7 @@ current directory and in parent directories; first such file found is used.
|
|||
See also: |syntastic-cpp-pc_lint|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
10. Sparse *syntastic-c-sparse*
|
||||
12. Sparse *syntastic-c-sparse*
|
||||
|
||||
Name: sparse
|
||||
Maintainer: Daniel Walker <dwalker@fifo99.com>
|
||||
|
@ -899,7 +953,7 @@ your vimrc: >
|
|||
This allows "Sparse" to read "GCC"'s private include files.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
11. Splint *syntastic-c-splint*
|
||||
13. Splint *syntastic-c-splint*
|
||||
|
||||
Name: splint
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
@ -955,11 +1009,13 @@ The following checkers are available for C++ (filetype "cpp"):
|
|||
2. ClangCheck...............|syntastic-cpp-clang_check|
|
||||
3. Clang-Tidy...............|syntastic-cpp-clang_tidy|
|
||||
4. Cppcheck.................|syntastic-cpp-cppcheck|
|
||||
5. Cpplint..................|syntastic-cpp-cpplint|
|
||||
6. GCC......................|syntastic-cpp-gcc|
|
||||
7. OClint...................|syntastic-cpp-oclint|
|
||||
8. PC-Lint..................|syntastic-cpp-pc_lint|
|
||||
9. Vera++...................|syntastic-cpp-verapp|
|
||||
5. cppclean.................|syntastic-cpp-cppclean|
|
||||
6. Cpplint..................|syntastic-cpp-cpplint|
|
||||
7. Flawfinder...............|syntastic-cpp-flawfinder|
|
||||
8. GCC......................|syntastic-cpp-gcc|
|
||||
9. OClint...................|syntastic-cpp-oclint|
|
||||
10. PC-Lint.................|syntastic-cpp-pc_lint|
|
||||
11. Vera++..................|syntastic-cpp-verapp|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. AVR-GCC *syntastic-cpp-avrgcc*
|
||||
|
@ -1103,7 +1159,31 @@ one option per line (cf. |syntastic-config-files|).
|
|||
See also: |syntastic-c-cppcheck|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5. Cpplint *syntastic-cpp-cpplint*
|
||||
5. cppclean *syntastic-cpp-cppclean*
|
||||
|
||||
Name: cppclean
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
||||
"cppclean" attempts to find problems in C++ source that slow development in
|
||||
large code bases, for example various forms of unused code. See the project's
|
||||
page at GitHub for more information:
|
||||
|
||||
https://github.com/myint/cppclean
|
||||
|
||||
Installation~
|
||||
|
||||
Install it with "pip": >
|
||||
pip install cppclean
|
||||
<
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
See also: |syntastic-c-cppclean|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6. Cpplint *syntastic-cpp-cpplint*
|
||||
|
||||
Name: cpplint
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
@ -1139,7 +1219,33 @@ However, if your "cpplint" was installed with "pip", the script's name is
|
|||
let g:syntastic_cpp_cpplint_exec = "cpplint"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
6. GCC *syntastic-cpp-gcc*
|
||||
7. Flawfinder *syntastic-cpp-flawfinder*
|
||||
|
||||
Name: flawfinder
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
||||
"Flawfinder" scans C/C++ source code for possible security weaknesses. See the
|
||||
project's page for more information:
|
||||
|
||||
https://www.dwheeler.com/flawfinder
|
||||
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
Additionally:
|
||||
|
||||
*'g:syntastic_cpp_flawfinder_thres'*
|
||||
Type: integer
|
||||
Default: 3
|
||||
Error threshold. Policy violations with a severity above this value are
|
||||
highlighted as errors, the others are considered warnings by syntastic.
|
||||
|
||||
See also: |syntastic-c-flawfinder|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
8. GCC *syntastic-cpp-gcc*
|
||||
|
||||
Name: gcc
|
||||
Maintainer: Gregor Uhlenheuer <kongo2002@gmail.com>
|
||||
|
@ -1236,7 +1342,7 @@ executable.
|
|||
See also: |syntastic-c-gcc|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
7. OClint *syntastic-cpp-oclint*
|
||||
9. OClint *syntastic-cpp-oclint*
|
||||
|
||||
Name: oclint
|
||||
Maintainer: "UnCO" Lin <undercooled@lavabit.com>
|
||||
|
@ -1276,7 +1382,7 @@ Config files pointed to by 'g:syntastic_oclint_config_file' are then ignored.
|
|||
See also: |syntastic-c-oclint|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
8. PC-Lint *syntastic-cpp-pc_lint*
|
||||
10. PC-Lint *syntastic-cpp-pc_lint*
|
||||
|
||||
Name: pc_lint
|
||||
Maintainer: Steve Bragg <steve@empresseffects.com>
|
||||
|
@ -1303,7 +1409,7 @@ current directory and in parent directories; first such file found is used.
|
|||
See also: |syntastic-c-pc_lint|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
9. Vera++ *syntastic-cpp-verapp*
|
||||
11. Vera++ *syntastic-cpp-verapp*
|
||||
|
||||
Name: verapp
|
||||
Maintainer: Lucas Verney <phyks@phyks.me>
|
||||
|
@ -1381,6 +1487,34 @@ You probably also need a plugin to set |filetype| for Chef files, such as
|
|||
|
||||
https://github.com/dougireton/vim-chef
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR CMAKE *syntastic-checkers-cmake*
|
||||
|
||||
The following checkers are available for CMake (filetype "cmake"):
|
||||
|
||||
1. cmakelint................|syntastic-cmake-cmakelint|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. cmakelint *syntastic-cmake-cmakelint*
|
||||
|
||||
Name: cmakelint
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
||||
"cmakelint" is a style checker for "CMake" files (https://cmake.org/).
|
||||
See the project's page at GitHub more information:
|
||||
|
||||
https://github.com/richq/cmake-lint
|
||||
|
||||
Installation~
|
||||
|
||||
Install it with "pip": >
|
||||
pip install cmakelint
|
||||
<
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR COBOL *syntastic-checkers-cobol*
|
||||
|
||||
|
@ -1480,7 +1614,8 @@ SYNTAX CHECKERS FOR COFFEESCRIPT *syntastic-checkers-coffee*
|
|||
The following checkers are available for CoffeeScript (filetype "coffee"):
|
||||
|
||||
1. Coffee...................|syntastic-coffee-coffee|
|
||||
2. CoffeeLint...............|syntastic-coffee-coffeelint|
|
||||
2. Coffee->JSHint...........|syntastic-coffee-coffee_jshint|
|
||||
3. CoffeeLint...............|syntastic-coffee-coffeelint|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. Coffee *syntastic-coffee-coffee*
|
||||
|
@ -1500,7 +1635,28 @@ This checker is initialised using the "makeprgBuild()" function and thus it
|
|||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2. CoffeeLint *syntastic-coffee-coffeelint*
|
||||
2. Coffee->JSHint *syntastic-coffee-coffee_jshint*
|
||||
|
||||
Name: coffee_jshint
|
||||
Maintainer: John Krauss <john@johnkrauss.com>
|
||||
|
||||
"Coffee->JSHint" is a JSHint validator for CoffeeScript. See the project's
|
||||
page at GitHub for details:
|
||||
|
||||
https://github.com/marviq/coffee-jshint
|
||||
|
||||
Installation~
|
||||
|
||||
Install it with "npm": >
|
||||
npm install -g coffee-jshint
|
||||
<
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
Accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3. CoffeeLint *syntastic-coffee-coffeelint*
|
||||
|
||||
Name: coffeelint
|
||||
Maintainer: Lincoln Stoll <l@lds.li>
|
||||
|
@ -1755,6 +1911,7 @@ SYNTAX CHECKERS FOR D *syntastic-checkers-d*
|
|||
The following checkers are available for D (filetype "d"):
|
||||
|
||||
1. DMD......................|syntastic-d-dmd|
|
||||
2. D-Scanner................|syntastic-d-dscanner|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. DMD *syntastic-d-dmd*
|
||||
|
@ -1834,6 +1991,22 @@ the usual 'g:syntastic_d_dmd_<option>' variables. The only exception is
|
|||
'g:syntastic_d_dmd_exec', which can still be used to override the checker's
|
||||
executable.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2. D-Scanner *syntastic-d-dscanner*
|
||||
|
||||
Name: dscanner
|
||||
Maintainer: ANtlord
|
||||
|
||||
"D-Scanner" is a tool for analyzing D source code (https://dlang.org/). See
|
||||
the project's page at GitHub for more information:
|
||||
|
||||
https://github.com/Hackerpilot/Dscanner
|
||||
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR DART *syntastic-checkers-dart*
|
||||
|
||||
|
@ -1934,6 +2107,7 @@ SYNTAX CHECKERS FOR DOCKERFILE *syntastic-checkers-dockerfile*
|
|||
The following checkers are available for Dockerfile (filetype "dockerfile"):
|
||||
|
||||
1. dockerfile-lint..........|syntastic-dockerfile-dockerfile_lint|
|
||||
2. Hadolint.................|syntastic-dockerfile-hadolint|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. dockerfile-lint *syntastic-dockerfile-dockerfile_lint*
|
||||
|
@ -1957,6 +2131,22 @@ Checker options~
|
|||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2. Hadolint *syntastic-dockerfile-hadolint*
|
||||
|
||||
Name: hadolint
|
||||
Maintainer: Jesper B. Rosenkilde <jbr@humppa.dk>
|
||||
|
||||
"Hadolint" is a dockerfile linter written in Haskell. See the project's page
|
||||
at GitHub for details:
|
||||
|
||||
https://github.com/lukasmartinelli/hadolint
|
||||
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR DUST *syntastic-checkers-dustjs*
|
||||
|
||||
|
@ -2210,10 +2400,37 @@ SYNTAX CHECKERS FOR GETTEXT PO *syntastic-checkers-po*
|
|||
|
||||
The following checkers are available for gettext .po files (filetype "po"):
|
||||
|
||||
1. msgfmt...................|syntastic-po-msgfmt|
|
||||
1. Dennis...................|syntastic-po-dennis|
|
||||
2. msgfmt...................|syntastic-po-msgfmt|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. msgfmt *syntastic-po-msgfmt*
|
||||
1. Dennis *syntastic-po-dennis*
|
||||
|
||||
Name: dennis
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
||||
"Dennis" is a set of utilities for working with gettext Portable Object
|
||||
(http://www.gnu.org/software/gettext/manual/html_node/PO-Files.html)
|
||||
translation files:
|
||||
|
||||
https://github.com/willkg/dennis/
|
||||
|
||||
See the program's manual for further details:
|
||||
|
||||
http://dennis.readthedocs.io/en/latest/linting.html
|
||||
|
||||
Installation~
|
||||
|
||||
Install it with "pip": >
|
||||
pip install dennis
|
||||
<
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2. msgfmt *syntastic-po-msgfmt*
|
||||
|
||||
Name: msgfmt
|
||||
Maintainer: Ryo Okubo <syucream1031@gmail.com>
|
||||
|
@ -2640,7 +2857,9 @@ Checker options~
|
|||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
Note~
|
||||
Notes~
|
||||
|
||||
Automatically fixing errors (option "--fix") is not supported.
|
||||
|
||||
You can also use "eslint_d" (https://github.com/mantoni/eslint_d.js), version
|
||||
2.1.0 or later, instead of "ESLint". Just point 'g:syntastic_html_eslint_exec'
|
||||
|
@ -3226,7 +3445,7 @@ accepts the standard options described at |syntastic-config-makeprg|.
|
|||
|
||||
Notes~
|
||||
|
||||
Syntastic requires "Flow" version 0.18.1 or later.
|
||||
Syntastic requires "Flow" version 0.34.0 or later.
|
||||
|
||||
To use "Flow" with your projects, you must:
|
||||
|
||||
|
@ -3557,6 +3776,44 @@ Checker options~
|
|||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR JULIA *syntastic-checkers-julia*
|
||||
|
||||
The following checkers are available for Julia (filetype "julia"):
|
||||
|
||||
1. lint.....................|syntastic-julia-lint|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. lint *syntastic-julia-lint*
|
||||
|
||||
Name: lint
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
||||
This is a checker for Julia files (https://julialang.org/), using the Julia
|
||||
package "Lint". See the package's documentation for more information:
|
||||
|
||||
http://lintjl.readthedocs.io/
|
||||
|
||||
Installation~
|
||||
|
||||
You need to install Julia itself, and the package "Lint". You can install
|
||||
"Lint" from the Julia package manager, with the command: >
|
||||
Pkg.add("Lint")
|
||||
<
|
||||
Checker Options~
|
||||
|
||||
This checker doesn't call the "makeprgBuild()" function, and thus it ignores
|
||||
the usual 'g:syntastic_julia_lint_<option>' variables. The only exception is
|
||||
'g:syntastic_julia_lint_exec', which can still be used to override the "julia"
|
||||
executable.
|
||||
|
||||
Note~
|
||||
|
||||
You probably also need a plugin to set |filetype| for Julia files, such as
|
||||
"julia-vim":
|
||||
|
||||
https://github.com/JuliaEditorSupport/julia-vim
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR LESS *syntastic-checkers-less*
|
||||
|
||||
|
@ -4400,6 +4657,7 @@ The following checkers are available for PHP (filetype "php"):
|
|||
2. PHP_CodeSniffer..........|syntastic-php-phpcs|
|
||||
3. PHPLint..................|syntastic-php-phplint|
|
||||
4. PHP Mess Detector........|syntastic-php-phpmd|
|
||||
5. PHPStan..................|syntastic-php-phpstan|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. PHP *syntastic-php-php*
|
||||
|
@ -4479,6 +4737,24 @@ Checker options~
|
|||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5. PHP Static Analysis Tool *syntastic-php-phpstan*
|
||||
|
||||
Name: phpstan
|
||||
Maintainer: Przepompownia <przepompownia@users.noreply.github.com>
|
||||
|
||||
"PHPStan" focuses on finding errors in your code without actually running it.
|
||||
See the project's page iat GitHub for details:
|
||||
|
||||
https://github.com/phpstan/phpstan
|
||||
|
||||
Syntastic supports "PHPStan" versions 0.7 and later.
|
||||
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR POD *syntastic-checkers-pod*
|
||||
|
||||
|
@ -4595,20 +4871,49 @@ SYNTAX CHECKERS FOR PYTHON *syntastic-checkers-python*
|
|||
|
||||
The following checkers are available for Python (filetype "python"):
|
||||
|
||||
1. flake8...................|syntastic-python-flake8|
|
||||
2. Frosted..................|syntastic-python-frosted|
|
||||
3. mypy.....................|syntastic-python-mypy|
|
||||
4. Prospector...............|syntastic-python-prospector|
|
||||
5. py3kwarn.................|syntastic-python-py3kwarn|
|
||||
6. pycodestyle..............|syntastic-python-pycodestyle|
|
||||
7. pydocstyle...............|syntastic-python-pydocstyle|
|
||||
8. Pyflakes.................|syntastic-python-pyflakes|
|
||||
9. Pylama...................|syntastic-python-pylama|
|
||||
10. Pylint..................|syntastic-python-pylint|
|
||||
11. python..................|syntastic-python-python|
|
||||
1. Bandit...................|syntastic-python-bandit|
|
||||
2. flake8...................|syntastic-python-flake8|
|
||||
3. Frosted..................|syntastic-python-frosted|
|
||||
4. mypy.....................|syntastic-python-mypy|
|
||||
5. Prospector...............|syntastic-python-prospector|
|
||||
6. py3kwarn.................|syntastic-python-py3kwarn|
|
||||
7. pycodestyle..............|syntastic-python-pycodestyle|
|
||||
8. pydocstyle...............|syntastic-python-pydocstyle|
|
||||
9. Pyflakes.................|syntastic-python-pyflakes|
|
||||
10. Pylama..................|syntastic-python-pylama|
|
||||
11. Pylint..................|syntastic-python-pylint|
|
||||
12. python..................|syntastic-python-python|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. flake8 *syntastic-python-flake8*
|
||||
1. Bandit *syntastic-python-bandit*
|
||||
|
||||
Name: bandit
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
||||
"Bandit" is an AST-based static analyzer for Python from OpenStack Security
|
||||
Group (http://openstack.org). See the project's official documentation for
|
||||
details:
|
||||
|
||||
https://wiki.openstack.org/wiki/Security/Projects/Bandit
|
||||
|
||||
Installation~
|
||||
|
||||
Install it with "pip": >
|
||||
pip install bandit
|
||||
<
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
Note~
|
||||
|
||||
In order to check all files in a project, rather than the current file: >
|
||||
let g:syntastic_python_bandit_fname = ['/path/to/project']
|
||||
let g:syntastic_python_bandit_args = '-r'
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
2. flake8 *syntastic-python-flake8*
|
||||
|
||||
Name: flake8
|
||||
Maintainers: Sylvain Soliman <Sylvain.Soliman+git@gmail.com>
|
||||
|
@ -4628,7 +4933,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
|
|||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2. Frosted *syntastic-python-frosted*
|
||||
3. Frosted *syntastic-python-frosted*
|
||||
|
||||
Name: frosted
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
@ -4644,7 +4949,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
|
|||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3. mypy *syntastic-python-mypy*
|
||||
4. mypy *syntastic-python-mypy*
|
||||
|
||||
Name: mypy
|
||||
Maintainer: Russ Hewgill <Russ.Hewgill@gmail.com>
|
||||
|
@ -4660,7 +4965,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
|
|||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4. Prospector *syntastic-python-prospector*
|
||||
5. Prospector *syntastic-python-prospector*
|
||||
|
||||
Name: prospector
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
@ -4683,7 +4988,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
|
|||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5. py3kwarn *syntastic-python-py3kwarn*
|
||||
6. py3kwarn *syntastic-python-py3kwarn*
|
||||
|
||||
Name: py3kwarn
|
||||
Author: Liam Curry <liam@curry.name>
|
||||
|
@ -4699,7 +5004,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
|
|||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6. pycodestyle *syntastic-python-pycodestyle*
|
||||
7. pycodestyle *syntastic-python-pycodestyle*
|
||||
|
||||
Name: pycodestyle
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
@ -4716,7 +5021,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
|
|||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
7. pydocstyle *syntastic-python-pydocstyle*
|
||||
8. pydocstyle *syntastic-python-pydocstyle*
|
||||
|
||||
Name: pydocstyle
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
@ -4734,7 +5039,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
|
|||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
8. Pyflakes *syntastic-python-pyflakes*
|
||||
9. Pyflakes *syntastic-python-pyflakes*
|
||||
|
||||
Name: pyflakes
|
||||
Authors: Martin Grenfell <martin.grenfell@gmail.com>
|
||||
|
@ -4752,7 +5057,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
|
|||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
9. Pylama *syntastic-python-pylama*
|
||||
10. Pylama *syntastic-python-pylama*
|
||||
|
||||
Name: pylama
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
@ -4778,7 +5083,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
|
|||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
10. Pylint *syntastic-python-pylint*
|
||||
11. Pylint *syntastic-python-pylint*
|
||||
|
||||
Name: pylint
|
||||
Author: Parantapa Bhattacharya <parantapa@gmail.com>
|
||||
|
@ -4808,7 +5113,7 @@ recognise any messages. Example: >
|
|||
\ '--msg-template="{path}:{line}:{column}:{C}: [{symbol} {msg_id}] {msg}"'
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
11. python *syntastic-python-python*
|
||||
12. python *syntastic-python-python*
|
||||
|
||||
Name: python
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
@ -4884,59 +5189,11 @@ SYNTAX CHECKERS FOR R *syntastic-checkers-r*
|
|||
|
||||
The following checkers are available for R (filetype "r"):
|
||||
|
||||
1. lint.....................|syntastic-r-lint|
|
||||
2. lintr....................|syntastic-r-lintr|
|
||||
3. svtools..................|syntastic-r-svtools|
|
||||
1. lintr....................|syntastic-r-lintr|
|
||||
2. svtools..................|syntastic-r-svtools|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. lint *syntastic-r-lint*
|
||||
|
||||
Name: lint
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
||||
This is a style checker for R files, using the R package "lint":
|
||||
|
||||
http://cran.r-project.org/web/packages/lint/
|
||||
|
||||
Checker option~
|
||||
|
||||
*'g:syntastic_r_lint_styles'*
|
||||
Type: string
|
||||
Default: "lint.style"
|
||||
R list of style tests to apply.
|
||||
|
||||
Set 'g:syntastic_r_lint_styles' to something like this: >
|
||||
let g:syntastic_r_lint_styles =
|
||||
\ 'list(spacing.indentation.notabs, spacing.indentation.evenindent)'
|
||||
<
|
||||
See "lint"'s manual for possible values:
|
||||
|
||||
http://cran.r-project.org/web/packages/lint/lint.pdf
|
||||
|
||||
Note~
|
||||
|
||||
This checker doesn't call the "makeprgBuild()" function, and thus it ignores
|
||||
the usual 'g:syntastic_r_lint_<option>' variables. The only exception is
|
||||
'g:syntastic_r_lint_exec', which can still be used to override the "R"
|
||||
executable.
|
||||
|
||||
Limitations~
|
||||
|
||||
The checker uses column numbers only when running into syntax errors. If
|
||||
you're checking files containing tab characters, then Vim's 'tabstop' must
|
||||
match R's idea of tabstop, otherwise column numbers will be shifted. At the
|
||||
time of this writing R's tabstop is hardcoded to 8, so you should probably
|
||||
add something like this to your vimrc: >
|
||||
set tabstop=8
|
||||
<
|
||||
The "lint" package will only show at most 5 messages of a kind. At the time of
|
||||
this writing this is not configurable.
|
||||
|
||||
Beware also that the checker is pretty slow when using the default style
|
||||
setting of "lint.style".
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2. lintr *syntastic-r-lintr*
|
||||
1. lintr *syntastic-r-lintr*
|
||||
|
||||
Name: lintr
|
||||
Maintainer: Jim Hester <james.f.hester@gmail.com>
|
||||
|
@ -4984,7 +5241,7 @@ executable.
|
|||
See also: |syntastic-rmd-lintr|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3. svtools *syntastic-r-svtools*
|
||||
2. svtools *syntastic-r-svtools*
|
||||
|
||||
Name: svtools
|
||||
Maintainer: LCD 47 <lcd047@gmail.com>
|
||||
|
@ -5909,6 +6166,13 @@ Installation~
|
|||
You can install "Slim-Lint" with "gem": >
|
||||
gem install slim_lint
|
||||
<
|
||||
Note~
|
||||
|
||||
You probably also need a plugin to set |filetype| for Slim files, such as
|
||||
"vim-slim":
|
||||
|
||||
https://github.com/slim-template/vim-slim
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2. Slimrb *syntastic-slim-slimrb*
|
||||
|
||||
|
@ -5925,6 +6189,13 @@ Checker options~
|
|||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
Note~
|
||||
|
||||
You probably also need a plugin to set |filetype| for Slim files, such as
|
||||
"vim-slim":
|
||||
|
||||
https://github.com/slim-template/vim-slim
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR SML *syntastic-checkers-sml*
|
||||
|
||||
|
@ -5953,6 +6224,7 @@ SYNTAX CHECKERS FOR SOLIDITY *syntastic-checkers-solidity*
|
|||
The following checkers are available for Solidity (filetype "solidity"):
|
||||
|
||||
1. solc.....................|syntastic-solidity-solc|
|
||||
2. Solium...................|syntastic-solidity-solium|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
1. solc *syntastic-solidity-solc*
|
||||
|
@ -5977,6 +6249,27 @@ You probably also need a plugin to set |filetype| for Solidity files, such as
|
|||
|
||||
https://github.com/tomlion/vim-solidity
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2. Solium *syntastic-solidity-solium*
|
||||
|
||||
Name: solium
|
||||
Maintainer: Matthijs van den Bos <matthijs@vandenbos.org>
|
||||
|
||||
"Solium" is a linter for "Solidity" files. See the project's page for details:
|
||||
|
||||
https://github.com/duaraghav8/Solium
|
||||
|
||||
Checker options~
|
||||
|
||||
This checker is initialised using the "makeprgBuild()" function and thus it
|
||||
accepts the standard options described at |syntastic-config-makeprg|.
|
||||
|
||||
Note~
|
||||
|
||||
You probably also need a plugin to set |filetype| for Solidity files, such as
|
||||
"vim-solidity":
|
||||
|
||||
https://github.com/tomlion/vim-solidity
|
||||
|
||||
==============================================================================
|
||||
SYNTAX CHECKERS FOR SQL *syntastic-checkers-sql*
|
||||
|
|
|
@ -164,7 +164,7 @@ When syntax errors are detected a flag will be shown. The content of the flag
|
|||
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 the |syntastic-compatibility| notes
|
||||
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
|
||||
|
|
|
@ -19,7 +19,7 @@ if has('reltime')
|
|||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.8.0-10'
|
||||
let g:_SYNTASTIC_VERSION = '3.8.0-63'
|
||||
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)
|
||||
|
@ -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
|
||||
|
@ -344,13 +354,6 @@ function! s:BufWinEnterHook(fname) abort " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! s:VimEnterHook() abort " {{{2
|
||||
let g:syntastic_version =
|
||||
\ g:_SYNTASTIC_VERSION .
|
||||
\ ' (Vim ' . v:version . (has('nvim') ? ', Neovim' : '') . ', ' .
|
||||
\ g:_SYNTASTIC_UNAME .
|
||||
\ (has('gui') ? ', GUI' : '') . ')'
|
||||
lockvar g:syntastic_version
|
||||
|
||||
let buf = bufnr('')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: VimEnter, buffer ' . buf . ' = ' . string(bufname(buf)) . ', &buftype = ' . string(&buftype))
|
||||
|
|
|
@ -19,6 +19,7 @@ let s:_DEFAULT_CHECKERS = {
|
|||
\ 'c': ['gcc'],
|
||||
\ 'cabal': ['cabal'],
|
||||
\ 'chef': ['foodcritic'],
|
||||
\ 'cmake': ['cmakelint'],
|
||||
\ 'co': ['coco'],
|
||||
\ 'cobol': ['cobc'],
|
||||
\ 'coffee': ['coffee', 'coffeelint'],
|
||||
|
@ -50,6 +51,7 @@ let s:_DEFAULT_CHECKERS = {
|
|||
\ 'java': ['javac'],
|
||||
\ 'javascript': ['jshint', 'jslint'],
|
||||
\ 'json': ['jsonlint', 'jsonval'],
|
||||
\ 'julia': [],
|
||||
\ 'less': ['lessc'],
|
||||
\ 'lex': ['flex'],
|
||||
\ 'limbo': ['limbo'],
|
||||
|
|
|
@ -34,19 +34,20 @@ function! SyntaxCheckers_asm_gcc_IsAvailable() dict " {{{1
|
|||
endfunction " }}}1
|
||||
|
||||
function! SyntaxCheckers_asm_gcc_GetLocList() dict " {{{1
|
||||
let buf = bufnr('')
|
||||
return syntastic#c#GetLocList('asm', 'gcc', {
|
||||
\ 'errorformat':
|
||||
\ '%-G%f:%s:,' .
|
||||
\ '%f:%l:%c: %trror: %m,' .
|
||||
\ '%f:%l:%c: %tarning: %m,' .
|
||||
\ '%f:%l: %m',
|
||||
\ 'main_flags': '-x assembler -fsyntax-only' . (g:syntastic_asm_generic ? '' : ' -masm=' . s:GetDialect()) })
|
||||
\ 'main_flags': '-x assembler -fsyntax-only' . (g:syntastic_asm_generic ? '' : ' -masm=' . s:GetDialect(buf)) })
|
||||
endfunction " }}}1
|
||||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:GetDialect() " {{{2
|
||||
return syntastic#util#var('asm_dialect', expand('%:e', 1) ==? 'asm' ? 'intel' : 'att')
|
||||
function! s:GetDialect(buf) " {{{2
|
||||
return syntastic#util#bufVar(a:buf, 'asm_dialect', fnamemodify(bufname(a:buf), ':e') ==? 'asm' ? 'intel' : 'att')
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
|
40
sources_non_forked/syntastic/syntax_checkers/c/cppclean.vim
Normal file
40
sources_non_forked/syntastic/syntax_checkers/c/cppclean.vim
Normal file
|
@ -0,0 +1,40 @@
|
|||
"============================================================================
|
||||
"File: cppclean.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: LCD 47 <lcd047 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_c_cppclean_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_c_cppclean_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_c_cppclean_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat = '%f:%l: %m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0, 1] })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'c',
|
||||
\ 'name': 'cppclean' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -0,0 +1,61 @@
|
|||
"============================================================================
|
||||
"File: flawfinder.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: LCD 47 <lcd047 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_c_flawfinder_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_c_flawfinder_checker = 1
|
||||
|
||||
if !exists('g:syntastic_c_flawfinder_sort')
|
||||
let g:syntastic_c_flawfinder_sort = 1
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_c_flawfinder_thres')
|
||||
let g:syntastic_c_flawfinder_thres = 3
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_c_flawfinder_GetHighlightRegex(item)
|
||||
let term = matchstr(a:item['text'], '\m^(\S\+)\s\+\zs\S\+\ze:')
|
||||
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_c_flawfinder_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': '--columns --dataonly --singleline --quiet' })
|
||||
|
||||
let errorformat = '%f:%l:%c: [%n] %m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0] })
|
||||
|
||||
for e in loclist
|
||||
let e['type'] = e['nr'] < g:syntastic_{self.getFiletype()}_flawfinder_thres ? 'W' : 'E'
|
||||
let e['nr'] = 0
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'c',
|
||||
\ 'name': 'flawfinder' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -23,7 +23,8 @@ if !exists('g:syntastic_pc_lint_config_file')
|
|||
endif
|
||||
|
||||
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
|
||||
let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, expand('%:p:h', 1))
|
||||
let buf = bufnr('')
|
||||
let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, fnamemodify(bufname(buf), ':p:h'))
|
||||
call self.log('config =', config)
|
||||
|
||||
" -hFs1 - show filename, add space after messages, try to make message 1 line
|
||||
|
|
|
@ -31,6 +31,7 @@ function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item)
|
|||
endfunction
|
||||
|
||||
function! SyntaxCheckers_cabal_cabal_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
let makeprg = self.getExecEscaped() . ' check'
|
||||
|
||||
let errorformat =
|
||||
|
@ -40,9 +41,9 @@ function! SyntaxCheckers_cabal_cabal_GetLocList() dict
|
|||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'cwd': expand('%:p:h', 1),
|
||||
\ 'cwd': fnamemodify(bufname(buf), ':p:h'),
|
||||
\ 'preprocess': 'cabal',
|
||||
\ 'defaults': {'bufnr': bufnr('')} })
|
||||
\ 'defaults': {'bufnr': buf} })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
"============================================================================
|
||||
"File: cmakelint.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: LCD 47 <lcd047 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_cmake_cmakelint_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_cmake_cmakelint_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_cmake_cmakelint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat = '%f:%l: %m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0, 1] })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'cmake',
|
||||
\ 'name': 'cmakelint' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -0,0 +1,44 @@
|
|||
"============================================================================
|
||||
"File: coffee_jshint.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: John Krauss <john@johnkrauss.com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_coffee_coffee_jshint_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_coffee_coffee_jshint_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_coffee_coffee_jshint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat =
|
||||
\ '%Q-%\{32\,},' .
|
||||
\ '%E%l:%c: %m,' .
|
||||
\ '%P%f'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'returns': [0, 1] })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'coffee',
|
||||
\ 'exec': 'coffee-jshint',
|
||||
\ 'name': 'coffee_jshint' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
"============================================================================
|
||||
"File: cppclean.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: Benjamin Bannier <bbannier at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_cpp_cppclean_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_cpp_cppclean_checker = 1
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'cpp',
|
||||
\ 'name': 'cppclean',
|
||||
\ 'redirect': 'c/cppclean'})
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -0,0 +1,26 @@
|
|||
"============================================================================
|
||||
"File: flawfinder.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: Benjamin Bannier <bbannier at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_cpp_flawfinder_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_cpp_flawfinder_checker = 1
|
||||
|
||||
if !exists('g:syntastic_cpp_flawfinder_thres')
|
||||
let g:syntastic_cpp_flawfinder_thres = 3
|
||||
endif
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'cpp',
|
||||
\ 'name': 'flawfinder',
|
||||
\ 'redirect': 'c/flawfinder'})
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -33,6 +33,7 @@ function! SyntaxCheckers_css_csslint_GetLocList() dict
|
|||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'postprocess': ['guards'],
|
||||
\ 'defaults': {'bufnr': bufnr('')} })
|
||||
|
||||
endfunction
|
||||
|
|
|
@ -18,7 +18,8 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
|
||||
let arch_flag = syntastic#util#var('cuda_arch')
|
||||
let buf = bufnr('')
|
||||
let arch_flag = syntastic#util#bufVar(buf, 'cuda_arch')
|
||||
if arch_flag !=# ''
|
||||
let arch_flag = '-arch=' . arch_flag
|
||||
call syntastic#log#oneTimeWarn('variable g:syntastic_cuda_arch is deprecated, ' .
|
||||
|
@ -27,9 +28,9 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
|
|||
|
||||
let build_opts = {}
|
||||
let dummy = ''
|
||||
if index(['h', 'hpp', 'cuh'], expand('%:e', 1), 0, 1) >= 0
|
||||
if syntastic#util#var('cuda_check_header', 0)
|
||||
let dummy = expand('%:p:h', 1) . syntastic#util#Slash() . '.syntastic_dummy.cu'
|
||||
if index(['h', 'hpp', 'cuh'], fnamemodify(bufname(buf), ':e'), 0, 1) >= 0
|
||||
if syntastic#util#bufVar(buf, 'cuda_check_header', 0)
|
||||
let dummy = fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . '.syntastic_dummy.cu'
|
||||
let build_opts = {
|
||||
\ 'exe_before': 'echo > ' . syntastic#util#shescape(dummy) . ' ;',
|
||||
\ 'fname_before': '.syntastic_dummy.cu -include' }
|
||||
|
@ -62,7 +63,18 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
|
|||
\ '%DMaking %*\a in %f,'.
|
||||
\ '%f|%l| %m'
|
||||
|
||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'type': 'E'} })
|
||||
|
||||
for e in loclist
|
||||
let pat = matchstr(e['text'], '\m\c^\s*warning:\s*\zs.*')
|
||||
if pat !=# ''
|
||||
let e['text'] = pat
|
||||
let e['type'] = 'W'
|
||||
endif
|
||||
endfor
|
||||
|
||||
if dummy !=# ''
|
||||
call delete(dummy)
|
||||
|
|
|
@ -44,8 +44,9 @@ function! SyntaxCheckers_d_dmd_IsAvailable() dict " {{{1
|
|||
endfunction " }}}1
|
||||
|
||||
function! SyntaxCheckers_d_dmd_GetLocList() dict " {{{1
|
||||
let buf = bufnr('')
|
||||
if !exists('g:syntastic_d_include_dirs')
|
||||
let g:syntastic_d_include_dirs = s:GetIncludes(self, expand('%:p:h'))
|
||||
let g:syntastic_d_include_dirs = s:GetIncludes(self, fnamemodify(bufname(buf), ':p:h'))
|
||||
endif
|
||||
|
||||
return syntastic#c#GetLocList('d', 'dmd', {
|
||||
|
|
48
sources_non_forked/syntastic/syntax_checkers/d/dscanner.vim
Normal file
48
sources_non_forked/syntastic/syntax_checkers/d/dscanner.vim
Normal file
|
@ -0,0 +1,48 @@
|
|||
"============================================================================
|
||||
"File: dscanner.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: ANtlord
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_d_dscanner_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_d_dscanner_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_d_dscanner_GetHighlightRegex(i)
|
||||
let term = matchstr(a:i['text'], '\m^.\{-}''\zs\S\+\ze''')
|
||||
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_d_dscanner_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': '--report',
|
||||
\ 'tail': '2>' . syntastic#util#DevNull() })
|
||||
|
||||
let errorformat = '%f:%l:%c:%m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'preprocess': 'dscanner',
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0] })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'd',
|
||||
\ 'name': 'dscanner' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -30,7 +30,10 @@ function! SyntaxCheckers_dart_dartanalyzer_GetHighlightRegex(error)
|
|||
endfunction
|
||||
|
||||
function! SyntaxCheckers_dart_dartanalyzer_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '--machine' })
|
||||
if !exists('s:format_machine')
|
||||
let s:format_machine = syntastic#util#versionIsAtLeast(self.getVersion(), [1, 23]) ? '--format=machine' : '--machine'
|
||||
endif
|
||||
let makeprg = self.makeprgBuild({ 'args_after': s:format_machine })
|
||||
|
||||
" Machine readable format looks like:
|
||||
" SEVERITY|TYPE|ERROR_CODE|FILENAME|LINE_NUMBER|COLUMN|LENGTH|MESSAGE
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
"============================================================================
|
||||
"File: hadolint.vim
|
||||
"Description: Dockerfile linter written in Haskell
|
||||
" (http://hadolint.lukasmartinelli.ch/).
|
||||
"Maintainer: Jesper B. Rosenkilde <jbr at humppa dot dk>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_dockerfile_hadolint_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_dockerfile_hadolint_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_dockerfile_hadolint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat = '%W%f:%l %m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0, 1] })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'dockerfile',
|
||||
\ 'name': 'hadolint'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -27,9 +27,10 @@ function! SyntaxCheckers_elixir_elixir_IsAvailable() dict
|
|||
endfunction
|
||||
|
||||
function! SyntaxCheckers_elixir_elixir_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
let make_options = {}
|
||||
let compile_command = 'elixir'
|
||||
let mix_file = syntastic#util#findFileInParent('mix.exs', expand('%:p:h', 1))
|
||||
let mix_file = syntastic#util#findFileInParent('mix.exs', fnamemodify(bufname(buf), ':p:h'))
|
||||
|
||||
if filereadable(mix_file)
|
||||
let compile_command = 'mix compile'
|
||||
|
|
|
@ -13,28 +13,58 @@ main([File]) ->
|
|||
%% `rebar.config` is looked for,
|
||||
%% but it is not necessarily the one in the project root.
|
||||
%% I.e. it may be one deeper in the project file hierarchy.
|
||||
RebarFile = rebar_file(Dir),
|
||||
%% `rebar.config` might contain relative paths.
|
||||
%% They are relative to the file! Not to the project root.
|
||||
RebarOpts = rebar_opts(Dir ++ "/" ++ RebarFile),
|
||||
Profile = which_compile_opts_profile(filename:absname(File)),
|
||||
CompileOpts = case which_build_tool(Dir, Profile) of
|
||||
{rebar, RebarFile} ->
|
||||
%% `rebar.config` might contain relative paths.
|
||||
%% They are relative to the file! Not to the project root.
|
||||
%% rebar specific begin
|
||||
rebar_opts(RebarFile);
|
||||
%% rebar specific end
|
||||
{erlangmk, ErlangMkDir} ->
|
||||
%% Erlang.mk specific begin
|
||||
erlangmk_opts(ErlangMkDir, Profile);
|
||||
%% Erlang.mk specific end
|
||||
undefined ->
|
||||
fallback_opts()
|
||||
end,
|
||||
code:add_patha(filename:absname("ebin")),
|
||||
%% `compile:file/2` requires the `{i, Path}` to be relative
|
||||
%% to CWD - no surprise here.
|
||||
compile:file(File, Defs ++ translate_paths(Dir, RebarOpts));
|
||||
compile:file(File, Defs ++ translate_paths(Dir, CompileOpts));
|
||||
|
||||
main(_) ->
|
||||
io:format("Usage: ~s <file>~n", [escript:script_name()]),
|
||||
halt(1).
|
||||
|
||||
rebar_file(Dir) ->
|
||||
DirList = filename:split(Dir),
|
||||
case lists:last(DirList) of
|
||||
"test" ->
|
||||
"rebar.test.config";
|
||||
_ ->
|
||||
"rebar.config"
|
||||
which_compile_opts_profile(File) ->
|
||||
case filename:basename(filename:dirname(File)) of
|
||||
"test" -> test;
|
||||
_ -> normal
|
||||
end.
|
||||
|
||||
which_build_tool(Dir, Profile) ->
|
||||
%% rebar specific begin
|
||||
RebarFile = rebar_file(Dir, Profile),
|
||||
%% rebar specific end
|
||||
case filelib:is_file(RebarFile) of
|
||||
true ->
|
||||
{rebar, RebarFile};
|
||||
false ->
|
||||
%% Erlang.mk specific begin
|
||||
ErlangMk = erlangmk_file(Dir),
|
||||
%% Erlang.mk specific end
|
||||
case filelib:is_file(ErlangMk) of
|
||||
true -> {erlangmk, Dir};
|
||||
false -> undefined
|
||||
end
|
||||
end.
|
||||
|
||||
rebar_file(Dir, normal) -> filename:join(Dir, "rebar.config");
|
||||
rebar_file(Dir, test) -> filename:join(Dir, "rebar.test.config").
|
||||
|
||||
erlangmk_file(Dir) -> filename:join(Dir, "erlang.mk").
|
||||
|
||||
rebar_opts(RebarFile) ->
|
||||
Dir = get_root(filename:dirname(RebarFile)),
|
||||
case file:consult(RebarFile) of
|
||||
|
@ -54,6 +84,165 @@ rebar_opts(RebarFile) ->
|
|||
rebar_opts("rebar.config")
|
||||
end.
|
||||
|
||||
erlangmk_opts(BaseDir, Profile) ->
|
||||
Make =
|
||||
case os:getenv("MAKE") of
|
||||
false ->
|
||||
case os:find_executable("gmake") of
|
||||
false -> "make";
|
||||
Path -> Path
|
||||
end;
|
||||
Cmd ->
|
||||
case (lists:member($/, Cmd) orelse lists:member($\\, Cmd)) of
|
||||
true -> Cmd;
|
||||
false -> os:find_executable(Cmd)
|
||||
end
|
||||
end,
|
||||
ERLC_OPTS_Target =
|
||||
case Profile of
|
||||
normal -> "show-ERLC_OPTS";
|
||||
test -> "show-TEST_ERLC_OPTS"
|
||||
end,
|
||||
Args = [
|
||||
"--no-print-directory",
|
||||
"-C", BaseDir,
|
||||
"show-ERL_LIBS",
|
||||
ERLC_OPTS_Target
|
||||
],
|
||||
try
|
||||
Port = erlang:open_port({spawn_executable, Make}, [
|
||||
{args, Args},
|
||||
exit_status, use_stdio, stderr_to_stdout]),
|
||||
case erlangmk_port_receive_loop(Port, "", BaseDir) of
|
||||
{error, _} ->
|
||||
fallback_opts();
|
||||
{ok, {ErlLibs, ErlcOpts}} ->
|
||||
[code:add_pathsa(filelib:wildcard(
|
||||
filename:join([ErlLib, "*", "ebin"])))
|
||||
|| ErlLib <- ErlLibs],
|
||||
ErlcOpts
|
||||
end
|
||||
catch
|
||||
error:_ ->
|
||||
fallback_opts()
|
||||
end.
|
||||
|
||||
erlangmk_port_receive_loop(Port, Stdout, BaseDir) ->
|
||||
receive
|
||||
{Port, {exit_status, 0}} ->
|
||||
erlangmk_format_opts(Stdout, BaseDir);
|
||||
{Port, {exit_status, _}} ->
|
||||
{error, {erlangmk, make_target_failure}};
|
||||
{Port, {data, Out}} ->
|
||||
erlangmk_port_receive_loop(Port, Stdout ++ Out, BaseDir)
|
||||
end.
|
||||
|
||||
erlangmk_format_opts(Stdout, BaseDir) ->
|
||||
case string:tokens(Stdout, "\n") of
|
||||
[ErlLibsLine | ErlcOptsLines] ->
|
||||
ErlLibs = erlangmk_format_erl_libs(ErlLibsLine),
|
||||
ErlcOpts = erlangmk_format_erlc_opts(ErlcOptsLines, BaseDir),
|
||||
{ok, {ErlLibs, ErlcOpts}};
|
||||
_ ->
|
||||
{error, {erlangmk, incorrect_output}}
|
||||
end.
|
||||
|
||||
erlangmk_format_erl_libs(ErlLibsLine) ->
|
||||
case os:type() of
|
||||
{win32, _} -> string:tokens(ErlLibsLine, ";");
|
||||
_ -> string:tokens(ErlLibsLine, ":")
|
||||
end.
|
||||
|
||||
erlangmk_format_erlc_opts(ErlcOptsLines, BaseDir) ->
|
||||
erlangmk_format_erlc_opts(ErlcOptsLines, [], BaseDir).
|
||||
|
||||
erlangmk_format_erlc_opts(["+" ++ Option | Rest], Opts, BaseDir) ->
|
||||
case make_term(Option) of
|
||||
{error, _} -> erlangmk_format_erlc_opts(Rest, Opts, BaseDir);
|
||||
Opt -> erlangmk_format_erlc_opts(Rest, [Opt | Opts], BaseDir)
|
||||
end;
|
||||
erlangmk_format_erlc_opts(["-I" ++ Opt | Rest], Opts, BaseDir)
|
||||
when Opt =/= "" ->
|
||||
erlangmk_format_erlc_opts(["-I", Opt | Rest], Opts, BaseDir);
|
||||
erlangmk_format_erlc_opts(["-I", [C | _] = Dir | Rest], Opts, BaseDir)
|
||||
when C =/= $- andalso C =/= $+ ->
|
||||
AbsDir = filename:absname(Dir, BaseDir),
|
||||
erlangmk_format_erlc_opts(Rest, [{i, AbsDir} | Opts], BaseDir);
|
||||
erlangmk_format_erlc_opts(["-W" ++ Warn | Rest], Opts, BaseDir)
|
||||
when Warn =/= "" ->
|
||||
erlangmk_format_erlc_opts(["-W", Warn | Rest], Opts, BaseDir);
|
||||
erlangmk_format_erlc_opts(["-W", Warn | Rest], Opts, BaseDir) ->
|
||||
case Warn of
|
||||
"all" ->
|
||||
erlangmk_format_erlc_opts(Rest, [{warn_format, 999} | Opts],
|
||||
BaseDir);
|
||||
"error" ->
|
||||
erlangmk_format_erlc_opts(Rest, [warnings_as_errors | Opts],
|
||||
BaseDir);
|
||||
"" ->
|
||||
erlangmk_format_erlc_opts(Rest, [{warn_format, 1} | Opts],
|
||||
BaseDir);
|
||||
_ ->
|
||||
try list_to_integer(Warn) of
|
||||
Level ->
|
||||
erlangmk_format_erlc_opts(Rest,
|
||||
[{warn_format, Level} | Opts], BaseDir)
|
||||
catch
|
||||
error:badarg ->
|
||||
erlangmk_format_erlc_opts(Rest, Opts, BaseDir)
|
||||
end
|
||||
end;
|
||||
erlangmk_format_erlc_opts(["-D" ++ Opt | Rest], Opts, BaseDir)
|
||||
when Opt =/= "" ->
|
||||
erlangmk_format_erlc_opts(["-D", Opt | Rest], Opts, BaseDir);
|
||||
erlangmk_format_erlc_opts(["-D", [C | _] = Val0 | Rest], Opts, BaseDir)
|
||||
when C =/= $- andalso C =/= $+ ->
|
||||
{Key0, Val1} = split_at_equals(Val0, []),
|
||||
Key = list_to_atom(Key0),
|
||||
case Val1 of
|
||||
[] ->
|
||||
erlangmk_format_erlc_opts(Rest, [{d, Key} | Opts], BaseDir);
|
||||
Val2 ->
|
||||
case make_term(Val2) of
|
||||
{error, _} ->
|
||||
erlangmk_format_erlc_opts(Rest, Opts, BaseDir);
|
||||
Val ->
|
||||
erlangmk_format_erlc_opts(Rest, [{d, Key, Val} | Opts], BaseDir)
|
||||
end
|
||||
end;
|
||||
erlangmk_format_erlc_opts([PathFlag, [_ | _] = Dir | Rest], Opts, BaseDir)
|
||||
when PathFlag =:= "-pa" orelse PathFlag =:= "-pz" ->
|
||||
AbsDir = filename:absname(Dir, BaseDir),
|
||||
case PathFlag of
|
||||
"-pa" -> code:add_patha(AbsDir);
|
||||
"-pz" -> code:add_pathz(AbsDir)
|
||||
end,
|
||||
erlangmk_format_erlc_opts(Rest, Opts, BaseDir);
|
||||
erlangmk_format_erlc_opts([_ | Rest], Opts, BaseDir) ->
|
||||
erlangmk_format_erlc_opts(Rest, Opts, BaseDir);
|
||||
erlangmk_format_erlc_opts([], Opts, _) ->
|
||||
lists:reverse(Opts).
|
||||
|
||||
%% Function imported from erl_compile.erl from Erlang 19.1.
|
||||
make_term(Str) ->
|
||||
case erl_scan:string(Str) of
|
||||
{ok, Tokens, _} ->
|
||||
case erl_parse:parse_term(Tokens ++ [{dot, 1}]) of
|
||||
{ok, Term} -> Term;
|
||||
{error, Reason} -> {error, Reason}
|
||||
end;
|
||||
{error, Reason, _} ->
|
||||
{error, Reason}
|
||||
end.
|
||||
|
||||
%% Function imported from erl_compile.erl from Erlang 19.1.
|
||||
split_at_equals([$=|T], Acc) ->
|
||||
{lists:reverse(Acc),T};
|
||||
split_at_equals([H|T], Acc) ->
|
||||
split_at_equals(T, [H|Acc]);
|
||||
split_at_equals([], Acc) ->
|
||||
{lists:reverse(Acc),[]}.
|
||||
|
||||
fallback_opts() ->
|
||||
code:add_pathsa(filelib:wildcard("deps/*/ebin")),
|
||||
code:add_pathsa(nested_app_ebins()),
|
||||
|
|
|
@ -25,11 +25,13 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_erlang_escript_GetLocList() dict
|
||||
if expand('%:e', 1) ==# 'hrl'
|
||||
let buf = bufnr('')
|
||||
|
||||
if fnamemodify(bufname(buf), ':e') ==# 'hrl'
|
||||
return []
|
||||
endif
|
||||
|
||||
let shebang = syntastic#util#parseShebang()
|
||||
let shebang = syntastic#util#parseShebang(buf)
|
||||
if shebang['exe'] ==# 'escript'
|
||||
let args = '-s'
|
||||
let post_args = ''
|
||||
|
@ -39,7 +41,7 @@ function! SyntaxCheckers_erlang_escript_GetLocList() dict
|
|||
endif
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': args,
|
||||
\ 'fname': syntastic#util#shexpand('%:p'),
|
||||
\ 'fname': syntastic#util#shexpand(fnamemodify(bufname(buf), ':p')),
|
||||
\ 'post_args_after': post_args })
|
||||
|
||||
let errorformat =
|
||||
|
|
|
@ -31,7 +31,8 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
|
|||
let s:ruby_new = syntastic#util#versionIsAtLeast(self.getVersion(), [1, 9])
|
||||
endif
|
||||
|
||||
let fname = "'" . escape(expand('%', 1), "\\'") . "'"
|
||||
let buf = bufnr('')
|
||||
let fname = "'" . escape(bufname(buf), "\\'") . "'"
|
||||
|
||||
" TODO: encodings became useful in ruby 1.9 :)
|
||||
if s:ruby_new
|
||||
|
@ -69,7 +70,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
|
|||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'defaults': { 'bufnr': bufnr(''), 'vcol': 1 } })
|
||||
\ 'defaults': { 'bufnr': buf, 'vcol': 1 } })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
|
|
@ -28,8 +28,9 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_glsl_cgc_GetLocList() dict " {{{1
|
||||
let buf = bufnr('')
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_before': '-oglsl -profile ' . s:GetProfile(),
|
||||
\ 'args_before': '-oglsl -profile ' . s:GetProfile(buf),
|
||||
\ 'args': (exists('g:syntastic_glsl_options') ? ' ' . g:syntastic_glsl_options : '') })
|
||||
|
||||
let errorformat =
|
||||
|
@ -43,27 +44,11 @@ endfunction " }}}1
|
|||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:GetProfile() " {{{2
|
||||
let save_view = winsaveview()
|
||||
let old_foldenable = &foldenable
|
||||
let old_lazyredraw = &lazyredraw
|
||||
|
||||
let &lazyredraw = 1
|
||||
let &foldenable = 0
|
||||
call cursor(1, 1)
|
||||
|
||||
let magic = '\m\C^// profile:\s*'
|
||||
let line = search(magic, 'c')
|
||||
|
||||
call winrestview(save_view)
|
||||
let &foldenable = old_foldenable
|
||||
let &lazyredraw = old_lazyredraw
|
||||
|
||||
if line
|
||||
let profile = matchstr(getline(line), magic . '\zs.*')
|
||||
else
|
||||
let extensions = exists('g:syntastic_glsl_extensions') ? g:syntastic_glsl_extensions : s:glsl_extensions
|
||||
let profile = get(extensions, tolower(expand('%:e', 1)), 'gpu_vert')
|
||||
function! s:GetProfile(buf) " {{{2
|
||||
let profile = matchstr(get(filter(getbufline(a:buf, 1, 100), 'v:val =~# "\\m\\C^//\\s*profile:"'), 0, ''), '\m\C^//\s*profile:\s*\zs.*')
|
||||
if profile ==# ''
|
||||
let extensions = syntastic#util#bufVar(a:buf, 'glsl_extensions', s:glsl_extensions)
|
||||
let profile = get(extensions, tolower(fnamemodify(bufname(a:buf), ':e')), 'gpu_vert')
|
||||
endif
|
||||
|
||||
return profile
|
||||
|
|
|
@ -30,6 +30,7 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
|||
if !exists('s:go_new')
|
||||
let s:go_new = syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [1, 5])
|
||||
endif
|
||||
let buf = bufnr('')
|
||||
|
||||
" Check with gofmt first, since `go build` and `go test` might not report
|
||||
" syntax errors in the current file if another file with syntax error is
|
||||
|
@ -53,14 +54,14 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
|||
|
||||
" Test files, i.e. files with a name ending in `_test.go`, are not
|
||||
" compiled by `go build`, therefore `go test` must be called for those.
|
||||
if match(expand('%', 1), '\m_test\.go$') == -1
|
||||
let cmd = 'build'
|
||||
let opts = syntastic#util#var('go_go_build_args', s:go_new ? '-buildmode=archive' : '')
|
||||
let cleanup = 0
|
||||
else
|
||||
if bufname(buf) =~# '\m_test\.go$'
|
||||
let cmd = 'test -c'
|
||||
let opts = syntastic#util#var('go_go_test_args', s:go_new ? '-buildmode=archive' : '')
|
||||
let opts = syntastic#util#bufVar(buf, 'go_go_test_args', s:go_new ? '-buildmode=archive' : '')
|
||||
let cleanup = 1
|
||||
else
|
||||
let cmd = 'build'
|
||||
let opts = syntastic#util#bufVar(buf, 'go_go_build_args', s:go_new ? '-buildmode=archive' : '')
|
||||
let cleanup = 0
|
||||
endif
|
||||
let opt_str = (type(opts) != type('') || opts !=# '') ? join(syntastic#util#argsescape(opts)) : opts
|
||||
let makeprg = self.getExecEscaped() . ' ' . cmd . ' ' . opt_str
|
||||
|
@ -82,12 +83,12 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
|||
let errors = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'cwd': expand('%:p:h', 1),
|
||||
\ 'cwd': fnamemodify(bufname(buf), ':p:h'),
|
||||
\ 'env': {'GOGC': 'off'},
|
||||
\ 'defaults': {'type': 'e'} })
|
||||
|
||||
if cleanup
|
||||
call delete(expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:p:h:t', 1) . '.test')
|
||||
call delete(fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . fnamemodify(bufname(buf), ':p:h') . '.test')
|
||||
endif
|
||||
|
||||
return errors
|
||||
|
|
|
@ -19,9 +19,10 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_go_gometalinter_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': '-t',
|
||||
\ 'fname': syntastic#util#shexpand('%:p:h') })
|
||||
\ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p:h')) })
|
||||
|
||||
let errorformat =
|
||||
\ '%f:%l:%c:%trror: %m,' .
|
||||
|
|
|
@ -19,8 +19,25 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_go_gotype_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
|
||||
if !exists('s:go_new')
|
||||
let command = syntastic#util#shescape(syntastic#util#bufVar(buf, 'go_go_exec', 'go')) . ' version'
|
||||
let version_output = syntastic#util#system(command)
|
||||
call self.log('finding go version: ' . string(command) . ': ' .
|
||||
\ string(split(version_output, "\n", 1)) .
|
||||
\ (v:shell_error ? ' (exit code ' . v:shell_error . ')' : ''))
|
||||
let parsed_ver = syntastic#util#parseVersion(version_output)
|
||||
if len(parsed_ver)
|
||||
let s:go_new = syntastic#util#versionIsAtLeast(parsed_ver, [1, 8])
|
||||
else
|
||||
call syntastic#log#error("checker " . self.getCName() . ": can't parse go version (abnormal termination?)")
|
||||
return []
|
||||
endif
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': (expand('%', 1) =~# '\m_test\.go$' ? '-a' : ''),
|
||||
\ 'args': (bufname(buf) =~# '\m_test\.go$' ? (s:go_new ? '-t' : '-a') : ''),
|
||||
\ 'fname': '.' })
|
||||
|
||||
let errorformat =
|
||||
|
@ -34,7 +51,7 @@ function! SyntaxCheckers_go_gotype_GetLocList() dict
|
|||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'cwd': expand('%:p:h', 1),
|
||||
\ 'cwd': fnamemodify(bufname(buf), ':p:h'),
|
||||
\ 'defaults': {'type': 'e'} })
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_go_govet_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
let makeprg = self.getExecEscaped() . ' vet'
|
||||
|
||||
let errorformat =
|
||||
|
@ -33,7 +34,7 @@ function! SyntaxCheckers_go_govet_GetLocList() dict
|
|||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'cwd': expand('%:p:h', 1),
|
||||
\ 'cwd': fnamemodify(bufname(buf), ':p:h'),
|
||||
\ 'defaults': {'type': 'w'} })
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -25,9 +25,10 @@ function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict
|
|||
let g:syntastic_haskell_hdevtools_args = g:hdevtools_options
|
||||
endif
|
||||
|
||||
let buf = bufnr('')
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_after': 'check',
|
||||
\ 'fname': syntastic#util#shexpand('%:p') })
|
||||
\ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) })
|
||||
|
||||
let errorformat =
|
||||
\ '%-Z %#,'.
|
||||
|
|
|
@ -14,8 +14,9 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_haskell_hlint_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'fname': syntastic#util#shexpand('%:p')})
|
||||
\ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) })
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l:%v: Error while reading hint file\, %m,' .
|
||||
|
|
|
@ -19,12 +19,10 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_haxe_haxe_GetLocList() dict
|
||||
if exists('b:vaxe_hxml')
|
||||
let hxml = b:vaxe_hxml
|
||||
elseif exists('g:vaxe_hxml')
|
||||
let hxml = g:vaxe_hxml
|
||||
else
|
||||
let hxml = syntastic#util#findGlobInParent('*.hxml', expand('%:p:h', 1))
|
||||
let buf = bufnr('')
|
||||
let hxml = syntastic#util#bufRawVar(buf, 'vaxe_hxml')
|
||||
if hxml ==# ''
|
||||
let hxml = syntastic#util#findGlobInParent('*.hxml', fnamemodify(bufname(buf), ':p:h'))
|
||||
endif
|
||||
let hxml = fnamemodify(hxml, ':p')
|
||||
|
||||
|
@ -32,9 +30,12 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict
|
|||
|
||||
if hxml !=# ''
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')) })
|
||||
\ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')),
|
||||
\ 'args_after' : ['--no-output'] })
|
||||
|
||||
let errorformat = '%E%f:%l: characters %c-%n : %m'
|
||||
let errorformat =
|
||||
\ '%W%f:%l: characters %c-%n : Warning : %m,' .
|
||||
\ '%E%f:%l: characters %c-%n : %m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
|
|
|
@ -31,7 +31,8 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_html_validator_GetLocList() dict
|
||||
let fname = syntastic#util#shexpand('%')
|
||||
let buf = bufnr('')
|
||||
let fname = syntastic#util#shescape(fnamemodify(bufname(buf), ':p'))
|
||||
let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F out=gnu -F asciiquotes=yes' .
|
||||
\ (g:syntastic_html_validator_parser !=# '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
|
||||
\ (g:syntastic_html_validator_nsfilter !=# '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
|
||||
|
|
|
@ -23,8 +23,9 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_html_w3_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
let makeprg = self.getExecEscaped() . ' -q -L -s -F output=json ' .
|
||||
\ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' .
|
||||
\ '-F uploaded_file=@' . syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) . '\;type=text/html ' .
|
||||
\ g:syntastic_html_w3_api
|
||||
|
||||
let errorformat =
|
||||
|
|
|
@ -40,6 +40,8 @@ endfunction
|
|||
|
||||
function! SyntaxCheckers_java_checkstyle_GetLocList() dict
|
||||
|
||||
let buf = bufnr('')
|
||||
|
||||
" classpath
|
||||
if !exists('s:sep')
|
||||
let s:sep = syntastic#util#isRunningWindows() || has('win32unix') ? ';' : ':'
|
||||
|
@ -58,7 +60,7 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() dict
|
|||
\ '-f', 'xml' ])
|
||||
|
||||
" filename
|
||||
let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) )
|
||||
let fname = syntastic#util#shescape( fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . fnamemodify(bufname(buf), ':t') )
|
||||
if has('win32unix')
|
||||
let fname = substitute(syntastic#util#system('cygpath -m ' . fname), '\m\%x00', '', 'g')
|
||||
endif
|
||||
|
|
|
@ -223,7 +223,7 @@ endfunction " }}}2
|
|||
function! s:SaveClasspath() " {{{2
|
||||
" build classpath from lines
|
||||
let path = ''
|
||||
let lines = getline(1, line('$'))
|
||||
let lines = getline(1, '$')
|
||||
for l in lines
|
||||
let path = s:AddToClasspath(path, l)
|
||||
endfor
|
||||
|
@ -281,7 +281,7 @@ endfunction " }}}2
|
|||
|
||||
function! s:SaveConfig() " {{{2
|
||||
" get lines
|
||||
let lines = getline(1, line('$'))
|
||||
let lines = getline(1, '$')
|
||||
if g:syntastic_java_javac_config_file_enabled
|
||||
" save config file lines
|
||||
call writefile(lines, expand(g:syntastic_java_javac_config_file, 1))
|
||||
|
|
|
@ -42,11 +42,12 @@ function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict
|
|||
call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args')
|
||||
call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list')
|
||||
|
||||
let flist = expand(get(g:, 'syntastic_javascript_closurecompiler_file_list', ''), 1)
|
||||
let buf = bufnr('')
|
||||
let flist = expand(syntastic#util#bufVar(buf, 'javascript_closurecompiler_file_list'), 1)
|
||||
if filereadable(flist)
|
||||
let file_list = map( readfile(flist), 'expand(v:var, 1)' )
|
||||
else
|
||||
let file_list = [expand('%', 1)]
|
||||
let file_list = [bufname(buf)]
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
|
|
|
@ -25,17 +25,18 @@ function! SyntaxCheckers_javascript_flow_IsAvailable() dict
|
|||
if !executable(self.getExec())
|
||||
return 0
|
||||
endif
|
||||
return syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [0, 18, 1])
|
||||
return syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [0, 34])
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_javascript_flow_GetLocList() dict
|
||||
if syntastic#util#findFileInParent('.flowconfig', expand('%:p:h', 1)) ==# ''
|
||||
let buf = bufnr('')
|
||||
if syntastic#util#findFileInParent('.flowconfig', fnamemodify(bufname(buf), ':p:h')) ==# ''
|
||||
return []
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe': self.getExecEscaped() . ' check',
|
||||
\ 'args_after': '--show-all-errors --json' })
|
||||
\ 'exe': self.getExecEscaped() . ' status',
|
||||
\ 'args_after': '--quiet --show-all-errors --json' })
|
||||
|
||||
let errorformat =
|
||||
\ '%f:%l:%c:%n: %m,' .
|
||||
|
|
51
sources_non_forked/syntastic/syntax_checkers/julia/lint.vim
Normal file
51
sources_non_forked/syntastic/syntax_checkers/julia/lint.vim
Normal file
|
@ -0,0 +1,51 @@
|
|||
"============================================================================
|
||||
"File: lint.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: LCD 47 <lcd047 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_julia_lint_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_julia_lint_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_julia_lint_GetHighlightRegex(item)
|
||||
let term = matchstr(a:item['text'], '\m^\S\+\ze:')
|
||||
return term !=# '' ? '\V' . escape(term, '\') : ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_julia_lint_IsAvailable() dict
|
||||
return
|
||||
\ executable(self.getExec()) &&
|
||||
\ syntastic#util#system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('import Lint')) ==# '' &&
|
||||
\ v:shell_error == 0
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_julia_lint_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
|
||||
let makeprg = self.getExecEscaped() . ' -e ' . syntastic#util#shescape('using Lint; display(filter(err -> !isinfo(err), lintfile("' . escape(bufname(buf), '\"') . '")))')
|
||||
|
||||
let errorformat = '%f:%l %t%n %m'
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'julia',
|
||||
\ 'name': 'lint',
|
||||
\ 'exec': 'julia' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -19,6 +19,7 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_limbo_limbo_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
let include = $INFERNO_HOME !=# '' ? '-I$INFERNO_HOME ' : ''
|
||||
" don't generate .dis in current dir while checking syntax,
|
||||
" .dis should be generated by `mk`
|
||||
|
@ -27,7 +28,7 @@ function! SyntaxCheckers_limbo_limbo_GetLocList() dict
|
|||
let makeprg = self.makeprgBuild({ 'args_before': include . '-w' . output })
|
||||
|
||||
let errorformat = '%E%f:%l:%m'
|
||||
if expand('%', 1) =~# '\m\.m$'
|
||||
if bufname(buf) =~# '\m\.m$'
|
||||
let errorformat = '%-G%f:%l: near ` EOF ` : no implementation module,' . errorformat
|
||||
endif
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_lisp_clisp_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
let tmpdir = syntastic#util#tmpdir()
|
||||
let out = tmpdir !=# '.' ? ('-o ' . syntastic#util#shescape(tmpdir . syntastic#util#Slash() . 'syntastic_' . getpid())) : ''
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': '-q',
|
||||
\ 'fname_before': '-c',
|
||||
\ 'post_args_after': out })
|
||||
\ 'post_args_after': ['-o', tmpdir] })
|
||||
|
||||
let errorformat =
|
||||
\ '%-G;%.%#,' .
|
||||
|
@ -40,7 +40,7 @@ function! SyntaxCheckers_lisp_clisp_GetLocList() dict
|
|||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'bufnr': bufnr('')} })
|
||||
\ 'defaults': {'bufnr': buf} })
|
||||
|
||||
call syntastic#util#rmrf(tmpdir)
|
||||
|
||||
|
|
|
@ -19,9 +19,10 @@ let s:save_cpo = &cpo
|
|||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_nasm_nasm_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': '-X gnu' .
|
||||
\ ' -I ' . syntastic#util#shescape(expand('%:p:h', 1) . syntastic#util#Slash()) .
|
||||
\ ' -I ' . syntastic#util#shescape(fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash()) .
|
||||
\ ' ' . syntastic#c#NullOutput() })
|
||||
|
||||
let errorformat = '%f:%l: %t%*[^:]: %m'
|
||||
|
|
|
@ -44,7 +44,8 @@ function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() dict " {{{1
|
|||
endfunction " }}}1
|
||||
|
||||
function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1
|
||||
let makeprg = s:GetMakeprg()
|
||||
let buf = bufnr('')
|
||||
let makeprg = s:GetMakeprg(buf)
|
||||
if makeprg ==# ''
|
||||
return []
|
||||
endif
|
||||
|
@ -65,7 +66,7 @@ function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1
|
|||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'bufnr': bufnr('')} })
|
||||
\ 'defaults': {'bufnr': buf} })
|
||||
|
||||
for e in loclist
|
||||
if get(e, 'col', 0) && get(e, 'nr', 0)
|
||||
|
@ -79,40 +80,41 @@ endfunction " }}}1
|
|||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:GetMakeprg() " {{{2
|
||||
function! s:GetMakeprg(buf) " {{{2
|
||||
return
|
||||
\ g:syntastic_ocaml_use_ocamlc ? g:syntastic_ocaml_use_ocamlc :
|
||||
\ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg() :
|
||||
\ s:GetOtherMakeprg()
|
||||
\ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg(a:buf) :
|
||||
\ s:GetOtherMakeprg(a:buf)
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:GetOcamlcMakeprg() " {{{2
|
||||
function! s:GetOcamlcMakeprg(buf) " {{{2
|
||||
let build_cmd = g:syntastic_ocaml_use_janestreet_core ?
|
||||
\ 'ocamlc -I ' . syntastic#util#shexpand(g:syntastic_ocaml_janestreet_core_dir) : 'ocamlc'
|
||||
let build_cmd .= ' -c ' . syntastic#util#shexpand('%')
|
||||
let build_cmd .= ' -c ' . syntastic#util#shescape(bufname(a:buf))
|
||||
return build_cmd
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:GetOcamlBuildMakeprg() " {{{2
|
||||
function! s:GetOcamlBuildMakeprg(buf) " {{{2
|
||||
return 'ocamlbuild -quiet -no-log -tag annot,' . s:ocamlpp . ' -no-links -no-hygiene -no-sanitize ' .
|
||||
\ syntastic#util#shexpand('%:r') . '.cmi'
|
||||
\ syntastic#util#shexpand(fnamemodify(bufname(a:buf), ':r')) . '.cmi'
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:GetOtherMakeprg() " {{{2
|
||||
function! s:GetOtherMakeprg(buf) " {{{2
|
||||
"TODO: give this function a better name?
|
||||
"
|
||||
"TODO: should use throw/catch instead of returning an empty makeprg
|
||||
|
||||
let extension = expand('%:e', 1)
|
||||
let fname = bufname(a:buf)
|
||||
let extension = fnamemodify(fname, ':e')
|
||||
let makeprg = ''
|
||||
|
||||
if stridx(extension, 'mly') >= 0 && executable('menhir')
|
||||
" ocamlyacc output can't be redirected, so use menhir
|
||||
let makeprg = 'menhir --only-preprocess ' . syntastic#util#shexpand('%') . ' >' . syntastic#util#DevNull()
|
||||
let makeprg = 'menhir --only-preprocess ' . syntastic#util#shescape(fname) . ' >' . syntastic#util#DevNull()
|
||||
elseif stridx(extension,'mll') >= 0 && executable('ocamllex')
|
||||
let makeprg = 'ocamllex -q ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shexpand('%')
|
||||
let makeprg = 'ocamllex -q ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shescape(fname)
|
||||
else
|
||||
let makeprg = 'camlp4o ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shexpand('%')
|
||||
let makeprg = 'camlp4o ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shescape(fname)
|
||||
endif
|
||||
|
||||
return makeprg
|
||||
|
|
|
@ -51,13 +51,14 @@ function! SyntaxCheckers_perl_perl_IsAvailable() dict " {{{1
|
|||
endfunction " }}}1
|
||||
|
||||
function! SyntaxCheckers_perl_perl_GetLocList() dict " {{{1
|
||||
let buf = bufnr('')
|
||||
if type(g:syntastic_perl_lib_path) == type('')
|
||||
call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list')
|
||||
let includes = split(g:syntastic_perl_lib_path, ',')
|
||||
else
|
||||
let includes = copy(syntastic#util#var('perl_lib_path', []))
|
||||
let includes = copy(syntastic#util#bufVar(buf, 'perl_lib_path', []))
|
||||
endif
|
||||
let shebang = syntastic#util#parseShebang()
|
||||
let shebang = syntastic#util#parseShebang(buf)
|
||||
let extra = map(includes, '"-I" . v:val') +
|
||||
\ (index(shebang['args'], '-T') >= 0 ? ['-T'] : []) +
|
||||
\ (index(shebang['args'], '-t') >= 0 ? ['-t'] : [])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"============================================================================
|
||||
"File: php.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
|
@ -26,7 +26,7 @@ endfunction
|
|||
function! SyntaxCheckers_php_php_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': '-d error_reporting=E_ALL',
|
||||
\ 'args_after': '-l -d display_errors=1 -d log_errors=0 -d xdebug.cli_color=0' })
|
||||
\ 'args_after': '-l -d error_log= -d display_errors=1 -d log_errors=0 -d xdebug.cli_color=0' })
|
||||
|
||||
let errorformat =
|
||||
\ '%-GNo syntax errors detected in%.%#,'.
|
||||
|
|
49
sources_non_forked/syntastic/syntax_checkers/php/phpstan.vim
Normal file
49
sources_non_forked/syntastic/syntax_checkers/php/phpstan.vim
Normal file
|
@ -0,0 +1,49 @@
|
|||
"============================================================================
|
||||
"File: phpstan.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: Przepompownia przepompownia@users.noreply.github.com
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_php_phpstan_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_php_phpstan_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_php_phpstan_IsAvailable() dict
|
||||
if !executable(self.getExec())
|
||||
return 0
|
||||
endif
|
||||
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 7])
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_php_phpstan_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_after': 'analyse',
|
||||
\ 'args': '--level=5',
|
||||
\ 'args_after': '--errorFormat raw' })
|
||||
|
||||
let errorformat = '%f:%l:%m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype' : 'Style' })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'php',
|
||||
\ 'name': 'phpstan'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
43
sources_non_forked/syntastic/syntax_checkers/po/dennis.vim
Normal file
43
sources_non_forked/syntastic/syntax_checkers/po/dennis.vim
Normal file
|
@ -0,0 +1,43 @@
|
|||
"============================================================================
|
||||
"File: dennis.vim
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: LCD 47 <lcd047 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_po_dennis_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_po_dennis_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_po_dennis_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_after': 'lint',
|
||||
\ 'post_args_after': '--reporter line' })
|
||||
|
||||
let errorformat = '%f:%l:%c:%t%n:%m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0, 1] })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'po',
|
||||
\ 'name': 'dennis',
|
||||
\ 'exec': 'dennis-cmd' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -0,0 +1,54 @@
|
|||
"============================================================================
|
||||
"File: bandit
|
||||
"Description: Syntax checking plugin for syntastic
|
||||
"Maintainer: LCD 47 <lcd047 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists('g:loaded_syntastic_python_bandit_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_python_bandit_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_python_bandit_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': '--format json',
|
||||
\ 'tail': '2> ' . syntastic#util#DevNull() })
|
||||
|
||||
let errorformat = '%f:%l:%t:%n:%m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'preprocess': 'bandit',
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
for e in loclist
|
||||
if e['type'] ==? 'I'
|
||||
let e['type'] = 'W'
|
||||
let e['subtype'] = 'Style'
|
||||
endif
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'python',
|
||||
\ 'name': 'bandit' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -43,11 +43,13 @@ function! SyntaxCheckers_r_lint_IsAvailable() dict
|
|||
endfunction
|
||||
|
||||
function! SyntaxCheckers_r_lint_GetLocList() dict
|
||||
let buf = bufnr('')
|
||||
|
||||
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
|
||||
let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' .
|
||||
\ ' -e ' . syntastic#util#shescape(setwd . 'library(lint); ' .
|
||||
\ 'try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') .
|
||||
\ ' --args ' . syntastic#util#shexpand('%')
|
||||
\ ' --args ' . syntastic#util#shescape(bufname(buf))
|
||||
|
||||
let errorformat =
|
||||
\ '%t:%f:%l:%v: %m,' .
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue