commit
c9886dcdca
124 changed files with 4113 additions and 1907 deletions
171
README.md
171
README.md
|
@ -1,28 +1,28 @@
|
|||
![VIM](https://camo.githubusercontent.com/bec48ea0e886e5489a8819486bf74075fe626067/68747470733a2f2f7261772e6769746875622e636f6d2f656c6d636173742f656c6d2d76696d2f6d61737465722f73637265656e73686f74732f6c6f676f2e706e67)
|
||||
![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
|
||||
sh ~/.vim_runtime/install_awesome_vimrc.sh
|
||||
|
||||
I also recommend using [Source Code Pro font from Adobe](https://typekit.com/fonts/source-code-pro) (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
|
||||
sh ~/.vim_runtime/install_basic_vimrc.sh
|
||||
|
@ -39,7 +39,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
|
||||
|
@ -48,49 +48,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)
|
||||
|
@ -109,37 +107,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
|
||||
|
@ -149,6 +148,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`):
|
||||
|
@ -161,7 +161,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>
|
||||
|
||||
|
@ -172,7 +172,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>
|
||||
|
@ -191,21 +191,13 @@ 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>
|
||||
|
||||
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
|
||||
map <leader>g :Ack
|
||||
|
||||
Quickly open a buffer for scripbble:
|
||||
|
||||
|
@ -216,6 +208,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.:
|
||||
|
@ -233,31 +250,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:
|
||||
|
@ -273,27 +265,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:
|
||||
|
@ -302,15 +295,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:
|
||||
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 :-)"
|
||||
|
|
|
@ -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>)
|
|
@ -1763,6 +1763,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
|
||||
|
@ -2304,7 +2305,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)
|
||||
|
@ -2384,7 +2385,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
|
||||
|
||||
|
|
|
@ -31,7 +31,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 != ''
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -848,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
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
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:
|
|
@ -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
|
||||
|
|
|
@ -65,7 +65,7 @@ This software is released under the MIT License, see LICENSE.
|
|||
|
||||
git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline.vim
|
||||
|
||||
### Vundle (https://github.com/gmarik/Vundle.vim)
|
||||
### Vundle (https://github.com/VundleVim/Vundle.vim)
|
||||
1. Add the following configuration to your `.vimrc`.
|
||||
|
||||
Plugin 'itchyny/lightline.vim'
|
||||
|
|
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?)_
|
||||
|
||||
>…
|
||||
|
|
@ -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`.
|
||||
|
||||
|
||||
####[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
|
||||
|
||||
|
|
|
@ -89,10 +89,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
|
||||
|
|
|
@ -806,7 +806,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.
|
||||
|
|
|
@ -544,7 +544,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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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] !=# '{'
|
||||
|
@ -406,7 +466,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
|
||||
|
|
|
@ -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*
|
||||
|
||||
|
@ -1755,6 +1889,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 +1969,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 +2085,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 +2109,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 +2378,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>
|
||||
|
@ -3557,6 +3752,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 +4633,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 +4713,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 +4847,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 +4909,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 +4925,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 +4941,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 +4964,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 +4980,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 +4997,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 +5015,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 +5033,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 +5059,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 +5089,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 +5165,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 +5217,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 +6142,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 +6165,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 +6200,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 +6225,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*
|
||||
|
|
|
@ -19,7 +19,7 @@ if has('reltime')
|
|||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.8.0-26'
|
||||
let g:_SYNTASTIC_VERSION = '3.8.0-55'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
|
|
@ -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'],
|
||||
|
|
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:
|
|
@ -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,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:
|
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:
|
|
@ -20,8 +20,24 @@ 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': (bufname(buf) =~# '\m_test\.go$' ? '-a' : ''),
|
||||
\ 'args': (bufname(buf) =~# '\m_test\.go$' ? (s:go_new ? '-t' : '-a') : ''),
|
||||
\ 'fname': '.' })
|
||||
|
||||
let errorformat =
|
||||
|
|
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:
|
|
@ -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:
|
|
@ -0,0 +1,43 @@
|
|||
"============================================================================
|
||||
"File: solium.vim
|
||||
"Description: Solidity syntax checker - using solium
|
||||
"Maintainer: Matthijs van den Bos <matthijs@vandenbos.org>
|
||||
"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_solidity_solium_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_solidity_solium_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_solidity_solium_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': '-R gcc',
|
||||
\ 'fname_before': '--file'})
|
||||
|
||||
let errorformat =
|
||||
\ '%f:%l:%c: %trror: %m,' .
|
||||
\ '%f:%l:%c: %tarning: %m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'returns': [0, 1] })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'solidity',
|
||||
\ 'name': 'solium'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
|
@ -30,8 +30,10 @@ function! SyntaxCheckers_typescript_tslint_GetLocList() dict
|
|||
\ 'args_after': '--format verbose',
|
||||
\ 'fname_before': (s:tslint_new ? '' : '-f') })
|
||||
|
||||
" (comment-format) ts/app.ts[12, 36]: comment must start with lowercase letter
|
||||
let errorformat = '%f[%l\, %c]: %m'
|
||||
let errorformat =
|
||||
\ '%EERROR: %f[%l\, %c]: %m,' .
|
||||
\ '%WWARNING: %f[%l\, %c]: %m,' .
|
||||
\ '%E%f[%l\, %c]: %m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
|
|
|
@ -36,8 +36,14 @@ function! SyntaxCheckers_vim_vimlint_GetHighlightRegex(item) " {{{1
|
|||
endfunction " }}}1
|
||||
|
||||
function! SyntaxCheckers_vim_vimlint_IsAvailable() dict " {{{1
|
||||
let vimlparser = globpath(&runtimepath, 'autoload/vimlparser.vim', 1)
|
||||
let vimlint = globpath(&runtimepath, 'autoload/vimlint.vim', 1)
|
||||
try
|
||||
" Vim 7.2-051 and later
|
||||
let vimlparser = globpath(&runtimepath, 'autoload/vimlparser.vim', 1)
|
||||
let vimlint = globpath(&runtimepath, 'autoload/vimlint.vim', 1)
|
||||
catch /\m^Vim\%((\a\+)\)\=:E118/
|
||||
let vimlparser = globpath(&runtimepath, 'autoload/vimlparser.vim')
|
||||
let vimlint = globpath(&runtimepath, 'autoload/vimlint.vim')
|
||||
endtry
|
||||
call self.log("globpath(&runtimepath, 'autoload/vimlparser.vim', 1) = " . string(vimlparser) . ', ' .
|
||||
\ "globpath(&runtimepath, 'autoload/vimlint.vim', 1) = " . string(vimlint))
|
||||
return vimlparser !=# '' && vimlint !=# ''
|
||||
|
|
1
sources_non_forked/vim-abolish/.gitignore
vendored
Normal file
1
sources_non_forked/vim-abolish/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/doc/tags
|
1
sources_non_forked/vim-abolish/CONTRIBUTING.markdown
Normal file
1
sources_non_forked/vim-abolish/CONTRIBUTING.markdown
Normal file
|
@ -0,0 +1 @@
|
|||
See the [contribution guidelines for pathogen.vim](https://github.com/tpope/vim-pathogen/blob/master/CONTRIBUTING.markdown).
|
150
sources_non_forked/vim-abolish/README.markdown
Normal file
150
sources_non_forked/vim-abolish/README.markdown
Normal file
|
@ -0,0 +1,150 @@
|
|||
# abolish.vim
|
||||
|
||||
I sat on this plugin for 3 years before releasing it, primarily
|
||||
because it's so gosh darn hard to explain. It's three superficially
|
||||
unrelated plugins in one that share a common theme: working with
|
||||
variants of a word.
|
||||
|
||||
## Abbreviation
|
||||
|
||||
I know how to spell "separate". I know how to spell "desperate". My
|
||||
fingers, however, have trouble distinguishing between the two, and I
|
||||
invariably have a 50 percent chance of typing "seperate" or "desparate"
|
||||
each time one of these comes up. At first, I tried abbreviations:
|
||||
|
||||
:iabbrev seperate separate
|
||||
:iabbrev desparate desperate
|
||||
|
||||
But this falls short at the beginning of a sentence.
|
||||
|
||||
:iabbrev Seperate Separate
|
||||
:iabbrev Desparate Desperate
|
||||
|
||||
To be really thorough, we need uppercase too!
|
||||
|
||||
:iabbrev SEPERATE SEPARATE
|
||||
:iabbrev DESPARATE DESPERATE
|
||||
|
||||
Oh, but consider the noun form, and the adverb form!
|
||||
|
||||
:iabbrev seperation separation
|
||||
:iabbrev desparation desperation
|
||||
:iabbrev seperately separately
|
||||
:iabbrev desparately desperately
|
||||
:iabbrev Seperation separation
|
||||
:iabbrev Desparation Desperation
|
||||
:iabbrev Seperately Separately
|
||||
:iabbrev Desparately Desperately
|
||||
:iabbrev SEPERATION SEPARATION
|
||||
:iabbrev DESPARATION DESPERATION
|
||||
:iabbrev SEPERATELY SEPARATELY
|
||||
:iabbrev DESPARATELY DESPERATELY
|
||||
|
||||
Wait, there's also "separates", "separated", "separating",
|
||||
"separations", "separator"...
|
||||
|
||||
Abolish.vim provides a simpler way. The following one command produces
|
||||
48 abbreviations including all of the above.
|
||||
|
||||
:Abolish {despa,sepe}rat{e,es,ed,ing,ely,ion,ions,or} {despe,sepa}rat{}
|
||||
|
||||
My current configuration has 25 Abolish commands that create hundreds of
|
||||
corrections my fingers refuse to learn.
|
||||
|
||||
## Substitution
|
||||
|
||||
One time I had an application with a domain model called
|
||||
"facility" that needed to be renamed to "building". So, a simple
|
||||
search and replace, right?
|
||||
|
||||
:%s/facility/building/g
|
||||
|
||||
Oh, but the case variants!
|
||||
|
||||
:%s/Facility/Building/g
|
||||
:%s/FACILITY/BUILDING/g
|
||||
|
||||
Wait, the plural is more than "s" so we need to get that too!
|
||||
|
||||
:%s/facilities/buildings/g
|
||||
:%s/Facilities/Buildings/g
|
||||
:%s/FACILITIES/BUILDINGS/g
|
||||
|
||||
Abolish.vim has your back. One command to do all six, and you can
|
||||
repeat it with `&` too!
|
||||
|
||||
:%Subvert/facilit{y,ies}/building{,s}/g
|
||||
|
||||
From a conceptual level, one way to think about how this substitution
|
||||
works is to imagine that in the braces you are declaring the
|
||||
requirements for turning that word from singular to plural. In
|
||||
the facility example, the same base letters in both the singular
|
||||
and plural form of the word are `facilit` To turn "facility" to a
|
||||
plural word you must change the `y` to `ies` so you specify
|
||||
`{y,ies}` in the braces.
|
||||
|
||||
To convert the word "building" from singular to plural, again
|
||||
look at the common letters between the singular and plural forms:
|
||||
`building`. In this case you do not need to remove any letter
|
||||
from building to turn it into plural form and you need to
|
||||
add an `s` so the braces should be `{,s}`.
|
||||
|
||||
A few more examples:
|
||||
|
||||
Address to Reference
|
||||
|
||||
:Subvert/address{,es}/reference{,s}/g
|
||||
|
||||
Blog to Post (you can just do this with a regular :s also)
|
||||
|
||||
:Subvert/blog{,s}/post{,s}/g
|
||||
|
||||
Child to Adult
|
||||
|
||||
:Subvert/child{,ren}/adult{,s}/g
|
||||
|
||||
Be amazed as it correctly turns the word children into the word adults!
|
||||
|
||||
Die to Spinner
|
||||
|
||||
:Subvert/di{e,ce}/spinner{,s}/g
|
||||
|
||||
You can abbreviate it as `:S`, and it accepts the full range of flags
|
||||
including things like `c` (confirm).
|
||||
|
||||
There's also a variant for searching and a variant for grepping.
|
||||
|
||||
## Coercion
|
||||
|
||||
Want to turn `fooBar` into `foo_bar`? Press `crs` (coerce to
|
||||
snake\_case). MixedCase (`crm`), camelCase (`crc`), snake\_case
|
||||
(`crs`), UPPER\_CASE (`cru`), dash-case (`cr-`), dot.case (`cr.`),
|
||||
space case (`cr<space>`), and Title Case (`crt`) are all just 3
|
||||
keystrokes away. These commands support
|
||||
[repeat.vim](https://github.com/tpope/vim-repeat).
|
||||
|
||||
## Installation
|
||||
|
||||
If you don't have a preferred installation method, I recommend
|
||||
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
|
||||
then simply copy and paste:
|
||||
|
||||
cd ~/.vim/bundle
|
||||
git clone git://github.com/tpope/vim-abolish.git
|
||||
|
||||
Once help tags have been generated, you can view the manual with
|
||||
`:help abolish`.
|
||||
|
||||
## Self-Promotion
|
||||
|
||||
Like abolish.vim? Follow the repository on
|
||||
[GitHub](https://github.com/tpope/vim-abolish) and vote for it on
|
||||
[vim.org](http://www.vim.org/scripts/script.php?script_id=1545). And if
|
||||
you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
|
||||
[Twitter](http://twitter.com/tpope) and
|
||||
[GitHub](https://github.com/tpope).
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
|
||||
See `:help license`.
|
181
sources_non_forked/vim-abolish/doc/abolish.txt
Normal file
181
sources_non_forked/vim-abolish/doc/abolish.txt
Normal file
|
@ -0,0 +1,181 @@
|
|||
*abolish.txt* Language friendly searches, substitutions, and abbreviations
|
||||
|
||||
Author: Tim Pope <http://tpo.pe/>
|
||||
License: Same terms as Vim itself (see |license|)
|
||||
|
||||
This plugin is only available if 'compatible' is not set.
|
||||
|
||||
INTRODUCTION *abolish* *:Abolish* *:Subvert*
|
||||
|
||||
Abolish lets you quickly find, substitute, and abbreviate several variations
|
||||
of a word at once. By default, three case variants (foo, Foo, and FOO) are
|
||||
operated on by every command.
|
||||
|
||||
Two commands are provided. :Abolish is the most general interface.
|
||||
:Subvert provides an alternative, more concise syntax for searching and
|
||||
substituting.
|
||||
>
|
||||
:Abolish [options] {abbreviation} {replacement}
|
||||
:Abolish -delete [options] {abbreviation}
|
||||
|
||||
:Abolish -search [options] {pattern}
|
||||
:Subvert/{pattern}[/flags]
|
||||
:Abolish!-search [options] {pattern}
|
||||
:Subvert?{pattern}[?flags]
|
||||
|
||||
:Abolish -search [options] {pattern} {grep-arguments}
|
||||
:Subvert /{pattern}/[flags] {grep-options}
|
||||
:Abolish!-search [options] {pattern} {grep-arguments}
|
||||
:Subvert!/{pattern}/[flags] {grep-options}
|
||||
|
||||
:[range]Abolish -substitute [options] {pattern} {replacement}
|
||||
:[range]Subvert/{pattern}/{replacement}[/flags]
|
||||
<
|
||||
*:S*
|
||||
In addition to the :Subvert command, a :S synonym is provided if not
|
||||
already defined. This will be used in examples below.
|
||||
|
||||
PATTERNS *abolish-patterns*
|
||||
|
||||
Patterns can include brace pairs that contain comma separated alternatives:
|
||||
|
||||
box{,es} => box, boxes, Box, Boxes, BOX, BOXES
|
||||
|
||||
For commands with a replacement, corresponding brace pairs are used in both
|
||||
halves. If the replacement should be identical to the pattern, an empty
|
||||
brace pair may be used. If fewer replacements are given than were given in
|
||||
the pattern, they are looped. That is, {a,b} on the replacement side is the
|
||||
same as {a,b,a,b,a,b,...} repeated indefinitely.
|
||||
|
||||
The following replaces several different misspellings of "necessary":
|
||||
>
|
||||
:%S/{,un}nec{ce,ces,e}sar{y,ily}/{}nec{es}sar{}/g
|
||||
<
|
||||
ABBREVIATING *abolish-abbrev*
|
||||
|
||||
By default :Abolish creates abbreviations, which replace words automatically
|
||||
as you type. This is good for words you frequently misspell, or as
|
||||
shortcuts for longer words. Since these are just Vim abbreviations, only
|
||||
whole words will match.
|
||||
>
|
||||
:Abolish anomol{y,ies} anomal{}
|
||||
:Abolish {,in}consistant{,ly} {}consistent{}
|
||||
:Abolish Tqbf The quick, brown fox jumps over the lazy dog
|
||||
<
|
||||
Accepts the following options:
|
||||
|
||||
-buffer: buffer local
|
||||
-cmdline: work in command line in addition to insert mode
|
||||
|
||||
A good place to define abbreviations is "after/plugin/abolish.vim",
|
||||
relative to ~\vimfiles on Windows and ~/.vim everywhere else.
|
||||
|
||||
With a bang (:Abolish!) the abbreviation is also appended to the file in
|
||||
g:abolish_save_file. The default is "after/plugin/abolish.vim", relative
|
||||
to the install directory.
|
||||
|
||||
Abbreviations can be removed with :Abolish -delete:
|
||||
>
|
||||
Abolish -delete -buffer -cmdline anomol{y,ies}
|
||||
<
|
||||
SEARCHING *abolish-search*
|
||||
|
||||
The -search command does a search in a manner similar to / key.
|
||||
search. After searching, you can use |n| and |N| as you would with a normal
|
||||
search.
|
||||
|
||||
The following will search for box, Box, and BOX:
|
||||
>
|
||||
:Abolish -search box
|
||||
<
|
||||
When given a single word to operate on, :Subvert defaults to doing a
|
||||
search as well:
|
||||
>
|
||||
:S/box/
|
||||
<
|
||||
This one searches for box, boxes, boxed, boxing, Box, Boxes, Boxed, Boxing,
|
||||
BOX, BOXES, BOXED, and BOXING:
|
||||
>
|
||||
:S/box{,es,ed,ing}/
|
||||
<
|
||||
The following syntaxes search in reverse.
|
||||
>
|
||||
:Abolish! -search box
|
||||
:S?box?
|
||||
<
|
||||
Flags can be given with the -flags= option to :Abolish, or by appending them
|
||||
after the separator to :Subvert. The flags trigger the following behaviors:
|
||||
|
||||
I: Disable case variations (box, Box, BOX)
|
||||
v: Match inside variable names (match my_box, myBox, but not mybox)
|
||||
w: Match whole words (like surrounding with \< and \>)
|
||||
|
||||
A |search-offset| may follow the flags.
|
||||
>
|
||||
:Abolish -search -flags=avs+1 box
|
||||
:S?box{,es,ed,ing}?we
|
||||
<
|
||||
GREPPING *abolish-grep*
|
||||
|
||||
Grepping works similar to searching, and is invoked when additional options
|
||||
are given. These options are passed directly to the :grep command.
|
||||
>
|
||||
:Abolish -search box{,es}
|
||||
:S /box{,es}/ *
|
||||
:S /box/aw *.txt *.html
|
||||
<
|
||||
The slash delimiters must both be present if used with :Subvert. They may
|
||||
both be omitted if no flags are used.
|
||||
|
||||
Both an external grepprg and vimgrep (via grepprg=internal) are supported.
|
||||
With an external grep, the "v" flag behaves less intelligently, due to the
|
||||
lack of look ahead and look behind support in grep regexps.
|
||||
|
||||
SUBSTITUTING *abolish-substitute*
|
||||
|
||||
Giving a range switches :Subvert into substitute mode. This command will
|
||||
change box -> bag, boxes -> bags, Box -> Bag, Boxes -> Bags, BOX -> BAG,
|
||||
BOXES -> BAGS across the entire document:
|
||||
>
|
||||
:%Abolish -substitute -flags=g box{,es} bag{,s}
|
||||
:%S/box{,es}/bag{,s}/g
|
||||
<
|
||||
The "c", "e", "g", and "n" flags can be used from the substitute command
|
||||
|:s_flags|, along with the "a", "I", "v", and "w" flags from searching.
|
||||
|
||||
COERCION *abolish-coercion* *cr*
|
||||
|
||||
Abolish's case mutating algorithms can be applied to the word under the cursor
|
||||
using the cr mapping (mnemonic: CoeRce) followed by one of the following
|
||||
characters:
|
||||
|
||||
c: camelCase
|
||||
m: MixedCase
|
||||
_: snake_case
|
||||
s: snake_case
|
||||
u: SNAKE_UPPERCASE
|
||||
U: SNAKE_UPPERCASE
|
||||
-: dash-case (not usually reversible; see |abolish-coercion-reversible|)
|
||||
k: kebab-case (not usually reversible; see |abolish-coercion-reversible|)
|
||||
.: dot.case (not usually reversible; see |abolish-coercion-reversible|)
|
||||
<space>: space case (not usually reversible; see |abolish-coercion-reversible|)
|
||||
t: Title Case (not usually reversible; see |abolish-coercion-reversible|)
|
||||
|
||||
For example, cru on a lowercase word is a slightly easier to type equivalent
|
||||
to gUiw.
|
||||
|
||||
COERCION REVERSIBILITY *abolish-coercion-reversible*
|
||||
|
||||
Some separators, such as "-" and ".", are listed as "not usually reversible".
|
||||
The reason is that these are not "keyword characters", so vim (and
|
||||
abolish.vim) will treat them as breaking a word.
|
||||
|
||||
For example: "key_word" is a single keyword. The dash-case version,
|
||||
"key-word", is treated as two keywords, "key" and "word".
|
||||
|
||||
This behaviour is governed by the 'iskeyword' option. If a separator appears
|
||||
in 'iskeyword', the corresponding coercion will be reversible. For instance,
|
||||
dash-case is reversible in 'lisp' files, and dot-case is reversible in R
|
||||
files.
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
631
sources_non_forked/vim-abolish/plugin/abolish.vim
Normal file
631
sources_non_forked/vim-abolish/plugin/abolish.vim
Normal file
|
@ -0,0 +1,631 @@
|
|||
" abolish.vim - Language friendly searches, substitutions, and abbreviations
|
||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||
" Version: 1.1
|
||||
" GetLatestVimScripts: 1545 1 :AutoInstall: abolish.vim
|
||||
|
||||
" Initialization {{{1
|
||||
|
||||
if exists("g:loaded_abolish") || &cp || v:version < 700
|
||||
finish
|
||||
endif
|
||||
let g:loaded_abolish = 1
|
||||
|
||||
if !exists("g:abolish_save_file")
|
||||
if isdirectory(expand("~/.vim"))
|
||||
let g:abolish_save_file = expand("~/.vim/after/plugin/abolish.vim")
|
||||
elseif isdirectory(expand("~/vimfiles")) || has("win32")
|
||||
let g:abolish_save_file = expand("~/vimfiles/after/plugin/abolish.vim")
|
||||
else
|
||||
let g:abolish_save_file = expand("~/.vim/after/plugin/abolish.vim")
|
||||
endif
|
||||
endif
|
||||
|
||||
" }}}1
|
||||
" Utility functions {{{1
|
||||
|
||||
function! s:function(name)
|
||||
return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '<SNR>\d\+_'),''))
|
||||
endfunction
|
||||
|
||||
function! s:send(self,func,...)
|
||||
if type(a:func) == type('') || type(a:func) == type(0)
|
||||
let Func = get(a:self,a:func,'')
|
||||
else
|
||||
let Func = a:func
|
||||
endif
|
||||
let s = type(a:self) == type({}) ? a:self : {}
|
||||
if type(Func) == type(function('tr'))
|
||||
return call(Func,a:000,s)
|
||||
elseif type(Func) == type({}) && has_key(Func,'apply')
|
||||
return call(Func.apply,a:000,Func)
|
||||
elseif type(Func) == type({}) && has_key(Func,'call')
|
||||
return call(Func.call,a:000,s)
|
||||
elseif type(Func) == type('') && Func == '' && has_key(s,'function missing')
|
||||
return call('s:send',[s,'function missing',a:func] + a:000)
|
||||
else
|
||||
return Func
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:object = {}
|
||||
function! s:object.clone(...)
|
||||
let sub = deepcopy(self)
|
||||
return a:0 ? extend(sub,a:1) : sub
|
||||
endfunction
|
||||
|
||||
if !exists("g:Abolish")
|
||||
let Abolish = {}
|
||||
endif
|
||||
call extend(Abolish, s:object, 'force')
|
||||
call extend(Abolish, {'Coercions': {}}, 'keep')
|
||||
|
||||
function! s:throw(msg)
|
||||
let v:errmsg = a:msg
|
||||
throw "Abolish: ".a:msg
|
||||
endfunction
|
||||
|
||||
function! s:words()
|
||||
let words = []
|
||||
let lnum = line('w0')
|
||||
while lnum <= line('w$')
|
||||
let line = getline(lnum)
|
||||
let col = 0
|
||||
while match(line,'\<\k\k\+\>',col) != -1
|
||||
let words += [matchstr(line,'\<\k\k\+\>',col)]
|
||||
let col = matchend(line,'\<\k\k\+\>',col)
|
||||
endwhile
|
||||
let lnum += 1
|
||||
endwhile
|
||||
return words
|
||||
endfunction
|
||||
|
||||
function! s:extractopts(list,opts)
|
||||
let i = 0
|
||||
while i < len(a:list)
|
||||
if a:list[i] =~ '^-[^=]' && has_key(a:opts,matchstr(a:list[i],'-\zs[^=]*'))
|
||||
let key = matchstr(a:list[i],'-\zs[^=]*')
|
||||
let value = matchstr(a:list[i],'=\zs.*')
|
||||
if type(get(a:opts,key)) == type([])
|
||||
let a:opts[key] += [value]
|
||||
elseif type(get(a:opts,key)) == type(0)
|
||||
let a:opts[key] = 1
|
||||
else
|
||||
let a:opts[key] = value
|
||||
endif
|
||||
else
|
||||
let i += 1
|
||||
continue
|
||||
endif
|
||||
call remove(a:list,i)
|
||||
endwhile
|
||||
return a:opts
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
" Dictionary creation {{{1
|
||||
|
||||
function! s:mixedcase(word)
|
||||
return substitute(s:camelcase(a:word),'^.','\u&','')
|
||||
endfunction
|
||||
|
||||
function! s:camelcase(word)
|
||||
let word = substitute(a:word, '-', '_', 'g')
|
||||
if word !~# '_' && word =~# '\l'
|
||||
return substitute(word,'^.','\l&','')
|
||||
else
|
||||
return substitute(word,'\C\(_\)\=\(.\)','\=submatch(1)==""?tolower(submatch(2)) : toupper(submatch(2))','g')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:snakecase(word)
|
||||
let word = substitute(a:word,'::','/','g')
|
||||
let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g')
|
||||
let word = substitute(word,'\(\l\|\d\)\(\u\)','\1_\2','g')
|
||||
let word = substitute(word,'[.-]','_','g')
|
||||
let word = tolower(word)
|
||||
return word
|
||||
endfunction
|
||||
|
||||
function! s:uppercase(word)
|
||||
return toupper(s:snakecase(a:word))
|
||||
endfunction
|
||||
|
||||
function! s:dashcase(word)
|
||||
return substitute(s:snakecase(a:word),'_','-','g')
|
||||
endfunction
|
||||
|
||||
function! s:spacecase(word)
|
||||
return substitute(s:snakecase(a:word),'_',' ','g')
|
||||
endfunction
|
||||
|
||||
function! s:dotcase(word)
|
||||
return substitute(s:snakecase(a:word),'_','.','g')
|
||||
endfunction
|
||||
|
||||
function! s:titlecase(word)
|
||||
return substitute(s:spacecase(a:word), '\(\<\w\)','\=toupper(submatch(1))','g')
|
||||
endfunction
|
||||
|
||||
call extend(Abolish, {
|
||||
\ 'camelcase': s:function('s:camelcase'),
|
||||
\ 'mixedcase': s:function('s:mixedcase'),
|
||||
\ 'snakecase': s:function('s:snakecase'),
|
||||
\ 'uppercase': s:function('s:uppercase'),
|
||||
\ 'dashcase': s:function('s:dashcase'),
|
||||
\ 'dotcase': s:function('s:dotcase'),
|
||||
\ 'spacecase': s:function('s:spacecase'),
|
||||
\ 'titlecase': s:function('s:titlecase')
|
||||
\ }, 'keep')
|
||||
|
||||
function! s:create_dictionary(lhs,rhs,opts)
|
||||
let dictionary = {}
|
||||
let i = 0
|
||||
let expanded = s:expand_braces({a:lhs : a:rhs})
|
||||
for [lhs,rhs] in items(expanded)
|
||||
if get(a:opts,'case',1)
|
||||
let dictionary[s:mixedcase(lhs)] = s:mixedcase(rhs)
|
||||
let dictionary[tolower(lhs)] = tolower(rhs)
|
||||
let dictionary[toupper(lhs)] = toupper(rhs)
|
||||
endif
|
||||
let dictionary[lhs] = rhs
|
||||
endfor
|
||||
let i += 1
|
||||
return dictionary
|
||||
endfunction
|
||||
|
||||
function! s:expand_braces(dict)
|
||||
let new_dict = {}
|
||||
for [key,val] in items(a:dict)
|
||||
if key =~ '{.*}'
|
||||
let redo = 1
|
||||
let [all,kbefore,kmiddle,kafter;crap] = matchlist(key,'\(.\{-\}\){\(.\{-\}\)}\(.*\)')
|
||||
let [all,vbefore,vmiddle,vafter;crap] = matchlist(val,'\(.\{-\}\){\(.\{-\}\)}\(.*\)') + ["","","",""]
|
||||
if all == ""
|
||||
let [vbefore,vmiddle,vafter] = [val, ",", ""]
|
||||
endif
|
||||
let targets = split(kmiddle,',',1)
|
||||
let replacements = split(vmiddle,',',1)
|
||||
if replacements == [""]
|
||||
let replacements = targets
|
||||
endif
|
||||
for i in range(0,len(targets)-1)
|
||||
let new_dict[kbefore.targets[i].kafter] = vbefore.replacements[i%len(replacements)].vafter
|
||||
endfor
|
||||
else
|
||||
let new_dict[key] = val
|
||||
endif
|
||||
endfor
|
||||
if exists("redo")
|
||||
return s:expand_braces(new_dict)
|
||||
else
|
||||
return new_dict
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
" Abolish Dispatcher {{{1
|
||||
|
||||
function! s:SubComplete(A,L,P)
|
||||
if a:A =~ '^[/?]\k\+$'
|
||||
let char = strpart(a:A,0,1)
|
||||
return join(map(s:words(),'char . v:val'),"\n")
|
||||
elseif a:A =~# '^\k\+$'
|
||||
return join(s:words(),"\n")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:Complete(A,L,P)
|
||||
let g:L = a:L
|
||||
" Vim bug: :Abolish -<Tab> calls this function with a:A equal to 0
|
||||
if a:A =~# '^[^/?-]' && type(a:A) != type(0)
|
||||
return join(s:words(),"\n")
|
||||
elseif a:L =~# '^\w\+\s\+\%(-\w*\)\=$'
|
||||
return "-search\n-substitute\n-delete\n-buffer\n-cmdline\n"
|
||||
elseif a:L =~# ' -\%(search\|substitute\)\>'
|
||||
return "-flags="
|
||||
else
|
||||
return "-buffer\n-cmdline"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:commands = {}
|
||||
let s:commands.abstract = s:object.clone()
|
||||
|
||||
function! s:commands.abstract.dispatch(bang,line1,line2,count,args)
|
||||
return self.clone().go(a:bang,a:line1,a:line2,a:count,a:args)
|
||||
endfunction
|
||||
|
||||
function! s:commands.abstract.go(bang,line1,line2,count,args)
|
||||
let self.bang = a:bang
|
||||
let self.line1 = a:line1
|
||||
let self.line2 = a:line2
|
||||
let self.count = a:count
|
||||
return self.process(a:bang,a:line1,a:line2,a:count,a:args)
|
||||
endfunction
|
||||
|
||||
function! s:dispatcher(bang,line1,line2,count,args)
|
||||
let i = 0
|
||||
let args = copy(a:args)
|
||||
let command = s:commands.abbrev
|
||||
while i < len(args)
|
||||
if args[i] =~# '^-\w\+$' && has_key(s:commands,matchstr(args[i],'-\zs.*'))
|
||||
let command = s:commands[matchstr(args[i],'-\zs.*')]
|
||||
call remove(args,i)
|
||||
break
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
try
|
||||
return command.dispatch(a:bang,a:line1,a:line2,a:count,args)
|
||||
catch /^Abolish: /
|
||||
echohl ErrorMsg
|
||||
echo v:errmsg
|
||||
echohl NONE
|
||||
return ""
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
" Subvert Dispatcher {{{1
|
||||
|
||||
function! s:subvert_dispatcher(bang,line1,line2,count,args)
|
||||
try
|
||||
return s:parse_subvert(a:bang,a:line1,a:line2,a:count,a:args)
|
||||
catch /^Subvert: /
|
||||
echohl ErrorMsg
|
||||
echo v:errmsg
|
||||
echohl NONE
|
||||
return ""
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:parse_subvert(bang,line1,line2,count,args)
|
||||
if a:args =~ '^\%(\w\|$\)'
|
||||
let args = (a:bang ? "!" : "").a:args
|
||||
else
|
||||
let args = a:args
|
||||
endif
|
||||
let separator = matchstr(args,'^.')
|
||||
let split = split(args,separator,1)[1:]
|
||||
if a:count || split == [""]
|
||||
return s:parse_substitute(a:bang,a:line1,a:line2,a:count,split)
|
||||
elseif len(split) == 1
|
||||
return s:find_command(separator,"",split[0])
|
||||
elseif len(split) == 2 && split[1] =~# '^[A-Za-z]*n[A-Za-z]*$'
|
||||
return s:parse_substitute(a:bang,a:line1,a:line2,a:count,[split[0],"",split[1]])
|
||||
elseif len(split) == 2 && split[1] =~# '^[A-Za-z]*\%([+-]\d\+\)\=$'
|
||||
return s:find_command(separator,split[1],split[0])
|
||||
elseif len(split) >= 2 && split[1] =~# '^[A-Za-z]* '
|
||||
let flags = matchstr(split[1],'^[A-Za-z]*')
|
||||
let rest = matchstr(join(split[1:],separator),' \zs.*')
|
||||
return s:grep_command(rest,a:bang,flags,split[0])
|
||||
elseif len(split) >= 2 && separator == ' '
|
||||
return s:grep_command(join(split[1:],' '),a:bang,"",split[0])
|
||||
else
|
||||
return s:parse_substitute(a:bang,a:line1,a:line2,a:count,split)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:normalize_options(flags)
|
||||
if type(a:flags) == type({})
|
||||
let opts = a:flags
|
||||
let flags = get(a:flags,"flags","")
|
||||
else
|
||||
let opts = {}
|
||||
let flags = a:flags
|
||||
endif
|
||||
let g:op1 = copy(opts)
|
||||
if flags =~# 'w'
|
||||
let opts.boundaries = 2
|
||||
elseif flags =~# 'v'
|
||||
let opts.boundaries = 1
|
||||
elseif !has_key(opts,'boundaries')
|
||||
let opts.boundaries = 0
|
||||
endif
|
||||
let opts.case = (flags !~# 'I' ? get(opts,'case',1) : 0)
|
||||
let opts.flags = substitute(flags,'\C[avIiw]','','g')
|
||||
let g:op2 = copy(opts)
|
||||
return opts
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
" Searching {{{1
|
||||
|
||||
function! s:subesc(pattern)
|
||||
return substitute(a:pattern,'[][\\/.*+?~%()&]','\\&','g')
|
||||
endfunction
|
||||
|
||||
function! s:sort(a,b)
|
||||
if a:a ==? a:b
|
||||
return a:a == a:b ? 0 : a:a > a:b ? 1 : -1
|
||||
elseif strlen(a:a) == strlen(a:b)
|
||||
return a:a >? a:b ? 1 : -1
|
||||
else
|
||||
return strlen(a:a) < strlen(a:b) ? 1 : -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:pattern(dict,boundaries)
|
||||
if a:boundaries == 2
|
||||
let a = '<'
|
||||
let b = '>'
|
||||
elseif a:boundaries
|
||||
let a = '%(<|_@<=|[[:lower:]]@<=[[:upper:]]@=)'
|
||||
let b = '%(>|_@=|[[:lower:]]@<=[[:upper:]]@=)'
|
||||
else
|
||||
let a = ''
|
||||
let b = ''
|
||||
endif
|
||||
return '\v\C'.a.'%('.join(map(sort(keys(a:dict),function('s:sort')),'s:subesc(v:val)'),'|').')'.b
|
||||
endfunction
|
||||
|
||||
function! s:egrep_pattern(dict,boundaries)
|
||||
if a:boundaries == 2
|
||||
let a = '\<'
|
||||
let b = '\>'
|
||||
elseif a:boundaries
|
||||
let a = '(\<\|_)'
|
||||
let b = '(\>\|_\|[[:upper:]][[:lower:]])'
|
||||
else
|
||||
let a = ''
|
||||
let b = ''
|
||||
endif
|
||||
return a.'('.join(map(sort(keys(a:dict),function('s:sort')),'s:subesc(v:val)'),'\|').')'.b
|
||||
endfunction
|
||||
|
||||
function! s:c()
|
||||
call histdel('search',-1)
|
||||
return ""
|
||||
endfunction
|
||||
|
||||
function! s:find_command(cmd,flags,word)
|
||||
let opts = s:normalize_options(a:flags)
|
||||
let dict = s:create_dictionary(a:word,"",opts)
|
||||
" This is tricky. If we use :/pattern, the search drops us at the
|
||||
" beginning of the line, and we can't use position flags (e.g., /foo/e).
|
||||
" If we use :norm /pattern, we leave ourselves vulnerable to "press enter"
|
||||
" prompts (even with :silent).
|
||||
let cmd = (a:cmd =~ '[?!]' ? '?' : '/')
|
||||
let @/ = s:pattern(dict,opts.boundaries)
|
||||
if opts.flags == "" || !search(@/,'n')
|
||||
return "norm! ".cmd."\<CR>"
|
||||
elseif opts.flags =~ ';[/?]\@!'
|
||||
call s:throw("E386: Expected '?' or '/' after ';'")
|
||||
else
|
||||
return "exe 'norm! ".cmd.cmd.opts.flags."\<CR>'|call histdel('search',-1)"
|
||||
return ""
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:grep_command(args,bang,flags,word)
|
||||
let opts = s:normalize_options(a:flags)
|
||||
let dict = s:create_dictionary(a:word,"",opts)
|
||||
if &grepprg == "internal"
|
||||
let lhs = "'".s:pattern(dict,opts.boundaries)."'"
|
||||
else
|
||||
let lhs = "-E '".s:egrep_pattern(dict,opts.boundaries)."'"
|
||||
endif
|
||||
return "grep".(a:bang ? "!" : "")." ".lhs." ".a:args
|
||||
endfunction
|
||||
|
||||
let s:commands.search = s:commands.abstract.clone()
|
||||
let s:commands.search.options = {"word": 0, "variable": 0, "flags": ""}
|
||||
|
||||
function! s:commands.search.process(bang,line1,line2,count,args)
|
||||
call s:extractopts(a:args,self.options)
|
||||
if self.options.word
|
||||
let self.options.flags .= "w"
|
||||
elseif self.options.variable
|
||||
let self.options.flags .= "v"
|
||||
endif
|
||||
let opts = s:normalize_options(self.options)
|
||||
if len(a:args) > 1
|
||||
return s:grep_command(join(a:args[1:]," "),a:bang,opts,a:args[0])
|
||||
elseif len(a:args) == 1
|
||||
return s:find_command(a:bang ? "!" : " ",opts,a:args[0])
|
||||
else
|
||||
call s:throw("E471: Argument required")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
" Substitution {{{1
|
||||
|
||||
function! Abolished()
|
||||
return get(g:abolish_last_dict,submatch(0),submatch(0))
|
||||
endfunction
|
||||
|
||||
function! s:substitute_command(cmd,bad,good,flags)
|
||||
let opts = s:normalize_options(a:flags)
|
||||
let dict = s:create_dictionary(a:bad,a:good,opts)
|
||||
let lhs = s:pattern(dict,opts.boundaries)
|
||||
let g:abolish_last_dict = dict
|
||||
return a:cmd.'/'.lhs.'/\=Abolished()'."/".opts.flags
|
||||
endfunction
|
||||
|
||||
function! s:parse_substitute(bang,line1,line2,count,args)
|
||||
if get(a:args,0,'') =~ '^[/?'']'
|
||||
let separator = matchstr(a:args[0],'^.')
|
||||
let args = split(join(a:args,' '),separator,1)
|
||||
call remove(args,0)
|
||||
else
|
||||
let args = a:args
|
||||
endif
|
||||
if len(args) < 2
|
||||
call s:throw("E471: Argument required")
|
||||
elseif len(args) > 3
|
||||
call s:throw("E488: Trailing characters")
|
||||
endif
|
||||
let [bad,good,flags] = (args + [""])[0:2]
|
||||
if a:count == 0
|
||||
let cmd = "substitute"
|
||||
else
|
||||
let cmd = a:line1.",".a:line2."substitute"
|
||||
endif
|
||||
return s:substitute_command(cmd,bad,good,flags)
|
||||
endfunction
|
||||
|
||||
let s:commands.substitute = s:commands.abstract.clone()
|
||||
let s:commands.substitute.options = {"word": 0, "variable": 0, "flags": "g"}
|
||||
|
||||
function! s:commands.substitute.process(bang,line1,line2,count,args)
|
||||
call s:extractopts(a:args,self.options)
|
||||
if self.options.word
|
||||
let self.options.flags .= "w"
|
||||
elseif self.options.variable
|
||||
let self.options.flags .= "v"
|
||||
endif
|
||||
let opts = s:normalize_options(self.options)
|
||||
if len(a:args) <= 1
|
||||
call s:throw("E471: Argument required")
|
||||
else
|
||||
let good = join(a:args[1:],"")
|
||||
let cmd = a:bang ? "." : "%"
|
||||
return s:substitute_command(cmd,a:args[0],good,self.options)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
" Abbreviations {{{1
|
||||
|
||||
function! s:badgood(args)
|
||||
let words = filter(copy(a:args),'v:val !~ "^-"')
|
||||
call filter(a:args,'v:val =~ "^-"')
|
||||
if empty(words)
|
||||
call s:throw("E471: Argument required")
|
||||
elseif !empty(a:args)
|
||||
call s:throw("Unknown argument: ".a:args[0])
|
||||
endif
|
||||
let [bad; words] = words
|
||||
return [bad, join(words," ")]
|
||||
endfunction
|
||||
|
||||
function! s:abbreviate_from_dict(cmd,dict)
|
||||
for [lhs,rhs] in items(a:dict)
|
||||
exe a:cmd lhs rhs
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
let s:commands.abbrev = s:commands.abstract.clone()
|
||||
let s:commands.abbrev.options = {"buffer":0,"cmdline":0,"delete":0}
|
||||
function! s:commands.abbrev.process(bang,line1,line2,count,args)
|
||||
let args = copy(a:args)
|
||||
call s:extractopts(a:args,self.options)
|
||||
if self.options.delete
|
||||
let cmd = "unabbrev"
|
||||
let good = ""
|
||||
else
|
||||
let cmd = "noreabbrev"
|
||||
endif
|
||||
if !self.options.cmdline
|
||||
let cmd = "i" . cmd
|
||||
endif
|
||||
if self.options.delete
|
||||
let cmd = "silent! ".cmd
|
||||
endif
|
||||
if self.options.buffer
|
||||
let cmd = cmd . " <buffer>"
|
||||
endif
|
||||
let [bad, good] = s:badgood(a:args)
|
||||
if substitute(bad,'{.\{-\}.}','','g') !~ '^\k\+$'
|
||||
call s:throw("E474: Invalid argument (not a keyword: ".string(bad).")")
|
||||
endif
|
||||
if !self.options.delete && good == ""
|
||||
call s:throw("E471: Argument required".a:args[0])
|
||||
endif
|
||||
let dict = s:create_dictionary(bad,good,self.options)
|
||||
call s:abbreviate_from_dict(cmd,dict)
|
||||
if a:bang
|
||||
let i = 0
|
||||
let str = "Abolish ".join(args," ")
|
||||
let file = g:abolish_save_file
|
||||
if !isdirectory(fnamemodify(file,':h'))
|
||||
call mkdir(fnamemodify(file,':h'),'p')
|
||||
endif
|
||||
|
||||
if filereadable(file)
|
||||
let old = readfile(file)
|
||||
else
|
||||
let old = ["\" Exit if :Abolish isn't available.","if !exists(':Abolish')"," finish","endif",""]
|
||||
endif
|
||||
call writefile(old + [str],file)
|
||||
endif
|
||||
return ""
|
||||
endfunction
|
||||
|
||||
let s:commands.delete = s:commands.abbrev.clone()
|
||||
let s:commands.delete.options.delete = 1
|
||||
|
||||
" }}}1
|
||||
" Maps {{{1
|
||||
|
||||
function! s:unknown_coercion(letter,word)
|
||||
return a:word
|
||||
endfunction
|
||||
|
||||
call extend(Abolish.Coercions, {
|
||||
\ 'c': Abolish.camelcase,
|
||||
\ 'm': Abolish.mixedcase,
|
||||
\ 's': Abolish.snakecase,
|
||||
\ '_': Abolish.snakecase,
|
||||
\ 'u': Abolish.uppercase,
|
||||
\ 'U': Abolish.uppercase,
|
||||
\ '-': Abolish.dashcase,
|
||||
\ 'k': Abolish.dashcase,
|
||||
\ '.': Abolish.dotcase,
|
||||
\ ' ': Abolish.spacecase,
|
||||
\ 't': Abolish.titlecase,
|
||||
\ "function missing": s:function("s:unknown_coercion")
|
||||
\}, "keep")
|
||||
|
||||
function! s:coerce(transformation)
|
||||
let clipboard = &clipboard
|
||||
try
|
||||
set clipboard=
|
||||
let regbody = getreg('"')
|
||||
let regtype = getregtype('"')
|
||||
let c = v:count1
|
||||
while c > 0
|
||||
let c -= 1
|
||||
norm! yiw
|
||||
let word = @@
|
||||
let @@ = s:send(g:Abolish.Coercions,a:transformation,word)
|
||||
if !exists('begin')
|
||||
let begin = getpos("'[")
|
||||
endif
|
||||
if word !=# @@
|
||||
let changed = 1
|
||||
norm! viwpw
|
||||
else
|
||||
norm! w
|
||||
endif
|
||||
endwhile
|
||||
call setreg('"',regbody,regtype)
|
||||
call setpos("'[",begin)
|
||||
call setpos(".",begin)
|
||||
if exists("changed")
|
||||
silent! call repeat#set("\<Plug>Coerce".a:transformation)
|
||||
endif
|
||||
finally
|
||||
let &clipboard = clipboard
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <Plug>Coerce :<C-U>call <SID>coerce(nr2char(getchar()))<CR>
|
||||
|
||||
" }}}1
|
||||
|
||||
if !exists("g:abolish_no_mappings") || ! g:abolish_no_mappings
|
||||
nmap cr <Plug>Coerce
|
||||
endif
|
||||
|
||||
command! -nargs=+ -bang -bar -range=0 -complete=custom,s:Complete Abolish
|
||||
\ :exec s:dispatcher(<bang>0,<line1>,<line2>,<count>,[<f-args>])
|
||||
command! -nargs=1 -bang -bar -range=0 -complete=custom,s:SubComplete Subvert
|
||||
\ :exec s:subvert_dispatcher(<bang>0,<line1>,<line2>,<count>,<q-args>)
|
||||
if exists(':S') != 2
|
||||
command -nargs=1 -bang -bar -range=0 -complete=custom,s:SubComplete S
|
||||
\ :exec s:subvert_dispatcher(<bang>0,<line1>,<line2>,<count>,<q-args>)
|
||||
endif
|
||||
|
||||
" vim:set ft=vim sw=2 sts=2:
|
|
@ -42,8 +42,6 @@
|
|||
" 0.1 - 06 June 2009
|
||||
" - Initial public release of mako indent file
|
||||
|
||||
let sw=2 " default shiftwidth of 2 spaces
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
@ -53,6 +51,9 @@ setlocal nosmartindent
|
|||
setlocal noautoindent
|
||||
setlocal nocindent
|
||||
setlocal nolisp
|
||||
setlocal expandtab
|
||||
setlocal softtabstop=2
|
||||
setlocal shiftwidth=2
|
||||
|
||||
setlocal indentexpr=GetMakoIndent()
|
||||
setlocal indentkeys+=*<Return>,<>>,<bs>,end,:
|
||||
|
|
|
@ -35,9 +35,15 @@ and you never get any warnings about the file changing outside Vim.
|
|||
making it like `git add` when called from a work tree file and like
|
||||
`git checkout` when called from the index or a blob in history.
|
||||
|
||||
Use `:Gbrowse` to open the current file on GitHub, with optional line
|
||||
range (try it in visual mode!). If your current repository isn't on
|
||||
GitHub, `git instaweb` will be spun up instead.
|
||||
Use `:Gbrowse` to open the current file on the web front-end of your favorite
|
||||
hosting provider, with optional line range (try it in visual mode!). Built-in
|
||||
support is provided for `git instaweb`, and plugins are available for popular
|
||||
providers such as [GitHub][rhubarb.vim], [GitLab][fugitive-gitlab.vim], and
|
||||
[Bitbucket][fubitive.vim].
|
||||
|
||||
[rhubarb.vim]: https://github.com/tpope/vim-rhubarb
|
||||
[fugitive-gitlab.vim]: https://github.com/shumphrey/fugitive-gitlab.vim
|
||||
[fubitive.vim]: https://github.com/tommcdo/vim-fubitive
|
||||
|
||||
Add `%{fugitive#statusline()}` to `'statusline'` to get an indicator
|
||||
with the current branch in (surprise!) your statusline.
|
||||
|
|
|
@ -181,7 +181,9 @@ that are part of Git repositories).
|
|||
to the right or bottom, depending on 'diffopt' and
|
||||
the width of the window relative to 'textwidth'. Use
|
||||
|do| and |dp| and write to the index file to simulate
|
||||
"git add --patch".
|
||||
"git add --patch". For the three-way diff, there is
|
||||
also d2o and d3o pulling the hunk to the middle from
|
||||
the left or the right window, respectively.
|
||||
|
||||
*fugitive-:Gsdiff*
|
||||
:Gsdiff [revision] Like |:Gdiff|, but always split horizontally.
|
||||
|
@ -232,9 +234,7 @@ that are part of Git repositories).
|
|||
Upstream providers can be added by installing an
|
||||
appropriate Vim plugin. For example, GitHub can be
|
||||
supported by installing rhubarb.vim, available at
|
||||
<https://github.com/tpope/vim-rhubarb>. (Native
|
||||
support for GitHub is currently included, but that is
|
||||
slated to be removed.)
|
||||
<https://github.com/tpope/vim-rhubarb>.
|
||||
|
||||
The hosting provider is determined by looking at the
|
||||
remote for the current or specified branch and falls
|
||||
|
|
|
@ -70,6 +70,10 @@ endfunction
|
|||
|
||||
let s:git_versions = {}
|
||||
|
||||
function! s:git_command() abort
|
||||
return get(g:, 'fugitive_git_command', g:fugitive_git_executable)
|
||||
endfunction
|
||||
|
||||
function! fugitive#git_version(...) abort
|
||||
if !has_key(s:git_versions, g:fugitive_git_executable)
|
||||
let s:git_versions[g:fugitive_git_executable] = matchstr(system(g:fugitive_git_executable.' --version'), "\\S\\+\n")
|
||||
|
@ -127,7 +131,12 @@ function! fugitive#extract_git_dir(path) abort
|
|||
if s:shellslash(a:path) =~# '^fugitive://.*//'
|
||||
return matchstr(s:shellslash(a:path), '\C^fugitive://\zs.\{-\}\ze//')
|
||||
endif
|
||||
let root = s:shellslash(simplify(fnamemodify(a:path, ':p:s?[\/]$??')))
|
||||
if isdirectory(a:path)
|
||||
let path = fnamemodify(a:path, ':p:s?[\/]$??')
|
||||
else
|
||||
let path = fnamemodify(a:path, ':p:h:s?[\/]$??')
|
||||
endif
|
||||
let root = s:shellslash(resolve(path))
|
||||
let previous = ""
|
||||
while root !=# previous
|
||||
if root =~# '\v^//%([^/]+/?)?$'
|
||||
|
@ -179,6 +188,9 @@ function! fugitive#detect(path) abort
|
|||
let dir = fugitive#extract_git_dir(a:path)
|
||||
if dir !=# ''
|
||||
let b:git_dir = dir
|
||||
if empty(fugitive#buffer().path())
|
||||
silent! exe haslocaldir() ? 'lcd .' : 'cd .'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
if exists('b:git_dir')
|
||||
|
@ -286,6 +298,9 @@ endfunction
|
|||
function! s:repo_tree(...) dict abort
|
||||
if self.dir() =~# '/\.git$'
|
||||
let dir = self.dir()[0:-6]
|
||||
if dir !~# '/'
|
||||
let dir .= '/'
|
||||
endif
|
||||
else
|
||||
let dir = s:configured_tree(self.git_dir)
|
||||
endif
|
||||
|
@ -374,12 +389,14 @@ endfunction
|
|||
call s:add_methods('repo',['dir','tree','bare','translate','head'])
|
||||
|
||||
function! s:repo_git_command(...) dict abort
|
||||
let git = g:fugitive_git_executable . ' --git-dir='.s:shellesc(self.git_dir)
|
||||
let git = s:git_command() . ' --git-dir='.s:shellesc(self.git_dir)
|
||||
return git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'')
|
||||
endfunction
|
||||
|
||||
function! s:repo_git_chomp(...) dict abort
|
||||
return s:sub(system(call(self.git_command,a:000,self)),'\n$','')
|
||||
let git = g:fugitive_git_executable . ' --git-dir='.s:shellesc(self.git_dir)
|
||||
let output = git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'')
|
||||
return s:sub(system(output),'\n$','')
|
||||
endfunction
|
||||
|
||||
function! s:repo_git_chomp_in_tree(...) dict abort
|
||||
|
@ -456,7 +473,7 @@ endfunction
|
|||
call s:add_methods('repo',['dirglob','superglob'])
|
||||
|
||||
function! s:repo_config(conf) dict abort
|
||||
return matchstr(system(s:repo().git_command('config').' '.a:conf),"[^\r\n]*")
|
||||
return matchstr(s:repo().git_chomp('config',a:conf),"[^\r\n]*")
|
||||
endfun
|
||||
|
||||
function! s:repo_user() dict abort
|
||||
|
@ -480,9 +497,9 @@ call s:add_methods('repo',['config', 'user', 'aliases'])
|
|||
function! s:repo_keywordprg() dict abort
|
||||
let args = ' --git-dir='.escape(self.dir(),"\\\"' ")
|
||||
if has('gui_running') && !has('win32')
|
||||
return g:fugitive_git_executable . ' --no-pager' . args . ' log -1'
|
||||
return s:git_command() . ' --no-pager' . args . ' log -1'
|
||||
else
|
||||
return g:fugitive_git_executable . args . ' show'
|
||||
return s:git_command() . args . ' show'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -693,7 +710,7 @@ function! s:Git(bang, args) abort
|
|||
if a:bang
|
||||
return s:Edit('edit', 1, a:args)
|
||||
endif
|
||||
let git = g:fugitive_git_executable
|
||||
let git = s:git_command()
|
||||
if has('gui_running') && !has('win32')
|
||||
let git .= ' --no-pager'
|
||||
endif
|
||||
|
@ -958,11 +975,14 @@ function! s:StageToggle(lnum1,lnum2) abort
|
|||
continue
|
||||
endif
|
||||
execute lnum
|
||||
if filename =~ ' -> '
|
||||
let cmd = ['mv','--'] + reverse(split(filename,' -> '))
|
||||
let filename = cmd[-1]
|
||||
elseif section ==# 'staged'
|
||||
let cmd = ['reset','-q','--',filename]
|
||||
if section ==# 'staged'
|
||||
if filename =~ ' -> '
|
||||
let files_to_unstage = split(filename,' -> ')
|
||||
else
|
||||
let files_to_unstage = [filename]
|
||||
endif
|
||||
let filename = files_to_unstage[-1]
|
||||
let cmd = ['reset','-q','--'] + files_to_unstage
|
||||
elseif getline(lnum) =~# '^#\tdeleted:'
|
||||
let cmd = ['rm','--',filename]
|
||||
elseif getline(lnum) =~# '^#\tmodified:'
|
||||
|
@ -1104,7 +1124,7 @@ function! s:Commit(args, ...) abort
|
|||
elseif error ==# '!'
|
||||
return s:Status()
|
||||
else
|
||||
call s:throw(error)
|
||||
call s:throw(empty(error)?join(errors, ' '):error)
|
||||
endif
|
||||
endif
|
||||
catch /^fugitive:/
|
||||
|
@ -1211,7 +1231,7 @@ function! s:Merge(cmd, bang, args) abort
|
|||
\ !empty(s:repo().git_chomp('diff-files', '--diff-filter=U')))
|
||||
let &l:makeprg = g:fugitive_git_executable.' diff-files --name-status --diff-filter=U'
|
||||
else
|
||||
let &l:makeprg = s:sub(g:fugitive_git_executable . ' ' . a:cmd .
|
||||
let &l:makeprg = s:sub(s:git_command() . ' ' . a:cmd .
|
||||
\ (a:args =~# ' \%(--no-edit\|--abort\|-m\)\>' ? '' : ' --edit') .
|
||||
\ ' ' . a:args, ' *$', '')
|
||||
endif
|
||||
|
@ -1371,6 +1391,7 @@ function! s:Edit(cmd,bang,...) abort
|
|||
endif
|
||||
endif
|
||||
endfor
|
||||
diffoff!
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
@ -1390,6 +1411,9 @@ function! s:Edit(cmd,bang,...) abort
|
|||
return 'redraw|echo '.string(':!'.git.' '.args)
|
||||
else
|
||||
let temp = resolve(tempname())
|
||||
if has('win32')
|
||||
let temp = fnamemodify(fnamemodify(temp, ':h'), ':p').fnamemodify(temp, ':t')
|
||||
endif
|
||||
let s:temp_files[s:cpath(temp)] = { 'dir': buffer.repo().dir(), 'args': arglist }
|
||||
silent execute a:cmd.' '.temp
|
||||
if a:cmd =~# 'pedit'
|
||||
|
@ -1632,7 +1656,7 @@ function! s:Dispatch(bang, args)
|
|||
try
|
||||
let b:current_compiler = 'git'
|
||||
let &l:errorformat = s:common_efm
|
||||
let &l:makeprg = g:fugitive_git_executable . ' ' . a:args
|
||||
let &l:makeprg = substitute(s:git_command() . ' ' . a:args, '\s\+$', '', '')
|
||||
execute cd fnameescape(s:repo().tree())
|
||||
if exists(':Make') == 2
|
||||
noautocmd Make
|
||||
|
@ -2011,6 +2035,9 @@ function! s:Blame(bang,line1,line2,count,args) abort
|
|||
endif
|
||||
let top = line('w0') + &scrolloff
|
||||
let current = line('.')
|
||||
if has('win32')
|
||||
let temp = fnamemodify(fnamemodify(temp, ':h'), ':p').fnamemodify(temp, ':t')
|
||||
endif
|
||||
let s:temp_files[s:cpath(temp)] = { 'dir': s:repo().dir(), 'args': cmd }
|
||||
exe 'keepalt leftabove vsplit '.temp
|
||||
let b:fugitive_blamed_bufnr = bufnr
|
||||
|
@ -2188,7 +2215,7 @@ endfunction
|
|||
|
||||
function! s:RehighlightBlame() abort
|
||||
for [hash, cterm] in items(s:hash_colors)
|
||||
if !empty(cterm) || has('gui_running')
|
||||
if !empty(cterm) || has('gui_running') || has('termguicolors') && &termguicolors
|
||||
exe 'hi FugitiveblameHash'.hash.' guifg=#'.hash.get(s:hash_colors, hash, '')
|
||||
else
|
||||
exe 'hi link FugitiveblameHash'.hash.' Identifier'
|
||||
|
@ -2260,10 +2287,11 @@ function! s:Browse(bang,line1,count,...) abort
|
|||
if path =~# '^\.git/refs/remotes/.'
|
||||
if empty(remote)
|
||||
let remote = matchstr(path, '^\.git/refs/remotes/\zs[^/]\+')
|
||||
let branch = matchstr(path, '^\.git/refs/remotes/[^/]\+/\zs.\+')
|
||||
else
|
||||
let merge = matchstr(path, '^\.git/refs/remotes/[^/]\+/\zs.\+')
|
||||
let path = '.git/refs/heads/'.merge
|
||||
endif
|
||||
let merge = matchstr(path, '^\.git/refs/remotes/[^/]\+/\zs.\+')
|
||||
let branch = ''
|
||||
let path = '.git/refs/heads/'.merge
|
||||
elseif path =~# '^\.git/refs/heads/.'
|
||||
let branch = path[16:-1]
|
||||
elseif !exists('branch')
|
||||
|
@ -2300,9 +2328,14 @@ function! s:Browse(bang,line1,count,...) abort
|
|||
|
||||
if empty(remote)
|
||||
let remote = '.'
|
||||
let raw = s:repo().git_chomp('remote','get-url','origin')
|
||||
let remote_for_url = 'origin'
|
||||
else
|
||||
let raw = s:repo().git_chomp('remote','get-url',remote)
|
||||
let remote_for_url = remote
|
||||
endif
|
||||
if fugitive#git_version() =~# '^[01]\.|^2\.[0-6]\.'
|
||||
let raw = s:repo().git_chomp('config','remote.'.remote_for_url.'.url')
|
||||
else
|
||||
let raw = s:repo().git_chomp('remote','get-url',remote_for_url)
|
||||
endif
|
||||
if raw ==# ''
|
||||
let raw = remote
|
||||
|
@ -2365,46 +2398,8 @@ function! s:github_url(opts, ...) abort
|
|||
if repo ==# ''
|
||||
return ''
|
||||
endif
|
||||
let path = substitute(a:opts.path, '^/', '', '')
|
||||
if index(domains, 'http://' . matchstr(repo, '^[^:/]*')) >= 0
|
||||
let root = 'http://' . s:sub(repo,':','/')
|
||||
else
|
||||
let root = 'https://' . s:sub(repo,':','/')
|
||||
endif
|
||||
if path =~# '^\.git/refs/heads/'
|
||||
let branch = a:opts.repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1]
|
||||
if branch ==# ''
|
||||
return root . '/commits/' . path[16:-1]
|
||||
else
|
||||
return root . '/commits/' . branch
|
||||
endif
|
||||
elseif path =~# '^\.git/refs/tags/'
|
||||
return root . '/releases/tag/' . path[15:-1]
|
||||
elseif path =~# '^\.git/refs/remotes/[^/]\+/.'
|
||||
return root . '/commits/' . matchstr(path,'remotes/[^/]\+/\zs.*')
|
||||
elseif path =~# '.git/\%(config$\|hooks\>\)'
|
||||
return root . '/admin'
|
||||
elseif path =~# '^\.git\>'
|
||||
return root
|
||||
endif
|
||||
if a:opts.commit =~# '^\d\=$'
|
||||
let commit = a:opts.repo.rev_parse('HEAD')
|
||||
else
|
||||
let commit = a:opts.commit
|
||||
endif
|
||||
if get(a:opts, 'type', '') ==# 'tree' || a:opts.path =~# '/$'
|
||||
let url = substitute(root . '/tree/' . commit . '/' . path, '/$', '', 'g')
|
||||
elseif get(a:opts, 'type', '') ==# 'blob' || a:opts.path =~# '[^/]$'
|
||||
let url = root . '/blob/' . commit . '/' . path
|
||||
if get(a:opts, 'line2') && a:opts.line1 == a:opts.line2
|
||||
let url .= '#L' . a:opts.line1
|
||||
elseif get(a:opts, 'line2')
|
||||
let url .= '#L' . a:opts.line1 . '-L' . a:opts.line2
|
||||
endif
|
||||
else
|
||||
let url = root . '/commit/' . commit
|
||||
endif
|
||||
return url
|
||||
call s:warn('Install rhubarb.vim for GitHub support')
|
||||
return 'https://github.com/tpope/vim-rhubarb'
|
||||
endfunction
|
||||
|
||||
function! s:instaweb_url(opts) abort
|
||||
|
@ -2662,7 +2657,7 @@ function! s:BufReadObject() abort
|
|||
let b:fugitive_type = s:repo().git_chomp('cat-file','-t',hash)
|
||||
endif
|
||||
if b:fugitive_type !~# '^\%(tag\|commit\|tree\|blob\)$'
|
||||
return "echoerr 'fugitive: unrecognized git type'"
|
||||
return "echoerr ".string("fugitive: unrecognized git type '".b:fugitive_type."'")
|
||||
endif
|
||||
let firstline = getline('.')
|
||||
if !exists('b:fugitive_display_format') && b:fugitive_type != 'blob'
|
||||
|
@ -2906,7 +2901,7 @@ function! s:cfile() abort
|
|||
let ref = matchstr(getline('.'),'\x\{40\}')
|
||||
echoerr "warning: unknown context ".matchstr(getline('.'),'^\l*')
|
||||
|
||||
elseif getline('.') =~# '^[+-]\{3\} [ab/]'
|
||||
elseif getline('.') =~# '^[+-]\{3\} [abciow12]\=/'
|
||||
let ref = getline('.')[4:]
|
||||
|
||||
elseif getline('.') =~# '^[+-]' && search('^@@ -\d\+,\d\+ +\d\+,','bnW')
|
||||
|
@ -2920,7 +2915,7 @@ function! s:cfile() abort
|
|||
let lnum -= 1
|
||||
endwhile
|
||||
let offset += matchstr(getline(lnum), type.'\zs\d\+')
|
||||
let ref = getline(search('^'.type.'\{3\} [ab]/','bnW'))[4:-1]
|
||||
let ref = getline(search('^'.type.'\{3\} [abciow12]/','bnW'))[4:-1]
|
||||
let dcmds = [offset, 'normal!zv']
|
||||
|
||||
elseif getline('.') =~# '^rename from '
|
||||
|
@ -2929,22 +2924,22 @@ function! s:cfile() abort
|
|||
let ref = 'b/'.getline('.')[10:]
|
||||
|
||||
elseif getline('.') =~# '^@@ -\d\+,\d\+ +\d\+,'
|
||||
let diff = getline(search('^diff --git \%(a/.*\|/dev/null\) \%(b/.*\|/dev/null\)', 'bcnW'))
|
||||
let diff = getline(search('^diff --git \%([abciow12]/.*\|/dev/null\) \%([abciow12]/.*\|/dev/null\)', 'bcnW'))
|
||||
let offset = matchstr(getline('.'), '+\zs\d\+')
|
||||
|
||||
let dref = matchstr(diff, '\Cdiff --git \zs\%(a/.*\|/dev/null\)\ze \%(b/.*\|/dev/null\)')
|
||||
let ref = matchstr(diff, '\Cdiff --git \%(a/.*\|/dev/null\) \zs\%(b/.*\|/dev/null\)')
|
||||
let dref = matchstr(diff, '\Cdiff --git \zs\%([abciow12]/.*\|/dev/null\)\ze \%([abciow12]/.*\|/dev/null\)')
|
||||
let ref = matchstr(diff, '\Cdiff --git \%([abciow12]/.*\|/dev/null\) \zs\%([abciow12]/.*\|/dev/null\)')
|
||||
let dcmd = 'Gdiff! +'.offset
|
||||
|
||||
elseif getline('.') =~# '^diff --git \%(a/.*\|/dev/null\) \%(b/.*\|/dev/null\)'
|
||||
let dref = matchstr(getline('.'),'\Cdiff --git \zs\%(a/.*\|/dev/null\)\ze \%(b/.*\|/dev/null\)')
|
||||
let ref = matchstr(getline('.'),'\Cdiff --git \%(a/.*\|/dev/null\) \zs\%(b/.*\|/dev/null\)')
|
||||
elseif getline('.') =~# '^diff --git \%([abciow12]/.*\|/dev/null\) \%([abciow12]/.*\|/dev/null\)'
|
||||
let dref = matchstr(getline('.'),'\Cdiff --git \zs\%([abciow12]/.*\|/dev/null\)\ze \%([abciow12]/.*\|/dev/null\)')
|
||||
let ref = matchstr(getline('.'),'\Cdiff --git \%([abciow12]/.*\|/dev/null\) \zs\%([abciow12]/.*\|/dev/null\)')
|
||||
let dcmd = 'Gdiff!'
|
||||
|
||||
elseif getline('.') =~# '^index ' && getline(line('.')-1) =~# '^diff --git \%(a/.*\|/dev/null\) \%(b/.*\|/dev/null\)'
|
||||
elseif getline('.') =~# '^index ' && getline(line('.')-1) =~# '^diff --git \%([abciow12]/.*\|/dev/null\) \%([abciow12]/.*\|/dev/null\)'
|
||||
let line = getline(line('.')-1)
|
||||
let dref = matchstr(line,'\Cdiff --git \zs\%(a/.*\|/dev/null\)\ze \%(b/.*\|/dev/null\)')
|
||||
let ref = matchstr(line,'\Cdiff --git \%(a/.*\|/dev/null\) \zs\%(b/.*\|/dev/null\)')
|
||||
let dref = matchstr(line,'\Cdiff --git \zs\%([abciow12]/.*\|/dev/null\)\ze \%([abciow12]/.*\|/dev/null\)')
|
||||
let ref = matchstr(line,'\Cdiff --git \%([abciow12]/.*\|/dev/null\) \zs\%([abciow12]/.*\|/dev/null\)')
|
||||
let dcmd = 'Gdiff!'
|
||||
|
||||
elseif line('$') == 1 && getline('.') =~ '^\x\{40\}$'
|
||||
|
@ -2957,18 +2952,21 @@ function! s:cfile() abort
|
|||
let ref = ''
|
||||
endif
|
||||
|
||||
if myhash ==# ''
|
||||
let ref = s:sub(ref,'^a/','HEAD:')
|
||||
let ref = s:sub(ref,'^b/',':0:')
|
||||
if exists('dref')
|
||||
let dref = s:sub(dref,'^a/','HEAD:')
|
||||
endif
|
||||
else
|
||||
let ref = s:sub(ref,'^a/',myhash.'^:')
|
||||
let ref = s:sub(ref,'^b/',myhash.':')
|
||||
if exists('dref')
|
||||
let dref = s:sub(dref,'^a/',myhash.'^:')
|
||||
endif
|
||||
let prefixes = {
|
||||
\ '1': '',
|
||||
\ '2': '',
|
||||
\ 'b': ':0:',
|
||||
\ 'i': ':0:',
|
||||
\ 'o': '',
|
||||
\ 'w': ''}
|
||||
|
||||
if len(myhash)
|
||||
let prefixes.a = myhash.'^:'
|
||||
let prefixes.b = myhash.':'
|
||||
endif
|
||||
let ref = substitute(ref, '^\(\w\)/', '\=get(prefixes, submatch(1), "HEAD:")', '')
|
||||
if exists('dref')
|
||||
let dref = substitute(dref, '^\(\w\)/', '\=get(prefixes, submatch(1), "HEAD:")', '')
|
||||
endif
|
||||
|
||||
if ref ==# '/dev/null'
|
||||
|
@ -3076,7 +3074,7 @@ function! fugitive#foldtext() abort
|
|||
endif
|
||||
endfor
|
||||
if filename ==# ''
|
||||
let filename = matchstr(getline(v:foldstart), '^diff .\{-\} a/\zs.*\ze b/')
|
||||
let filename = matchstr(getline(v:foldstart), '^diff .\{-\} [abciow12]/\zs.*\ze [abciow12]/')
|
||||
endif
|
||||
if filename ==# ''
|
||||
let filename = getline(v:foldstart)[5:-1]
|
||||
|
|
|
@ -215,6 +215,7 @@ By default the signs are updated as follows:
|
|||
| Switch buffer | To notice change to git index | `g:gitgutter_eager` |
|
||||
| Switch tab | To notice change to git index | `g:gitgutter_eager` |
|
||||
| Focus the GUI | To notice change to git index | `g:gitgutter_eager` (not gVim on Windows) |
|
||||
| After shell command | To notice change to git index | `g:gitgutter_eager` |
|
||||
| Read a file into a buffer | To display initial signs | [always] |
|
||||
| Save a buffer | So non-realtime signs are up to date | [always] |
|
||||
| Change a file outside Vim | To notice `git stash` | [always] |
|
||||
|
@ -338,11 +339,11 @@ See above for configuring maps for hunk-jumping and staging/undoing.
|
|||
|
||||
#### Use a custom `grep` command
|
||||
|
||||
If you use an alternative to grep, or your grep does not support the `color` flag, you can tell vim-gitgutter to use it here. It only needs to support extended POSIX regex.
|
||||
If you use an alternative to grep, you can tell vim-gitgutter to use it here.
|
||||
|
||||
```viml
|
||||
" Default:
|
||||
let g:gitgutter_grep_command = 'grep --color=never -e'
|
||||
let g:gitgutter_grep_command = 'grep'
|
||||
```
|
||||
|
||||
#### To turn off vim-gitgutter by default
|
||||
|
@ -427,6 +428,58 @@ Let's say, for example, you want to remove trailing whitespace from all changed
|
|||
```
|
||||
|
||||
|
||||
#### Cycle through hunks in all buffers
|
||||
|
||||
`]c` and `[c` jump from one hunk to the next in the current buffer. You can use this code to jump to the next hunk no matter which buffer it's in.
|
||||
|
||||
```viml
|
||||
function! NextHunkAllBuffers()
|
||||
let line = line('.')
|
||||
GitGutterNextHunk
|
||||
if line('.') != line
|
||||
return
|
||||
endif
|
||||
|
||||
let bufnr = bufnr('')
|
||||
while 1
|
||||
bnext
|
||||
if bufnr('') == bufnr
|
||||
return
|
||||
endif
|
||||
if !empty(GitGutterGetHunks())
|
||||
normal! 1G
|
||||
GitGutterNextHunk
|
||||
return
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! PrevHunkAllBuffers()
|
||||
let line = line('.')
|
||||
GitGutterPrevHunk
|
||||
if line('.') != line
|
||||
return
|
||||
endif
|
||||
|
||||
let bufnr = bufnr('')
|
||||
while 1
|
||||
bprevious
|
||||
if bufnr('') == bufnr
|
||||
return
|
||||
endif
|
||||
if !empty(GitGutterGetHunks())
|
||||
normal! G
|
||||
GitGutterPrevHunk
|
||||
return
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
nmap <silent> ]c :call NextHunkAllBuffers()<CR>
|
||||
nmap <silent> [c :call PrevHunkAllBuffers()<CR>
|
||||
```
|
||||
|
||||
|
||||
### FAQ
|
||||
|
||||
> Why can't I unstage staged changes?
|
||||
|
@ -474,7 +527,7 @@ Here are some things you can check:
|
|||
* Your git config is compatible with the version of git returned by the command above.
|
||||
* Your Vim supports signs (`:echo has('signs')` should give `1`).
|
||||
* Your file is being tracked by git and has unstaged changes.
|
||||
* If your grep does not support the `color` flag, add `let g:gitgutter_grep_command = 'grep -e'` to your `~/.vimrc`.
|
||||
* If you have aliased or configured `grep` to use any flags, add `let g:gitgutter_grep_command = 'grep'` to your `~/.vimrc`.
|
||||
|
||||
|
||||
### Shameless Plug
|
||||
|
|
|
@ -44,7 +44,7 @@ endfunction
|
|||
function! gitgutter#handle_diff(diff) abort
|
||||
call gitgutter#debug#log(a:diff)
|
||||
|
||||
call setbufvar(gitgutter#utility#bufnr(), 'gitgutter_tracked', 1)
|
||||
call gitgutter#utility#setbufvar(gitgutter#utility#bufnr(), 'tracked', 1)
|
||||
|
||||
call gitgutter#hunk#set_hunks(gitgutter#diff#parse_diff(a:diff))
|
||||
let modified_lines = gitgutter#diff#process_hunks(gitgutter#hunk#hunks())
|
||||
|
@ -209,10 +209,16 @@ function! gitgutter#undo_hunk() abort
|
|||
call gitgutter#utility#system(gitgutter#utility#command_in_directory_of_file(g:gitgutter_git_executable.' apply --reverse --unidiff-zero - '), diff_for_hunk)
|
||||
|
||||
" reload file preserving screen line position
|
||||
let wl = winline()
|
||||
" CTRL-Y and CTRL-E treat negative counts as positive counts.
|
||||
let x = line('w0')
|
||||
silent edit
|
||||
let offset = wl - winline()
|
||||
execute "normal! ".offset."\<C-Y>"
|
||||
let y = line('w0')
|
||||
let z = x - y
|
||||
if z > 0
|
||||
execute "normal! ".z."\<C-E>"
|
||||
else
|
||||
execute "normal! ".z."\<C-Y>"
|
||||
endif
|
||||
endif
|
||||
|
||||
silent! call repeat#set("\<Plug>GitGutterUndoHunk", -1)<CR>
|
||||
|
|
|
@ -59,11 +59,7 @@ function! gitgutter#async#execute(cmd) abort
|
|||
if has('unix')
|
||||
let command = ["sh", "-c", a:cmd]
|
||||
elseif has('win32')
|
||||
" Help docs recommend {command} be a string on Windows. But I think
|
||||
" they also say that will run the command directly, which I believe would
|
||||
" mean the redirection and pipe stuff wouldn't work.
|
||||
" let command = "cmd.exe /c ".a:cmd
|
||||
let command = ["cmd.exe", "/c", a:cmd]
|
||||
let command = "cmd.exe /c ".a:cmd
|
||||
else
|
||||
throw 'unknown os'
|
||||
endif
|
||||
|
@ -79,7 +75,7 @@ function! gitgutter#async#execute(cmd) abort
|
|||
endfunction
|
||||
|
||||
|
||||
function! gitgutter#async#handle_diff_job_nvim(job_id, data, event) abort
|
||||
function! gitgutter#async#handle_diff_job_nvim(job_id, data, event) dict abort
|
||||
call gitgutter#debug#log('job_id: '.a:job_id.', event: '.a:event.', buffer: '.self.buffer)
|
||||
|
||||
let job_bufnr = self.buffer
|
||||
|
|
|
@ -4,7 +4,10 @@ if exists('g:gitgutter_grep_command')
|
|||
else
|
||||
let s:grep_available = executable('grep')
|
||||
if s:grep_available
|
||||
let s:grep_command = 'grep --color=never -e'
|
||||
let s:grep_command = 'grep'
|
||||
if $GREP_OPTIONS =~# '--color=always'
|
||||
let s:grep_command .= ' --color=never'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'
|
||||
|
@ -56,7 +59,7 @@ function! gitgutter#diff#run_diff(realtime, preserve_full_diff) abort
|
|||
let cmd = '('
|
||||
|
||||
let bufnr = gitgutter#utility#bufnr()
|
||||
let tracked = getbufvar(bufnr, 'gitgutter_tracked') " i.e. tracked by git
|
||||
let tracked = gitgutter#utility#getbufvar(bufnr, 'tracked', 0) " i.e. tracked by git
|
||||
if !tracked
|
||||
" Don't bother trying to realtime-diff an untracked file.
|
||||
" NOTE: perhaps we should pull this guard up to the caller?
|
||||
|
@ -95,6 +98,7 @@ function! gitgutter#diff#run_diff(realtime, preserve_full_diff) abort
|
|||
let cmd .= g:gitgutter_git_executable
|
||||
if s:c_flag
|
||||
let cmd .= ' -c "diff.autorefreshindex=0"'
|
||||
let cmd .= ' -c "diff.noprefix=false"'
|
||||
endif
|
||||
let cmd .= ' diff --no-ext-diff --no-color -U0 '.g:gitgutter_diff_args.' '
|
||||
|
||||
|
@ -165,7 +169,6 @@ function! gitgutter#diff#parse_hunk(line) abort
|
|||
endfunction
|
||||
|
||||
function! gitgutter#diff#process_hunks(hunks) abort
|
||||
call gitgutter#hunk#reset()
|
||||
let modified_lines = []
|
||||
for hunk in a:hunks
|
||||
call extend(modified_lines, gitgutter#diff#process_hunk(hunk))
|
||||
|
|
|
@ -1,47 +1,53 @@
|
|||
let s:hunks = []
|
||||
|
||||
function! gitgutter#hunk#set_hunks(hunks) abort
|
||||
let s:hunks = a:hunks
|
||||
call gitgutter#utility#setbufvar(gitgutter#utility#bufnr(), 'hunks', a:hunks)
|
||||
call s:reset_summary()
|
||||
endfunction
|
||||
|
||||
function! gitgutter#hunk#hunks() abort
|
||||
return s:hunks
|
||||
endfunction
|
||||
|
||||
function! gitgutter#hunk#summary(bufnr) abort
|
||||
return get(getbufvar(a:bufnr,''), 'gitgutter_summary', [0,0,0])
|
||||
return gitgutter#utility#getbufvar(gitgutter#utility#bufnr(), 'hunks', [])
|
||||
endfunction
|
||||
|
||||
function! gitgutter#hunk#reset() abort
|
||||
call setbufvar(gitgutter#utility#bufnr(), 'gitgutter_summary', [0,0,0])
|
||||
call gitgutter#utility#setbufvar(gitgutter#utility#bufnr(), 'hunks', [])
|
||||
call s:reset_summary()
|
||||
endfunction
|
||||
|
||||
|
||||
function! gitgutter#hunk#summary(bufnr) abort
|
||||
return gitgutter#utility#getbufvar(a:bufnr, 'summary', [0,0,0])
|
||||
endfunction
|
||||
|
||||
function! s:reset_summary() abort
|
||||
call gitgutter#utility#setbufvar(gitgutter#utility#bufnr(), 'summary', [0,0,0])
|
||||
endfunction
|
||||
|
||||
function! gitgutter#hunk#increment_lines_added(count) abort
|
||||
let bufnr = gitgutter#utility#bufnr()
|
||||
let summary = gitgutter#hunk#summary(bufnr)
|
||||
let summary[0] += a:count
|
||||
call setbufvar(bufnr, 'gitgutter_summary', summary)
|
||||
call gitgutter#utility#setbufvar(bufnr, 'summary', summary)
|
||||
endfunction
|
||||
|
||||
function! gitgutter#hunk#increment_lines_modified(count) abort
|
||||
let bufnr = gitgutter#utility#bufnr()
|
||||
let summary = gitgutter#hunk#summary(bufnr)
|
||||
let summary[1] += a:count
|
||||
call setbufvar(bufnr, 'gitgutter_summary', summary)
|
||||
call gitgutter#utility#setbufvar(bufnr, 'summary', summary)
|
||||
endfunction
|
||||
|
||||
function! gitgutter#hunk#increment_lines_removed(count) abort
|
||||
let bufnr = gitgutter#utility#bufnr()
|
||||
let summary = gitgutter#hunk#summary(bufnr)
|
||||
let summary[2] += a:count
|
||||
call setbufvar(bufnr, 'gitgutter_summary', summary)
|
||||
call gitgutter#utility#setbufvar(bufnr, 'summary', summary)
|
||||
endfunction
|
||||
|
||||
|
||||
function! gitgutter#hunk#next_hunk(count) abort
|
||||
if gitgutter#utility#is_active()
|
||||
let current_line = line('.')
|
||||
let hunk_count = 0
|
||||
for hunk in s:hunks
|
||||
for hunk in gitgutter#hunk#hunks()
|
||||
if hunk[2] > current_line
|
||||
let hunk_count += 1
|
||||
if hunk_count == a:count
|
||||
|
@ -58,7 +64,7 @@ function! gitgutter#hunk#prev_hunk(count) abort
|
|||
if gitgutter#utility#is_active()
|
||||
let current_line = line('.')
|
||||
let hunk_count = 0
|
||||
for hunk in reverse(copy(s:hunks))
|
||||
for hunk in reverse(copy(gitgutter#hunk#hunks()))
|
||||
if hunk[2] < current_line
|
||||
let hunk_count += 1
|
||||
if hunk_count == a:count
|
||||
|
@ -77,7 +83,7 @@ endfunction
|
|||
function! gitgutter#hunk#current_hunk() abort
|
||||
let current_hunk = []
|
||||
|
||||
for hunk in s:hunks
|
||||
for hunk in gitgutter#hunk#hunks()
|
||||
if gitgutter#hunk#cursor_in_hunk(hunk)
|
||||
let current_hunk = hunk
|
||||
break
|
||||
|
@ -105,7 +111,7 @@ endfunction
|
|||
" be if any changes above it in the file didn't exist.
|
||||
function! gitgutter#hunk#line_adjustment_for_current_hunk() abort
|
||||
let adj = 0
|
||||
for hunk in s:hunks
|
||||
for hunk in gitgutter#hunk#hunks()
|
||||
if gitgutter#hunk#cursor_in_hunk(hunk)
|
||||
break
|
||||
else
|
||||
|
|
|
@ -15,9 +15,9 @@ function! gitgutter#sign#clear_signs() abort
|
|||
let bufnr = gitgutter#utility#bufnr()
|
||||
call gitgutter#sign#find_current_signs()
|
||||
|
||||
let sign_ids = map(values(getbufvar(bufnr, 'gitgutter_gitgutter_signs')), 'v:val.id')
|
||||
let sign_ids = map(values(gitgutter#utility#getbufvar(bufnr, 'gitgutter_signs')), 'v:val.id')
|
||||
call gitgutter#sign#remove_signs(sign_ids, 1)
|
||||
call setbufvar(bufnr, 'gitgutter_gitgutter_signs', {})
|
||||
call gitgutter#utility#setbufvar(bufnr, 'gitgutter_signs', {})
|
||||
endfunction
|
||||
|
||||
|
||||
|
@ -47,17 +47,17 @@ endfunction
|
|||
|
||||
function! gitgutter#sign#add_dummy_sign() abort
|
||||
let bufnr = gitgutter#utility#bufnr()
|
||||
if !getbufvar(bufnr, 'gitgutter_dummy_sign')
|
||||
if !gitgutter#utility#getbufvar(bufnr, 'dummy_sign')
|
||||
execute "sign place" s:dummy_sign_id "line=" . 9999 "name=GitGutterDummy buffer=" . bufnr
|
||||
call setbufvar(bufnr, 'gitgutter_dummy_sign', 1)
|
||||
call gitgutter#utility#setbufvar(bufnr, 'dummy_sign', 1)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! gitgutter#sign#remove_dummy_sign(force) abort
|
||||
let bufnr = gitgutter#utility#bufnr()
|
||||
if getbufvar(bufnr, 'gitgutter_dummy_sign') && (a:force || !g:gitgutter_sign_column_always)
|
||||
if gitgutter#utility#getbufvar(bufnr, 'dummy_sign') && (a:force || !g:gitgutter_sign_column_always)
|
||||
execute "sign unplace" s:dummy_sign_id "buffer=" . bufnr
|
||||
call setbufvar(bufnr, 'gitgutter_dummy_sign', 0)
|
||||
call gitgutter#utility#setbufvar(bufnr, 'dummy_sign', 0)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -101,9 +101,9 @@ function! gitgutter#sign#find_current_signs() abort
|
|||
end
|
||||
endfor
|
||||
|
||||
call setbufvar(bufnr, 'gitgutter_dummy_sign', dummy_sign_placed)
|
||||
call setbufvar(bufnr, 'gitgutter_gitgutter_signs', gitgutter_signs)
|
||||
call setbufvar(bufnr, 'gitgutter_other_signs', other_signs)
|
||||
call gitgutter#utility#setbufvar(bufnr, 'dummy_sign', dummy_sign_placed)
|
||||
call gitgutter#utility#setbufvar(bufnr, 'gitgutter_signs', gitgutter_signs)
|
||||
call gitgutter#utility#setbufvar(bufnr, 'other_signs', other_signs)
|
||||
endfunction
|
||||
|
||||
|
||||
|
@ -113,7 +113,7 @@ function! gitgutter#sign#obsolete_gitgutter_signs_to_remove(new_gitgutter_signs_
|
|||
let bufnr = gitgutter#utility#bufnr()
|
||||
let signs_to_remove = [] " list of [<id (number)>, ...]
|
||||
let remove_all_signs = 1
|
||||
let old_gitgutter_signs = getbufvar(bufnr, 'gitgutter_gitgutter_signs')
|
||||
let old_gitgutter_signs = gitgutter#utility#getbufvar(bufnr, 'gitgutter_signs')
|
||||
for line_number in keys(old_gitgutter_signs)
|
||||
if index(a:new_gitgutter_signs_line_numbers, str2nr(line_number)) == -1
|
||||
call add(signs_to_remove, old_gitgutter_signs[line_number].id)
|
||||
|
@ -128,8 +128,8 @@ endfunction
|
|||
|
||||
function! gitgutter#sign#remove_signs(sign_ids, all_signs) abort
|
||||
let bufnr = gitgutter#utility#bufnr()
|
||||
if a:all_signs && s:supports_star && empty(getbufvar(bufnr, 'gitgutter_other_signs'))
|
||||
let dummy_sign_present = getbufvar(bufnr, 'gitgutter_dummy_sign')
|
||||
if a:all_signs && s:supports_star && empty(gitgutter#utility#getbufvar(bufnr, 'other_signs'))
|
||||
let dummy_sign_present = gitgutter#utility#getbufvar(bufnr, 'dummy_sign')
|
||||
execute "sign unplace * buffer=" . bufnr
|
||||
if dummy_sign_present
|
||||
execute "sign place" s:dummy_sign_id "line=" . 9999 "name=GitGutterDummy buffer=" . bufnr
|
||||
|
@ -144,8 +144,8 @@ endfunction
|
|||
|
||||
function! gitgutter#sign#upsert_new_gitgutter_signs(modified_lines) abort
|
||||
let bufnr = gitgutter#utility#bufnr()
|
||||
let other_signs = getbufvar(bufnr, 'gitgutter_other_signs')
|
||||
let old_gitgutter_signs = getbufvar(bufnr, 'gitgutter_gitgutter_signs')
|
||||
let other_signs = gitgutter#utility#getbufvar(bufnr, 'other_signs')
|
||||
let old_gitgutter_signs = gitgutter#utility#getbufvar(bufnr, 'gitgutter_signs')
|
||||
|
||||
for line in a:modified_lines
|
||||
let line_number = line[0] " <number>
|
||||
|
|
|
@ -2,6 +2,23 @@ let s:file = ''
|
|||
let s:using_xolox_shell = -1
|
||||
let s:exit_code = 0
|
||||
|
||||
function! gitgutter#utility#setbufvar(buffer, varname, val)
|
||||
let dict = get(getbufvar(a:buffer, ''), 'gitgutter', {})
|
||||
let dict[a:varname] = a:val
|
||||
call setbufvar(a:buffer, 'gitgutter', dict)
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#getbufvar(buffer, varname, ...)
|
||||
let dict = get(getbufvar(a:buffer, ''), 'gitgutter', {})
|
||||
if has_key(dict, a:varname)
|
||||
return dict[a:varname]
|
||||
else
|
||||
if a:0
|
||||
return a:1
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#warn(message) abort
|
||||
echohl WarningMsg
|
||||
echo 'vim-gitgutter: ' . a:message
|
||||
|
@ -10,8 +27,8 @@ function! gitgutter#utility#warn(message) abort
|
|||
endfunction
|
||||
|
||||
function! gitgutter#utility#warn_once(message, key) abort
|
||||
if empty(getbufvar(s:bufnr, a:key))
|
||||
call setbufvar(s:bufnr, a:key, '1')
|
||||
if empty(gitgutter#utility#getbufvar(s:bufnr, a:key))
|
||||
call gitgutter#utility#setbufvar(s:bufnr, a:key, '1')
|
||||
echohl WarningMsg
|
||||
redraw | echo 'vim-gitgutter: ' . a:message
|
||||
echohl None
|
||||
|
@ -92,11 +109,11 @@ function! gitgutter#utility#has_unsaved_changes() abort
|
|||
endfunction
|
||||
|
||||
function! gitgutter#utility#has_fresh_changes() abort
|
||||
return getbufvar(s:bufnr, 'changedtick') != getbufvar(s:bufnr, 'gitgutter_last_tick')
|
||||
return getbufvar(s:bufnr, 'changedtick') != gitgutter#utility#getbufvar(s:bufnr, 'last_tick')
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#save_last_seen_change() abort
|
||||
call setbufvar(s:bufnr, 'gitgutter_last_tick', getbufvar(s:bufnr, 'changedtick'))
|
||||
call gitgutter#utility#setbufvar(s:bufnr, 'last_tick', getbufvar(s:bufnr, 'changedtick'))
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#shell_error() abort
|
||||
|
@ -136,12 +153,12 @@ function! gitgutter#utility#system(cmd, ...) abort
|
|||
endfunction
|
||||
|
||||
function! gitgutter#utility#file_relative_to_repo_root() abort
|
||||
let file_path_relative_to_repo_root = getbufvar(s:bufnr, 'gitgutter_repo_relative_path')
|
||||
let file_path_relative_to_repo_root = gitgutter#utility#getbufvar(s:bufnr, 'repo_relative_path')
|
||||
if empty(file_path_relative_to_repo_root)
|
||||
let dir_path_relative_to_repo_root = gitgutter#utility#system(gitgutter#utility#command_in_directory_of_file(g:gitgutter_git_executable.' rev-parse --show-prefix'))
|
||||
let dir_path_relative_to_repo_root = gitgutter#utility#strip_trailing_new_line(dir_path_relative_to_repo_root)
|
||||
let file_path_relative_to_repo_root = dir_path_relative_to_repo_root . gitgutter#utility#filename()
|
||||
call setbufvar(s:bufnr, 'gitgutter_repo_relative_path', file_path_relative_to_repo_root)
|
||||
call gitgutter#utility#setbufvar(s:bufnr, 'repo_relative_path', file_path_relative_to_repo_root)
|
||||
endif
|
||||
return file_path_relative_to_repo_root
|
||||
endfunction
|
||||
|
@ -174,14 +191,10 @@ function! gitgutter#utility#strip_trailing_new_line(line) abort
|
|||
return substitute(a:line, '\n$', '', '')
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#git_version() abort
|
||||
return matchstr(system(g:gitgutter_git_executable.' --version'), '[0-9.]\+')
|
||||
endfunction
|
||||
|
||||
" True for git v1.7.2+.
|
||||
function! gitgutter#utility#git_supports_command_line_config_override() abort
|
||||
let [major, minor, patch; _] = split(gitgutter#utility#git_version(), '\.')
|
||||
return major > 1 || (major == 1 && minor > 7) || (minor == 7 && patch > 1)
|
||||
call system(g:gitgutter_git_executable.' -c foo.bar=baz --version')
|
||||
return !v:shell_error
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#stringify(list) abort
|
||||
|
|
|
@ -138,6 +138,7 @@ Commands for staging or undoing individual hunks:
|
|||
|
||||
:GitGutterPreviewHunk *:GitGutterPreviewHunk*
|
||||
Preview the hunk the cursor is in.
|
||||
Use |:pclose| or |CTRL-W_CTRL-Z| to close the preview window.
|
||||
|
||||
===============================================================================
|
||||
5. AUTOCOMMAND *GitGutterAutocmd*
|
||||
|
@ -273,7 +274,7 @@ TO USE A CUSTOM GREP COMMAND
|
|||
|
||||
To use a custom invocation for grep, use this:
|
||||
>
|
||||
let g:gitgutter_grep_command = 'grep --color=never -e'
|
||||
let g:gitgutter_grep_command = 'grep'
|
||||
<
|
||||
|
||||
TO TURN OFF VIM-GITGUTTER BY DEFAULT
|
||||
|
|
|
@ -196,30 +196,17 @@ augroup gitgutter
|
|||
endif
|
||||
|
||||
if g:gitgutter_eager
|
||||
autocmd BufWritePost,FileChangedShellPost * call gitgutter#process_buffer(bufnr(''), 0)
|
||||
|
||||
" When you enter a new tab, BufEnter is only fired if the buffer you enter
|
||||
" is not the one you came from.
|
||||
"
|
||||
" For example:
|
||||
"
|
||||
" `:tab split` fires TabEnter but not BufEnter.
|
||||
" `:tab new` fires TabEnter and BufEnter.
|
||||
"
|
||||
" As and when both TabEnter and BufEnter are fired, we do not want to
|
||||
" process the entered buffer twice. We avoid this by setting and clearing
|
||||
" a flag.
|
||||
autocmd BufWritePost,FileChangedShellPost,ShellCmdPost * call gitgutter#process_buffer(bufnr(''), 0)
|
||||
|
||||
autocmd BufEnter *
|
||||
\ if gettabvar(tabpagenr(), 'gitgutter_didtabenter') |
|
||||
\ call settabvar(tabpagenr(), 'gitgutter_didtabenter', 0) |
|
||||
\ call gitgutter#all() |
|
||||
\ else |
|
||||
\ call gitgutter#process_buffer(bufnr(''), 0) |
|
||||
\ endif
|
||||
|
||||
autocmd TabEnter *
|
||||
\ call settabvar(tabpagenr(), 'gitgutter_didtabenter', 1) |
|
||||
\ call gitgutter#all()
|
||||
autocmd TabEnter * call settabvar(tabpagenr(), 'gitgutter_didtabenter', 1)
|
||||
|
||||
if !has('gui_win32')
|
||||
autocmd FocusGained * call gitgutter#all()
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
Thanks for improving vim-go! Before you dive in please read the following:
|
||||
|
||||
1. Please read our
|
||||
[FAQ](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), it might
|
||||
[Documentation](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt), it might
|
||||
have answers for your problem
|
||||
2. If you add a new feature please don't forget to update the documentation:
|
||||
[doc/vim-go.txt](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt)
|
||||
[doc/vim-go.txt](https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt.
|
||||
3. If it's a breaking change or exceed +100 lines please open an issue first
|
||||
and describe the changes you want to make.
|
||||
|
|
|
@ -2,6 +2,31 @@
|
|||
|
||||
FEATURES:
|
||||
|
||||
* New `:GoKeyify` command that turns unkeyed struct literals into keyed struct literals. [gh-1258]
|
||||
* New `g:go_addtags_transform` setting to change the transform rule (snakecase, camelcase, etc..) for `:GoAddTags` command [gh-1275]
|
||||
* New snippet shortcut assigned to `ife` that expands to `if err := foo(); err != nil { ... }` [gh-1268]
|
||||
|
||||
IMPROVEMENTS
|
||||
|
||||
* :GoMetaLinter can now exclude linters with the new `g:go_metalinter_excludes` option [gh-1253]
|
||||
* Override `<C-LeftMouse>` mapping so `:GoDef` is used by default (as we do the same for `CTRL-]`, `gd`, etc. [gh-1264]
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
* job: fix race between channel close and job exit [gh-1247]
|
||||
* internal: fix system calls when using tcsh [gh-1276]
|
||||
* path: return the unmodified GOPATH if autodetect is disabled [gh-1280]
|
||||
* fix jumping to quickfix window when autom gometalinter on save was enabled [gh-1293]
|
||||
|
||||
BACKWARDS INCOMPATIBILITIES:
|
||||
|
||||
* `:GoLint` works on the whole directory instead of the current file. To use it for the current file give it as an argument, i.e `:GoLint foo.go` [gh-1295]
|
||||
* `go_snippet_case_type` is removed in favor of the new `go_addtags_transform` setting [gh-1299]
|
||||
|
||||
## 1.12 - (March 29, 2017)
|
||||
|
||||
FEATURES:
|
||||
|
||||
* New `:GoAddTags` and `:GoRemoveTags` command based on the tool
|
||||
[gomodifytags](https://github.com/fatih/gomodifytags). This fixes many old
|
||||
bugs that were due prior regexp based implementation. For the usage please
|
||||
|
@ -20,6 +45,7 @@ if err != nil {
|
|||
|
||||
IMPROVEMENTS:
|
||||
|
||||
* vim-go works now even if GOPATH is not set (starting with Go 1.8) [gh-1248]
|
||||
* Lowercase `<Leader>` in mappings examples for consistent documentation across the README [gh-1192]
|
||||
* All of files should be written in utf-8 if the file will be passed to external command. [gh-1184]
|
||||
* `:GoAddTags` is now able to add options to existing tags with the syntax
|
||||
|
@ -27,6 +53,8 @@ IMPROVEMENTS:
|
|||
* Document 'noshowmode' requirement for echo_go_info [gh-1197]
|
||||
* Improve godoc view for vertical splits [gh-1195]
|
||||
* Set GOPATH for both possible go guru execution paths (sync and async) [gh-1193]
|
||||
* Improve docs for :GoDef usage [gh-1242]
|
||||
* Highlight trimming syntax for Go templates [gh-1235]
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
|
@ -44,12 +72,13 @@ BUG FIXES:
|
|||
* Fix `:GoAddTags` not working if any field comment would contain `{}` [gh-1189]
|
||||
* Respect go_fmt_options when running goimports [gh-1211]
|
||||
* Set the filename in the location-list when there is an error with :GoFmt [gh-1199]
|
||||
* Fix `:GoInstall` to accept additional arguments if async mode was enabled [gh-1246]
|
||||
|
||||
BACKWARDS INCOMPATIBILITIES:
|
||||
|
||||
* The command `:GoGuruTags` is removed in favour of the new command
|
||||
`:GoBuildTags`. This command will be used now not just for `guru`, also for
|
||||
all new commands such as `guru` [gh-1232]
|
||||
all new commands such as `gorename` [gh-1232]
|
||||
* The setting `g:go_guru_tags` is removed in favour of the new setting
|
||||
`g:go_build_tags` [gh-1232]
|
||||
|
||||
|
|
|
@ -4,336 +4,64 @@
|
|||
<img style="float: right;" src="assets/vim-go.png" alt="Vim-go logo"/>
|
||||
</p>
|
||||
|
||||
Go (golang) support for Vim, which comes with pre-defined sensible settings (like
|
||||
auto gofmt on save), with autocomplete, snippet support, improved syntax
|
||||
highlighting, go toolchain commands, and more. If needed vim-go installs all
|
||||
necessary binaries for providing seamless Vim integration with current
|
||||
commands. It's highly customizable and each individual feature can be
|
||||
disabled/enabled easily.
|
||||
|
||||
## Features
|
||||
|
||||
* Improved Syntax highlighting with items such as Functions, Operators, Methods.
|
||||
* Auto completion support via `gocode`
|
||||
* Better `gofmt` on save, which keeps cursor position and doesn't break your undo
|
||||
history
|
||||
* Go to symbol/declaration with `:GoDef`
|
||||
* Look up documentation with `:GoDoc` inside Vim or open it in browser
|
||||
* Automatically import packages via `:GoImport` or plug it into autosave
|
||||
* Compile your package with `:GoBuild`, install it with `:GoInstall` or test
|
||||
them with `:GoTest` (also supports running single tests via `:GoTestFunc`)
|
||||
This plugin adds Go language support for Vim, with the following main features:
|
||||
|
||||
* Build with `:GoBuild`, install with `:GoInstall` or test
|
||||
with `:GoTest` (run single tests via `:GoTestFunc`)
|
||||
* Show test coverage with `:GoCoverage` or in browser with `:GoCoverageBrowser`
|
||||
* Goto definition with `:GoDef`
|
||||
* Quick jump to declarations with `:GoDecls` or `:GoDeclsDir`
|
||||
* Show documentation with `:GoDoc` inside or in browser with `:GoDocBrowser`
|
||||
* Quickly execute your current file/files with `:GoRun`
|
||||
* Automatic `GOPATH` detection based on the directory structure (i.e. `gb`
|
||||
projects, `godep` vendored projects)
|
||||
* Change or display `GOPATH` with `:GoPath`
|
||||
* Create a coverage profile and display annotated source code to see which
|
||||
functions are covered with `:GoCoverage`
|
||||
* Call `gometalinter` with `:GoMetaLinter`, which invokes all possible linters
|
||||
(golint, vet, errcheck, deadcode, etc..) and shows the warnings/errors
|
||||
* Lint your code with `:GoLint`
|
||||
* Run your code through `:GoVet` to catch static errors
|
||||
* Advanced source analysis tools utilizing guru, such as `:GoImplements`,
|
||||
`:GoCallees`, and `:GoReferrers`
|
||||
* Precise type-safe renaming of identifiers with `:GoRename`
|
||||
* List all source files and dependencies
|
||||
* Unchecked error checking with `:GoErrCheck`
|
||||
* Integrated and improved snippets, supporting `ultisnips` or `neosnippet`
|
||||
* Share your current code to [play.golang.org](http://play.golang.org) with `:GoPlay`
|
||||
* On-the-fly type information about the word under the cursor. Plug it into
|
||||
your custom vim function.
|
||||
* Go asm formatting on save
|
||||
* Tagbar support to show tags of the source code in a sidebar with `gotags`
|
||||
* Custom vim text objects such as `a function` or `inner function`
|
||||
list.
|
||||
* Jump to function or type declarations with `:GoDecls` or `:GoDeclsDir`
|
||||
* Vim 8.0 support. Async execution for most commands, various underlying improvements.
|
||||
* NeoVim support (beta). Async execution for some commands.
|
||||
* Alternate between implementation and test code with `:GoAlternate`
|
||||
* Change or display `GOPATH` with `:GoPath`
|
||||
* Multiple 3rd linter support with `:GoMetaLinter`
|
||||
* Renaming identifiers with `:GoRename`
|
||||
* Share your code to [play.golang.org](http://play.golang.org) with `:GoPlay`
|
||||
* Switch between `*.go` and `*_test.go` code with `:GoAlternate`
|
||||
* Add/Remove tags on struct fields with `:GoAddTags`
|
||||
* Add import paths via `:GoImport` or remove them with `:GoDrop`
|
||||
* Custom vim text objects such as `a function (af)` or `inner function (if)`
|
||||
* ... and many more! Please see [doc/vim-go.txt](doc/vim-go.txt) for more information.
|
||||
|
||||
Checkout the official [tutorial](https://github.com/fatih/vim-go-tutorial)
|
||||
that goes literally over all features and shows many tips and tricks. It shows
|
||||
how to install vim-go and explains many unknown use cases. Recommended for
|
||||
beginners as well as advanced users: https://github.com/fatih/vim-go-tutorial
|
||||
|
||||
## Install
|
||||
|
||||
Master branch is supposed to be a development branch. So stuff here can break
|
||||
and change. Please try use always the [latest
|
||||
release](https://github.com/fatih/vim-go/releases/latest)
|
||||
Master branch is a **development** branch. Please use with caution.
|
||||
I recommend to use the [**latest stable release**](https://github.com/fatih/vim-go/releases/latest)
|
||||
|
||||
Vim-go follows the standard runtime path structure, so I highly recommend to
|
||||
use a common and well known plugin manager to install vim-go. Do not use vim-go
|
||||
with other Go oriented vim plugins. For Pathogen just clone the repo. For other
|
||||
plugin managers add the appropriate lines and execute the plugin's install
|
||||
command.
|
||||
Vim-go follows the standard runtime path structure. Below are some helper lines
|
||||
for popular package managers:
|
||||
|
||||
* [Pathogen](https://github.com/tpope/vim-pathogen)
|
||||
* `git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go`
|
||||
* `git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go`
|
||||
* [vim-plug](https://github.com/junegunn/vim-plug)
|
||||
* `Plug 'fatih/vim-go'`
|
||||
* [NeoBundle](https://github.com/Shougo/neobundle.vim)
|
||||
* `NeoBundle 'fatih/vim-go'`
|
||||
* [Vundle](https://github.com/gmarik/vundle)
|
||||
* `Plugin 'fatih/vim-go'`
|
||||
* [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528)
|
||||
* `git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go`
|
||||
* `Plug 'fatih/vim-go'`
|
||||
* [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages)
|
||||
* `git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go`
|
||||
|
||||
Please be sure all necessary binaries are installed (such as `gocode`, `godef`,
|
||||
`goimports`, etc.). You can easily install them with the included
|
||||
`:GoInstallBinaries` command. If invoked, all necessary binaries will be
|
||||
automatically downloaded and installed to your `$GOBIN` environment (if not set
|
||||
it will use `$GOPATH/bin`). Note that this command requires `git` for fetching
|
||||
the individual Go packages. Additionally, use `:GoUpdateBinaries` to update the
|
||||
installed binaries.
|
||||
After installing, please install all necessary binaries. We have a handy
|
||||
command for it:
|
||||
|
||||
### Optional
|
||||
```
|
||||
:GoInstallBinaries
|
||||
```
|
||||
|
||||
* Autocompletion is enabled by default via `<C-x><C-o>`. To get real-time
|
||||
completion (completion by type) install:
|
||||
[neocomplete](https://github.com/Shougo/neocomplete.vim) for Vim or
|
||||
[deoplete](https://github.com/Shougo/deoplete.nvim) and
|
||||
[deoplete-go](https://github.com/zchee/deoplete-go) for NeoVim or
|
||||
[SimpleAutoCmplPop](https://github.com/roxma/SimpleAutoComplPop)
|
||||
* To display source code tag information on a sidebar install
|
||||
[tagbar](https://github.com/majutsushi/tagbar).
|
||||
* For snippet features install:
|
||||
[neosnippet](https://github.com/Shougo/neosnippet.vim) or
|
||||
[ultisnips](https://github.com/SirVer/ultisnips).
|
||||
* Screenshot color scheme is a slightly modified molokai:
|
||||
[fatih/molokai](https://github.com/fatih/molokai).
|
||||
* For a better documentation viewer checkout:
|
||||
[go-explorer](https://github.com/garyburd/go-explorer).
|
||||
for more information please check out the [documentation](doc/vim-go.txt)
|
||||
|
||||
## Usage
|
||||
|
||||
Many of the plugin's [features](#features) are enabled by default. There are no
|
||||
additional settings needed. All usages and commands are listed in
|
||||
`doc/vim-go.txt`. Note that help tags needs to be populated. Check your plugin
|
||||
manager settings to generate the documentation (some do it automatically).
|
||||
After that just open the help page to see all commands:
|
||||
|
||||
:help vim-go
|
||||
|
||||
## Example Mappings
|
||||
|
||||
vim-go has several `<Plug>` mappings which can be used to create custom
|
||||
mappings. Unless otherwise specified, none of these mappings are enabled
|
||||
by default. Here some examples you might find useful:
|
||||
|
||||
Run commands such as `go run` for the current file with `<leader>r` or `go
|
||||
build` and `go test` for the current package with `<leader>b` and `<leader>t`
|
||||
respectively. Display beautifully annotated source code to see which functions
|
||||
are covered with `<leader>c`.
|
||||
|
||||
```vim
|
||||
au FileType go nmap <leader>r <Plug>(go-run)
|
||||
au FileType go nmap <leader>b <Plug>(go-build)
|
||||
au FileType go nmap <leader>t <Plug>(go-test)
|
||||
au FileType go nmap <leader>c <Plug>(go-coverage)
|
||||
```
|
||||
|
||||
By default the mapping `gd` is enabled, which opens the target identifier in
|
||||
current buffer. You can also open the definition/declaration, in a new vertical,
|
||||
horizontal, or tab, for the word under your cursor:
|
||||
|
||||
```vim
|
||||
au FileType go nmap <leader>ds <Plug>(go-def-split)
|
||||
au FileType go nmap <leader>dv <Plug>(go-def-vertical)
|
||||
au FileType go nmap <leader>dt <Plug>(go-def-tab)
|
||||
```
|
||||
|
||||
Open the relevant Godoc for the word under the cursor with `<leader>gd` or open
|
||||
it vertically with `<leader>gv`
|
||||
|
||||
```vim
|
||||
au FileType go nmap <leader>gd <Plug>(go-doc)
|
||||
au FileType go nmap <leader>gv <Plug>(go-doc-vertical)
|
||||
```
|
||||
|
||||
Or open the Godoc in browser
|
||||
|
||||
```vim
|
||||
au FileType go nmap <leader>gb <Plug>(go-doc-browser)
|
||||
```
|
||||
|
||||
Show a list of interfaces which is implemented by the type under your cursor
|
||||
with `<leader>s`
|
||||
|
||||
```vim
|
||||
au FileType go nmap <leader>s <Plug>(go-implements)
|
||||
```
|
||||
|
||||
Show type info for the word under your cursor with `<leader>i` (useful if you
|
||||
have disabled auto showing type info via `g:go_auto_type_info`)
|
||||
|
||||
```vim
|
||||
au FileType go nmap <leader>i <Plug>(go-info)
|
||||
```
|
||||
|
||||
Rename the identifier under the cursor to a new name
|
||||
|
||||
```vim
|
||||
au FileType go nmap <leader>e <Plug>(go-rename)
|
||||
```
|
||||
|
||||
More `<Plug>` mappings can be seen with `:he go-mappings`. Also these are just
|
||||
recommendations, you are free to create more advanced mappings or functions
|
||||
based on `:he go-commands`.
|
||||
|
||||
## Settings
|
||||
Below are some settings you might find useful. For the full list see `:he
|
||||
go-settings`.
|
||||
|
||||
By default syntax-highlighting for Functions, Methods and Structs is disabled.
|
||||
To change it:
|
||||
```vim
|
||||
let g:go_highlight_functions = 1
|
||||
let g:go_highlight_methods = 1
|
||||
let g:go_highlight_fields = 1
|
||||
let g:go_highlight_types = 1
|
||||
let g:go_highlight_operators = 1
|
||||
let g:go_highlight_build_constraints = 1
|
||||
```
|
||||
|
||||
Enable goimports to automatically insert import paths instead of gofmt:
|
||||
|
||||
```vim
|
||||
let g:go_fmt_command = "goimports"
|
||||
```
|
||||
|
||||
By default vim-go shows errors for the fmt command, to disable it:
|
||||
|
||||
```vim
|
||||
let g:go_fmt_fail_silently = 1
|
||||
```
|
||||
|
||||
Disable auto fmt on save:
|
||||
|
||||
```vim
|
||||
let g:go_fmt_autosave = 0
|
||||
```
|
||||
|
||||
Disable opening browser after posting your snippet to `play.golang.org`:
|
||||
|
||||
```vim
|
||||
let g:go_play_open_browser = 0
|
||||
```
|
||||
|
||||
By default when `:GoInstallBinaries` is called, the binaries are installed to
|
||||
`$GOBIN` or `$GOPATH/bin`. To change it:
|
||||
|
||||
```vim
|
||||
let g:go_bin_path = expand("~/.gotools")
|
||||
let g:go_bin_path = "/home/fatih/.mypath" "or give absolute path
|
||||
```
|
||||
|
||||
Disable updating dependencies when installing/updating binaries:
|
||||
```vim
|
||||
let g:go_get_update = 0
|
||||
```
|
||||
|
||||
### Using with Neovim (beta)
|
||||
|
||||
Note: Neovim currently is not a first class citizen for vim-go. You are free
|
||||
to open bug, however I'm not using Neovim so it's hard for me to test it.
|
||||
vim-go might not work well as good as in Vim. I'm happy to accept pull requests
|
||||
or very detailed bug reports. If you're interested to improve the state of
|
||||
Neovim in vim-go you're always welcome!
|
||||
|
||||
|
||||
Run `:GoRun` in a new tab, horizontal split or vertical split terminal
|
||||
|
||||
```vim
|
||||
au FileType go nmap <leader>rt <Plug>(go-run-tab)
|
||||
au FileType go nmap <leader>rs <Plug>(go-run-split)
|
||||
au FileType go nmap <leader>rv <Plug>(go-run-vertical)
|
||||
```
|
||||
|
||||
By default new terminals are opened in a vertical split. To change it
|
||||
|
||||
```vim
|
||||
let g:go_term_mode = "split"
|
||||
```
|
||||
|
||||
By default the testing commands run asynchronously in the background and
|
||||
display results with `go#jobcontrol#Statusline()`. To make them run in a new
|
||||
terminal
|
||||
|
||||
```vim
|
||||
let g:go_term_enabled = 1
|
||||
```
|
||||
|
||||
### Using with Syntastic
|
||||
Sometimes when using both `vim-go` and `syntastic` Vim will start lagging while
|
||||
saving and opening files. The following fixes this:
|
||||
|
||||
```vim
|
||||
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
|
||||
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
|
||||
```
|
||||
|
||||
Another issue with `vim-go` and `syntastic` is that the location list window
|
||||
that contains the output of commands such as `:GoBuild` and `:GoTest` might not appear.
|
||||
To resolve this:
|
||||
|
||||
```vim
|
||||
let g:go_list_type = "quickfix"
|
||||
```
|
||||
|
||||
## More info
|
||||
|
||||
Check out the [Wiki](https://github.com/fatih/vim-go/wiki) page for more
|
||||
information. It includes
|
||||
[Screencasts](https://github.com/fatih/vim-go/wiki/Screencasts), an [FAQ
|
||||
section](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), and many
|
||||
other [various pieces](https://github.com/fatih/vim-go/wiki) of information.
|
||||
|
||||
## Development & Testing
|
||||
|
||||
vim-go supports now test files. Please check `autoload` folder for examples. If
|
||||
you add a new feature be sure you also include the `_test.vim` file next to the
|
||||
script. Test functions should be starting with `Test_`, example:
|
||||
|
||||
|
||||
```viml
|
||||
function Test_run_fmt()
|
||||
call assert_equal(expected, actual)
|
||||
...
|
||||
endfunction
|
||||
```
|
||||
|
||||
You can locally test it by running:
|
||||
Official documentation can be found under [doc/vim-go.txt](doc/vim-go.txt). You can display it from within Vim with:
|
||||
|
||||
```
|
||||
make
|
||||
:help vim-go
|
||||
```
|
||||
|
||||
This will run all tests and print either `PASS` or `FAIL` to indicate the final
|
||||
status of all tests.
|
||||
|
||||
Additionally, each new pull request will trigger a new Travis-ci job.
|
||||
|
||||
## Donation
|
||||
|
||||
People have asked for this for a long time, now you can be a fully supporter by
|
||||
[being a patron](https://www.patreon.com/fatih)!
|
||||
|
||||
By being a patron, you are enabling vim-go to grow and mature, helping me to
|
||||
invest in bug fixes, new documentation, and improving both current and future
|
||||
features. It's completely optional and is just a direct way to support Vim-go's
|
||||
ongoing development. Thanks!
|
||||
|
||||
[https://www.patreon.com/fatih](https://www.patreon.com/fatih)
|
||||
|
||||
## Credits
|
||||
|
||||
* Go Authors for official vim plugins
|
||||
* Gocode, Godef, Golint, Guru, Goimports, Gotags, Errcheck projects and
|
||||
authors of those projects.
|
||||
* Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode,
|
||||
vim-godef)
|
||||
* [Contributors](https://github.com/fatih/vim-go/graphs/contributors) of vim-go
|
||||
We also have an [official vim-go
|
||||
tutorial](https://github.com/fatih/vim-go-tutorial).
|
||||
|
||||
## License
|
||||
|
||||
The BSD 3-Clause License - see `LICENSE` for more details
|
||||
The BSD 3-Clause License - see [`LICENSE`](LICENSE) for more details
|
||||
|
|
|
@ -177,9 +177,6 @@ function! go#cmd#Install(bang, ...) abort
|
|||
" expand all wildcards(i.e: '%' to the current file name)
|
||||
let goargs = map(copy(a:000), "expand(v:val)")
|
||||
|
||||
" escape all shell arguments before we pass it to make
|
||||
let goargs = go#util#Shelllist(goargs, 1)
|
||||
|
||||
if get(g:, 'go_echo_command_info', 1)
|
||||
call go#util#EchoProgress("installing dispatched ...")
|
||||
endif
|
||||
|
@ -221,7 +218,7 @@ function! go#cmd#Install(bang, ...) abort
|
|||
if !empty(errors) && !a:bang
|
||||
call go#list#JumpToFirst(l:listtype)
|
||||
else
|
||||
call go#util#EchoSuccess("installed to ". $GOPATH)
|
||||
call go#util#EchoSuccess("installed to ". go#path#Detect())
|
||||
endif
|
||||
|
||||
let $GOPATH = old_gopath
|
||||
|
@ -407,7 +404,6 @@ function! go#cmd#Generate(bang, ...) abort
|
|||
let $GOPATH = old_gopath
|
||||
endfunction
|
||||
|
||||
|
||||
" ---------------------
|
||||
" | Vim job callbacks |
|
||||
" ---------------------
|
||||
|
@ -449,7 +445,7 @@ function s:cmd_job(args) abort
|
|||
|
||||
let start_options = {
|
||||
\ 'callback': callbacks.callback,
|
||||
\ 'close_cb': callbacks.close_cb,
|
||||
\ 'exit_cb': callbacks.exit_cb,
|
||||
\ }
|
||||
|
||||
" modify GOPATH if needed
|
||||
|
|
|
@ -288,7 +288,7 @@ function s:coverage_job(args)
|
|||
|
||||
let start_options = {
|
||||
\ 'callback': callbacks.callback,
|
||||
\ 'close_cb': callbacks.close_cb,
|
||||
\ 'exit_cb': callbacks.exit_cb,
|
||||
\ }
|
||||
|
||||
" modify GOPATH if needed
|
||||
|
|
|
@ -303,7 +303,7 @@ function s:def_job(args) abort
|
|||
|
||||
let start_options = {
|
||||
\ 'callback': callbacks.callback,
|
||||
\ 'close_cb': callbacks.close_cb,
|
||||
\ 'exit_cb': callbacks.exit_cb,
|
||||
\ }
|
||||
|
||||
if &modified
|
||||
|
|
|
@ -136,6 +136,10 @@ endfunction
|
|||
" formated.
|
||||
function! go#fmt#run(bin_name, source, target)
|
||||
let cmd = s:fmt_cmd(a:bin_name, a:source, a:target)
|
||||
if empty(cmd)
|
||||
return
|
||||
endif
|
||||
|
||||
if cmd[0] == "goimports"
|
||||
" change GOPATH too, so goimports can pick up the correct library
|
||||
let old_gopath = $GOPATH
|
||||
|
@ -162,7 +166,7 @@ function! s:fmt_cmd(bin_name, source, target)
|
|||
" if not the user get's a warning via go#path#CheckBinPath()
|
||||
let bin_path = go#path#CheckBinPath(a:bin_name)
|
||||
if empty(bin_path)
|
||||
return
|
||||
return []
|
||||
endif
|
||||
|
||||
" start constructing the command
|
||||
|
@ -176,7 +180,7 @@ function! s:fmt_cmd(bin_name, source, target)
|
|||
if !exists('b:goimports_vendor_compatible')
|
||||
let out = go#util#System(bin_path . " --help")
|
||||
if out !~ "-srcdir"
|
||||
call go#util#EchoWarning(printf("vim-go: goimports (%s) does not support srcdir. Update with: :GoUpdateBinaries", bin_path))
|
||||
call go#util#EchoWarning(printf("vim-go: goimports (%s) does not support srcdir. Update with: :GoUpdateBinaries", , bin_path))
|
||||
else
|
||||
let b:goimports_vendor_compatible = 1
|
||||
endif
|
||||
|
|
|
@ -155,21 +155,12 @@ function! s:async_guru(args) abort
|
|||
endif
|
||||
endif
|
||||
|
||||
function! s:close_cb(chan) closure
|
||||
let messages = []
|
||||
while ch_status(a:chan, {'part': 'out'}) == 'buffered'
|
||||
let msg = ch_read(a:chan, {'part': 'out'})
|
||||
call add(messages, msg)
|
||||
endwhile
|
||||
|
||||
while ch_status(a:chan, {'part': 'err'}) == 'buffered'
|
||||
let msg = ch_read(a:chan, {'part': 'err'})
|
||||
call add(messages, msg)
|
||||
endwhile
|
||||
|
||||
let l:job = ch_getjob(a:chan)
|
||||
let l:info = job_info(l:job)
|
||||
let messages = []
|
||||
function! s:callback(chan, msg) closure
|
||||
call add(messages, a:msg)
|
||||
endfunction
|
||||
|
||||
function! s:exit_cb(job, exitval) closure
|
||||
let out = join(messages, "\n")
|
||||
|
||||
let status = {
|
||||
|
@ -178,21 +169,22 @@ function! s:async_guru(args) abort
|
|||
\ 'state': "finished",
|
||||
\ }
|
||||
|
||||
if l:info.exitval
|
||||
if a:exitval
|
||||
let status.state = "failed"
|
||||
endif
|
||||
|
||||
call go#statusline#Update(status_dir, status)
|
||||
|
||||
if has_key(a:args, 'custom_parse')
|
||||
call a:args.custom_parse(l:info.exitval, out)
|
||||
call a:args.custom_parse(a:exitval, out)
|
||||
else
|
||||
call s:parse_guru_output(l:info.exitval, out, a:args.mode)
|
||||
call s:parse_guru_output(a:exitval, out, a:args.mode)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let start_options = {
|
||||
\ 'close_cb': funcref("s:close_cb"),
|
||||
\ 'callback': funcref("s:callback"),
|
||||
\ 'exit_cb': funcref("s:exit_cb"),
|
||||
\ }
|
||||
|
||||
if has_key(result, 'stdin_content')
|
||||
|
|
|
@ -30,28 +30,17 @@ function go#job#Spawn(args)
|
|||
call add(self.messages, a:msg)
|
||||
endfunction
|
||||
|
||||
function cbs.close_cb(chan) dict
|
||||
let l:job = ch_getjob(a:chan)
|
||||
let l:status = job_status(l:job)
|
||||
|
||||
" the job might be in fail status, we assume by default it's failed.
|
||||
" However if it's dead, we can use the real exitval
|
||||
let exitval = 1
|
||||
if l:status == "dead"
|
||||
let l:info = job_info(l:job)
|
||||
let exitval = l:info.exitval
|
||||
endif
|
||||
|
||||
function cbs.exit_cb(job, exitval) dict
|
||||
if has_key(self, 'custom_cb')
|
||||
call self.custom_cb(l:job, exitval, self.messages)
|
||||
call self.custom_cb(a:job, a:exitval, self.messages)
|
||||
endif
|
||||
|
||||
if has_key(self, 'error_info_cb')
|
||||
call self.error_info_cb(l:job, exitval, self.messages)
|
||||
call self.error_info_cb(a:job, a:exitval, self.messages)
|
||||
endif
|
||||
|
||||
if get(g:, 'go_echo_command_info', 1)
|
||||
if exitval == 0
|
||||
if a:exitval == 0
|
||||
call go#util#EchoSuccess("SUCCESS")
|
||||
else
|
||||
call go#util#EchoError("FAILED")
|
||||
|
@ -59,7 +48,7 @@ function go#job#Spawn(args)
|
|||
endif
|
||||
|
||||
let l:listtype = go#list#Type("quickfix")
|
||||
if exitval == 0
|
||||
if a:exitval == 0
|
||||
call go#list#Clean(l:listtype)
|
||||
call go#list#Window(l:listtype)
|
||||
return
|
||||
|
@ -99,9 +88,9 @@ function go#job#Spawn(args)
|
|||
let cbs.callback = a:args.callback
|
||||
endif
|
||||
|
||||
" override close callback handler if user provided it
|
||||
if has_key(a:args, 'close_cb')
|
||||
let cbs.close_cb = a:args.close_cb
|
||||
" override exit callback handler if user provided it
|
||||
if has_key(a:args, 'exit_cb')
|
||||
let cbs.exit_cb = a:args.exit_cb
|
||||
endif
|
||||
|
||||
return cbs
|
||||
|
|
58
sources_non_forked/vim-go/autoload/go/keyify.vim
Normal file
58
sources_non_forked/vim-go/autoload/go/keyify.vim
Normal file
|
@ -0,0 +1,58 @@
|
|||
function! go#keyify#Keyify()
|
||||
let old_gopath = $GOPATH
|
||||
let $GOPATH = go#path#Detect()
|
||||
let bin_path = go#path#CheckBinPath("keyify")
|
||||
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
|
||||
|
||||
if empty(bin_path) || !exists('*json_decode')
|
||||
let $GOPATH = old_gopath
|
||||
return
|
||||
endif
|
||||
|
||||
" Get result of command as json, that contains `start`, `end` and `replacement`
|
||||
let command = printf("%s -json %s:#%s", bin_path, fname, go#util#OffsetCursor())
|
||||
let output = go#util#System(command)
|
||||
silent! let result = json_decode(output)
|
||||
|
||||
" We want to output the error message in case the result isn't a JSON
|
||||
if type(result) != type({})
|
||||
call go#util#EchoError(s:chomp(output))
|
||||
let $GOPATH = old_gopath
|
||||
return
|
||||
endif
|
||||
|
||||
" Because keyify returns the byte before the region we want, we goto the
|
||||
" byte after that
|
||||
execute "goto" result.start + 1
|
||||
let start = getpos('.')
|
||||
execute "goto" result.end
|
||||
let end = getpos('.')
|
||||
|
||||
let vis_start = getpos("'<")
|
||||
let vis_end = getpos("'>")
|
||||
|
||||
" Replace contents between start and end with `replacement`
|
||||
call setpos("'<", start)
|
||||
call setpos("'>", end)
|
||||
|
||||
let select = 'gv'
|
||||
|
||||
" Make sure the visual mode is 'v', to avoid some bugs
|
||||
normal! gv
|
||||
if mode() !=# 'v'
|
||||
let select .= 'v'
|
||||
endif
|
||||
|
||||
silent! execute "normal!" select."\"=result.replacement\<cr>p"
|
||||
|
||||
" Replacement text isn't aligned, so it needs fix
|
||||
normal! '<v'>=
|
||||
|
||||
call setpos("'<", vis_start)
|
||||
call setpos("'>", vis_end)
|
||||
let $GOPATH = old_gopath
|
||||
endfunction
|
||||
|
||||
function! s:chomp(string)
|
||||
return substitute(a:string, '\n\+$', '', '')
|
||||
endfunction
|
|
@ -10,6 +10,10 @@ if !exists("g:go_metalinter_enabled")
|
|||
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
|
||||
endif
|
||||
|
||||
if !exists("g:go_metalinter_excludes")
|
||||
let g:go_metalinter_excludes = []
|
||||
endif
|
||||
|
||||
if !exists("g:go_golint_bin")
|
||||
let g:go_golint_bin = "golint"
|
||||
endif
|
||||
|
@ -40,6 +44,10 @@ function! go#lint#Gometa(autosave, ...) abort
|
|||
let cmd += ["--enable=".linter]
|
||||
endfor
|
||||
|
||||
for exclude in g:go_metalinter_excludes
|
||||
let cmd += ["--exclude=".exclude]
|
||||
endfor
|
||||
|
||||
" path
|
||||
let cmd += [expand('%:p:h')]
|
||||
else
|
||||
|
@ -115,12 +123,11 @@ function! go#lint#Golint(...) abort
|
|||
endif
|
||||
|
||||
if a:0 == 0
|
||||
let goargs = shellescape(expand('%'))
|
||||
let out = go#util#System(bin_path)
|
||||
else
|
||||
let goargs = go#util#Shelljoin(a:000)
|
||||
let out = go#util#System(bin_path . " " . go#util#Shelljoin(a:000))
|
||||
endif
|
||||
|
||||
let out = go#util#System(bin_path . " " . goargs)
|
||||
if empty(out)
|
||||
echon "vim-go: " | echohl Function | echon "[lint] PASS" | echohl None
|
||||
return
|
||||
|
@ -247,28 +254,23 @@ function s:lint_job(args)
|
|||
caddexpr a:msg
|
||||
let &errorformat = old_errorformat
|
||||
|
||||
" TODO(arslan): cursor still jumps to first error even If I don't want
|
||||
" it. Seems like there is a regression somewhere, but not sure where.
|
||||
" TODO(jinleileiking): give a configure to jump or not
|
||||
let l:winnr = winnr()
|
||||
|
||||
copen
|
||||
|
||||
exe l:winnr . "wincmd w"
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:close_cb(chan) closure
|
||||
let l:job = ch_getjob(a:chan)
|
||||
let l:status = job_status(l:job)
|
||||
|
||||
let exitval = 1
|
||||
if l:status == "dead"
|
||||
let l:info = job_info(l:job)
|
||||
let exitval = l:info.exitval
|
||||
endif
|
||||
|
||||
function! s:exit_cb(job, exitval) closure
|
||||
let status = {
|
||||
\ 'desc': 'last status',
|
||||
\ 'type': "gometaliner",
|
||||
\ 'state': "finished",
|
||||
\ }
|
||||
|
||||
if exitval
|
||||
if a:exitval
|
||||
let status.state = "failed"
|
||||
endif
|
||||
|
||||
|
@ -297,7 +299,7 @@ function s:lint_job(args)
|
|||
|
||||
let start_options = {
|
||||
\ 'callback': funcref("s:callback"),
|
||||
\ 'close_cb': funcref("s:close_cb"),
|
||||
\ 'exit_cb': funcref("s:exit_cb"),
|
||||
\ }
|
||||
|
||||
call job_start(a:args.cmd, start_options)
|
||||
|
|
|
@ -9,46 +9,46 @@ let s:initial_go_path = ""
|
|||
" GOPATH with it. If two double quotes are passed (the empty string in go),
|
||||
" it'll clear the GOPATH and will restore to the initial GOPATH.
|
||||
function! go#path#GoPath(...) abort
|
||||
" we have an argument, replace GOPATH
|
||||
if len(a:000)
|
||||
" clears the current manually set GOPATH and restores it to the
|
||||
" initial GOPATH, which was set when Vim was started.
|
||||
if len(a:000) == 1 && a:1 == '""'
|
||||
if !empty(s:initial_go_path)
|
||||
let $GOPATH = s:initial_go_path
|
||||
let s:initial_go_path = ""
|
||||
endif
|
||||
|
||||
echon "vim-go: " | echohl Function | echon "GOPATH restored to ". $GOPATH | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
echon "vim-go: " | echohl Function | echon "GOPATH changed to ". a:1 | echohl None
|
||||
let s:initial_go_path = $GOPATH
|
||||
let $GOPATH = a:1
|
||||
" no argument, show GOPATH
|
||||
if len(a:000) == 0
|
||||
echo go#path#Detect()
|
||||
return
|
||||
endif
|
||||
|
||||
echo go#path#Detect()
|
||||
endfunction
|
||||
" we have an argument, replace GOPATH
|
||||
" clears the current manually set GOPATH and restores it to the
|
||||
" initial GOPATH, which was set when Vim was started.
|
||||
if len(a:000) == 1 && a:1 == '""'
|
||||
if !empty(s:initial_go_path)
|
||||
let $GOPATH = s:initial_go_path
|
||||
let s:initial_go_path = ""
|
||||
endif
|
||||
|
||||
" Default returns the default GOPATH. If there is a single GOPATH it returns
|
||||
" it. For multiple GOPATHS separated with a the OS specific separator, only
|
||||
" the first one is returned
|
||||
function! go#path#Default() abort
|
||||
let go_paths = split($GOPATH, go#util#PathListSep())
|
||||
|
||||
if len(go_paths) == 1
|
||||
return $GOPATH
|
||||
echon "vim-go: " | echohl Function | echon "GOPATH restored to ". $GOPATH | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
return go_paths[0]
|
||||
echon "vim-go: " | echohl Function | echon "GOPATH changed to ". a:1 | echohl None
|
||||
let s:initial_go_path = $GOPATH
|
||||
let $GOPATH = a:1
|
||||
endfunction
|
||||
|
||||
" Default returns the default GOPATH. If GOPATH is not set, it uses the
|
||||
" default GOPATH set starting with Go 1.8. This GOPATH can be retrieved via
|
||||
" 'go env GOPATH'
|
||||
function! go#path#Default() abort
|
||||
if $GOPATH == ""
|
||||
" use default GOPATH via go env
|
||||
return go#util#gopath()
|
||||
endif
|
||||
|
||||
return $GOPATH
|
||||
endfunction
|
||||
|
||||
" HasPath checks whether the given path exists in GOPATH environment variable
|
||||
" or not
|
||||
function! go#path#HasPath(path) abort
|
||||
let go_paths = split($GOPATH, go#util#PathListSep())
|
||||
let go_paths = split(go#path#Default(), go#util#PathListSep())
|
||||
let last_char = strlen(a:path) - 1
|
||||
|
||||
" check cases of '/foo/bar/' and '/foo/bar'
|
||||
|
@ -70,7 +70,7 @@ endfunction
|
|||
" over the current GOPATH. It also detects diretories whose are outside
|
||||
" GOPATH.
|
||||
function! go#path#Detect() abort
|
||||
let gopath = $GOPATH
|
||||
let gopath = go#path#Default()
|
||||
|
||||
" don't lookup for godeps if autodetect is disabled.
|
||||
if !get(g:, "go_autodetect_gopath", 1)
|
||||
|
@ -122,57 +122,58 @@ function! go#path#BinPath() abort
|
|||
let bin_path = ""
|
||||
|
||||
" check if our global custom path is set, if not check if $GOBIN is set so
|
||||
" we can use it, otherwise use $GOPATH + '/bin'
|
||||
" we can use it, otherwise use default GOPATH
|
||||
if exists("g:go_bin_path")
|
||||
let bin_path = g:go_bin_path
|
||||
elseif $GOBIN != ""
|
||||
let bin_path = $GOBIN
|
||||
elseif $GOPATH != ""
|
||||
let bin_path = expand(go#path#Default() . "/bin/")
|
||||
else
|
||||
" could not find anything
|
||||
endif
|
||||
else
|
||||
let go_paths = split(go#path#Default(), go#util#PathListSep())
|
||||
let bin_path = expand(go_paths[0] . "/bin/")
|
||||
endif
|
||||
|
||||
return bin_path
|
||||
return bin_path
|
||||
endfunction
|
||||
|
||||
" CheckBinPath checks whether the given binary exists or not and returns the
|
||||
" path of the binary. It returns an empty string doesn't exists.
|
||||
function! go#path#CheckBinPath(binpath) abort
|
||||
" remove whitespaces if user applied something like 'goimports '
|
||||
let binpath = substitute(a:binpath, '^\s*\(.\{-}\)\s*$', '\1', '')
|
||||
" save off original path
|
||||
let old_path = $PATH
|
||||
" remove whitespaces if user applied something like 'goimports '
|
||||
let binpath = substitute(a:binpath, '^\s*\(.\{-}\)\s*$', '\1', '')
|
||||
" save off original path
|
||||
let old_path = $PATH
|
||||
|
||||
" check if we have an appropriate bin_path
|
||||
let go_bin_path = go#path#BinPath()
|
||||
if !empty(go_bin_path)
|
||||
" append our GOBIN and GOPATH paths and be sure they can be found there...
|
||||
" let us search in our GOBIN and GOPATH paths
|
||||
let $PATH = go_bin_path . go#util#PathListSep() . $PATH
|
||||
" check if we have an appropriate bin_path
|
||||
let go_bin_path = go#path#BinPath()
|
||||
if !empty(go_bin_path)
|
||||
" append our GOBIN and GOPATH paths and be sure they can be found there...
|
||||
" let us search in our GOBIN and GOPATH paths
|
||||
let $PATH = go_bin_path . go#util#PathListSep() . $PATH
|
||||
endif
|
||||
|
||||
" if it's in PATH just return it
|
||||
if executable(binpath)
|
||||
if exists('*exepath')
|
||||
let binpath = exepath(binpath)
|
||||
endif
|
||||
|
||||
" if it's in PATH just return it
|
||||
if executable(binpath)
|
||||
if exists('*exepath')
|
||||
let binpath = exepath(binpath)
|
||||
endif
|
||||
let $PATH = old_path
|
||||
return binpath
|
||||
endif
|
||||
|
||||
" just get the basename
|
||||
let basename = fnamemodify(binpath, ":t")
|
||||
if !executable(basename)
|
||||
echom "vim-go: could not find '" . basename . "'. Run :GoInstallBinaries to fix it."
|
||||
" restore back!
|
||||
let $PATH = old_path
|
||||
return ""
|
||||
endif
|
||||
|
||||
let $PATH = old_path
|
||||
return binpath
|
||||
endif
|
||||
|
||||
return go_bin_path . go#util#PathSep() . basename
|
||||
" just get the basename
|
||||
let basename = fnamemodify(binpath, ":t")
|
||||
if !executable(basename)
|
||||
|
||||
call go#util#EchoError(printf("could not find '%s'. Run :GoInstallBinaries to fix it", basename))
|
||||
|
||||
" restore back!
|
||||
let $PATH = old_path
|
||||
return ""
|
||||
endif
|
||||
|
||||
let $PATH = old_path
|
||||
|
||||
return go_bin_path . go#util#PathSep() . basename
|
||||
endfunction
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -71,28 +71,25 @@ function s:rename_job(args)
|
|||
|
||||
let status_dir = expand('%:p:h')
|
||||
|
||||
function! s:close_cb(chan) closure
|
||||
let l:job = ch_getjob(a:chan)
|
||||
let l:info = job_info(l:job)
|
||||
|
||||
function! s:exit_cb(job, exitval) closure
|
||||
let status = {
|
||||
\ 'desc': 'last status',
|
||||
\ 'type': "gorename",
|
||||
\ 'state': "finished",
|
||||
\ }
|
||||
|
||||
if l:info.exitval
|
||||
if a:exitval
|
||||
let status.state = "failed"
|
||||
endif
|
||||
|
||||
call go#statusline#Update(status_dir, status)
|
||||
|
||||
call s:parse_errors(l:info.exitval, a:args.bang, messages)
|
||||
call s:parse_errors(a:exitval, a:args.bang, messages)
|
||||
endfunction
|
||||
|
||||
let start_options = {
|
||||
\ 'callback': funcref("s:callback"),
|
||||
\ 'close_cb': funcref("s:close_cb"),
|
||||
\ 'exit_cb': funcref("s:exit_cb"),
|
||||
\ }
|
||||
|
||||
" modify GOPATH if needed
|
||||
|
|
|
@ -122,11 +122,13 @@ func s:create_cmd(args) abort
|
|||
let l:offset = a:args.offset
|
||||
let l:mode = a:args.mode
|
||||
let l:cmd_args = a:args.cmd_args
|
||||
let l:modifytags_transform = get(g:, 'go_addtags_transform', "snakecase")
|
||||
|
||||
" start constructing the command
|
||||
let cmd = [bin_path]
|
||||
call extend(cmd, ["-format", "json"])
|
||||
call extend(cmd, ["-file", a:args.fname])
|
||||
call extend(cmd, ["-transform", l:modifytags_transform])
|
||||
|
||||
if l:offset != 0
|
||||
call extend(cmd, ["-offset", l:offset])
|
||||
|
|
|
@ -94,19 +94,29 @@ function! go#util#osarch() abort
|
|||
return go#util#goos() . '_' . go#util#goarch()
|
||||
endfunction
|
||||
|
||||
" System runs a shell command. It will reset the shell to /bin/sh for Unix-like
|
||||
" systems if it is executable.
|
||||
" System runs a shell command. If possible, it will temporary set
|
||||
" the shell to /bin/sh for Unix-like systems providing a Bourne
|
||||
" POSIX like environment.
|
||||
function! go#util#System(str, ...) abort
|
||||
" Preserve original shell and shellredir values
|
||||
let l:shell = &shell
|
||||
let l:shellredir = &shellredir
|
||||
|
||||
" Use a Bourne POSIX like shell. Some parts of vim-go expect
|
||||
" commands to be executed using bourne semantics #988 and #1276.
|
||||
" Alter shellredir to match bourne. Especially important if login shell
|
||||
" is set to any of the csh or zsh family #1276.
|
||||
if !go#util#IsWin() && executable('/bin/sh')
|
||||
let &shell = '/bin/sh'
|
||||
set shell=/bin/sh shellredir=>%s\ 2>&1
|
||||
endif
|
||||
|
||||
try
|
||||
let l:output = call('system', [a:str] + a:000)
|
||||
return l:output
|
||||
finally
|
||||
" Restore original values
|
||||
let &shell = l:shell
|
||||
let &shellredir = l:shellredir
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
|
@ -203,7 +213,7 @@ endfunction
|
|||
" snippetcase converts the given word to given preferred snippet setting type
|
||||
" case.
|
||||
function! go#util#snippetcase(word) abort
|
||||
let l:snippet_case = get(g:, 'go_snippet_case_type', "snakecase")
|
||||
let l:snippet_case = get(g:, 'go_addtags_transform', "snakecase")
|
||||
if l:snippet_case == "snakecase"
|
||||
return go#util#snakecase(a:word)
|
||||
elseif l:snippet_case == "camelcase"
|
||||
|
@ -235,51 +245,6 @@ function! go#util#camelcase(word) abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! go#util#AddTags(line1, line2, ...) abort
|
||||
" default is json
|
||||
let l:keys = ["json"]
|
||||
if a:0
|
||||
let l:keys = a:000
|
||||
endif
|
||||
|
||||
let l:line1 = a:line1
|
||||
let l:line2 = a:line2
|
||||
|
||||
" If we're inside a struct and just call this function let us add the tags
|
||||
" to all fields
|
||||
" TODO(arslan): I don't like using patterns. Check if we can move it to
|
||||
" `motion` and do it via AST based position
|
||||
let ln1 = searchpair('struct {', '', '}', 'bcnW')
|
||||
if ln1 == 0
|
||||
echon "vim-go: " | echohl ErrorMsg | echon "cursor is outside the struct" | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
" searchpair only returns a single position
|
||||
let ln2 = search('}', "cnW")
|
||||
|
||||
" if no range is given we apply for the whole struct
|
||||
if l:line1 == l:line2
|
||||
let l:line1 = ln1 + 1
|
||||
let l:line2 = ln2 - 1
|
||||
endif
|
||||
|
||||
for line in range(l:line1, l:line2)
|
||||
" get the field name (word) that are not part of a commented line
|
||||
let l:matched = matchstr(getline(line), '\(\/\/.*\)\@<!\w\+')
|
||||
if empty(l:matched)
|
||||
continue
|
||||
endif
|
||||
|
||||
let word = go#util#snippetcase(l:matched)
|
||||
let tags = map(copy(l:keys), 'printf("%s:%s", v:val,"\"'. word .'\"")')
|
||||
let updated_line = printf("%s `%s`", getline(line), join(tags, " "))
|
||||
|
||||
" finally, update the line inplace
|
||||
call setline(line, updated_line)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" TODO(arslan): I couldn't parameterize the highlight types. Check if we can
|
||||
" simplify the following functions
|
||||
"
|
||||
|
|
|
@ -21,8 +21,10 @@ CONTENTS *go-contents*
|
|||
5. Text Objects.................................|go-text-objects|
|
||||
6. Functions....................................|go-functions|
|
||||
7. Settings.....................................|go-settings|
|
||||
8. Troubleshooting..............................|go-troubleshooting|
|
||||
9. Credits......................................|go-credits|
|
||||
8. FAQ/Troubleshooting..........................|go-troubleshooting|
|
||||
9. Development..................................|go-development|
|
||||
10. Donation.....................................|go-donation|
|
||||
11. Credits......................................|go-credits|
|
||||
|
||||
==============================================================================
|
||||
INTRO *go-intro*
|
||||
|
@ -100,7 +102,7 @@ command.
|
|||
|
||||
Plugin 'fatih/vim-go'
|
||||
|
||||
* Vim |packages| (since Vim 7.4.1528)
|
||||
* Vim |packages|
|
||||
>
|
||||
git clone https://github.com/fatih/vim-go.git \
|
||||
~/.vim/pack/plugins/start/vim-go
|
||||
|
@ -165,7 +167,7 @@ COMMANDS *go-commands*
|
|||
*:GoLint*
|
||||
:GoLint [packages]
|
||||
|
||||
Run golint for the current Go file, or for given packages.
|
||||
Run golint for the current directory, or for given packages.
|
||||
|
||||
*:GoDoc*
|
||||
:GoDoc [word]
|
||||
|
@ -217,15 +219,17 @@ COMMANDS *go-commands*
|
|||
If [!] is not given the first error is jumped to.
|
||||
|
||||
*:GoDef*
|
||||
:GoDef [identifier]
|
||||
:GoDef
|
||||
gd
|
||||
CTRL-]
|
||||
g<C-LeftMouse>
|
||||
<C-LeftMouse>
|
||||
|
||||
Goto declaration/definition for the given [identifier]. If no argument is
|
||||
given, it will jump to the declaration under the cursor. By default the
|
||||
CTRL-] key and the mapping `gd` are enabled to invoke :GoDef for the
|
||||
identifier under the cursor. See |'g:go_def_mapping_enabled'| to disable
|
||||
them.
|
||||
Goto declaration/definition for the declaration under the cursor. By
|
||||
default the CTRL-] shortcut, the mapping `gd` and <C-LeftMouse>,
|
||||
g<LeftMouse> are enabled to invoke :GoDef for the identifier under the
|
||||
cursor. See |'g:go_def_mapping_enabled'| to disable them. No explicit
|
||||
arguments are supported.
|
||||
|
||||
vim-go also keeps a per-window location stack, roughly analogous to how
|
||||
Vim's internal |tags| functionality works. This is pushed to every time a
|
||||
|
@ -741,7 +745,22 @@ CTRL-t
|
|||
|
||||
Toggles |'g:go_template_autocreate'|.
|
||||
|
||||
*:GoKeyify*
|
||||
:GoKeyify
|
||||
|
||||
Uses `keyify` to turn unkeyed struct literals into keyed ones.
|
||||
|
||||
For example:
|
||||
>
|
||||
Person{"John", "Smith"}
|
||||
<
|
||||
Becomes:
|
||||
>
|
||||
Person{
|
||||
Name: "John",
|
||||
Surname: "Smith",
|
||||
}
|
||||
<
|
||||
==============================================================================
|
||||
MAPPINGS *go-mappings*
|
||||
|
||||
|
@ -1127,9 +1146,10 @@ Use this option to define the command to be used for |:GoDef|. By default
|
|||
<
|
||||
*'g:go_def_mapping_enabled'*
|
||||
|
||||
Use this option to enable/disable the default mapping of CTRL-] and (`gd`) for
|
||||
GoDef and CTRL-t for :GoDefPop. Disabling it allows you to map something else
|
||||
to these keys or mappings. Default is enabled. >
|
||||
Use this option to enable/disable the default mapping of CTRL-],
|
||||
<C-LeftMouse>, g<C-LeftMouse> and (`gd`) for GoDef and CTRL-t for :GoDefPop.
|
||||
Disabling it allows you to map something else to these keys or mappings.
|
||||
Default is enabled. >
|
||||
|
||||
let g:go_def_mapping_enabled = 1
|
||||
<
|
||||
|
@ -1168,28 +1188,6 @@ Use this option to define the default snippet engine. By default "ultisnips"
|
|||
is used. Use "neosnippet" for neosnippet.vim: >
|
||||
|
||||
let g:go_snippet_engine = "ultisnips"
|
||||
<
|
||||
*'g:go_snippet_case_type'*
|
||||
|
||||
Use this option to define the default conversion type of snippet expansion for
|
||||
field tags. For the following case, if `snakecase` is used the `json` snippet
|
||||
will expand to:
|
||||
>
|
||||
type T struct {
|
||||
FooBarQuz string `json:"foo_bar_quz"
|
||||
}
|
||||
<
|
||||
|
||||
If "camelcase" is used:
|
||||
>
|
||||
type T struct {
|
||||
FooBarQuz string `json:"fooBarQuz"
|
||||
}
|
||||
<
|
||||
By default "snakecase" is used. Current values are: ["snakecase",
|
||||
"camelcase"].
|
||||
>
|
||||
let g:go_snippet_case_type = "snakecase"
|
||||
<
|
||||
*'g:go_get_update'*
|
||||
|
||||
|
@ -1212,7 +1210,7 @@ set, so the relevant commands defaults are being used.
|
|||
*'g:go_build_tags'*
|
||||
|
||||
These options that will be automatically passed to the `-tags` option of
|
||||
various tools, such as `guru`, `gorename`, etc... This is a permanatent
|
||||
various tools, such as `guru`, `gorename`, etc... This is a permanent
|
||||
setting. A more useful way is to use |:GoBuildTags| to dynamically change or
|
||||
remove build tags. By default it's not set.
|
||||
>
|
||||
|
@ -1350,6 +1348,13 @@ Specifies the currently enabled linters for the |:GoMetaLinter| command. By
|
|||
default it's using `vet`, `golint` and `errcheck`.
|
||||
>
|
||||
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
|
||||
<
|
||||
*'g:go_metalinter_excludes'*
|
||||
|
||||
Specifies the linters to be excluded from the |:GoMetaLinter| command. By
|
||||
default it's empty
|
||||
>
|
||||
let g:go_metalinter_excludes = []
|
||||
<
|
||||
*'g:go_metalinter_command'*
|
||||
|
||||
|
@ -1530,8 +1535,55 @@ default it's 60 seconds. Must be in milliseconds.
|
|||
>
|
||||
let g:go_statusline_duration = 60000
|
||||
<
|
||||
|
||||
*'g:go_addtags_transform'*
|
||||
|
||||
Sets the `transform` option for `gomodifytags` when using |:GoAddTags| or if
|
||||
it's being used for snippet expansion of single fields. Possible options are:
|
||||
`snakecase`, `camelcase`. For the following case, if `snakecase` is used the
|
||||
field will be transformed to:
|
||||
>
|
||||
type T struct {
|
||||
FooBarQuz string `json:"foo_bar_quz"
|
||||
}
|
||||
<
|
||||
|
||||
If "camelcase" is used:
|
||||
>
|
||||
type T struct {
|
||||
FooBarQuz string `json:"fooBarQuz"
|
||||
}
|
||||
<
|
||||
By default "snakecase" is used. Current values are: ["snakecase",
|
||||
"camelcase"].
|
||||
>
|
||||
let g:go_addtags_transform = 'snakecase'
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
TROUBLESHOOTING *go-troubleshooting*
|
||||
DEVELOPMENT *go-development*
|
||||
|
||||
vim-go supports test files written in VimL. Please check `autoload` folder for
|
||||
examples. If you add a new feature be sure you also include the `_test.vim`
|
||||
file next to the script. Test functions should be starting with `Test_`,
|
||||
example:
|
||||
>
|
||||
function Test_run_fmt()
|
||||
call assert_equal(expected, actual)
|
||||
...
|
||||
endfunction
|
||||
<
|
||||
You can locally test it by running:
|
||||
>
|
||||
make
|
||||
<
|
||||
This will run all tests and print either `PASS` or `FAIL` to indicate the final
|
||||
status of all tests. Additionally, each new pull request will trigger a new
|
||||
Travis-ci job.
|
||||
|
||||
|
||||
==============================================================================
|
||||
FAQ TROUBLESHOOTING *go-troubleshooting*
|
||||
|
||||
I get "not an editor command" error when I invoke :GoXXX~
|
||||
|
||||
|
@ -1569,15 +1621,63 @@ If you see errors like this:
|
|||
>
|
||||
Error installing golang.org/x/tools/cmd/goimports
|
||||
<
|
||||
that means your local Go setup is broken or the remote website is down. For
|
||||
that means your local Go setup is broken or the remote website is down. For
|
||||
example sometimes code.google.com times out. To test, just execute a simple
|
||||
`go get`:
|
||||
|
||||
>
|
||||
go get golang.org/x/tools/cmd/goimports
|
||||
<
|
||||
You'll see a more detailed error. If this works, vim-go will work too.
|
||||
|
||||
|
||||
How do I use vim-go with syntastic?~
|
||||
|
||||
Sometimes when using both `vim-go` and `syntastic` Vim will start lagging
|
||||
while saving and opening files. The following fixes this:
|
||||
>
|
||||
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
|
||||
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
|
||||
<
|
||||
Another issue with `vim-go` and `syntastic` is that the location list window
|
||||
that contains the output of commands such as `:GoBuild` and `:GoTest` might
|
||||
not appear. To resolve this:
|
||||
>
|
||||
let g:go_list_type = "quickfix"
|
||||
<
|
||||
|
||||
Using with NeoVim~
|
||||
|
||||
Note: Neovim currently is not a first class citizen for vim-go. You are free
|
||||
to open bug, however I'm not using Neovim so it's hard for me to test it.
|
||||
vim-go might not work well as good as in Vim. I'm happy to accept pull requests
|
||||
or very detailed bug reports. If you're interested to improve the state of
|
||||
Neovim in vim-go you're always welcome!
|
||||
|
||||
Run `:GoRun` in a new tab, horizontal split or vertical split terminal
|
||||
>
|
||||
au FileType go nmap <leader>rt <Plug>(go-run-tab)
|
||||
au FileType go nmap <leader>rs <Plug>(go-run-split)
|
||||
au FileType go nmap <leader>rv <Plug>(go-run-vertical)
|
||||
<
|
||||
By default new terminals are opened in a vertical split. To change it
|
||||
>
|
||||
let g:go_term_mode = "split"
|
||||
>
|
||||
|
||||
==============================================================================
|
||||
DONATION *go-donation*
|
||||
|
||||
People have asked for this for a long time, now you can be a fully supporter
|
||||
by being a patreon at: https://www.patreon.com/fatih
|
||||
|
||||
By being a patron, you are enabling vim-go to grow and mature, helping me to
|
||||
invest in bug fixes, new documentation, and improving both current and future
|
||||
features. It's completely optional and is just a direct way to support Vim-go's
|
||||
ongoing development. Thanks!
|
||||
|
||||
Check it out: https://www.patreon.com/fatih
|
||||
|
||||
|
||||
==============================================================================
|
||||
CREDITS *go-credits*
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ if get(g:, "go_def_mapping_enabled", 1)
|
|||
" useful again for Go source code
|
||||
nnoremap <buffer> <silent> gd :GoDef<cr>
|
||||
nnoremap <buffer> <silent> <C-]> :GoDef<cr>
|
||||
nnoremap <buffer> <silent> <C-LeftMouse> <LeftMouse>:GoDef<cr>
|
||||
nnoremap <buffer> <silent> g<LeftMouse> <LeftMouse>:GoDef<cr>
|
||||
nnoremap <buffer> <silent> <C-w><C-]> :<C-u>call go#def#Jump("split")<CR>
|
||||
nnoremap <buffer> <silent> <C-w>] :<C-u>call go#def#Jump("split")<CR>
|
||||
nnoremap <buffer> <silent> <C-t> :<C-U>call go#def#StackPop(v:count1)<cr>
|
||||
|
|
|
@ -92,4 +92,7 @@ command! -nargs=* -buffer -complete=customlist,go#impl#Complete GoImpl call go#i
|
|||
" -- template
|
||||
command! -nargs=0 GoTemplateAutoCreateToggle call go#template#ToggleAutoCreate()
|
||||
|
||||
" -- keyify
|
||||
command! -nargs=0 GoKeyify call go#keyify#Keyify()
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
|
|
@ -143,6 +143,13 @@ else {
|
|||
}
|
||||
endsnippet
|
||||
|
||||
# if inline error
|
||||
snippet ife "If with inline erro"
|
||||
if err := ${1:condition}; err != nil {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# error snippet
|
||||
snippet errn "Error return " !b
|
||||
if err != nil {
|
||||
|
|
|
@ -118,6 +118,14 @@ snippet else
|
|||
else {
|
||||
${0}
|
||||
}
|
||||
|
||||
# if inline error
|
||||
snippet ife
|
||||
abbr if err := ...; err != nil { ... }
|
||||
if err := ${1:condition}; err != nil {
|
||||
${0}
|
||||
}
|
||||
|
||||
# error snippet
|
||||
snippet errn
|
||||
abbr if err != nil { ... }
|
||||
|
|
|
@ -21,6 +21,7 @@ let s:packages = [
|
|||
\ "github.com/fatih/gomodifytags",
|
||||
\ "github.com/zmb3/gogetdoc",
|
||||
\ "github.com/josharian/impl",
|
||||
\ "github.com/dominikh/go-tools/cmd/keyify",
|
||||
\ ]
|
||||
|
||||
" These commands are available on any filetypes
|
||||
|
@ -33,15 +34,15 @@ command! -nargs=? -complete=dir GoPath call go#path#GoPath(<f-args>)
|
|||
" target install directory. GoInstallBinaries doesn't install binaries if they
|
||||
" exist, to update current binaries pass 1 to the argument.
|
||||
function! s:GoInstallBinaries(updateBinaries)
|
||||
if $GOPATH == "" && go#util#gopath() == ""
|
||||
echohl Error
|
||||
echomsg "vim.go: $GOPATH is not set"
|
||||
echohl None
|
||||
let err = s:CheckBinaries()
|
||||
if err != 0
|
||||
return
|
||||
endif
|
||||
|
||||
let err = s:CheckBinaries()
|
||||
if err != 0
|
||||
if go#path#Default() == ""
|
||||
echohl Error
|
||||
echomsg "vim.go: $GOPATH is not set and 'go env GOPATH' returns empty"
|
||||
echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
|
|
|
@ -74,8 +74,8 @@ hi def link goTplVariable Special
|
|||
|
||||
syn region gotplAction start="{{" end="}}" contains=@gotplLiteral,gotplControl,gotplFunctions,gotplVariable,goTplIdentifier display
|
||||
syn region gotplAction start="\[\[" end="\]\]" contains=@gotplLiteral,gotplControl,gotplFunctions,gotplVariable display
|
||||
syn region goTplComment start="{{/\*" end="\*/}}" display
|
||||
syn region goTplComment start="\[\[/\*" end="\*/\]\]" display
|
||||
syn region goTplComment start="{{\(- \)\?/\*" end="\*/\( -\)\?}}" display
|
||||
syn region goTplComment start="\[\[\(- \)\?/\*" end="\*/\( -\)\?\]\]" display
|
||||
|
||||
hi def link gotplAction PreProc
|
||||
hi def link goTplComment Comment
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
Indent Text Objects
|
||||
|
||||
INTRODUCTION |idntobj-introduction|
|
||||
TEXT OBJECTS |idntobj-objects|
|
||||
BLANK LINES |idntobj-blanklines|
|
||||
ABOUT |idntobj-about|
|
||||
INTRODUCTION |indtobj-introduction|
|
||||
TEXT OBJECTS |indtobj-objects|
|
||||
BLANK LINES |indtobj-blanklines|
|
||||
ABOUT |indtobj-about|
|
||||
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *idntobj-introduction*
|
||||
INTRODUCTION *indtobj-introduction*
|
||||
|
||||
Vim text objects provide a convenient way to select and operate on various
|
||||
types of objects. These objects include regions surrounded by various types of
|
||||
|
@ -24,7 +24,7 @@ structure can be quickly selected, for example.
|
|||
|
||||
|
||||
==============================================================================
|
||||
TEXT OBJECTS *ai* *ii* *aI* *iI* *idntobj-objects*
|
||||
TEXT OBJECTS *ai* *ii* *aI* *iI* *indtobj-objects*
|
||||
|
||||
This plugin defines two new text objects. These are very similar - they differ
|
||||
only in whether they include the line below the block or not.
|
||||
|
@ -78,7 +78,7 @@ structure.
|
|||
|
||||
|
||||
==============================================================================
|
||||
BLANK LINES *idntobj-blanklines*
|
||||
BLANK LINES *indtobj-blanklines*
|
||||
|
||||
When scanning code blocks, the plugin usually ignores blank lines. There is an
|
||||
exception to this, however, when the block being selected is not indented. In
|
||||
|
@ -94,7 +94,7 @@ This exceptional behaviour can be disabled by executing the following line
|
|||
|
||||
|
||||
==============================================================================
|
||||
ABOUT *idntobj-about*
|
||||
ABOUT *indtobj-about*
|
||||
|
||||
vim-indent-object was written by Michael Smith <msmith@msmith.id.au>. The
|
||||
project repository is kept at:
|
||||
|
|
|
@ -20,6 +20,14 @@ To disable markdown syntax concealing add the following to your vimrc:
|
|||
|
||||
let g:markdown_syntax_conceal = 0
|
||||
|
||||
Syntax highlight is synchronized in 50 lines. It may cause collapsed
|
||||
highlighting at large fenced code block.
|
||||
In the case, please set larger value in your vimrc:
|
||||
|
||||
let g:markdown_minlines = 100
|
||||
|
||||
Note that setting too large value may cause bad performance on highlighting.
|
||||
|
||||
## License
|
||||
|
||||
Copyright © Tim Pope. Distributed under the same terms as Vim itself.
|
||||
|
|
|
@ -41,10 +41,35 @@ function! MarkdownFold()
|
|||
return "="
|
||||
endfunction
|
||||
|
||||
function! MarkdownFoldText()
|
||||
let hash_indent = s:HashIndent(v:foldstart)
|
||||
let title = substitute(getline(v:foldstart), '^#\+\s*', '', '')
|
||||
let foldsize = (v:foldend - v:foldstart + 1)
|
||||
let linecount = '['.foldsize.' lines]'
|
||||
return hash_indent.' '.title.' '.linecount
|
||||
endfunction
|
||||
|
||||
function! s:HashIndent(lnum)
|
||||
let hash_header = matchstr(getline(a:lnum), '^#\{1,6}')
|
||||
if len(hash_header) > 0
|
||||
" hashtag header
|
||||
return hash_header
|
||||
else
|
||||
" == or -- header
|
||||
let nextline = getline(a:lnum + 1)
|
||||
if nextline =~ '^=\+\s*$'
|
||||
return repeat('#', 1)
|
||||
elseif nextline =~ '^-\+\s*$'
|
||||
return repeat('#', 2)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if has("folding") && exists("g:markdown_folding")
|
||||
setlocal foldexpr=MarkdownFold()
|
||||
setlocal foldmethod=expr
|
||||
let b:undo_ftplugin .= " foldexpr< foldmethod<"
|
||||
setlocal foldtext=MarkdownFoldText()
|
||||
let b:undo_ftplugin .= " foldexpr< foldmethod< foldtext<"
|
||||
endif
|
||||
|
||||
" vim:set sw=2:
|
||||
|
|
|
@ -33,7 +33,10 @@ endfor
|
|||
unlet! s:type
|
||||
unlet! s:done_include
|
||||
|
||||
syn sync minlines=10
|
||||
if !exists('g:markdown_minlines')
|
||||
let g:markdown_minlines = 50
|
||||
endif
|
||||
execute 'syn sync minlines=' . g:markdown_minlines
|
||||
syn case ignore
|
||||
|
||||
syn match markdownValid '[<>]\c[a-z/$!]\@!'
|
||||
|
@ -94,7 +97,7 @@ exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start=
|
|||
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```*.*$" end="^\s*```*\ze\s*$" keepend
|
||||
syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*````*.*$" end="^\s*````*\ze\s*$" keepend
|
||||
|
||||
syn match markdownFootnote "\[^[^\]]\+\]"
|
||||
syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:"
|
||||
|
@ -105,7 +108,7 @@ if main_syntax ==# 'markdown'
|
|||
if has_key(s:done_include, matchstr(s:type,'[^.]*'))
|
||||
continue
|
||||
endif
|
||||
exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```*\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```*\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g')
|
||||
exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*````*\s*'.matchstr(s:type,'[^=]*').'\S\@!.*$" end="^\s*````*\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g')
|
||||
let s:done_include[matchstr(s:type,'[^.]*')] = 1
|
||||
endfor
|
||||
unlet! s:type
|
||||
|
|
|
@ -188,6 +188,9 @@ endfunction
|
|||
|
||||
With this locking and unlocking we prevent neocomplete to trigger it's function calls until we are finished with multiple cursors editing.
|
||||
|
||||
Plugins themselves can register `User` autocommands on `MultipleCursorsPre` and
|
||||
`MultipleCursorsPost` for automatic integration.
|
||||
|
||||
### Highlight
|
||||
The plugin uses the highlight group `multiple_cursors_cursor` and `multiple_cursors_visual` to highlight the virtual cursors and their visual selections respectively. You can customize them by putting something similar like the following in your vimrc:
|
||||
|
||||
|
|
|
@ -111,8 +111,11 @@ endfunction
|
|||
" attempted to be created at the next occurrence of the visual selection
|
||||
function! multiple_cursors#new(mode, word_boundary)
|
||||
" Call before function if exists only once until it is canceled (<Esc>)
|
||||
if exists('*Multiple_cursors_before') && !s:before_function_called
|
||||
exe "call Multiple_cursors_before()"
|
||||
if !s:before_function_called
|
||||
doautocmd User MultipleCursorsPre
|
||||
if exists('*Multiple_cursors_before')
|
||||
exe "call Multiple_cursors_before()"
|
||||
endif
|
||||
let s:before_function_called = 1
|
||||
endif
|
||||
let s:use_word_boundary = a:word_boundary
|
||||
|
@ -436,8 +439,11 @@ function! s:CursorManager.reset(restore_view, restore_setting, ...) dict
|
|||
call self.restore_user_settings()
|
||||
endif
|
||||
" Call after function if exists and only if action is canceled (<Esc>)
|
||||
if exists('*Multiple_cursors_after') && a:0 && s:before_function_called
|
||||
exe "call Multiple_cursors_after()"
|
||||
if a:0 && s:before_function_called
|
||||
if exists('*Multiple_cursors_after')
|
||||
exe "call Multiple_cursors_after()"
|
||||
endif
|
||||
doautocmd User MultipleCursorsPost
|
||||
let s:before_function_called = 0
|
||||
endif
|
||||
endfunction
|
||||
|
|
|
@ -37,7 +37,9 @@ syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo,@Spell
|
|||
syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo,@Spell keepend
|
||||
syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->" contains=pugCommentTodo,@Spell
|
||||
syn region pugAngular2 start="(" end=")" contains=htmlEvent
|
||||
syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent
|
||||
syn region pugJavascriptString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contained
|
||||
syn region pugJavascriptString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contained
|
||||
syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=pugJavascriptString,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent
|
||||
syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass
|
||||
syn match pugBlockExpansionChar ":\s\+" contained nextgroup=pugTag,pugClassChar,pugIdChar
|
||||
syn match pugIdChar "#[[{]\@!" contained nextgroup=pugId
|
||||
|
@ -99,6 +101,7 @@ hi def link pugCommentTodo Todo
|
|||
hi def link pugComment Comment
|
||||
hi def link pugCommentBlock Comment
|
||||
hi def link pugHtmlConditionalComment pugComment
|
||||
hi def link pugJavascriptString String
|
||||
|
||||
let b:current_syntax = "pug"
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
" in your mapping will look like this:
|
||||
"
|
||||
" nnoremap <silent> <Plug>MyMap
|
||||
" \ :<C-U>execute 'silent! call repeat#setreg("\<lt>Plug>MyMap", v:register)'<Bar>
|
||||
" \ :<C-U>silent! call repeat#setreg("\<lt>Plug>MyMap", v:register)<Bar>
|
||||
" \ call <SID>MyFunction(v:register, ...)<Bar>
|
||||
" \ silent! call repeat#set("\<lt>Plug>MyMap")<CR>
|
||||
|
||||
|
|
|
@ -96,6 +96,20 @@ will load the `ruby-rails` scope whenever the `ruby` scope is active. The
|
|||
buffer. The [vim-rails](https://github.com/tpope/vim-rails) plugin automatically
|
||||
does `:SnipMateLoadScope rails` when editing a Rails project for example.
|
||||
|
||||
> What are the snippet parser versions and what's the difference between them?
|
||||
|
||||
Originally SnipMate used regex to parse a snippet. Determining where stops were,
|
||||
what the placeholders were, where mirrors were, etc. were all done with regex.
|
||||
Needless to say this was a little fragile. When the time came for a rewritten
|
||||
parser, some incompatibilities were a little necessary. Rather than break
|
||||
everyone's snippets everywhere, we provided both the new (version 1) and the old
|
||||
(version 0) and let the user choose between them.
|
||||
|
||||
Version 0 is considered legacy and not a lot of effort is going to go into
|
||||
improving or even maintaining it. Version 1 is the future, and one can expect
|
||||
new features to only exist for version 1 users. A full list of differences can
|
||||
be found in the docs at `:h SnipMate-parser-versions`.
|
||||
|
||||
## Release Notes ##
|
||||
|
||||
### 0.89 - 2016-05-29 ###
|
||||
|
|
|
@ -384,7 +384,7 @@ function! snipMate#DefaultPool(scopes, trigger, result) abort
|
|||
let s:lookup_state.extends = []
|
||||
|
||||
for expr in s:snippet_filenames(scope, escape(a:trigger, "*[]?{}`'$|#%"))
|
||||
for path in g:snipMate.snippet_dirs
|
||||
for path in s:snippet_dirs()
|
||||
for file in s:Glob(path, expr)
|
||||
source `=file`
|
||||
endfor
|
||||
|
@ -416,6 +416,10 @@ fun! snipMate#GetSnippets(scopes, trigger) abort
|
|||
return result
|
||||
endf
|
||||
|
||||
function! s:snippet_dirs() abort
|
||||
return get(g:snipMate, 'snippet_dirs', split(&rtp, ','))
|
||||
endfunction
|
||||
|
||||
function! snipMate#OpenSnippetFiles() abort
|
||||
let files = []
|
||||
let scopes_done = []
|
||||
|
@ -425,7 +429,7 @@ function! snipMate#OpenSnippetFiles() abort
|
|||
let files += s:snippet_filenames(scope, '')
|
||||
endfor
|
||||
call filter(files, "v:val !~# '\\*'")
|
||||
for path in g:snipMate.snippet_dirs
|
||||
for path in s:snippet_dirs()
|
||||
let fullpaths = map(copy(files), 'printf("%s/%s", path, v:val)')
|
||||
let exists += filter(copy(fullpaths), 'filereadable(v:val)')
|
||||
let notexists += map(filter(copy(fullpaths),
|
||||
|
|
|
@ -148,7 +148,8 @@ g:snipMate.snippet_version
|
|||
1 Use the newer parser
|
||||
If unset, SnipMate defaults to version 0. The
|
||||
value of this option is also used for all
|
||||
.snippet files.
|
||||
.snippet files. See |SnipMate-parser-versions|
|
||||
for more information.
|
||||
|
||||
g:snipMate.override
|
||||
As detailed below, when two snippets with the
|
||||
|
@ -265,14 +266,18 @@ Note: Hard tabs in the expansion text are required. When the snippet is
|
|||
expanded in the text and 'expandtab' is set, each tab will be replaced with
|
||||
spaces based on 'softtabstop' if nonzero or 'shiftwidth' otherwise.
|
||||
|
||||
Which version parser the snippets in a file should be used with can be
|
||||
specified with a version line, e.g.: >
|
||||
|
||||
SnipMate currently provides two versions for the snippet parser. The
|
||||
differences between them can be found at |SnipMate-parser-versions|. Which
|
||||
version parser the snippets in a file should be used with can be specified
|
||||
with a version line, e.g.: >
|
||||
|
||||
version 1
|
||||
|
||||
Specification of a version applies to the snippets following it. Multiple
|
||||
version specifications can appear in a single file to intermix version 0 and
|
||||
version 1 snippets.
|
||||
version 1 snippets. The default is determined by the
|
||||
g:snipMate.snippet_version option. |SnipMate-options|
|
||||
|
||||
Comments can be made in .snippets files by starting a line with a # character.
|
||||
However these can't be used inside of snippet definitions: >
|
||||
|
@ -286,7 +291,7 @@ However these can't be used inside of snippet definitions: >
|
|||
|
||||
This should hopefully be clear with the included syntax highlighting.
|
||||
|
||||
*snipMate-extends*
|
||||
*SnipMate-extends*
|
||||
Borrowing from UltiSnips, .snippets files can also contain an extends
|
||||
directive, for example: >
|
||||
|
||||
|
@ -296,6 +301,11 @@ will tell SnipMate to also read html, javascript, and css snippets.
|
|||
|
||||
SNIPPET SYNTAX *snippet-syntax* *SnipMate-syntax*
|
||||
|
||||
As mentioned above, there are two versions of the snippet parser. They are
|
||||
selected by the g:snipMate.snippet_version option (|SnipMate-options|) or the
|
||||
version directive in .snippets files. Differences will be mentioned throughout
|
||||
with a summary at |SnipMate-parser-versions|.
|
||||
|
||||
Anywhere in a snippet, a backslash escapes the character following it,
|
||||
regardless of whether that character is special or not. That is, '\a' will
|
||||
always result in an 'a' in the output. A single backslash can be output by
|
||||
|
@ -366,13 +376,15 @@ edited. These look like a tab stop without a placeholder; $1 for example. In
|
|||
the event that no placeholder is specified for a certain tab stop--say $1--the
|
||||
first instance becomes the tab stop and the rest become mirrors.
|
||||
|
||||
Additionally substitutions similar to |:substitute| can be performed. For
|
||||
instance ${1/foo/bar/g} will replace all instances of "foo" in the $1 mirror
|
||||
with "bar". This uses |substitute()| behind the scenes.
|
||||
Additionally, in version 1 of the parser, substitutions similar to
|
||||
|:substitute| can be performed. For instance ${1/foo/bar/g} will replace all
|
||||
instances of "foo" in the $1 mirror with "bar". This uses |substitute()|
|
||||
behind the scenes.
|
||||
|
||||
Note: Just like with tab stops, braces can be used to avoid ambiguities: ${1}2
|
||||
is a mirror of the first tab stop followed by a 2. Version 0 of the snippet
|
||||
parser offers no way to resolve such ambiguities.
|
||||
parser offers no way to resolve such ambiguities. Version 0 also requires that
|
||||
a tabstop have a placeholder before its mirrors work.
|
||||
|
||||
As an example, >
|
||||
|
||||
|
@ -436,6 +448,39 @@ Example: >
|
|||
<div>
|
||||
${0:${VISUAL:<!-- content -->}}
|
||||
</div>
|
||||
<
|
||||
*SnipMate-parser-versions*
|
||||
Parser Versions~
|
||||
|
||||
SnipMate provides two versions for its snippet parser. Version 0 is the legacy
|
||||
regex based version and is updated sparingly. Version 1 is the revamped
|
||||
version with new features. Any newly developed features will likely only be
|
||||
available to version 1 users.
|
||||
|
||||
Which version is used is determined by version directives in snippet files
|
||||
(|SnipMate-snippet-files|) and by the g:snipMate.snippet_version option
|
||||
(|SnipMate-options|).
|
||||
|
||||
A complete list of current differences is as follows:
|
||||
- Backslash escaping is guaranteed to work in version 1. In certain edge cases
|
||||
this may not work in version 0.
|
||||
- Certain syntactic errors, such as a missing closing brace for a tabstop, are
|
||||
more gracefully handled in version 1. In most cases, the parser will either
|
||||
discard the error or, as in the previous example, end an item at the end of
|
||||
line. Version 0 may not be predictable in this regard.
|
||||
- Braces are not mandatory in version 1. SnipMate will determine which
|
||||
instance of a stop ID to use based on the presence of a placeholder, or
|
||||
whichever instance occurs first. Braces can therefore be used to
|
||||
disambiguate between stop 12, $12, and stop 1 followed by a 2, ${1}2. In
|
||||
other words, version 0 makes a distinction between a mirror and a stop while
|
||||
version 1 resolves the differences for you.
|
||||
- Placeholders are not mandatory to enable mirror support in version 1.
|
||||
- Version 0 uses the confusing syntax {VISUAL} to refer to visual content.
|
||||
Version 1 treats it as just another stop ID, so both $VISUAL and ${VISUAL}
|
||||
work. Plus version 1 allows a default value in case no visual selection has
|
||||
been made.
|
||||
- Transformations similar to |:substitute| can be preformed on any mirror,
|
||||
including visual content.
|
||||
|
||||
==============================================================================
|
||||
SNIPPET SOURCES *SnipMate-snippet-sources*
|
||||
|
|
|
@ -93,8 +93,7 @@ endif
|
|||
let g:snipMate['get_snippets'] = get(g:snipMate, 'get_snippets', funcref#Function("snipMate#GetSnippets"))
|
||||
|
||||
" List of paths where snippets/ dirs are located
|
||||
let g:snipMate['snippet_dirs'] = get(g:snipMate, 'snippet_dirs', split(&rtp, ','))
|
||||
if type(g:snipMate['snippet_dirs']) != type([])
|
||||
if exists('g:snipMate.snippet_dirs') && type(g:snipMate['snippet_dirs']) != type([])
|
||||
echohl WarningMsg
|
||||
echom "g:snipMate['snippet_dirs'] must be a List"
|
||||
echohl None
|
||||
|
|
135
sources_non_forked/vim-snippets/UltiSnips/blade.snippets
Normal file
135
sources_non_forked/vim-snippets/UltiSnips/blade.snippets
Normal file
|
@ -0,0 +1,135 @@
|
|||
priority -50
|
||||
|
||||
extends html
|
||||
|
||||
# We want to overwrite everything in parent ft.
|
||||
priority -49
|
||||
|
||||
snippet break "@break"
|
||||
@break
|
||||
endsnippet
|
||||
|
||||
snippet component "@component directive"
|
||||
@component('$1')
|
||||
${2:${VISUAL}}
|
||||
@endcomponent
|
||||
endsnippet
|
||||
|
||||
snippet each "@each directive"
|
||||
@each('$1', $$2, '$3')
|
||||
endsnippet
|
||||
|
||||
snippet else "@else directive"
|
||||
@else
|
||||
endsnippet
|
||||
|
||||
snippet eif "@else if directive"
|
||||
@else if ($1)
|
||||
${2:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet for "@for directive"
|
||||
@for ($1)
|
||||
${2:${VISUAL}}
|
||||
@endfor
|
||||
endsnippet
|
||||
|
||||
snippet foreach "@foreach directive"
|
||||
@foreach ($$1 as $$2)
|
||||
${3:${VISUAL}}
|
||||
@endforeach
|
||||
endsnippet
|
||||
|
||||
snippet extends "@extends directive"
|
||||
@extends('$1')
|
||||
endsnippet
|
||||
|
||||
snippet if "@if directive"
|
||||
@if ($1)
|
||||
${2:${VISUAL}}
|
||||
@endif
|
||||
endsnippet
|
||||
|
||||
snippet ife "@if @else structure"
|
||||
@if ($1)
|
||||
${2:${VISUAL}}
|
||||
@else
|
||||
${3:${VISUAL}}
|
||||
@endif
|
||||
endsnippet
|
||||
|
||||
snippet include "@include directive"
|
||||
@include('$1')
|
||||
endsnippet
|
||||
|
||||
snippet includeIf "@includeIf directive"
|
||||
@includeIf('$1')
|
||||
endsnippet
|
||||
|
||||
snippet isset "@isset directive"
|
||||
@isset
|
||||
${1:${VISUAL}}
|
||||
@endisset
|
||||
endsnippet
|
||||
|
||||
snippet inject "@inject directive"
|
||||
@inject('$1', '$2')
|
||||
endsnippet
|
||||
|
||||
snippet php "@php directive"
|
||||
@php
|
||||
${1:${VISUAL}}
|
||||
@endphp
|
||||
endsnippet
|
||||
|
||||
snippet push "@push directive"
|
||||
@push('$1')
|
||||
${2:${VISUAL}}
|
||||
@endpush
|
||||
endsnippet
|
||||
|
||||
snippet section "@section directive"
|
||||
@section('$1')
|
||||
endsnippet
|
||||
|
||||
snippet show "@show directive"
|
||||
@show
|
||||
endsnippet
|
||||
|
||||
snippet slot "@slot directive"
|
||||
@slot('$1')
|
||||
${2:${VISUAL}}
|
||||
@endslot
|
||||
endsnippet
|
||||
|
||||
snippet unless "@unless directive"
|
||||
@unless
|
||||
${1:${VISUAL}}
|
||||
@endunless
|
||||
endsnippet
|
||||
|
||||
snippet verbatim "@verbatim directive"
|
||||
@verbatim
|
||||
${0:$VISUAL}
|
||||
@endverbatim
|
||||
endsnippet
|
||||
|
||||
snippet wh "@while directive"
|
||||
@while ($1)
|
||||
${2:${VISUAL}}
|
||||
@endwhile
|
||||
endsnippet
|
||||
|
||||
snippet yield "@yield directive"
|
||||
@yield('$1')
|
||||
endsnippet
|
||||
|
||||
snippet { "{{ }} statement."
|
||||
{{ $1 }}
|
||||
endsnippet
|
||||
|
||||
snippet {! "{!! !!} statement"
|
||||
{!! $1 !!}
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
|
@ -355,18 +355,18 @@ snippet /// "XML summary comment" b
|
|||
/// </summary>
|
||||
endsnippet
|
||||
|
||||
snippet <p "XML pramameter comment" b
|
||||
snippet <p "XML pramameter comment" w
|
||||
<param name="${1}">${2}</param>
|
||||
endsnippet
|
||||
|
||||
snippet <ex "XML exception comment" b
|
||||
snippet <ex "XML exception comment" w
|
||||
<exception cref="${1:System.Exception}">${2}</exception>
|
||||
endsnippet
|
||||
|
||||
snippet <r "XML returns comment" b
|
||||
snippet <r "XML returns comment" w
|
||||
<returns>$0</returns>
|
||||
endsnippet
|
||||
|
||||
snippet <c "XML code comment" b
|
||||
snippet <c "XML code comment" w
|
||||
<code>$0</code>
|
||||
endsnippet
|
||||
|
|
|
@ -32,6 +32,18 @@ snippet escape "Escape (escape)"
|
|||
⎋
|
||||
endsnippet
|
||||
|
||||
snippet left "Left (left)"
|
||||
←
|
||||
endsnippet
|
||||
|
||||
snippet return "Return (return)"
|
||||
↩
|
||||
endsnippet
|
||||
|
||||
snippet right "Right (right)"
|
||||
→
|
||||
endsnippet
|
||||
|
||||
snippet shift "Shift (shift)"
|
||||
⇧
|
||||
endsnippet
|
||||
|
@ -44,67 +56,103 @@ snippet up "Up (up)"
|
|||
↑
|
||||
endsnippet
|
||||
|
||||
snippet return "Return (return)"
|
||||
↩
|
||||
endsnippet
|
||||
|
||||
snippet right "Right (right)"
|
||||
→
|
||||
endsnippet
|
||||
|
||||
snippet left "Left (left)"
|
||||
←
|
||||
endsnippet
|
||||
|
||||
#############
|
||||
# HTML TAGS #
|
||||
#############
|
||||
snippet input "Input with Label" w
|
||||
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`>
|
||||
snippet a "Link" w
|
||||
<a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a>
|
||||
endsnippet
|
||||
|
||||
snippet input "HTML <input>" w
|
||||
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p x(snip)`>
|
||||
snippet abbr "<abbr>" w
|
||||
<abbr title="$2">$1</abbr>
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet option "Option" w
|
||||
<option${1: value="${2:option}"}>${3:$2}</option>
|
||||
snippet access "accesskey global attribute"
|
||||
accesskey="$1"
|
||||
endsnippet
|
||||
|
||||
snippet select "Select Box" w
|
||||
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: onchange="${6:}"}${7: size="${8:1}"}}>
|
||||
${0:${VISUAL}}
|
||||
</select>
|
||||
snippet address "<address>" w
|
||||
<address>$1</address>
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet textarea "HTML <textarea>" w
|
||||
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
|
||||
snippet article "<article>"
|
||||
<article>
|
||||
${1:article content}
|
||||
</article>
|
||||
endsnippet
|
||||
|
||||
snippet mailto "HTML <a mailto: >" w
|
||||
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
|
||||
snippet aside "<aside>"
|
||||
<aside>
|
||||
${1:aside content}
|
||||
</aside>
|
||||
endsnippet
|
||||
|
||||
snippet b "<b>" w
|
||||
<b>$1</b>
|
||||
endsnippet
|
||||
|
||||
snippet base "HTML <base>" w
|
||||
<base href="$1"${2: target="$3"}`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet blockquote "<blockquote>"
|
||||
<blockquote>$1</blockquote>
|
||||
endsnippet
|
||||
|
||||
snippet body "<body>"
|
||||
<body>
|
||||
${0:${VISUAL}}
|
||||
</body>
|
||||
endsnippet
|
||||
|
||||
snippet div "<div>" w
|
||||
<div>
|
||||
${0:${VISUAL}}
|
||||
</div>
|
||||
snippet br "<br>" w
|
||||
<br>$1</br>
|
||||
endsnippet
|
||||
|
||||
snippet div. "<div> with class" w
|
||||
<div`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>
|
||||
snippet button "<button>"
|
||||
<button>$1</button>
|
||||
endsnippet
|
||||
|
||||
snippet caption "<caption>"
|
||||
<caption>$1</caption>
|
||||
endsnippet
|
||||
|
||||
snippet cite "<cite>" w
|
||||
<cite>$1</cite>
|
||||
endsnippet
|
||||
|
||||
snippet class "class global attribute"
|
||||
class="$1"
|
||||
endsnippet
|
||||
|
||||
snippet code "<code>" w
|
||||
<code>$1</code>
|
||||
endsnippet
|
||||
|
||||
snippet data "<data>"
|
||||
<data value="$2">$1</data>
|
||||
endsnippet
|
||||
|
||||
snippet datalist "<datalist>"
|
||||
<datalist id="$1" name="$2">
|
||||
opt$3
|
||||
</datalist>
|
||||
endsnippet
|
||||
|
||||
snippet dd "<dd>"
|
||||
<dd>$1</dd>
|
||||
endsnippet
|
||||
|
||||
snippet del "<del>" w
|
||||
<del cite="$2" datetime="${3:`date '+%Y-%m-%dT%H:%M:%S%:z'`}">$1</del>
|
||||
endsnippet
|
||||
|
||||
snippet dfn "<dfn>" w
|
||||
<dfn>$1</dfn>
|
||||
endsnippet
|
||||
|
||||
snippet div "<div>" w
|
||||
<div>
|
||||
${0:${VISUAL}}
|
||||
</div>
|
||||
endsnippet
|
||||
|
@ -115,120 +163,24 @@ snippet div# "<div> with ID & class" w
|
|||
</div>
|
||||
endsnippet
|
||||
|
||||
snippet form "XHTML <form>" w
|
||||
<form action="${1:`!p
|
||||
snip.rv = (snip.basename or 'unnamed') + '_submit'
|
||||
`}" method="${2:get}" accept-charset="utf-8">
|
||||
snippet div. "<div> with class" w
|
||||
<div`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>
|
||||
${0:${VISUAL}}
|
||||
</form>
|
||||
</div>
|
||||
endsnippet
|
||||
|
||||
snippet h1 "XHTML <h1>" w
|
||||
<h1>${0:${VISUAL}}</h1>
|
||||
snippet dl "<dl>"
|
||||
<dl>
|
||||
${1:Definition list}
|
||||
</dl>
|
||||
endsnippet
|
||||
|
||||
snippet h2 "XHTML <h2>" w
|
||||
<h2>${0:${VISUAL}}</h2>
|
||||
snippet dt "<dt>"
|
||||
<dt>$1</dt>
|
||||
endsnippet
|
||||
|
||||
snippet h3 "XHTML <h3>" w
|
||||
<h3>${0:${VISUAL}}</h3>
|
||||
endsnippet
|
||||
|
||||
snippet h4 "XHTML <h4>" w
|
||||
<h4>${0:${VISUAL}}</h4>
|
||||
endsnippet
|
||||
|
||||
snippet h5 "XHTML <h5>" w
|
||||
<h5>${0:${VISUAL}}</h5>
|
||||
endsnippet
|
||||
|
||||
snippet h6 "XHTML <h6>" w
|
||||
<h6>${0:${VISUAL}}</h6>
|
||||
endsnippet
|
||||
|
||||
snippet head "XHTML <head>"
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
||||
${0:${VISUAL}}
|
||||
</head>
|
||||
endsnippet
|
||||
|
||||
snippet link "XHTML <link>" w
|
||||
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet meta "XHTML <meta>" w
|
||||
<meta name="${1:name}" content="${2:content}"`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet scriptsrc "HTML <script src...>" w
|
||||
<script src="$1" charset="${3:utf-8}"></script>
|
||||
endsnippet
|
||||
|
||||
snippet script "HTML <script>" w
|
||||
<script charset="utf-8">
|
||||
${0:${VISUAL}}
|
||||
</script>
|
||||
endsnippet
|
||||
|
||||
snippet span "<span>" w
|
||||
<span> ${0:${VISUAL}} </span>
|
||||
endsnippet
|
||||
|
||||
snippet span. "<span> with class" w
|
||||
<span`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`> ${0:${VISUAL}} </span>
|
||||
endsnippet
|
||||
|
||||
snippet span# "<span> with ID & class" w
|
||||
<span`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`> ${0:${VISUAL}} </span>
|
||||
endsnippet
|
||||
|
||||
snippet style "XHTML <style>" w
|
||||
<style type="text/css" media="screen">
|
||||
${0:${VISUAL}}
|
||||
</style>
|
||||
endsnippet
|
||||
|
||||
snippet table "XHTML <table>" w
|
||||
<table>
|
||||
${0:${VISUAL}}
|
||||
</table>
|
||||
endsnippet
|
||||
|
||||
snippet a "Link" w
|
||||
<a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a>
|
||||
endsnippet
|
||||
|
||||
snippet p "paragraph" w
|
||||
<p>${0:${VISUAL}}</p>
|
||||
endsnippet
|
||||
|
||||
snippet li "list item" w
|
||||
<li>${0:${VISUAL}}</li>
|
||||
endsnippet
|
||||
|
||||
snippet ul "unordered list" w
|
||||
<ul>
|
||||
${0:${VISUAL}}
|
||||
</ul>
|
||||
endsnippet
|
||||
|
||||
snippet td "table cell" w
|
||||
<td>${0:${VISUAL}}</td>
|
||||
endsnippet
|
||||
|
||||
snippet th "table header" w
|
||||
<th>${0:${VISUAL}}</th>
|
||||
endsnippet
|
||||
|
||||
snippet tr "table row" w
|
||||
<tr>${0:${VISUAL}}</tr>
|
||||
endsnippet
|
||||
|
||||
snippet title "XHTML <title>" w
|
||||
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
||||
snippet em "<em>" w
|
||||
<em>$1</em>
|
||||
endsnippet
|
||||
|
||||
snippet fieldset "Fieldset" w
|
||||
|
@ -238,7 +190,341 @@ snippet fieldset "Fieldset" w
|
|||
</fieldset>
|
||||
endsnippet
|
||||
|
||||
snippet fig "<figure>"
|
||||
<figure>
|
||||
$1
|
||||
<figcaption>$2</figcaption>
|
||||
</figure>
|
||||
endsnippet
|
||||
|
||||
snippet figcaption "<figcaption>"
|
||||
<figcaption>$1</figcaption>
|
||||
endsnippet
|
||||
|
||||
snippet footer "<footer>"
|
||||
<footer>
|
||||
${1:footer content}
|
||||
</footer>
|
||||
endsnippet
|
||||
|
||||
snippet form "HTML <form>" w
|
||||
<form action="${1:`!p
|
||||
snip.rv = (snip.basename or 'unnamed') + '_submit'
|
||||
`}" method="${2:get}" accept-charset="utf-8">
|
||||
${0:${VISUAL}}
|
||||
</form>
|
||||
endsnippet
|
||||
|
||||
snippet h1 "HTML <h1>" w
|
||||
<h1>${0:${VISUAL}}</h1>
|
||||
endsnippet
|
||||
|
||||
snippet h2 "HTML <h2>" w
|
||||
<h2>${0:${VISUAL}}</h2>
|
||||
endsnippet
|
||||
|
||||
snippet h3 "HTML <h3>" w
|
||||
<h3>${0:${VISUAL}}</h3>
|
||||
endsnippet
|
||||
|
||||
snippet h4 "HTML <h4>" w
|
||||
<h4>${0:${VISUAL}}</h4>
|
||||
endsnippet
|
||||
|
||||
snippet h5 "HTML <h5>" w
|
||||
<h5>${0:${VISUAL}}</h5>
|
||||
endsnippet
|
||||
|
||||
snippet h6 "HTML <h6>" w
|
||||
<h6>${0:${VISUAL}}</h6>
|
||||
endsnippet
|
||||
|
||||
snippet head "HTML <head>"
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
||||
${0:${VISUAL}}
|
||||
</head>
|
||||
endsnippet
|
||||
|
||||
snippet header "<header>"
|
||||
<header>
|
||||
${1:header content}
|
||||
</header>
|
||||
endsnippet
|
||||
|
||||
snippet hr "<hr>"
|
||||
<hr>
|
||||
endsnippet
|
||||
|
||||
snippet html "HTML basic structure" b
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>${1:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
|
||||
</head>
|
||||
<body>
|
||||
${0:body}
|
||||
</body>
|
||||
</html>
|
||||
endsnippet
|
||||
|
||||
snippet htmll "HTML basic structure with the lang attribute" b
|
||||
<!DOCTYPE html>
|
||||
<html lang="${1:es}">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>${2:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
|
||||
</head>
|
||||
<body>
|
||||
${0:body}
|
||||
</body>
|
||||
</html>
|
||||
endsnippet
|
||||
|
||||
snippet i "<i>" w
|
||||
<i>$1</i>
|
||||
endsnippet
|
||||
|
||||
snippet id "id global attribute"
|
||||
id="$1"
|
||||
endsnippet
|
||||
|
||||
snippet img "<img>"
|
||||
<img src="$1" alt="$2">
|
||||
endsnippet
|
||||
|
||||
snippet input "Input with Label" w
|
||||
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet input "HTML <input>" w
|
||||
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet ins "<ins>" w
|
||||
<ins cite="$2" datetime="${3:`date '+%Y-%m-%dT%H:%M:%S%:z'`}">$1</ins>
|
||||
endsnippet
|
||||
|
||||
snippet kbd "<kbd>" w
|
||||
<kbd>$1</kbd>
|
||||
endsnippet
|
||||
|
||||
snippet label "<label>"
|
||||
<label>$1</label>
|
||||
endsnippet
|
||||
|
||||
snippet legend "<legend>"
|
||||
<legend>$1</leyend>
|
||||
endsnippet
|
||||
|
||||
snippet li "list item" w
|
||||
<li>${0:${VISUAL}}</li>
|
||||
endsnippet
|
||||
|
||||
snippet link "HTML <link>" w
|
||||
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet mailto "HTML <a mailto: >" w
|
||||
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
|
||||
endsnippet
|
||||
|
||||
snippet main "<main>"
|
||||
<main>
|
||||
${1:main content}
|
||||
</main>
|
||||
endsnippet
|
||||
|
||||
snippet mark "<mark>"
|
||||
<mark>$1</mark>
|
||||
endsnippet
|
||||
|
||||
snippet meta "HTML <meta>" w
|
||||
<meta name="${1:name}" content="${2:content}"`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet meter "<meter>"
|
||||
<meter>$1</meter>
|
||||
endsnippet
|
||||
|
||||
snippet nav "<nav>"
|
||||
<nav>
|
||||
${1:navigation links}
|
||||
</nav>
|
||||
endsnippet
|
||||
|
||||
snippet noscript "<noscript>"
|
||||
<noscript>$1</noscript>
|
||||
endsnippet
|
||||
|
||||
snippet ol "<ol>"
|
||||
<ol>
|
||||
<li>$1</li>
|
||||
</ol>
|
||||
endsnippet
|
||||
|
||||
snippet optgroup "<optgroup>"
|
||||
<optgroup label="$1">
|
||||
opt$2
|
||||
</optgroup>
|
||||
endsnippet
|
||||
|
||||
snippet output "<output>"
|
||||
<output for="$1" name="$2">$3</output>
|
||||
endsnippet
|
||||
|
||||
snippet option "Option" w
|
||||
<option${1: value="${2:option}"}>${3:$2}</option>
|
||||
endsnippet
|
||||
|
||||
snippet p "paragraph" w
|
||||
<p>${0:${VISUAL}}</p>
|
||||
endsnippet
|
||||
|
||||
snippet picture "<picture>"
|
||||
<picture>
|
||||
${1:image sources}
|
||||
</picture>
|
||||
endsnippet
|
||||
|
||||
snippet pre "<pre>"
|
||||
<pre>$1</pre>
|
||||
endsnippet
|
||||
|
||||
snippet progress "<progress>"
|
||||
<progress>$1</progress>
|
||||
endsnippet
|
||||
|
||||
snippet q "<q>" w
|
||||
<q>$1</q>
|
||||
endsnippet
|
||||
|
||||
snippet s "<s>" w
|
||||
<s>$1</s>
|
||||
endsnippet
|
||||
|
||||
snippet samp "<samp>" w
|
||||
<samp>$1</samp>
|
||||
endsnippet
|
||||
|
||||
snippet script "HTML <script>" w
|
||||
<script charset="utf-8">
|
||||
${0:${VISUAL}}
|
||||
</script>
|
||||
endsnippet
|
||||
|
||||
snippet scriptsrc "HTML <script src...>" w
|
||||
<script src="$1" charset="${3:utf-8}"></script>
|
||||
endsnippet
|
||||
|
||||
snippet select "Select Box" w
|
||||
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: size="${6:1}"}}>
|
||||
${0:${VISUAL}}
|
||||
</select>
|
||||
endsnippet
|
||||
|
||||
snippet small "<small>" w
|
||||
<small>$1</small>
|
||||
endsnippet
|
||||
|
||||
snippet span "<span>" w
|
||||
<span> ${0:${VISUAL}} </span>
|
||||
endsnippet
|
||||
|
||||
snippet span# "<span> with ID & class" w
|
||||
<span`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`> ${0:${VISUAL}} </span>
|
||||
endsnippet
|
||||
|
||||
snippet span. "<span> with class" w
|
||||
<span`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`> ${0:${VISUAL}} </span>
|
||||
endsnippet
|
||||
|
||||
snippet strong "<strong>" w
|
||||
<strong>$1</strong>
|
||||
endsnippet
|
||||
|
||||
snippet style "HTML <style>" w
|
||||
<style type="text/css" media="screen">
|
||||
${0:${VISUAL}}
|
||||
</style>
|
||||
endsnippet
|
||||
|
||||
snippet sub "<sub>" w
|
||||
<sub>$1</sub>
|
||||
endsnippet
|
||||
|
||||
snippet sup "<sup>" w
|
||||
<sup>$1</sup>
|
||||
endsnippet
|
||||
|
||||
snippet table "HTML <table>" w
|
||||
<table>
|
||||
${0:${VISUAL}}
|
||||
</table>
|
||||
endsnippet
|
||||
|
||||
snippet tbody "<tbody>"
|
||||
<tbody>$1</tbody>
|
||||
endsnippet
|
||||
|
||||
snippet td "table cell" w
|
||||
<td>${0:${VISUAL}}</td>
|
||||
endsnippet
|
||||
|
||||
snippet template "<template>"
|
||||
<template id="$1">
|
||||
$2
|
||||
</template>
|
||||
endsnippet
|
||||
|
||||
snippet textarea "HTML <textarea>" w
|
||||
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
|
||||
endsnippet
|
||||
|
||||
snippet tfoot "<tfoot>"
|
||||
<tfoot>$1</tfoot>
|
||||
endsnippet
|
||||
|
||||
snippet th "table header" w
|
||||
<th>${0:${VISUAL}}</th>
|
||||
endsnippet
|
||||
|
||||
snippet thead "<thead>"
|
||||
<thead>$1</thead>
|
||||
endsnippet
|
||||
|
||||
snippet time "<time>" w
|
||||
<time datetime="$2">$1</time>
|
||||
endsnippet
|
||||
|
||||
snippet title "HTML <title>" w
|
||||
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
||||
endsnippet
|
||||
|
||||
snippet tr "table row" w
|
||||
<tr>${0:${VISUAL}}</tr>
|
||||
endsnippet
|
||||
|
||||
snippet ul "unordered list" w
|
||||
<ul>
|
||||
${0:${VISUAL}}
|
||||
</ul>
|
||||
endsnippet
|
||||
|
||||
snippet var "<var>" w
|
||||
<var>$1</var>
|
||||
endsnippet
|
||||
|
||||
snippet viewport "Responsive viewport meta" w
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
endsnippet
|
||||
|
||||
snippet wbr "<wbr>" w
|
||||
<wbr>$1</wbr>
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue