Updated plugins
This commit is contained in:
parent
57ba28a9a2
commit
9c54d954f6
21 changed files with 201 additions and 65 deletions
|
@ -84,11 +84,14 @@ function! s:CheckForBadConfig(buffer, lines) abort
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parseJSON(buffer, lines) abort
|
function! s:parseJSON(buffer, lines) abort
|
||||||
|
let l:parsed = []
|
||||||
|
|
||||||
|
for l:line in a:lines
|
||||||
try
|
try
|
||||||
let l:parsed = json_decode(a:lines[-1])
|
let l:parsed = extend(l:parsed, json_decode(l:line))
|
||||||
catch
|
catch
|
||||||
return []
|
|
||||||
endtry
|
endtry
|
||||||
|
endfor
|
||||||
|
|
||||||
if type(l:parsed) != v:t_list || empty(l:parsed)
|
if type(l:parsed) != v:t_list || empty(l:parsed)
|
||||||
return []
|
return []
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
in an unordered list. The format is:
|
in an unordered list. The format is:
|
||||||
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
||||||
-->
|
-->
|
||||||
|
#### 6.3
|
||||||
|
- **.0**: Add new command that behaves like NERDTreeToggle but defaults to the root of a VCS repository. (willfindlay) [#1060](https://github.com/scrooloose/nerdtree/pull/1060)
|
||||||
#### 6.2
|
#### 6.2
|
||||||
- **.1**: Menu option, 'copy path to clipboard' is aware of VIM clipboard option (jhzn) [#1056](https://github.com/scrooloose/nerdtree/pull/1056)
|
- **.1**: Menu option, 'copy path to clipboard' is aware of VIM clipboard option (jhzn) [#1056](https://github.com/scrooloose/nerdtree/pull/1056)
|
||||||
- **.0**: Support tab-specific CWDs (PhilRunninger) [#1032](https://github.com/scrooloose/nerdtree/pull/1032)
|
- **.0**: Support tab-specific CWDs (PhilRunninger) [#1032](https://github.com/scrooloose/nerdtree/pull/1032)
|
||||||
|
|
|
@ -125,6 +125,14 @@ The following features and functionality are provided by the NERDTree:
|
||||||
again. If no NERDTree exists for this tab then this command acts the
|
again. If no NERDTree exists for this tab then this command acts the
|
||||||
same as the |:NERDTree| command.
|
same as the |:NERDTree| command.
|
||||||
|
|
||||||
|
:NERDTreeToggleVCS [<start-directory> | <bookmark>] *:NERDTreeToggleVCS*
|
||||||
|
Like |:NERDTreeToggle|, but searches up the directory tree to find the top of
|
||||||
|
the version control system repository, and roots the NERDTree there. It
|
||||||
|
works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A
|
||||||
|
couple of examples: >
|
||||||
|
:NERDTreeToggleVCS /home/marty/nerdtree/doc (opens /home/marty/nerdtree)
|
||||||
|
:NERDTreeToggleVCS (opens root of repository containing CWD)
|
||||||
|
|
||||||
:NERDTreeFocus *:NERDTreeFocus*
|
:NERDTreeFocus *:NERDTreeFocus*
|
||||||
Opens (or reopens) the NERDTree if it is not currently visible;
|
Opens (or reopens) the NERDTree if it is not currently visible;
|
||||||
otherwise, the cursor is moved to the already-open NERDTree.
|
otherwise, the cursor is moved to the already-open NERDTree.
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
"
|
"
|
||||||
" ============================================================================
|
" ============================================================================
|
||||||
command! -n=? -complete=dir -bar NERDTreeVCS :call <SID>CreateTabTreeVCS('<args>')
|
command! -n=? -complete=dir -bar NERDTreeVCS :call <SID>CreateTabTreeVCS('<args>')
|
||||||
|
command! -n=? -complete=dir -bar NERDTreeToggleVCS :call <SID>ToggleTabTreeVCS('<args>')
|
||||||
|
|
||||||
" FUNCTION: s:CreateTabTreeVCS(a:name) {{{1
|
" FUNCTION: s:CreateTabTreeVCS(a:name) {{{1
|
||||||
function! s:CreateTabTreeVCS(name)
|
function! s:CreateTabTreeVCS(name)
|
||||||
|
@ -19,6 +20,14 @@ function! s:CreateTabTreeVCS(name)
|
||||||
call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str())
|
call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str())
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:ToggleTabTreeVCS(a:name) {{{1
|
||||||
|
" Behaves the same as ToggleTabTree except roots directory at VCS root
|
||||||
|
function! s:ToggleTabTreeVCS(name)
|
||||||
|
let l:path = g:NERDTreeCreator._pathForString(a:name)
|
||||||
|
let l:path = s:FindParentVCSRoot(l:path)
|
||||||
|
call g:NERDTreeCreator.toggleTabTree(empty(l:path) ? "" : l:path._str())
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:FindParentVCSRoot(a:path) {{{1
|
" FUNCTION: s:FindParentVCSRoot(a:path) {{{1
|
||||||
" Finds the root version control system folder of the given path. If a:path is
|
" Finds the root version control system folder of the given path. If a:path is
|
||||||
" not part of a repository, return the original path.
|
" not part of a repository, return the original path.
|
||||||
|
|
|
@ -3,7 +3,17 @@ function! cargo#Load()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! cargo#cmd(args)
|
function! cargo#cmd(args)
|
||||||
execute "! cargo" a:args
|
" Trim trailing spaces. This is necessary since :terminal command parses
|
||||||
|
" trailing spaces as an empty argument.
|
||||||
|
let args = substitute(a:args, '\s\+$', '', '')
|
||||||
|
if has('terminal')
|
||||||
|
let cmd = 'terminal'
|
||||||
|
elseif has('nvim')
|
||||||
|
let cmd = 'noautocmd new | terminal'
|
||||||
|
else
|
||||||
|
let cmd = '!'
|
||||||
|
endif
|
||||||
|
execute cmd 'cargo' args
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:nearest_cargo(...) abort
|
function! s:nearest_cargo(...) abort
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
" Author: Kevin Ballard
|
|
||||||
" Description: Helper functions for Rust commands/mappings
|
" Description: Helper functions for Rust commands/mappings
|
||||||
" Last Modified: May 27, 2014
|
" Last Modified: May 27, 2014
|
||||||
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
|
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
|
||||||
|
@ -508,16 +507,23 @@ function! s:SearchTestFunctionNameUnderCursor() abort
|
||||||
return matchstr(getline(test_func_line), '\m\C^\s*fn\s\+\zs\h\w*')
|
return matchstr(getline(test_func_line), '\m\C^\s*fn\s\+\zs\h\w*')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! rust#Test(all, options) abort
|
function! rust#Test(mods, winsize, all, options) abort
|
||||||
let manifest = findfile('Cargo.toml', expand('%:p:h') . ';')
|
let manifest = findfile('Cargo.toml', expand('%:p:h') . ';')
|
||||||
if manifest ==# ''
|
if manifest ==# ''
|
||||||
return rust#Run(1, '--test ' . a:options)
|
return rust#Run(1, '--test ' . a:options)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" <count> defaults to 0, but we prefer an empty string
|
||||||
|
let winsize = a:winsize ? a:winsize : ''
|
||||||
|
|
||||||
if has('terminal')
|
if has('terminal')
|
||||||
let cmd = 'terminal '
|
if has('patch-8.0.910')
|
||||||
|
let cmd = printf('%s noautocmd %snew | terminal ++curwin ', a:mods, winsize)
|
||||||
|
else
|
||||||
|
let cmd = printf('%s terminal ', a:mods)
|
||||||
|
endif
|
||||||
elseif has('nvim')
|
elseif has('nvim')
|
||||||
let cmd = 'noautocmd new | terminal '
|
let cmd = printf('%s noautocmd %snew | terminal ', a:mods, winsize)
|
||||||
else
|
else
|
||||||
let cmd = '!'
|
let cmd = '!'
|
||||||
let manifest = shellescape(manifest)
|
let manifest = shellescape(manifest)
|
||||||
|
|
|
@ -426,12 +426,15 @@ functionality from other plugins.
|
||||||
Running test(s)
|
Running test(s)
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
:RustTest[!] [options] *:RustTest*
|
:[N]RustTest[!] [options] *:RustTest*
|
||||||
Runs a test under the cursor when the current buffer is in a
|
Runs a test under the cursor when the current buffer is in a
|
||||||
cargo project with "cargo test" command. If the command did
|
cargo project with "cargo test" command. If the command did
|
||||||
not find any test function under the cursor, it stops with an
|
not find any test function under the cursor, it stops with an
|
||||||
error message.
|
error message.
|
||||||
|
|
||||||
|
When N is given, adjust the size of the new window to N lines
|
||||||
|
or columns.
|
||||||
|
|
||||||
When ! is given, runs all tests regardless of current cursor
|
When ! is given, runs all tests regardless of current cursor
|
||||||
position.
|
position.
|
||||||
|
|
||||||
|
@ -444,7 +447,11 @@ Running test(s)
|
||||||
is no way to run specific test function with rustc. [options]
|
is no way to run specific test function with rustc. [options]
|
||||||
is passed to "rustc" command arguments in the case.
|
is passed to "rustc" command arguments in the case.
|
||||||
|
|
||||||
|
Takes optional modifiers (see |<mods>|): >
|
||||||
|
:tab RustTest
|
||||||
|
:belowright 16RustTest
|
||||||
|
:leftabove vert 80RustTest
|
||||||
|
<
|
||||||
rust.vim Debugging
|
rust.vim Debugging
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
" Language: Rust
|
" Language: Rust
|
||||||
" Description: Vim ftplugin for Rust
|
" Description: Vim ftplugin for Rust
|
||||||
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
||||||
" Maintainer: Kevin Ballard <kevin@sb.org>
|
|
||||||
" Last Change: June 08, 2016
|
" Last Change: June 08, 2016
|
||||||
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
|
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
|
||||||
|
|
||||||
|
@ -137,7 +136,7 @@ command! -bar RustInfoToClipboard call rust#debugging#InfoToClipboard()
|
||||||
command! -bar -nargs=1 RustInfoToFile call rust#debugging#InfoToFile(<f-args>)
|
command! -bar -nargs=1 RustInfoToFile call rust#debugging#InfoToFile(<f-args>)
|
||||||
|
|
||||||
" See |:RustTest| for docs
|
" See |:RustTest| for docs
|
||||||
command! -buffer -nargs=* -bang RustTest call rust#Test(<bang>0, <q-args>)
|
command! -buffer -nargs=* -count -bang RustTest call rust#Test(<q-mods>, <count>, <bang>0, <q-args>)
|
||||||
|
|
||||||
if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args")
|
if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args")
|
||||||
let b:rust_last_rustc_args = []
|
let b:rust_last_rustc_args = []
|
||||||
|
|
|
@ -191,7 +191,12 @@ function GetRustIndent(lnum)
|
||||||
" A line that ends with '.<expr>;' is probably an end of a long list
|
" A line that ends with '.<expr>;' is probably an end of a long list
|
||||||
" of method operations.
|
" of method operations.
|
||||||
if prevline =~# '\V\^\s\*.' && l:last_prevline_character ==# ';'
|
if prevline =~# '\V\^\s\*.' && l:last_prevline_character ==# ';'
|
||||||
return indent(prevlinenum) - s:shiftwidth()
|
call cursor(a:lnum - 1, 1)
|
||||||
|
let l:scope_start = searchpair('{\|(', '', '}\|)', 'nbW',
|
||||||
|
\ 's:is_string_comment(line("."), col("."))')
|
||||||
|
if l:scope_start != 0 && l:scope_start < a:lnum
|
||||||
|
return indent(l:scope_start) + 4
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if l:last_prevline_character ==# ","
|
if l:last_prevline_character ==# ","
|
||||||
|
|
|
@ -53,6 +53,7 @@ syn keyword rustKeyword mod trait nextgroup=rustIdentifier skipwhite skipe
|
||||||
syn keyword rustStorage move mut ref static const
|
syn keyword rustStorage move mut ref static const
|
||||||
syn match rustDefault /\<default\ze\_s\+\(impl\|fn\|type\|const\)\>/
|
syn match rustDefault /\<default\ze\_s\+\(impl\|fn\|type\|const\)\>/
|
||||||
syn keyword rustAwait await
|
syn keyword rustAwait await
|
||||||
|
syn match rustKeyword /\<try\>!\@!/ display
|
||||||
|
|
||||||
syn keyword rustPubScopeCrate crate contained
|
syn keyword rustPubScopeCrate crate contained
|
||||||
syn match rustPubScopeDelim /[()]/ contained
|
syn match rustPubScopeDelim /[()]/ contained
|
||||||
|
|
|
@ -225,6 +225,51 @@ Expect rust (issue #5):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# Issue #366
|
||||||
|
|
||||||
|
Given rust:
|
||||||
|
fn f() {
|
||||||
|
g(|_| {
|
||||||
|
h();
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
h();
|
||||||
|
}
|
||||||
|
|
||||||
|
Do:
|
||||||
|
vip=
|
||||||
|
|
||||||
|
Expect rust (issue #366):
|
||||||
|
fn f() {
|
||||||
|
g(|_| {
|
||||||
|
h();
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
h();
|
||||||
|
}
|
||||||
|
|
||||||
|
Given rust:
|
||||||
|
fn f() {
|
||||||
|
let a = g(|_| {
|
||||||
|
h();
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
h();
|
||||||
|
}
|
||||||
|
|
||||||
|
Do:
|
||||||
|
vip=
|
||||||
|
|
||||||
|
Expect rust (issue #366, variation #2):
|
||||||
|
fn f() {
|
||||||
|
let a = g(|_| {
|
||||||
|
h();
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
h();
|
||||||
|
}
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
|
|
||||||
Given rust:
|
Given rust:
|
||||||
|
|
|
@ -54,7 +54,7 @@ function! s:go(...) abort
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
if strlen(r) > 2 && l.r !~# '\\'
|
if strlen(r) > 2 && l.r !~# '\\'
|
||||||
let line = substitute(line,
|
let line = substitute(line,
|
||||||
\'\M'.r[0:-2].'\zs\d\*\ze'.r[-1:-1].'\|'.l[0].'\zs\d\*\ze'.l[1:-1],
|
\'\M' . substitute(l, '\ze\S\s*$', '\\zs\\d\\*\\ze', '') . '\|' . substitute(r, '\S\zs', '\\zs\\d\\*\\ze', ''),
|
||||||
\'\=substitute(submatch(0)+1-uncomment,"^0$\\|^-\\d*$","","")','g')
|
\'\=substitute(submatch(0)+1-uncomment,"^0$\\|^-\\d*$","","")','g')
|
||||||
endif
|
endif
|
||||||
if uncomment
|
if uncomment
|
||||||
|
|
|
@ -1400,10 +1400,11 @@ call s:add_methods('buffer', ['repo', 'type'])
|
||||||
|
|
||||||
function! s:FilterEscape(items, ...) abort
|
function! s:FilterEscape(items, ...) abort
|
||||||
let items = copy(a:items)
|
let items = copy(a:items)
|
||||||
|
call map(items, 's:fnameescape(v:val)')
|
||||||
if a:0 && type(a:1) == type('')
|
if a:0 && type(a:1) == type('')
|
||||||
call filter(items, 'strpart(v:val, 0, strlen(a:1)) ==# a:1')
|
call filter(items, 'strpart(v:val, 0, strlen(a:1)) ==# a:1')
|
||||||
endif
|
endif
|
||||||
return map(items, 's:fnameescape(v:val)')
|
return items
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:GlobComplete(lead, pattern) abort
|
function! s:GlobComplete(lead, pattern) abort
|
||||||
|
@ -1469,16 +1470,15 @@ function! fugitive#CompleteObject(base, ...) abort
|
||||||
let results = []
|
let results = []
|
||||||
if a:base =~# '^refs/'
|
if a:base =~# '^refs/'
|
||||||
let results += map(s:GlobComplete(fugitive#CommonDir(dir) . '/', a:base . '*'), 's:Slash(v:val)')
|
let results += map(s:GlobComplete(fugitive#CommonDir(dir) . '/', a:base . '*'), 's:Slash(v:val)')
|
||||||
|
call map(results, 's:fnameescape(v:val)')
|
||||||
elseif a:base !~# '^\.\=/\|^:('
|
elseif a:base !~# '^\.\=/\|^:('
|
||||||
let heads = s:CompleteHeads(dir)
|
let heads = s:CompleteHeads(dir)
|
||||||
if filereadable(fugitive#Find('.git/refs/stash', dir))
|
if filereadable(fugitive#Find('.git/refs/stash', dir))
|
||||||
let heads += ["stash"]
|
let heads += ["stash"]
|
||||||
let heads += sort(s:LinesError(["stash","list","--pretty=format:%gd"], dir)[0])
|
let heads += sort(s:LinesError(["stash","list","--pretty=format:%gd"], dir)[0])
|
||||||
endif
|
endif
|
||||||
call filter(heads,'v:val[ 0 : strlen(a:base)-1 ] ==# a:base')
|
let results += s:FilterEscape(heads, a:base)
|
||||||
let results += heads
|
|
||||||
endif
|
endif
|
||||||
call map(results, 's:fnameescape(v:val)')
|
|
||||||
if !empty(tree)
|
if !empty(tree)
|
||||||
let results += a:0 == 1 ? fugitive#CompletePath(a:base, dir) : fugitive#CompletePath(a:base)
|
let results += a:0 == 1 ? fugitive#CompletePath(a:base, dir) : fugitive#CompletePath(a:base)
|
||||||
endif
|
endif
|
||||||
|
@ -1724,6 +1724,10 @@ function! fugitive#BufReadStatus() abort
|
||||||
endwhile
|
endwhile
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if empty(s:Tree())
|
||||||
|
let [unstaged, untracked] = [[], []]
|
||||||
|
endif
|
||||||
|
|
||||||
for dict in staged
|
for dict in staged
|
||||||
let b:fugitive_files['Staged'][dict.filename] = dict
|
let b:fugitive_files['Staged'][dict.filename] = dict
|
||||||
endfor
|
endfor
|
||||||
|
@ -1820,6 +1824,9 @@ function! fugitive#BufReadStatus() abort
|
||||||
if push !=# pull
|
if push !=# pull
|
||||||
call s:AddHeader('Push', push)
|
call s:AddHeader('Push', push)
|
||||||
endif
|
endif
|
||||||
|
if empty(s:Tree())
|
||||||
|
call s:AddHeader('Bare', 'yes')
|
||||||
|
endif
|
||||||
call s:AddSection('Rebasing ' . rebasing_head, rebasing)
|
call s:AddSection('Rebasing ' . rebasing_head, rebasing)
|
||||||
call s:AddSection('Untracked', untracked)
|
call s:AddSection('Untracked', untracked)
|
||||||
call s:AddSection('Unstaged', unstaged)
|
call s:AddSection('Unstaged', unstaged)
|
||||||
|
@ -4518,15 +4525,12 @@ endfunction
|
||||||
function! s:diffoff_all(dir) abort
|
function! s:diffoff_all(dir) abort
|
||||||
let curwin = winnr()
|
let curwin = winnr()
|
||||||
for nr in range(1,winnr('$'))
|
for nr in range(1,winnr('$'))
|
||||||
if getwinvar(nr,'&diff')
|
if getwinvar(nr, '&diff') && !empty(getwinvar(nr, 'fugitive_diff_restore'))
|
||||||
if nr != winnr()
|
if nr != winnr()
|
||||||
execute nr.'wincmd w'
|
execute nr.'wincmd w'
|
||||||
let restorewinnr = 1
|
|
||||||
endif
|
endif
|
||||||
if s:Dir() ==# a:dir
|
|
||||||
call s:diffoff()
|
call s:diffoff()
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
endfor
|
endfor
|
||||||
execute curwin.'wincmd w'
|
execute curwin.'wincmd w'
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -4626,6 +4630,8 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort
|
||||||
elseif arg =~# '^:\d$'
|
elseif arg =~# '^:\d$'
|
||||||
exe s:DirCheck()
|
exe s:DirCheck()
|
||||||
let file = s:Relative(arg . ':')
|
let file = s:Relative(arg . ':')
|
||||||
|
elseif arg =~# '^[~^]\d*$'
|
||||||
|
return 'echoerr ' . string('fugitive: change ' . arg . ' to !' . arg . ' to diff against ancestor')
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
let file = arg =~# '^:/.' ? fugitive#RevParse(arg) . s:Relative(':') : s:Expand(arg)
|
let file = arg =~# '^:/.' ? fugitive#RevParse(arg) . s:Relative(':') : s:Expand(arg)
|
||||||
|
@ -5130,12 +5136,10 @@ function! s:BlameJump(suffix, ...) abort
|
||||||
let winnr = bufwinnr(blame_bufnr)
|
let winnr = bufwinnr(blame_bufnr)
|
||||||
if winnr > 0
|
if winnr > 0
|
||||||
exe winnr.'wincmd w'
|
exe winnr.'wincmd w'
|
||||||
|
exe bufnr.'bdelete'
|
||||||
endif
|
endif
|
||||||
execute 'Gedit' s:fnameescape(commit . suffix . ':' . path)
|
execute 'Gedit' s:fnameescape(commit . suffix . ':' . path)
|
||||||
execute lnum
|
execute lnum
|
||||||
if winnr > 0
|
|
||||||
exe bufnr.'bdelete'
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
if exists(':Gblame')
|
if exists(':Gblame')
|
||||||
let my_bufnr = bufnr('')
|
let my_bufnr = bufnr('')
|
||||||
|
|
|
@ -181,6 +181,8 @@ function! FugitiveExtractGitDir(path) abort
|
||||||
let path = s:Slash(a:path)
|
let path = s:Slash(a:path)
|
||||||
if path =~# '^fugitive:'
|
if path =~# '^fugitive:'
|
||||||
return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)')
|
return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)')
|
||||||
|
elseif empty(path)
|
||||||
|
return ''
|
||||||
elseif isdirectory(path)
|
elseif isdirectory(path)
|
||||||
let path = fnamemodify(path, ':p:s?/$??')
|
let path = fnamemodify(path, ':p:s?/$??')
|
||||||
else
|
else
|
||||||
|
|
|
@ -18,7 +18,7 @@ Features:
|
||||||
* Diffs against index (default) or any commit.
|
* Diffs against index (default) or any commit.
|
||||||
* Allows folding all unchanged text.
|
* Allows folding all unchanged text.
|
||||||
* Provides fold text showing whether folded lines have been changed.
|
* Provides fold text showing whether folded lines have been changed.
|
||||||
* Can load all hunk locations into quickfix list.
|
* Can load all hunk locations into quickfix list or the current window's location list.
|
||||||
* Handles line endings correctly, even with repos that do CRLF conversion.
|
* Handles line endings correctly, even with repos that do CRLF conversion.
|
||||||
* Optional line highlighting.
|
* Optional line highlighting.
|
||||||
* Optional line number highlighting. (Only available in Neovim 0.3.2 or higher)
|
* Optional line number highlighting. (Only available in Neovim 0.3.2 or higher)
|
||||||
|
@ -147,7 +147,7 @@ nmap ]h <Plug>(GitGutterNextHunk)
|
||||||
nmap [h <Plug>(GitGutterPrevHunk)
|
nmap [h <Plug>(GitGutterPrevHunk)
|
||||||
```
|
```
|
||||||
|
|
||||||
You can load all your hunks into the quickfix list with `:GitGutterQuickFix`. Note this ignores any unsaved changes in your buffers.
|
You can load all your hunks into the quickfix list with `:GitGutterQuickFix`. Note this ignores any unsaved changes in your buffers. If the option `g:gitgutter_use_location_list` is set, this command will load hunks into the current window's location list instead.
|
||||||
|
|
||||||
You can stage or undo an individual hunk when your cursor is in it:
|
You can stage or undo an individual hunk when your cursor is in it:
|
||||||
|
|
||||||
|
@ -254,6 +254,7 @@ You can customise:
|
||||||
* Whether to clobber or preserve non-gitgutter signs
|
* Whether to clobber or preserve non-gitgutter signs
|
||||||
* The priority of gitgutter's signs.
|
* The priority of gitgutter's signs.
|
||||||
* Whether to use a floating/popup window for hunk previews
|
* Whether to use a floating/popup window for hunk previews
|
||||||
|
* Whether to populate the quickfix list or a location list with all hunks
|
||||||
|
|
||||||
Please note that vim-gitgutter won't override any colours or highlights you've set in your colorscheme.
|
Please note that vim-gitgutter won't override any colours or highlights you've set in your colorscheme.
|
||||||
|
|
||||||
|
@ -452,7 +453,12 @@ let g:gitgutter_async = 0
|
||||||
|
|
||||||
#### To use floating/popup windows for hunk previews
|
#### To use floating/popup windows for hunk previews
|
||||||
|
|
||||||
Add `let g:gitgutter_preview_win_floating = 1` to your vimrc. Note that on Vim this prevents you staging (partial) hunks via the preview window.
|
Add `let g:gitgutter_preview_win_floating = 1` to your `~/.vimrc`. Note that on Vim this prevents you staging (partial) hunks via the preview window.
|
||||||
|
|
||||||
|
|
||||||
|
#### To load all hunks into the current window's location list instead of the quickfix list
|
||||||
|
|
||||||
|
Add `let g:gitgutter_use_location_list = 1` to your `~/.vimrc`.
|
||||||
|
|
||||||
|
|
||||||
### Extensions
|
### Extensions
|
||||||
|
@ -513,9 +519,25 @@ Let's say, for example, you want to remove trailing whitespace from all changed
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Cycle through hunks in current buffer
|
||||||
|
|
||||||
|
This is like `:GitGutterNextHunk` but when it gets to the last hunk in the buffer it cycles around to the first.
|
||||||
|
|
||||||
|
```viml
|
||||||
|
function! GitGutterNextHunkCycle()
|
||||||
|
let line = line('.')
|
||||||
|
silent! GitGutterNextHunk
|
||||||
|
if line('.') == line
|
||||||
|
1
|
||||||
|
GitGutterNextHunk
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Cycle through hunks in all buffers
|
#### Cycle through hunks in all buffers
|
||||||
|
|
||||||
You can use `:GitGutterQuickFix` to load all hunks into the quickfix list.
|
You can use `:GitGutterQuickFix` to load all hunks into the quickfix list or the current window's location list.
|
||||||
|
|
||||||
Alternatively, given that`]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.
|
Alternatively, given that`]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.
|
||||||
|
|
||||||
|
@ -534,7 +556,7 @@ function! NextHunkAllBuffers()
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
if !empty(GitGutterGetHunks())
|
if !empty(GitGutterGetHunks())
|
||||||
normal! 1G
|
1
|
||||||
GitGutterNextHunk
|
GitGutterNextHunk
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -207,5 +207,9 @@ function! gitgutter#quickfix()
|
||||||
let lnum = 0
|
let lnum = 0
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
if !g:gitgutter_use_location_list
|
||||||
call setqflist(locations)
|
call setqflist(locations)
|
||||||
|
else
|
||||||
|
call setloclist(0, locations)
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
|
@ -140,7 +140,9 @@ Commands for jumping between hunks:~
|
||||||
|
|
||||||
*gitgutter-:GitGutterQuickFix*
|
*gitgutter-:GitGutterQuickFix*
|
||||||
:GitGutterQuickFix Load all hunks into the |quickfix| list. Note this
|
:GitGutterQuickFix Load all hunks into the |quickfix| list. Note this
|
||||||
ignores any unsaved changes in your buffers.
|
ignores any unsaved changes in your buffers. The
|
||||||
|
|g:gitgutter_use_location_list| option can be set to
|
||||||
|
populate the location list of the current window instead
|
||||||
|
|
||||||
|
|
||||||
Commands for operating on a hunk:~
|
Commands for operating on a hunk:~
|
||||||
|
@ -294,6 +296,7 @@ General:~
|
||||||
|g:gitgutter_map_keys|
|
|g:gitgutter_map_keys|
|
||||||
|g:gitgutter_async|
|
|g:gitgutter_async|
|
||||||
|g:gitgutter_log|
|
|g:gitgutter_log|
|
||||||
|
|g:gitgutter_use_location_list|
|
||||||
|
|
||||||
|
|
||||||
*g:gitgutter_preview_win_location*
|
*g:gitgutter_preview_win_location*
|
||||||
|
@ -473,7 +476,7 @@ Controls whether or not the plugin is on at startup.
|
||||||
*g:gitgutter_map_keys*
|
*g:gitgutter_map_keys*
|
||||||
Default: 1
|
Default: 1
|
||||||
|
|
||||||
Controls whether or not the plugin provides mappings. See |gitgutter-mapppings|.
|
Controls whether or not the plugin provides mappings. See |gitgutter-mappings|.
|
||||||
|
|
||||||
*g:gitgutter_async*
|
*g:gitgutter_async*
|
||||||
Default: 1
|
Default: 1
|
||||||
|
@ -487,6 +490,12 @@ Default: 0
|
||||||
When switched on, the plugin logs to gitgutter.log in the directory where it is
|
When switched on, the plugin logs to gitgutter.log in the directory where it is
|
||||||
installed. Additionally it logs channel activity to channel.log.
|
installed. Additionally it logs channel activity to channel.log.
|
||||||
|
|
||||||
|
*g:gitgutter_use_location_list*
|
||||||
|
Default: 0
|
||||||
|
|
||||||
|
When switched on, the :GitGutterQuickFix command populates the location list
|
||||||
|
of the current window instead of the global quickfix list.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
HIGHLIGHTS *gitgutter-highlights*
|
HIGHLIGHTS *gitgutter-highlights*
|
||||||
|
|
|
@ -61,6 +61,7 @@ call s:set('g:gitgutter_map_keys', 1)
|
||||||
call s:set('g:gitgutter_terminal_reports_focus', 1)
|
call s:set('g:gitgutter_terminal_reports_focus', 1)
|
||||||
call s:set('g:gitgutter_async', 1)
|
call s:set('g:gitgutter_async', 1)
|
||||||
call s:set('g:gitgutter_log', 0)
|
call s:set('g:gitgutter_log', 0)
|
||||||
|
call s:set('g:gitgutter_use_location_list', 0)
|
||||||
|
|
||||||
call s:set('g:gitgutter_git_executable', 'git')
|
call s:set('g:gitgutter_git_executable', 'git')
|
||||||
if !executable(g:gitgutter_git_executable)
|
if !executable(g:gitgutter_git_executable)
|
||||||
|
|
|
@ -69,7 +69,7 @@ endsnippet
|
||||||
|
|
||||||
# FIXME: handling literal bracket pair inside of nested tab groups?
|
# FIXME: handling literal bracket pair inside of nested tab groups?
|
||||||
snippet tcr "Create references column"
|
snippet tcr "Create references column"
|
||||||
t.references :${1:taggable}${2:, polymorphic ${3:{ :default: '${4:Photo}' \}}}
|
t.references :${1:taggable}${2:, polymorphic: ${3:{ default: '${4:Photo}' }}}
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -597,7 +597,7 @@ endsnippet
|
||||||
|
|
||||||
snippet rest "respond_to"
|
snippet rest "respond_to"
|
||||||
respond_to do |wants|
|
respond_to do |wants|
|
||||||
wants.${1:html}${2: { $0 \}}
|
wants.${1:html}${2: { $0 }}
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -655,7 +655,7 @@ t.$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet t. "t.references (tcr)"
|
snippet t. "t.references (tcr)"
|
||||||
t.references :${1:taggable}${2:, polymorphic ${3:{ :default: '${4:Photo}' \}}}
|
t.references :${1:taggable}${2:, polymorphic: ${3:{ default: '${4:Photo}' }}}
|
||||||
t.$0
|
t.$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -780,7 +780,7 @@ verify only: [:$1], session: :user, params: :id, redirect_to {:action: '${2:inde
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet wants "wants_format"
|
snippet wants "wants_format"
|
||||||
wants.${1:js|json|html}${2: { $0 \}}
|
wants.${1:js|json|html}${2: { $0 }}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet xdelete "xhr delete"
|
snippet xdelete "xhr delete"
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
snippet impl
|
snippet impl
|
||||||
implicit none
|
implicit none
|
||||||
$0
|
${0}
|
||||||
snippet prog
|
snippet prog
|
||||||
program ${1:main}
|
program ${1:main}
|
||||||
$0
|
${0}
|
||||||
end program $1
|
end program $1
|
||||||
snippet mod
|
snippet mod
|
||||||
module ${1:modulename}
|
module ${1:modulename}
|
||||||
$0
|
${0}
|
||||||
end module $1
|
end module $1
|
||||||
snippet proc
|
snippet proc
|
||||||
procedure ${1:name}
|
procedure ${1:name}
|
||||||
|
@ -25,7 +25,7 @@ snippet doc
|
||||||
! Github: `g:snips_github`
|
! Github: `g:snips_github`
|
||||||
! Description: $1
|
! Description: $1
|
||||||
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
$0
|
${0}
|
||||||
snippet dox
|
snippet dox
|
||||||
!> @brief ${1}
|
!> @brief ${1}
|
||||||
!!
|
!!
|
||||||
|
@ -37,45 +37,45 @@ snippet doxp
|
||||||
# Variables definitions
|
# Variables definitions
|
||||||
# Boolean
|
# Boolean
|
||||||
snippet bool
|
snippet bool
|
||||||
logical :: $0
|
logical :: ${0}
|
||||||
# Integer
|
# Integer
|
||||||
snippet int
|
snippet int
|
||||||
integer :: $0
|
integer :: ${0}
|
||||||
snippet real
|
snippet real
|
||||||
real :: $0
|
real :: ${0}
|
||||||
# Double Precision
|
# Double Precision
|
||||||
snippet double
|
snippet double
|
||||||
double precision :: $0
|
double precision :: ${0}
|
||||||
# Char
|
# Char
|
||||||
snippet str
|
snippet str
|
||||||
character(len=${1:*}) :: ${0:}
|
character(len=${1:*}) :: ${0:}
|
||||||
# Types
|
# Types
|
||||||
snippet type
|
snippet type
|
||||||
type(${1:name})
|
type(${1:name})
|
||||||
$0
|
${0}
|
||||||
end type
|
end type
|
||||||
snippet const
|
snippet const
|
||||||
${1:type}, parameter :: $2 = $0
|
${1:type}, parameter :: $2 = ${0}
|
||||||
snippet arr
|
snippet arr
|
||||||
${1:type}, ${2:allocatable, }dimension(${3::}) :: $0
|
${1:type}, ${2:allocatable, }dimension(${3::}) :: ${0}
|
||||||
snippet intent
|
snippet intent
|
||||||
${1:type}, intent(inout) :: $0
|
${1:type}, intent(inout) :: ${0}
|
||||||
# Array
|
# Array
|
||||||
snippet /
|
snippet /
|
||||||
(/ $1 /) ${2:,&} $0
|
(/ $1 /) ${2:,&} ${0}
|
||||||
snippet if
|
snippet if
|
||||||
if (${1:condition}) then
|
if (${1:condition}) then
|
||||||
$0
|
${0}
|
||||||
end if
|
end if
|
||||||
snippet case
|
snippet case
|
||||||
select case (${1:expr})
|
select case (${1:expr})
|
||||||
case ($2)
|
case ($2)
|
||||||
case default
|
case default
|
||||||
$3
|
$3
|
||||||
end select $0
|
end select ${0}
|
||||||
snippet do
|
snippet do
|
||||||
do ${1:i} = ${2:start}, ${3:end}, ${4:incr}
|
do ${1:i} = ${2:start}, ${3:end}, ${4:incr}
|
||||||
$0
|
${0}
|
||||||
end do
|
end do
|
||||||
snippet dow
|
snippet dow
|
||||||
do while (${1:condition})
|
do while (${1:condition})
|
||||||
|
@ -83,21 +83,21 @@ snippet dow
|
||||||
end do
|
end do
|
||||||
snippet sub
|
snippet sub
|
||||||
subroutine ${1:name}($2)
|
subroutine ${1:name}($2)
|
||||||
$0
|
${0}
|
||||||
end subroutine $1
|
end subroutine $1
|
||||||
snippet func
|
snippet func
|
||||||
function ${1:name}($2) result($3)
|
function ${1:name}($2) result($3)
|
||||||
$0
|
${0}
|
||||||
end function $1
|
end function $1
|
||||||
snippet pr
|
snippet pr
|
||||||
write(*,*) $0
|
write(*,*) ${0}
|
||||||
snippet dpr
|
snippet dpr
|
||||||
write(*,*) '$1 = ', $1
|
write(*,*) '$1 = ', $1
|
||||||
snippet read
|
snippet read
|
||||||
read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0
|
read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) ${0}
|
||||||
snippet write
|
snippet write
|
||||||
write(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0
|
write(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) ${0}
|
||||||
snippet open
|
snippet open
|
||||||
open(unit = ${1:fp}, file = ${2:filename}, status = ${3:unknown}, iostat = ${4:ierr}) $0
|
open(unit = ${1:fp}, file = ${2:filename}, status = ${3:unknown}, iostat = ${4:ierr}) ${0}
|
||||||
snippet close
|
snippet close
|
||||||
close(unit = ${1:fp}) $0
|
close(unit = ${1:fp}) ${0}
|
||||||
|
|
|
@ -447,7 +447,7 @@ function! s:dosurround(...) " {{{1
|
||||||
let keeper = substitute(keeper,'^\s\+','','')
|
let keeper = substitute(keeper,'^\s\+','','')
|
||||||
let keeper = substitute(keeper,'\s\+$','','')
|
let keeper = substitute(keeper,'\s\+$','','')
|
||||||
endif
|
endif
|
||||||
if col("']") == col("$") && col('.') + 1 == col('$')
|
if col("']") == col("$") && virtcol('.') + 1 == virtcol('$')
|
||||||
if oldhead =~# '^\s*$' && a:0 < 2
|
if oldhead =~# '^\s*$' && a:0 < 2
|
||||||
let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','')
|
let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','')
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue