mirror of
1
0
Fork 0

Updated plugins

This commit is contained in:
amix 2019-11-30 13:06:56 +01:00
parent 57ba28a9a2
commit 9c54d954f6
21 changed files with 201 additions and 65 deletions

View File

@ -84,11 +84,14 @@ function! s:CheckForBadConfig(buffer, lines) abort
endfunction
function! s:parseJSON(buffer, lines) abort
try
let l:parsed = json_decode(a:lines[-1])
catch
return []
endtry
let l:parsed = []
for l:line in a:lines
try
let l:parsed = extend(l:parsed, json_decode(l:line))
catch
endtry
endfor
if type(l:parsed) != v:t_list || empty(l:parsed)
return []

View File

@ -7,7 +7,8 @@
in an unordered list. The format is:
- **.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
- **.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)

View File

@ -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
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*
Opens (or reopens) the NERDTree if it is not currently visible;
otherwise, the cursor is moved to the already-open NERDTree.

View File

@ -11,6 +11,7 @@
"
" ============================================================================
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(name)
@ -19,6 +20,14 @@ function! s:CreateTabTreeVCS(name)
call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str())
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
" Finds the root version control system folder of the given path. If a:path is
" not part of a repository, return the original path.

View File

@ -3,7 +3,17 @@ function! cargo#Load()
endfunction
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
function! s:nearest_cargo(...) abort

View File

@ -1,4 +1,3 @@
" Author: Kevin Ballard
" Description: Helper functions for Rust commands/mappings
" Last Modified: May 27, 2014
" 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*')
endfunction
function! rust#Test(all, options) abort
function! rust#Test(mods, winsize, all, options) abort
let manifest = findfile('Cargo.toml', expand('%:p:h') . ';')
if manifest ==# ''
return rust#Run(1, '--test ' . a:options)
endif
" <count> defaults to 0, but we prefer an empty string
let winsize = a:winsize ? a:winsize : ''
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')
let cmd = 'noautocmd new | terminal '
let cmd = printf('%s noautocmd %snew | terminal ', a:mods, winsize)
else
let cmd = '!'
let manifest = shellescape(manifest)

View File

@ -426,12 +426,15 @@ functionality from other plugins.
Running test(s)
---------------
:RustTest[!] [options] *:RustTest*
:[N]RustTest[!] [options] *:RustTest*
Runs a test under the cursor when the current buffer is in a
cargo project with "cargo test" command. If the command did
not find any test function under the cursor, it stops with an
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
position.
@ -444,7 +447,11 @@ Running test(s)
is no way to run specific test function with rustc. [options]
is passed to "rustc" command arguments in the case.
Takes optional modifiers (see |<mods>|): >
:tab RustTest
:belowright 16RustTest
:leftabove vert 80RustTest
<
rust.vim Debugging
------------------

View File

@ -1,7 +1,6 @@
" Language: Rust
" Description: Vim ftplugin for Rust
" Maintainer: Chris Morgan <me@chrismorgan.info>
" Maintainer: Kevin Ballard <kevin@sb.org>
" Last Change: June 08, 2016
" 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>)
" 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")
let b:rust_last_rustc_args = []

View File

@ -191,7 +191,12 @@ function GetRustIndent(lnum)
" A line that ends with '.<expr>;' is probably an end of a long list
" of method operations.
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
if l:last_prevline_character ==# ","

View File

@ -53,6 +53,7 @@ syn keyword rustKeyword mod trait nextgroup=rustIdentifier skipwhite skipe
syn keyword rustStorage move mut ref static const
syn match rustDefault /\<default\ze\_s\+\(impl\|fn\|type\|const\)\>/
syn keyword rustAwait await
syn match rustKeyword /\<try\>!\@!/ display
syn keyword rustPubScopeCrate crate contained
syn match rustPubScopeDelim /[()]/ contained

View File

@ -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:

View File

@ -54,7 +54,7 @@ function! s:go(...) abort
let line = getline(lnum)
if strlen(r) > 2 && l.r !~# '\\'
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')
endif
if uncomment

View File

@ -1400,10 +1400,11 @@ call s:add_methods('buffer', ['repo', 'type'])
function! s:FilterEscape(items, ...) abort
let items = copy(a:items)
call map(items, 's:fnameescape(v:val)')
if a:0 && type(a:1) == type('')
call filter(items, 'strpart(v:val, 0, strlen(a:1)) ==# a:1')
endif
return map(items, 's:fnameescape(v:val)')
return items
endfunction
function! s:GlobComplete(lead, pattern) abort
@ -1469,16 +1470,15 @@ function! fugitive#CompleteObject(base, ...) abort
let results = []
if a:base =~# '^refs/'
let results += map(s:GlobComplete(fugitive#CommonDir(dir) . '/', a:base . '*'), 's:Slash(v:val)')
call map(results, 's:fnameescape(v:val)')
elseif a:base !~# '^\.\=/\|^:('
let heads = s:CompleteHeads(dir)
if filereadable(fugitive#Find('.git/refs/stash', dir))
let heads += ["stash"]
let heads += sort(s:LinesError(["stash","list","--pretty=format:%gd"], dir)[0])
endif
call filter(heads,'v:val[ 0 : strlen(a:base)-1 ] ==# a:base')
let results += heads
let results += s:FilterEscape(heads, a:base)
endif
call map(results, 's:fnameescape(v:val)')
if !empty(tree)
let results += a:0 == 1 ? fugitive#CompletePath(a:base, dir) : fugitive#CompletePath(a:base)
endif
@ -1724,6 +1724,10 @@ function! fugitive#BufReadStatus() abort
endwhile
endif
if empty(s:Tree())
let [unstaged, untracked] = [[], []]
endif
for dict in staged
let b:fugitive_files['Staged'][dict.filename] = dict
endfor
@ -1820,6 +1824,9 @@ function! fugitive#BufReadStatus() abort
if push !=# pull
call s:AddHeader('Push', push)
endif
if empty(s:Tree())
call s:AddHeader('Bare', 'yes')
endif
call s:AddSection('Rebasing ' . rebasing_head, rebasing)
call s:AddSection('Untracked', untracked)
call s:AddSection('Unstaged', unstaged)
@ -4518,14 +4525,11 @@ endfunction
function! s:diffoff_all(dir) abort
let curwin = winnr()
for nr in range(1,winnr('$'))
if getwinvar(nr,'&diff')
if getwinvar(nr, '&diff') && !empty(getwinvar(nr, 'fugitive_diff_restore'))
if nr != winnr()
execute nr.'wincmd w'
let restorewinnr = 1
endif
if s:Dir() ==# a:dir
call s:diffoff()
endif
call s:diffoff()
endif
endfor
execute curwin.'wincmd w'
@ -4626,6 +4630,8 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, args) abort
elseif arg =~# '^:\d$'
exe s:DirCheck()
let file = s:Relative(arg . ':')
elseif arg =~# '^[~^]\d*$'
return 'echoerr ' . string('fugitive: change ' . arg . ' to !' . arg . ' to diff against ancestor')
else
try
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)
if winnr > 0
exe winnr.'wincmd w'
exe bufnr.'bdelete'
endif
execute 'Gedit' s:fnameescape(commit . suffix . ':' . path)
execute lnum
if winnr > 0
exe bufnr.'bdelete'
endif
endif
if exists(':Gblame')
let my_bufnr = bufnr('')

View File

@ -181,6 +181,8 @@ function! FugitiveExtractGitDir(path) abort
let path = s:Slash(a:path)
if path =~# '^fugitive:'
return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)')
elseif empty(path)
return ''
elseif isdirectory(path)
let path = fnamemodify(path, ':p:s?/$??')
else

View File

@ -18,7 +18,7 @@ Features:
* Diffs against index (default) or any commit.
* Allows folding all unchanged text.
* 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.
* Optional line highlighting.
* 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)
```
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:
@ -254,6 +254,7 @@ You can customise:
* Whether to clobber or preserve non-gitgutter signs
* The priority of gitgutter's signs.
* 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.
@ -452,7 +453,12 @@ let g:gitgutter_async = 0
#### 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
@ -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
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.
@ -534,7 +556,7 @@ function! NextHunkAllBuffers()
return
endif
if !empty(GitGutterGetHunks())
normal! 1G
1
GitGutterNextHunk
return
endif

View File

@ -207,5 +207,9 @@ function! gitgutter#quickfix()
let lnum = 0
endif
endfor
call setqflist(locations)
if !g:gitgutter_use_location_list
call setqflist(locations)
else
call setloclist(0, locations)
endif
endfunction

View File

@ -140,7 +140,9 @@ Commands for jumping between hunks:~
*gitgutter-:GitGutterQuickFix*
: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:~
@ -294,6 +296,7 @@ General:~
|g:gitgutter_map_keys|
|g:gitgutter_async|
|g:gitgutter_log|
|g:gitgutter_use_location_list|
*g:gitgutter_preview_win_location*
@ -473,7 +476,7 @@ Controls whether or not the plugin is on at startup.
*g:gitgutter_map_keys*
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*
Default: 1
@ -487,6 +490,12 @@ Default: 0
When switched on, the plugin logs to gitgutter.log in the directory where it is
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*

View File

@ -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_async', 1)
call s:set('g:gitgutter_log', 0)
call s:set('g:gitgutter_use_location_list', 0)
call s:set('g:gitgutter_git_executable', 'git')
if !executable(g:gitgutter_git_executable)

View File

@ -69,7 +69,7 @@ endsnippet
# FIXME: handling literal bracket pair inside of nested tab groups?
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
endsnippet
@ -597,7 +597,7 @@ endsnippet
snippet rest "respond_to"
respond_to do |wants|
wants.${1:html}${2: { $0 \}}
wants.${1:html}${2: { $0 }}
end
endsnippet
@ -655,7 +655,7 @@ t.$0
endsnippet
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
endsnippet
@ -780,7 +780,7 @@ verify only: [:$1], session: :user, params: :id, redirect_to {:action: '${2:inde
endsnippet
snippet wants "wants_format"
wants.${1:js|json|html}${2: { $0 \}}
wants.${1:js|json|html}${2: { $0 }}
endsnippet
snippet xdelete "xhr delete"

View File

@ -1,13 +1,13 @@
snippet impl
implicit none
$0
${0}
snippet prog
program ${1:main}
$0
${0}
end program $1
snippet mod
module ${1:modulename}
$0
${0}
end module $1
snippet proc
procedure ${1:name}
@ -25,7 +25,7 @@ snippet doc
! Github: `g:snips_github`
! Description: $1
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
$0
${0}
snippet dox
!> @brief ${1}
!!
@ -37,45 +37,45 @@ snippet doxp
# Variables definitions
# Boolean
snippet bool
logical :: $0
logical :: ${0}
# Integer
snippet int
integer :: $0
integer :: ${0}
snippet real
real :: $0
real :: ${0}
# Double Precision
snippet double
double precision :: $0
double precision :: ${0}
# Char
snippet str
character(len=${1:*}) :: ${0:}
# Types
snippet type
type(${1:name})
$0
${0}
end type
snippet const
${1:type}, parameter :: $2 = $0
${1:type}, parameter :: $2 = ${0}
snippet arr
${1:type}, ${2:allocatable, }dimension(${3::}) :: $0
${1:type}, ${2:allocatable, }dimension(${3::}) :: ${0}
snippet intent
${1:type}, intent(inout) :: $0
${1:type}, intent(inout) :: ${0}
# Array
snippet /
(/ $1 /) ${2:,&} $0
(/ $1 /) ${2:,&} ${0}
snippet if
if (${1:condition}) then
$0
${0}
end if
snippet case
select case (${1:expr})
case ($2)
case default
$3
end select $0
end select ${0}
snippet do
do ${1:i} = ${2:start}, ${3:end}, ${4:incr}
$0
${0}
end do
snippet dow
do while (${1:condition})
@ -83,21 +83,21 @@ snippet dow
end do
snippet sub
subroutine ${1:name}($2)
$0
${0}
end subroutine $1
snippet func
function ${1:name}($2) result($3)
$0
${0}
end function $1
snippet pr
write(*,*) $0
write(*,*) ${0}
snippet dpr
write(*,*) '$1 = ', $1
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
write(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0
write(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) ${0}
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
close(unit = ${1:fp}) $0
close(unit = ${1:fp}) ${0}

View File

@ -447,7 +447,7 @@ function! s:dosurround(...) " {{{1
let keeper = substitute(keeper,'^\s\+','','')
let keeper = substitute(keeper,'\s\+$','','')
endif
if col("']") == col("$") && col('.') + 1 == col('$')
if col("']") == col("$") && virtcol('.') + 1 == virtcol('$')
if oldhead =~# '^\s*$' && a:0 < 2
let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','')
endif