Updated vim plugins. Nerd tree is on the right by default
This commit is contained in:
parent
a4b4587019
commit
00f043f0de
25 changed files with 386 additions and 109 deletions
|
@ -19,7 +19,7 @@ if has('reltime')
|
||||||
lockvar! g:_SYNTASTIC_START
|
lockvar! g:_SYNTASTIC_START
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:_SYNTASTIC_VERSION = '3.6.0-14'
|
let g:_SYNTASTIC_VERSION = '3.6.0-16'
|
||||||
lockvar g:_SYNTASTIC_VERSION
|
lockvar g:_SYNTASTIC_VERSION
|
||||||
|
|
||||||
" Sanity checks {{{1
|
" Sanity checks {{{1
|
||||||
|
|
|
@ -31,7 +31,6 @@ endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_python_prospector_GetLocList() dict
|
function! SyntaxCheckers_python_prospector_GetLocList() dict
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'args': '--external-config merge',
|
|
||||||
\ 'args_after': '--messages-only --absolute-paths --die-on-tool-error --zero-exit --output-format json' })
|
\ 'args_after': '--messages-only --absolute-paths --die-on-tool-error --zero-exit --output-format json' })
|
||||||
|
|
||||||
let errorformat = '%f:%l:%c: %m'
|
let errorformat = '%f:%l:%c: %m'
|
||||||
|
|
|
@ -23,7 +23,9 @@ set cpo&vim
|
||||||
" and http://www.xmlsoft.org/catalog.html for more information.
|
" and http://www.xmlsoft.org/catalog.html for more information.
|
||||||
|
|
||||||
function! SyntaxCheckers_xml_xmllint_GetLocList() dict
|
function! SyntaxCheckers_xml_xmllint_GetLocList() dict
|
||||||
let makeprg = self.makeprgBuild({ 'args_after': '--xinclude --noout --postvalid' })
|
let makeprg = self.makeprgBuild({
|
||||||
|
\ 'args': '--xinclude --postvalid',
|
||||||
|
\ 'args_after': '--noout' })
|
||||||
|
|
||||||
let errorformat=
|
let errorformat=
|
||||||
\ '%E%f:%l: error : %m,' .
|
\ '%E%f:%l: error : %m,' .
|
||||||
|
|
|
@ -118,6 +118,7 @@ This plugin follows the standard runtime path structure, and as such it can be i
|
||||||
|
|
||||||
* [Pathogen][11]
|
* [Pathogen][11]
|
||||||
* `git clone https://github.com/bling/vim-airline ~/.vim/bundle/vim-airline`
|
* `git clone https://github.com/bling/vim-airline ~/.vim/bundle/vim-airline`
|
||||||
|
* Remember to run `:Helptags` to generate help tags
|
||||||
* [NeoBundle][12]
|
* [NeoBundle][12]
|
||||||
* `NeoBundle 'bling/vim-airline'`
|
* `NeoBundle 'bling/vim-airline'`
|
||||||
* [Vundle][13]
|
* [Vundle][13]
|
||||||
|
|
|
@ -59,19 +59,22 @@ function! s:toggle_on()
|
||||||
let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ]
|
let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ]
|
||||||
|
|
||||||
set tabline=%!airline#extensions#tabline#get()
|
set tabline=%!airline#extensions#tabline#get()
|
||||||
if s:buf_min_count <= 0 && s:tab_min_count <= 1
|
augroup airline_tabline
|
||||||
set showtabline=2
|
autocmd!
|
||||||
else
|
" Invalidate cache.
|
||||||
augroup airline_tabline
|
autocmd BufAdd,BufUnload * unlet! s:current_buffer_list
|
||||||
autocmd!
|
|
||||||
|
if s:buf_min_count <= 0 && s:tab_min_count <= 1
|
||||||
|
set showtabline=2
|
||||||
|
else
|
||||||
if s:show_buffers == 1
|
if s:show_buffers == 1
|
||||||
autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()))
|
autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()))
|
||||||
autocmd BufUnload * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()) - 1)
|
autocmd BufUnload * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()) - 1)
|
||||||
else
|
else
|
||||||
autocmd TabEnter * call <sid>show_tabline(s:tab_min_count, tabpagenr('$'))
|
autocmd TabEnter * call <sid>show_tabline(s:tab_min_count, tabpagenr('$'))
|
||||||
endif
|
endif
|
||||||
augroup END
|
endif
|
||||||
endif
|
augroup END
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#tabline#load_theme(palette)
|
function! airline#extensions#tabline#load_theme(palette)
|
||||||
|
@ -130,10 +133,14 @@ function! airline#extensions#tabline#title(n)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#tabline#get_buffer_name(nr)
|
function! airline#extensions#tabline#get_buffer_name(nr)
|
||||||
return airline#extensions#tabline#{s:formatter}#format(a:nr, get(s:, 'current_buffer_list', s:get_buffer_list()))
|
return airline#extensions#tabline#{s:formatter}#format(a:nr, s:get_buffer_list())
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:get_buffer_list()
|
function! s:get_buffer_list()
|
||||||
|
if exists('s:current_buffer_list')
|
||||||
|
return s:current_buffer_list
|
||||||
|
endif
|
||||||
|
|
||||||
let buffers = []
|
let buffers = []
|
||||||
let cur = bufnr('%')
|
let cur = bufnr('%')
|
||||||
for nr in range(1, bufnr('$'))
|
for nr in range(1, bufnr('$'))
|
||||||
|
|
|
@ -2225,7 +2225,11 @@ function! s:Browse(bang,line1,count,...) abort
|
||||||
elseif exists(':Browse') == 2
|
elseif exists(':Browse') == 2
|
||||||
return 'echomsg '.string(url).'|Browse '.url
|
return 'echomsg '.string(url).'|Browse '.url
|
||||||
else
|
else
|
||||||
return 'echomsg '.string(url).'|call netrw#NetrwBrowseX('.string(url).', 0)'
|
if has("patch-7.4.567")
|
||||||
|
return 'echomsg '.string(url).'|call netrw#BrowseX('.string(url).', 0)'
|
||||||
|
else
|
||||||
|
return 'echomsg '.string(url).'|call netrw#NetrwBrowseX('.string(url).', 0)'
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr v:errmsg'
|
||||||
|
|
|
@ -37,20 +37,21 @@ function! GoIndent(lnum)
|
||||||
let previ = indent(prevlnum)
|
let previ = indent(prevlnum)
|
||||||
|
|
||||||
let ind = previ
|
let ind = previ
|
||||||
|
let s:shiftwidth = shiftwidth()
|
||||||
|
|
||||||
if prevl =~ '[({]\s*$'
|
if prevl =~ '[({]\s*$'
|
||||||
" previous line opened a block
|
" previous line opened a block
|
||||||
let ind += &sw
|
let ind += s:shiftwidth
|
||||||
endif
|
endif
|
||||||
if prevl =~# '^\s*\(case .*\|default\):$'
|
if prevl =~# '^\s*\(case .*\|default\):$'
|
||||||
" previous line is part of a switch statement
|
" previous line is part of a switch statement
|
||||||
let ind += &sw
|
let ind += s:shiftwidth
|
||||||
endif
|
endif
|
||||||
" TODO: handle if the previous line is a label.
|
" TODO: handle if the previous line is a label.
|
||||||
|
|
||||||
if thisl =~ '^\s*[)}]'
|
if thisl =~ '^\s*[)}]'
|
||||||
" this line closed a block
|
" this line closed a block
|
||||||
let ind -= &sw
|
let ind -= s:shiftwidth
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Colons are tricky.
|
" Colons are tricky.
|
||||||
|
@ -58,7 +59,7 @@ function! GoIndent(lnum)
|
||||||
" We ignore trying to deal with jump labels because (a) they're rare, and
|
" We ignore trying to deal with jump labels because (a) they're rare, and
|
||||||
" (b) they're hard to disambiguate from a composite literal key.
|
" (b) they're hard to disambiguate from a composite literal key.
|
||||||
if thisl =~# '^\s*\(case .*\|default\):$'
|
if thisl =~# '^\s*\(case .*\|default\):$'
|
||||||
let ind -= &sw
|
let ind -= s:shiftwidth
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
|
|
@ -32,6 +32,7 @@ To see what keystrokes are used for the above example, see [this issue](https://
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
Install using [Pathogen], [Vundle], [Neobundle], or your favorite Vim package manager.
|
Install using [Pathogen], [Vundle], [Neobundle], or your favorite Vim package manager.
|
||||||
|
Requires vim 7.4 or later for full functionality.
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
Out of the box, all you need to know is a single key `Ctrl-n`. Pressing the key in Normal mode highlights the current word under the cursor in Visual mode and places a virtual cursor at the end of it. Pressing it again finds the next ocurrence and places another virtual cursor at the end of the visual selection. If you select multiple lines in Visual mode, pressing the key puts a virtual cursor at every line and leaves you in Normal mode.
|
Out of the box, all you need to know is a single key `Ctrl-n`. Pressing the key in Normal mode highlights the current word under the cursor in Visual mode and places a virtual cursor at the end of it. Pressing it again finds the next ocurrence and places another virtual cursor at the end of the visual selection. If you select multiple lines in Visual mode, pressing the key puts a virtual cursor at every line and leaves you in Normal mode.
|
||||||
|
|
|
@ -54,6 +54,11 @@ if !hlexists(s:hi_group_visual)
|
||||||
exec "highlight link ".s:hi_group_visual." Visual"
|
exec "highlight link ".s:hi_group_visual." Visual"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Temporary buffer that is used for individual paste buffer save/restore
|
||||||
|
" operations
|
||||||
|
let s:paste_buffer_temporary_text = ''
|
||||||
|
let s:paste_buffer_temporary_type = ''
|
||||||
|
|
||||||
"===============================================================================
|
"===============================================================================
|
||||||
" Internal Mappings
|
" Internal Mappings
|
||||||
"===============================================================================
|
"===============================================================================
|
||||||
|
@ -258,6 +263,9 @@ function! s:Cursor.new(position)
|
||||||
let obj = copy(self)
|
let obj = copy(self)
|
||||||
let obj.position = copy(a:position)
|
let obj.position = copy(a:position)
|
||||||
let obj.visual = []
|
let obj.visual = []
|
||||||
|
" Stores text that was yanked after any commands in Normal or Visual mode
|
||||||
|
let obj.paste_buffer_text = getreg('"')
|
||||||
|
let obj.paste_buffer_type = getregtype('"')
|
||||||
let obj.cursor_hi_id = s:highlight_cursor(a:position)
|
let obj.cursor_hi_id = s:highlight_cursor(a:position)
|
||||||
let obj.visual_hi_id = 0
|
let obj.visual_hi_id = 0
|
||||||
let obj.line_length = col([a:position[0], '$'])
|
let obj.line_length = col([a:position[0], '$'])
|
||||||
|
@ -325,6 +333,17 @@ function! s:Cursor.remove_visual_selection() dict
|
||||||
let self.visual_hi_id = 0
|
let self.visual_hi_id = 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Restore unnamed register from paste buffer
|
||||||
|
function! s:Cursor.restore_unnamed_register() dict
|
||||||
|
call setreg('"', self.paste_buffer_text, self.paste_buffer_type)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Save contents of the unnamed register into paste buffer
|
||||||
|
function! s:Cursor.save_unnamed_register() dict
|
||||||
|
let self.paste_buffer_text = getreg('"')
|
||||||
|
let self.paste_buffer_type = getregtype('"')
|
||||||
|
endfunction
|
||||||
|
|
||||||
"===============================================================================
|
"===============================================================================
|
||||||
" CursorManager class
|
" CursorManager class
|
||||||
"===============================================================================
|
"===============================================================================
|
||||||
|
@ -345,6 +364,7 @@ function! s:CursorManager.new()
|
||||||
\ 'cursorline': &cursorline,
|
\ 'cursorline': &cursorline,
|
||||||
\ 'lazyredraw': &lazyredraw,
|
\ 'lazyredraw': &lazyredraw,
|
||||||
\ 'paste': &paste,
|
\ 'paste': &paste,
|
||||||
|
\ 'clipboard': &clipboard,
|
||||||
\ }
|
\ }
|
||||||
" We save the window view when multicursor mode is entered
|
" We save the window view when multicursor mode is entered
|
||||||
let obj.saved_winview = []
|
let obj.saved_winview = []
|
||||||
|
@ -465,9 +485,17 @@ function! s:CursorManager.update_current() dict
|
||||||
exec "normal! gv\<Esc>"
|
exec "normal! gv\<Esc>"
|
||||||
call cur.update_visual_selection(s:get_visual_region(s:pos('.')))
|
call cur.update_visual_selection(s:get_visual_region(s:pos('.')))
|
||||||
elseif s:from_mode ==# 'v' || s:from_mode ==# 'V'
|
elseif s:from_mode ==# 'v' || s:from_mode ==# 'V'
|
||||||
|
" Save contents of unnamed register after each operation in Visual mode.
|
||||||
|
" This should be executed after user input is processed, when unnamed
|
||||||
|
" register already contains the text.
|
||||||
|
call cur.save_unnamed_register()
|
||||||
|
|
||||||
call cur.remove_visual_selection()
|
call cur.remove_visual_selection()
|
||||||
elseif s:from_mode ==# 'i' && s:to_mode ==# 'n' && self.current_index != self.size() - 1
|
elseif s:from_mode ==# 'i' && s:to_mode ==# 'n' && self.current_index != self.size() - 1
|
||||||
normal! h
|
normal! h
|
||||||
|
elseif s:from_mode ==# 'n'
|
||||||
|
" Save contents of unnamed register after each operation in Normal mode.
|
||||||
|
call cur.save_unnamed_register()
|
||||||
endif
|
endif
|
||||||
let vdelta = line('$') - s:saved_linecount
|
let vdelta = line('$') - s:saved_linecount
|
||||||
" If the total number of lines changed in the buffer, we need to potentially
|
" If the total number of lines changed in the buffer, we need to potentially
|
||||||
|
@ -551,19 +579,28 @@ endfunction
|
||||||
" cursors on screen
|
" cursors on screen
|
||||||
" paste mode needs to be switched off since it turns off a bunch of features
|
" paste mode needs to be switched off since it turns off a bunch of features
|
||||||
" that's critical for the plugin to function
|
" that's critical for the plugin to function
|
||||||
|
" clipboard should not have unnamed and unnamedplus otherwise plugin cannot
|
||||||
|
" reliably use unnamed register ('"')
|
||||||
function! s:CursorManager.initialize() dict
|
function! s:CursorManager.initialize() dict
|
||||||
let self.saved_settings['virtualedit'] = &virtualedit
|
let self.saved_settings['virtualedit'] = &virtualedit
|
||||||
let self.saved_settings['cursorline'] = &cursorline
|
let self.saved_settings['cursorline'] = &cursorline
|
||||||
let self.saved_settings['lazyredraw'] = &lazyredraw
|
let self.saved_settings['lazyredraw'] = &lazyredraw
|
||||||
let self.saved_settings['paste'] = &paste
|
let self.saved_settings['paste'] = &paste
|
||||||
|
let self.saved_settings['clipboard'] = &clipboard
|
||||||
let &virtualedit = "onemore"
|
let &virtualedit = "onemore"
|
||||||
let &cursorline = 0
|
let &cursorline = 0
|
||||||
let &lazyredraw = 1
|
let &lazyredraw = 1
|
||||||
let &paste = 0
|
let &paste = 0
|
||||||
|
set clipboard-=unnamed clipboard-=unnamedplus
|
||||||
" We could have already saved the view from multiple_cursors#find
|
" We could have already saved the view from multiple_cursors#find
|
||||||
if !self.start_from_find
|
if !self.start_from_find
|
||||||
let self.saved_winview = winsaveview()
|
let self.saved_winview = winsaveview()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Save contents and type of unnamed register upon entering multicursor mode
|
||||||
|
" to restore it later when leaving mode
|
||||||
|
let s:paste_buffer_temporary_text = getreg('"')
|
||||||
|
let s:paste_buffer_temporary_type = getregtype('"')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Restore user settings.
|
" Restore user settings.
|
||||||
|
@ -573,7 +610,15 @@ function! s:CursorManager.restore_user_settings() dict
|
||||||
let &cursorline = self.saved_settings['cursorline']
|
let &cursorline = self.saved_settings['cursorline']
|
||||||
let &lazyredraw = self.saved_settings['lazyredraw']
|
let &lazyredraw = self.saved_settings['lazyredraw']
|
||||||
let &paste = self.saved_settings['paste']
|
let &paste = self.saved_settings['paste']
|
||||||
|
let &clipboard = self.saved_settings['clipboard']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Restore original contents and type of unnamed register. This method is
|
||||||
|
" called from reset, which calls us only when restore_setting argument is
|
||||||
|
" true, which happens only when we leave multicursor mode. This should be
|
||||||
|
" symmetrical to saving of unnamed register upon the start of multicursor
|
||||||
|
" mode.
|
||||||
|
call setreg('"', s:paste_buffer_temporary_text, s:paste_buffer_temporary_type)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Reselect the current cursor's region in visual mode
|
" Reselect the current cursor's region in visual mode
|
||||||
|
@ -814,6 +859,12 @@ function! s:process_user_input()
|
||||||
call s:cm.get_current().update_line_length()
|
call s:cm.get_current().update_line_length()
|
||||||
let s:saved_linecount = line('$')
|
let s:saved_linecount = line('$')
|
||||||
|
|
||||||
|
" Restore unnamed register only in Normal mode. This should happen before user
|
||||||
|
" input is processed.
|
||||||
|
if s:from_mode ==# 'n' || s:from_mode ==# 'v' || s:from_mode ==# 'V'
|
||||||
|
call s:cm.get_current().restore_unnamed_register()
|
||||||
|
endif
|
||||||
|
|
||||||
" Apply the user input. Note that the above could potentially change mode, we
|
" Apply the user input. Note that the above could potentially change mode, we
|
||||||
" use the mapping below to help us determine what the new mode is
|
" use the mapping below to help us determine what the new mode is
|
||||||
" Note that it's possible that \<Plug>(multiple-cursors-apply) never gets called, we have a
|
" Note that it's possible that \<Plug>(multiple-cursors-apply) never gets called, we have a
|
||||||
|
|
|
@ -12,6 +12,7 @@ def get_file_content()
|
||||||
end
|
end
|
||||||
|
|
||||||
def before(string)
|
def before(string)
|
||||||
|
options.each { |x| vim.command(x) }
|
||||||
set_file_content(string)
|
set_file_content(string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,8 +30,198 @@ def type(string)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "Multiple Cursors op pending & exit from insert|visual mode" do
|
||||||
|
let(:filename) { 'test.txt' }
|
||||||
|
let(:options) { ['let g:multi_cursor_normal_maps = {"d": 1, "c": 1}',
|
||||||
|
'let g:multi_cursor_exit_from_insert_mode = 0',
|
||||||
|
'let g:multi_cursor_exit_from_visual_mode = 0'] }
|
||||||
|
|
||||||
|
specify "#paste from unnamed register to 3 cursors" do
|
||||||
|
before <<-EOF
|
||||||
|
yankme
|
||||||
|
a b c
|
||||||
|
a b c
|
||||||
|
a b c
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type 'yiwj<C-n><C-n><C-n>vwwp<Esc>'
|
||||||
|
|
||||||
|
after <<-EOF
|
||||||
|
yankme
|
||||||
|
a b cyankme
|
||||||
|
a b cyankme
|
||||||
|
a b cyankme
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
specify "#paste buffer normal caw then p" do
|
||||||
|
before <<-EOF
|
||||||
|
hello jan world
|
||||||
|
hello feb world
|
||||||
|
hello mar world
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type '<C-n><C-n><C-n>vwcaw<Esc>bP<Esc>'
|
||||||
|
|
||||||
|
after <<-EOF
|
||||||
|
jan hello world
|
||||||
|
feb hello world
|
||||||
|
mar hello world
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
specify "#paste buffer normal C then ABC then p" do
|
||||||
|
before <<-EOF
|
||||||
|
hello jan world
|
||||||
|
hello feb world
|
||||||
|
hello mar world
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type '<C-n><C-n><C-n>vwCABC <Esc>p<Esc>'
|
||||||
|
|
||||||
|
after <<-EOF
|
||||||
|
hello ABC jan world
|
||||||
|
hello ABC feb world
|
||||||
|
hello ABC mar world
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
specify "#paste buffer normal daw then P" do
|
||||||
|
before <<-EOF
|
||||||
|
hello jan world
|
||||||
|
hello feb world
|
||||||
|
hello mar world
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type '<C-n><C-n><C-n>vwdawbP<Esc>'
|
||||||
|
|
||||||
|
after <<-EOF
|
||||||
|
jan hello world
|
||||||
|
feb hello world
|
||||||
|
mar hello world
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
specify "#paste buffer normal D then P" do
|
||||||
|
before <<-EOF
|
||||||
|
hello jan world
|
||||||
|
hello feb world
|
||||||
|
hello mar world
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type '<C-n><C-n><C-n>vwwhDbhP<Esc>'
|
||||||
|
|
||||||
|
after <<-EOF
|
||||||
|
hello world jan
|
||||||
|
hello world feb
|
||||||
|
hello world mar
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
specify "#paste buffer normal s then p" do
|
||||||
|
before <<-EOF
|
||||||
|
hello jan world
|
||||||
|
hello feb world
|
||||||
|
hello mar world
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type '<C-n><C-n><C-n>vws1<Esc>p<Esc>'
|
||||||
|
|
||||||
|
after <<-EOF
|
||||||
|
hello 1jan world
|
||||||
|
hello 1feb world
|
||||||
|
hello 1mar world
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
describe "Multiple Cursors" do
|
describe "Multiple Cursors" do
|
||||||
let(:filename) { 'test.txt' }
|
let(:filename) { 'test.txt' }
|
||||||
|
let(:options) { [] }
|
||||||
|
|
||||||
|
specify "#paste buffer normal x then p" do
|
||||||
|
before <<-EOF
|
||||||
|
jan
|
||||||
|
feb
|
||||||
|
mar
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type '<C-v>jj<C-n>xp<Esc>'
|
||||||
|
|
||||||
|
after <<-EOF
|
||||||
|
ajn
|
||||||
|
efb
|
||||||
|
amr
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
specify "#paste buffer visual y then p" do
|
||||||
|
before <<-EOF
|
||||||
|
hello jan world
|
||||||
|
hello feb world
|
||||||
|
hello mar world
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type '<C-n><C-n><C-n>vwvelywhp<Esc>'
|
||||||
|
|
||||||
|
after <<-EOF
|
||||||
|
hello jan jan world
|
||||||
|
hello feb feb world
|
||||||
|
hello mar mar world
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
specify "#paste buffer initial visual y then P" do
|
||||||
|
before <<-EOF
|
||||||
|
hello jan world
|
||||||
|
hello feb world
|
||||||
|
hello mar world
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type 'wywb<C-n><C-n><C-n>p<Esc>'
|
||||||
|
|
||||||
|
after <<-EOF
|
||||||
|
jan jan world
|
||||||
|
jan feb world
|
||||||
|
jan mar world
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
specify "#paste buffer visual y then P" do
|
||||||
|
before <<-EOF
|
||||||
|
hello jan world
|
||||||
|
hello feb world
|
||||||
|
hello mar world
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type '<C-n><C-n><C-n>vwvely^P<Esc>'
|
||||||
|
|
||||||
|
after <<-EOF
|
||||||
|
jan hello jan world
|
||||||
|
feb hello feb world
|
||||||
|
mar hello mar world
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
specify "#paste buffer visual Y then P" do
|
||||||
|
before <<-EOF
|
||||||
|
hello jan world
|
||||||
|
hello feb world
|
||||||
|
hello mar world
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type '<C-n><C-n><C-n>vwvY^P<Esc>'
|
||||||
|
|
||||||
|
after <<-EOF
|
||||||
|
hello jan world
|
||||||
|
hello jan world
|
||||||
|
hello feb world
|
||||||
|
hello feb world
|
||||||
|
hello mar world
|
||||||
|
hello mar world
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
specify "#multiline replacement" do
|
specify "#multiline replacement" do
|
||||||
before <<-EOF
|
before <<-EOF
|
||||||
|
|
|
@ -5,7 +5,7 @@ Vimrunner::RSpec.configure do |config|
|
||||||
|
|
||||||
# Use a single Vim instance for the test suite. Set to false to use an
|
# Use a single Vim instance for the test suite. Set to false to use an
|
||||||
# instance per test (slower, but can be easier to manage).
|
# instance per test (slower, but can be easier to manage).
|
||||||
config.reuse_server = true
|
config.reuse_server = false
|
||||||
|
|
||||||
# Decide how to start a Vim instance. In this block, an instance should be
|
# Decide how to start a Vim instance. In this block, an instance should be
|
||||||
# spawned and set up with anything project-specific.
|
# spawned and set up with anything project-specific.
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! s:map_if_not_mapped(lhs, rhs, mode)
|
function! s:map_if_not_mapped(lhs, rhs, mode) abort
|
||||||
let l:unique = s:overwrite ? '' : ' <unique>'
|
let l:unique = s:overwrite ? '' : ' <unique>'
|
||||||
if !hasmapto(a:rhs, a:mode)
|
if !hasmapto(a:rhs, a:mode)
|
||||||
silent! exe a:mode . 'map' . l:unique a:lhs a:rhs
|
silent! exe a:mode . 'map' . l:unique a:lhs a:rhs
|
||||||
|
|
|
@ -9,7 +9,7 @@ catch /.*/
|
||||||
echoe "you're missing tlib. See install instructions at ".expand('<sfile>:h:h').'/README.md'
|
echoe "you're missing tlib. See install instructions at ".expand('<sfile>:h:h').'/README.md'
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
fun! Filename(...)
|
fun! Filename(...) abort
|
||||||
let filename = expand('%:t:r')
|
let filename = expand('%:t:r')
|
||||||
if filename == '' | return a:0 == 2 ? a:2 : '' | endif
|
if filename == '' | return a:0 == 2 ? a:2 : '' | endif
|
||||||
return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g')
|
return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g')
|
||||||
|
@ -17,7 +17,7 @@ endf
|
||||||
|
|
||||||
let s:cache = {}
|
let s:cache = {}
|
||||||
|
|
||||||
function! snipMate#expandSnip(snip, version, col)
|
function! snipMate#expandSnip(snip, version, col) abort
|
||||||
let lnum = line('.')
|
let lnum = line('.')
|
||||||
let col = a:col
|
let col = a:col
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
|
@ -76,11 +76,11 @@ function! snipMate#expandSnip(snip, version, col)
|
||||||
return b:snip_state.set_stop(0)
|
return b:snip_state.set_stop(0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! snipMate#placeholder_str(num, stops)
|
function! snipMate#placeholder_str(num, stops) abort
|
||||||
return snipMate#sniplist_str(a:stops[a:num].placeholder, a:stops)[0]
|
return snipMate#sniplist_str(a:stops[a:num].placeholder, a:stops)[0]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! snipMate#sniplist_str(snippet, stops)
|
function! snipMate#sniplist_str(snippet, stops) abort
|
||||||
let lines = ['']
|
let lines = ['']
|
||||||
let pos = 0
|
let pos = 0
|
||||||
let add_to = 1
|
let add_to = 1
|
||||||
|
@ -108,7 +108,7 @@ function! snipMate#sniplist_str(snippet, stops)
|
||||||
return lines
|
return lines
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:build_stops(snippet, stops, lnum, col, indent)
|
function! s:build_stops(snippet, stops, lnum, col, indent) abort
|
||||||
let stops = a:stops
|
let stops = a:stops
|
||||||
let line = a:lnum
|
let line = a:lnum
|
||||||
let col = a:col
|
let col = a:col
|
||||||
|
@ -146,7 +146,7 @@ function! s:build_stops(snippet, stops, lnum, col, indent)
|
||||||
return stop_count
|
return stop_count
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:build_loc_info(snippet, stops, line, col, indent)
|
function! s:build_loc_info(snippet, stops, line, col, indent) abort
|
||||||
let stops = a:stops
|
let stops = a:stops
|
||||||
let line = a:line
|
let line = a:line
|
||||||
let col = a:col
|
let col = a:col
|
||||||
|
@ -183,7 +183,7 @@ function! s:build_loc_info(snippet, stops, line, col, indent)
|
||||||
return [line, col]
|
return [line, col]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:add_mirror(stops, id, line, col, item)
|
function! s:add_mirror(stops, id, line, col, item) abort
|
||||||
let stops = a:stops
|
let stops = a:stops
|
||||||
let item = a:item
|
let item = a:item
|
||||||
let stops[a:id].mirrors = get(stops[a:id], 'mirrors', [])
|
let stops[a:id].mirrors = get(stops[a:id], 'mirrors', [])
|
||||||
|
@ -201,7 +201,7 @@ endfunction
|
||||||
" ['triggername', 'name', 'contents']
|
" ['triggername', 'name', 'contents']
|
||||||
" if triggername is not set 'default' is assumed
|
" if triggername is not set 'default' is assumed
|
||||||
" TODO: better error checking
|
" TODO: better error checking
|
||||||
fun! snipMate#ReadSnippetsFile(file)
|
fun! snipMate#ReadSnippetsFile(file) abort
|
||||||
let result = []
|
let result = []
|
||||||
let new_scopes = []
|
let new_scopes = []
|
||||||
if !filereadable(a:file) | return [result, new_scopes] | endif
|
if !filereadable(a:file) | return [result, new_scopes] | endif
|
||||||
|
@ -245,7 +245,7 @@ fun! snipMate#ReadSnippetsFile(file)
|
||||||
return [result, new_scopes]
|
return [result, new_scopes]
|
||||||
endf
|
endf
|
||||||
|
|
||||||
function! s:GetScopes()
|
function! s:GetScopes() abort
|
||||||
let ret = exists('b:snipMate.scope_aliases') ? copy(b:snipMate.scope_aliases) : {}
|
let ret = exists('b:snipMate.scope_aliases') ? copy(b:snipMate.scope_aliases) : {}
|
||||||
let global = get(g:snipMate, 'scope_aliases', {})
|
let global = get(g:snipMate, 'scope_aliases', {})
|
||||||
for alias in keys(global)
|
for alias in keys(global)
|
||||||
|
@ -262,7 +262,7 @@ endfunction
|
||||||
" adds scope aliases to list.
|
" adds scope aliases to list.
|
||||||
" returns new list
|
" returns new list
|
||||||
" the aliases of aliases are added recursively
|
" the aliases of aliases are added recursively
|
||||||
fun! s:AddScopeAliases(list)
|
fun! s:AddScopeAliases(list) abort
|
||||||
let did = {}
|
let did = {}
|
||||||
let scope_aliases = s:GetScopes()
|
let scope_aliases = s:GetScopes()
|
||||||
let new = a:list
|
let new = a:list
|
||||||
|
@ -282,7 +282,7 @@ endf
|
||||||
|
|
||||||
au SourceCmd *.snippet,*.snippets call s:source_snippet()
|
au SourceCmd *.snippet,*.snippets call s:source_snippet()
|
||||||
|
|
||||||
function! s:info_from_filename(file)
|
function! s:info_from_filename(file) abort
|
||||||
let parts = split(fnamemodify(a:file, ':r'), '/')
|
let parts = split(fnamemodify(a:file, ':r'), '/')
|
||||||
let snipidx = len(parts) - index(reverse(copy(parts)), 'snippets') - 1
|
let snipidx = len(parts) - index(reverse(copy(parts)), 'snippets') - 1
|
||||||
let rtp_prefix = join(parts[(snipidx -
|
let rtp_prefix = join(parts[(snipidx -
|
||||||
|
@ -293,7 +293,7 @@ function! s:info_from_filename(file)
|
||||||
return [rtp_prefix, trigger, desc]
|
return [rtp_prefix, trigger, desc]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:source_snippet()
|
function! s:source_snippet() abort
|
||||||
let file = expand('<afile>:p')
|
let file = expand('<afile>:p')
|
||||||
let [rtp_prefix, trigger, desc] = s:info_from_filename(file)
|
let [rtp_prefix, trigger, desc] = s:info_from_filename(file)
|
||||||
let new_snips = []
|
let new_snips = []
|
||||||
|
@ -316,7 +316,7 @@ function! s:source_snippet()
|
||||||
call extend(s:lookup_state.snips, new_snips)
|
call extend(s:lookup_state.snips, new_snips)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:CachedSnips(file)
|
function! s:CachedSnips(file) abort
|
||||||
let mtime = getftime(a:file)
|
let mtime = getftime(a:file)
|
||||||
if has_key(s:cache, a:file) && s:cache[a:file].mtime >= mtime
|
if has_key(s:cache, a:file) && s:cache[a:file].mtime >= mtime
|
||||||
return s:cache[a:file].contents
|
return s:cache[a:file].contents
|
||||||
|
@ -327,15 +327,14 @@ function! s:CachedSnips(file)
|
||||||
return s:cache[a:file].contents
|
return s:cache[a:file].contents
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:snippet_filenames(scope, trigger)
|
function! s:snippet_filenames(scope, trigger) abort
|
||||||
let mid = ['', '_*', '/*']
|
let mid = ['', '_*', '/*']
|
||||||
return join(map(extend(mid, map(filter(copy(mid), 'v:key != 1'),
|
let mid += map(copy(mid[1:]), "'/' . a:trigger . '*' . v:val")
|
||||||
\ "'/' . a:trigger . '*' . v:val")),
|
return join(map(mid, "'snippets/' . a:scope . v:val . '.snippet'"
|
||||||
\ "'snippets/' . a:scope . v:val . '.snippet'"
|
|
||||||
\ . ". (v:key < 3 ? 's' : '')"))
|
\ . ". (v:key < 3 ? 's' : '')"))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! snipMate#SetByPath(dict, trigger, path, snippet, bang, snipversion)
|
function! snipMate#SetByPath(dict, trigger, path, snippet, bang, snipversion) abort
|
||||||
let d = a:dict
|
let d = a:dict
|
||||||
if !has_key(d, a:trigger) || a:bang
|
if !has_key(d, a:trigger) || a:bang
|
||||||
let d[a:trigger] = {}
|
let d[a:trigger] = {}
|
||||||
|
@ -344,7 +343,7 @@ function! snipMate#SetByPath(dict, trigger, path, snippet, bang, snipversion)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" default triggers based on paths
|
" default triggers based on paths
|
||||||
function! snipMate#DefaultPool(scopes, trigger, result)
|
function! snipMate#DefaultPool(scopes, trigger, result) abort
|
||||||
let scopes = s:AddScopeAliases(a:scopes)
|
let scopes = s:AddScopeAliases(a:scopes)
|
||||||
let scopes_done = []
|
let scopes_done = []
|
||||||
let rtp_save = &rtp
|
let rtp_save = &rtp
|
||||||
|
@ -377,7 +376,7 @@ endfunction
|
||||||
" scopes: list of scopes. usually this is the filetype. eg ['c','cpp']
|
" scopes: list of scopes. usually this is the filetype. eg ['c','cpp']
|
||||||
" trigger may contain glob patterns. Thus use '*' to get all triggers
|
" trigger may contain glob patterns. Thus use '*' to get all triggers
|
||||||
"
|
"
|
||||||
fun! snipMate#GetSnippets(scopes, trigger)
|
fun! snipMate#GetSnippets(scopes, trigger) abort
|
||||||
let result = {}
|
let result = {}
|
||||||
|
|
||||||
for F in values(g:snipMateSources)
|
for F in values(g:snipMateSources)
|
||||||
|
@ -389,7 +388,7 @@ endf
|
||||||
" adds leading tab
|
" adds leading tab
|
||||||
" and replaces leading spaces by tabs
|
" and replaces leading spaces by tabs
|
||||||
" see ftplugin/snippet.vim
|
" see ftplugin/snippet.vim
|
||||||
fun! snipMate#RetabSnip() range
|
fun! snipMate#RetabSnip() range abort
|
||||||
let leadingTab = expand('%:e') == 'snippets'
|
let leadingTab = expand('%:e') == 'snippets'
|
||||||
|
|
||||||
let lines = getline(a:firstline, a:lastline)
|
let lines = getline(a:firstline, a:lastline)
|
||||||
|
@ -424,7 +423,7 @@ fun! snipMate#RetabSnip() range
|
||||||
endfor
|
endfor
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! snipMate#OpenSnippetFiles()
|
fun! snipMate#OpenSnippetFiles() abort
|
||||||
let dict = snipMate#GetSnippetFiles(0, snipMate#ScopesByFile(), '*')
|
let dict = snipMate#GetSnippetFiles(0, snipMate#ScopesByFile(), '*')
|
||||||
" sort by files wether they exist - put existing files first
|
" sort by files wether they exist - put existing files first
|
||||||
let exists = []
|
let exists = []
|
||||||
|
@ -445,13 +444,13 @@ fun! snipMate#OpenSnippetFiles()
|
||||||
endfor
|
endfor
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! snipMate#ScopesByFile()
|
fun! snipMate#ScopesByFile() abort
|
||||||
" duplicates are removed in AddScopeAliases
|
" duplicates are removed in AddScopeAliases
|
||||||
return filter(funcref#Call(g:snipMate.get_scopes), "v:val != ''")
|
return filter(funcref#Call(g:snipMate.get_scopes), "v:val != ''")
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" used by both: completion and insert snippet
|
" used by both: completion and insert snippet
|
||||||
fun! snipMate#GetSnippetsForWordBelowCursor(word, exact)
|
fun! snipMate#GetSnippetsForWordBelowCursor(word, exact) abort
|
||||||
" Setup lookups: '1.2.3' becomes [1.2.3] + [3, 2.3]
|
" Setup lookups: '1.2.3' becomes [1.2.3] + [3, 2.3]
|
||||||
let parts = split(a:word, '\W\zs')
|
let parts = split(a:word, '\W\zs')
|
||||||
" Since '\W\zs' results in splitting *after* a non-keyword character, the
|
" Since '\W\zs' results in splitting *after* a non-keyword character, the
|
||||||
|
@ -499,7 +498,7 @@ endf
|
||||||
|
|
||||||
" snippets: dict containing snippets by name
|
" snippets: dict containing snippets by name
|
||||||
" usually this is just {'default' : snippet_contents }
|
" usually this is just {'default' : snippet_contents }
|
||||||
fun! s:ChooseSnippet(snippets)
|
fun! s:ChooseSnippet(snippets) abort
|
||||||
let snippet = []
|
let snippet = []
|
||||||
let keys = keys(a:snippets)
|
let keys = keys(a:snippets)
|
||||||
let i = 1
|
let i = 1
|
||||||
|
@ -521,22 +520,22 @@ fun! s:ChooseSnippet(snippets)
|
||||||
return funcref#Call(a:snippets[keys(a:snippets)[idx]])
|
return funcref#Call(a:snippets[keys(a:snippets)[idx]])
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! snipMate#WordBelowCursor()
|
fun! snipMate#WordBelowCursor() abort
|
||||||
return matchstr(getline('.'), '\S\+\%' . col('.') . 'c')
|
return matchstr(getline('.'), '\S\+\%' . col('.') . 'c')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! snipMate#GetSnippetsForWordBelowCursorForComplete(word)
|
fun! snipMate#GetSnippetsForWordBelowCursorForComplete(word) abort
|
||||||
let snippets = map(snipMate#GetSnippetsForWordBelowCursor(a:word, 0), 'v:val[0]')
|
let snippets = map(snipMate#GetSnippetsForWordBelowCursor(a:word, 0), 'v:val[0]')
|
||||||
return filter(snippets, 'v:val =~# "\\V\\^' . escape(a:word, '"\') . '"')
|
return filter(snippets, 'v:val =~# "\\V\\^' . escape(a:word, '"\') . '"')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! snipMate#CanBeTriggered()
|
fun! snipMate#CanBeTriggered() abort
|
||||||
let word = snipMate#WordBelowCursor()
|
let word = snipMate#WordBelowCursor()
|
||||||
let matches = snipMate#GetSnippetsForWordBelowCursorForComplete(word)
|
let matches = snipMate#GetSnippetsForWordBelowCursorForComplete(word)
|
||||||
return len(matches) > 0
|
return len(matches) > 0
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! snipMate#ShowAvailableSnips()
|
fun! snipMate#ShowAvailableSnips() abort
|
||||||
let col = col('.')
|
let col = col('.')
|
||||||
let word = snipMate#WordBelowCursor()
|
let word = snipMate#WordBelowCursor()
|
||||||
let matches = snipMate#GetSnippetsForWordBelowCursorForComplete(word)
|
let matches = snipMate#GetSnippetsForWordBelowCursorForComplete(word)
|
||||||
|
@ -552,7 +551,7 @@ fun! snipMate#ShowAvailableSnips()
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" Pass an argument to force snippet expansion instead of triggering or jumping
|
" Pass an argument to force snippet expansion instead of triggering or jumping
|
||||||
function! snipMate#TriggerSnippet(...)
|
function! snipMate#TriggerSnippet(...) abort
|
||||||
if exists('g:SuperTabMappingForward')
|
if exists('g:SuperTabMappingForward')
|
||||||
if g:SuperTabMappingForward == "<tab>"
|
if g:SuperTabMappingForward == "<tab>"
|
||||||
let SuperTabPlug = maparg('<Plug>SuperTabForward', 'i')
|
let SuperTabPlug = maparg('<Plug>SuperTabForward', 'i')
|
||||||
|
@ -610,7 +609,7 @@ function! snipMate#TriggerSnippet(...)
|
||||||
\ : "\<c-r>=snipMate#ShowAvailableSnips()\<cr>"
|
\ : "\<c-r>=snipMate#ShowAvailableSnips()\<cr>"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
fun! snipMate#BackwardsSnippet()
|
fun! snipMate#BackwardsSnippet() abort
|
||||||
if exists('b:snip_state') | return b:snip_state.jump_stop(1) | endif
|
if exists('b:snip_state') | return b:snip_state.jump_stop(1) | endif
|
||||||
|
|
||||||
if exists('g:SuperTabMappingForward')
|
if exists('g:SuperTabMappingForward')
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
" will create a snippet on the fly which looks like this:
|
" will create a snippet on the fly which looks like this:
|
||||||
" abc(${1:a}, ${2:b}, ${3:c=None})
|
" abc(${1:a}, ${2:b}, ${3:c=None})
|
||||||
|
|
||||||
fun! snipMate_python_demo#Activate()
|
fun! snipMate_python_demo#Activate() abort
|
||||||
if !exists('g:snipMateSources')
|
if !exists('g:snipMateSources')
|
||||||
let g:snipMateSources = {}
|
let g:snipMateSources = {}
|
||||||
endif
|
endif
|
||||||
|
@ -17,7 +17,7 @@ fun! snipMate_python_demo#Activate()
|
||||||
let g:snipMateSources['python'] = funcref#Function('snipMate_python_demo#FunctionsFromCurrentFileAndTags')
|
let g:snipMateSources['python'] = funcref#Function('snipMate_python_demo#FunctionsFromCurrentFileAndTags')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:Add(dict, line, source, trigger)
|
fun! s:Add(dict, line, source, trigger) abort
|
||||||
let matched = matchlist(a:line,'def\s\+\([^( \t]\+\)[ \t]*(\([^)]*\)')
|
let matched = matchlist(a:line,'def\s\+\([^( \t]\+\)[ \t]*(\([^)]*\)')
|
||||||
if len(matched) > 2
|
if len(matched) > 2
|
||||||
let name = matched[1]
|
let name = matched[1]
|
||||||
|
@ -34,7 +34,7 @@ fun! s:Add(dict, line, source, trigger)
|
||||||
let sd[a:source] = name.'('.join(args,', ').')'
|
let sd[a:source] = name.'('.join(args,', ').')'
|
||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
fun! snipMate_python_demo#FunctionsFromCurrentFileAndTags(scopes, trigger, result)
|
fun! snipMate_python_demo#FunctionsFromCurrentFileAndTags(scopes, trigger, result) abort
|
||||||
" getting all might be too much
|
" getting all might be too much
|
||||||
if a:trigger == '*' | return | endif
|
if a:trigger == '*' | return | endif
|
||||||
if index(a:scopes, 'python') < 0 | return | endif
|
if index(a:scopes, 'python') < 0 | return | endif
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
function! s:sfile()
|
function! s:sfile() abort
|
||||||
return expand('<sfile>')
|
return expand('<sfile>')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:state_proto = {}
|
let s:state_proto = {}
|
||||||
|
|
||||||
function! snipmate#jumping#state()
|
function! snipmate#jumping#state() abort
|
||||||
return copy(s:state_proto)
|
return copy(s:state_proto)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:listize_mirror(mirrors)
|
function! s:listize_mirror(mirrors) abort
|
||||||
return map(copy(a:mirrors), '[v:val.line, v:val.col]')
|
return map(copy(a:mirrors), '[v:val.line, v:val.col]')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Removes snippet state info
|
" Removes snippet state info
|
||||||
function! s:state_remove() dict
|
function! s:state_remove() dict abort
|
||||||
" Remove all autocmds in group snipmate_changes in the current buffer
|
" Remove all autocmds in group snipmate_changes in the current buffer
|
||||||
unlet! b:snip_state
|
unlet! b:snip_state
|
||||||
silent! au! snipmate_changes * <buffer>
|
silent! au! snipmate_changes * <buffer>
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:state_find_next_stop(backwards) dict
|
function! s:state_find_next_stop(backwards) dict abort
|
||||||
let self.stop_no += a:backwards? -1 : 1
|
let self.stop_no += a:backwards? -1 : 1
|
||||||
while !has_key(self.stops, self.stop_no)
|
while !has_key(self.stops, self.stop_no)
|
||||||
if self.stop_no == self.stop_count
|
if self.stop_no == self.stop_count
|
||||||
|
@ -33,7 +33,7 @@ function! s:state_find_next_stop(backwards) dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Update state information to correspond to the given tab stop
|
" Update state information to correspond to the given tab stop
|
||||||
function! s:state_set_stop(backwards) dict
|
function! s:state_set_stop(backwards) dict abort
|
||||||
call self.find_next_stop(a:backwards)
|
call self.find_next_stop(a:backwards)
|
||||||
let self.cur_stop = self.stops[self.stop_no]
|
let self.cur_stop = self.stops[self.stop_no]
|
||||||
let self.stop_len = (type(self.cur_stop.placeholder) == type(0))
|
let self.stop_len = (type(self.cur_stop.placeholder) == type(0))
|
||||||
|
@ -54,7 +54,7 @@ function! s:state_set_stop(backwards) dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Jump to the next/previous tab stop
|
" Jump to the next/previous tab stop
|
||||||
function! s:state_jump_stop(backwards) dict
|
function! s:state_jump_stop(backwards) dict abort
|
||||||
" Update changes just in case
|
" Update changes just in case
|
||||||
" This seems to be only needed because insert completion does not trigger
|
" This seems to be only needed because insert completion does not trigger
|
||||||
" the CursorMovedI event
|
" the CursorMovedI event
|
||||||
|
@ -72,7 +72,7 @@ function! s:state_jump_stop(backwards) dict
|
||||||
return self.set_stop(a:backwards)
|
return self.set_stop(a:backwards)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:state_remove_nested(...) dict
|
function! s:state_remove_nested(...) dict abort
|
||||||
let id = a:0 ? a:1 : self.stop_no
|
let id = a:0 ? a:1 : self.stop_no
|
||||||
if type(self.stops[id].placeholder) == type([])
|
if type(self.stops[id].placeholder) == type([])
|
||||||
for i in self.stops[id].placeholder
|
for i in self.stops[id].placeholder
|
||||||
|
@ -90,7 +90,7 @@ function! s:state_remove_nested(...) dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Select the placeholder for the current tab stop
|
" Select the placeholder for the current tab stop
|
||||||
function! s:state_select_word() dict
|
function! s:state_select_word() dict abort
|
||||||
let len = self.stop_len
|
let len = self.stop_len
|
||||||
if !len | return '' | endif
|
if !len | return '' | endif
|
||||||
let l = col('.') != 1 ? 'l' : ''
|
let l = col('.') != 1 ? 'l' : ''
|
||||||
|
@ -103,7 +103,7 @@ endfunction
|
||||||
" Update the snippet as text is typed. The self.update_mirrors() function does
|
" Update the snippet as text is typed. The self.update_mirrors() function does
|
||||||
" the actual work.
|
" the actual work.
|
||||||
" If the cursor moves outside of a placeholder, call self.remove()
|
" If the cursor moves outside of a placeholder, call self.remove()
|
||||||
function! s:state_update_changes() dict
|
function! s:state_update_changes() dict abort
|
||||||
let change_len = col('$') - self.prev_len
|
let change_len = col('$') - self.prev_len
|
||||||
let self.changed = self.changed || change_len != 0
|
let self.changed = self.changed || change_len != 0
|
||||||
let self.end_col += change_len
|
let self.end_col += change_len
|
||||||
|
@ -122,7 +122,7 @@ function! s:state_update_changes() dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Actually update the mirrors for any changed text
|
" Actually update the mirrors for any changed text
|
||||||
function! s:state_update_mirrors(change) dict
|
function! s:state_update_mirrors(change) dict abort
|
||||||
let newWordLen = self.end_col - self.start_col
|
let newWordLen = self.end_col - self.start_col
|
||||||
let newWord = strpart(getline('.'), self.start_col - 1, newWordLen)
|
let newWord = strpart(getline('.'), self.start_col - 1, newWordLen)
|
||||||
let changeLen = a:change
|
let changeLen = a:change
|
||||||
|
@ -159,7 +159,7 @@ function! s:state_update_mirrors(change) dict
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:state_find_update_objects(item) dict
|
function! s:state_find_update_objects(item) dict abort
|
||||||
let item = a:item
|
let item = a:item
|
||||||
let item.update_objects = []
|
let item.update_objects = []
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ function! s:state_find_update_objects(item) dict
|
||||||
return item.update_objects
|
return item.update_objects
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:state_update(item, change_len) dict
|
function! s:state_update(item, change_len) dict abort
|
||||||
let item = a:item
|
let item = a:item
|
||||||
if exists('item.update_objects')
|
if exists('item.update_objects')
|
||||||
let to_update = item.update_objects
|
let to_update = item.update_objects
|
||||||
|
|
|
@ -2,7 +2,7 @@ let s:sigil = nr2char(31)
|
||||||
let snipmate#legacy#sigil = s:sigil
|
let snipmate#legacy#sigil = s:sigil
|
||||||
|
|
||||||
" Prepare snippet to be processed by s:BuildTabStops
|
" Prepare snippet to be processed by s:BuildTabStops
|
||||||
function! snipmate#legacy#process_snippet(snip)
|
function! snipmate#legacy#process_snippet(snip) abort
|
||||||
let snippet = a:snip
|
let snippet = a:snip
|
||||||
let esc_bslash = '\%(\\\@<!\%(\\\\\)*\)\@<='
|
let esc_bslash = '\%(\\\@<!\%(\\\\\)*\)\@<='
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ endfunction
|
||||||
" the matches of "$#", to be replaced with the placeholder. This list is
|
" the matches of "$#", to be replaced with the placeholder. This list is
|
||||||
" composed the same way as the parent; the first item is the line number,
|
" composed the same way as the parent; the first item is the line number,
|
||||||
" and the second is the column.
|
" and the second is the column.
|
||||||
function! snipmate#legacy#build_stops(snip, lnum, col, indent)
|
function! snipmate#legacy#build_stops(snip, lnum, col, indent) abort
|
||||||
let stops = {}
|
let stops = {}
|
||||||
let i = 0
|
let i = 0
|
||||||
let withoutVars = substitute(a:snip, s:sigil . '\d\+', '', 'g')
|
let withoutVars = substitute(a:snip, s:sigil . '\d\+', '', 'g')
|
||||||
|
@ -118,7 +118,7 @@ function! snipmate#legacy#build_stops(snip, lnum, col, indent)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Counts occurences of haystack in needle
|
" Counts occurences of haystack in needle
|
||||||
function! s:count(haystack, needle)
|
function! s:count(haystack, needle) abort
|
||||||
let counter = 0
|
let counter = 0
|
||||||
let index = stridx(a:haystack, a:needle)
|
let index = stridx(a:haystack, a:needle)
|
||||||
while index != -1
|
while index != -1
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
" Snippet definition parsing code
|
" Snippet definition parsing code
|
||||||
|
|
||||||
function! s:sfile()
|
function! s:sfile() abort
|
||||||
return expand('<sfile>')
|
return expand('<sfile>')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:parser_proto = {}
|
let s:parser_proto = {}
|
||||||
|
|
||||||
function! s:new_parser(text)
|
function! s:new_parser(text) abort
|
||||||
let ret = copy(s:parser_proto)
|
let ret = copy(s:parser_proto)
|
||||||
let ret.input = a:text
|
let ret.input = a:text
|
||||||
let ret.len = strlen(ret.input)
|
let ret.len = strlen(ret.input)
|
||||||
|
@ -18,12 +18,12 @@ function! s:new_parser(text)
|
||||||
return ret
|
return ret
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parser_advance(...) dict
|
function! s:parser_advance(...) dict abort
|
||||||
let self.pos += a:0 ? a:1 : 1
|
let self.pos += a:0 ? a:1 : 1
|
||||||
let self.next = self.input[self.pos]
|
let self.next = self.input[self.pos]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parser_same(tok) dict
|
function! s:parser_same(tok) dict abort
|
||||||
if self.next == a:tok
|
if self.next == a:tok
|
||||||
call self.advance()
|
call self.advance()
|
||||||
return 1
|
return 1
|
||||||
|
@ -32,7 +32,7 @@ function! s:parser_same(tok) dict
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parser_id() dict
|
function! s:parser_id() dict abort
|
||||||
if self.input[(self.pos):(self.pos+5)] == 'VISUAL'
|
if self.input[(self.pos):(self.pos+5)] == 'VISUAL'
|
||||||
call self.advance(6)
|
call self.advance(6)
|
||||||
return 'VISUAL'
|
return 'VISUAL'
|
||||||
|
@ -45,7 +45,7 @@ function! s:parser_id() dict
|
||||||
return -1
|
return -1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parser_add_var(var) dict
|
function! s:parser_add_var(var) dict abort
|
||||||
let id = a:var[0]
|
let id = a:var[0]
|
||||||
if !has_key(self.vars, id)
|
if !has_key(self.vars, id)
|
||||||
let self.vars[id] = { 'instances' : [] }
|
let self.vars[id] = { 'instances' : [] }
|
||||||
|
@ -53,7 +53,7 @@ function! s:parser_add_var(var) dict
|
||||||
call add(self.vars[id].instances, a:var)
|
call add(self.vars[id].instances, a:var)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parser_var() dict
|
function! s:parser_var() dict abort
|
||||||
let ret = []
|
let ret = []
|
||||||
if self.same('{')
|
if self.same('{')
|
||||||
let id = self.id()
|
let id = self.id()
|
||||||
|
@ -70,7 +70,7 @@ function! s:parser_var() dict
|
||||||
return ret
|
return ret
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parser_varend() dict
|
function! s:parser_varend() dict abort
|
||||||
let ret = []
|
let ret = []
|
||||||
if self.same(':')
|
if self.same(':')
|
||||||
call extend(ret, self.placeholder())
|
call extend(ret, self.placeholder())
|
||||||
|
@ -81,11 +81,11 @@ function! s:parser_varend() dict
|
||||||
return ret
|
return ret
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parser_placeholder() dict
|
function! s:parser_placeholder() dict abort
|
||||||
return self.parse('}')
|
return self.parse('}')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parser_subst() dict
|
function! s:parser_subst() dict abort
|
||||||
let ret = {}
|
let ret = {}
|
||||||
let ret.pat = join(self.text('/', 1))
|
let ret.pat = join(self.text('/', 1))
|
||||||
if self.same('/')
|
if self.same('/')
|
||||||
|
@ -97,14 +97,14 @@ function! s:parser_subst() dict
|
||||||
return ret
|
return ret
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parser_expr() dict
|
function! s:parser_expr() dict abort
|
||||||
let str = join(self.text('`', 1))
|
let str = join(self.text('`', 1))
|
||||||
let ret = eval(str)
|
let ret = eval(str)
|
||||||
call self.same('`')
|
call self.same('`')
|
||||||
return type(ret) == type('') ? ret : string(ret)
|
return type(ret) == type('') ? ret : string(ret)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parser_text(...) dict
|
function! s:parser_text(...) dict abort
|
||||||
let res = []
|
let res = []
|
||||||
let val = ''
|
let val = ''
|
||||||
if a:0 == 2 && a:2
|
if a:0 == 2 && a:2
|
||||||
|
@ -140,7 +140,7 @@ function! s:parser_text(...) dict
|
||||||
return res
|
return res
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:parser_parse(...) dict
|
function! s:parser_parse(...) dict abort
|
||||||
let ret = a:0 ? [] : self.value
|
let ret = a:0 ? [] : self.value
|
||||||
while self.pos < self.len
|
while self.pos < self.len
|
||||||
if self.same('$')
|
if self.same('$')
|
||||||
|
@ -186,7 +186,7 @@ call extend(s:parser_proto, snipmate#util#add_methods(s:sfile(), 'parser',
|
||||||
\ [ 'advance', 'same', 'id', 'add_var', 'var', 'varend',
|
\ [ 'advance', 'same', 'id', 'add_var', 'var', 'varend',
|
||||||
\ 'placeholder', 'subst', 'expr', 'text', 'parse' ]), 'error')
|
\ 'placeholder', 'subst', 'expr', 'text', 'parse' ]), 'error')
|
||||||
|
|
||||||
function! s:indent(count)
|
function! s:indent(count) abort
|
||||||
if &expandtab
|
if &expandtab
|
||||||
let shift = repeat(' ', (&sts > 0) ? &sts : &sw)
|
let shift = repeat(' ', (&sts > 0) ? &sts : &sw)
|
||||||
else
|
else
|
||||||
|
@ -195,7 +195,7 @@ function! s:indent(count)
|
||||||
return repeat(shift, a:count)
|
return repeat(shift, a:count)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:visual_placeholder(var, indent)
|
function! s:visual_placeholder(var, indent) abort
|
||||||
let arg = get(a:var, 1, {})
|
let arg = get(a:var, 1, {})
|
||||||
if type(arg) == type({})
|
if type(arg) == type({})
|
||||||
let pat = get(arg, 'pat', '')
|
let pat = get(arg, 'pat', '')
|
||||||
|
@ -212,7 +212,7 @@ function! s:visual_placeholder(var, indent)
|
||||||
return content
|
return content
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! snipmate#parse#snippet(text)
|
function! snipmate#parse#snippet(text) abort
|
||||||
let parser = s:new_parser(a:text)
|
let parser = s:new_parser(a:text)
|
||||||
call parser.parse()
|
call parser.parse()
|
||||||
unlet! b:snipmate_visual
|
unlet! b:snipmate_visual
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
" The next function was based on s:function and s:add_methods in fugitive
|
" The next function was based on s:function and s:add_methods in fugitive
|
||||||
" <https://github.com/tpope/vim-fugitive/blob/master/plugin/fugitive.vim>
|
" <https://github.com/tpope/vim-fugitive/blob/master/plugin/fugitive.vim>
|
||||||
function! snipmate#util#add_methods(sfile, namespace, methods)
|
function! snipmate#util#add_methods(sfile, namespace, methods) abort
|
||||||
let dict = {}
|
let dict = {}
|
||||||
for name in a:methods
|
for name in a:methods
|
||||||
let dict[name] = function(join([matchstr(a:sfile, '<SNR>\d\+'),
|
let dict[name] = function(join([matchstr(a:sfile, '<SNR>\d\+'),
|
||||||
|
|
|
@ -5,6 +5,6 @@ endif
|
||||||
let s:did_snip_helper = 1
|
let s:did_snip_helper = 1
|
||||||
|
|
||||||
" Automatically closes tag if in xhtml
|
" Automatically closes tag if in xhtml
|
||||||
fun! Close()
|
fun! Close() abort
|
||||||
return stridx(&ft, 'xhtml') == -1 ? '' : ' /'
|
return stridx(&ft, 'xhtml') == -1 ? '' : ' /'
|
||||||
endf
|
endf
|
||||||
|
|
|
@ -105,7 +105,7 @@ let g:snipMate['get_scopes'] = get(g:snipMate, 'get_scopes', funcref#Function('r
|
||||||
|
|
||||||
" Modified from Luc Hermitte's function on StackOverflow
|
" Modified from Luc Hermitte's function on StackOverflow
|
||||||
" <http://stackoverflow.com/a/1534347>
|
" <http://stackoverflow.com/a/1534347>
|
||||||
function! s:grab_visual()
|
function! s:grab_visual() abort
|
||||||
let a_save = @a
|
let a_save = @a
|
||||||
try
|
try
|
||||||
normal! gv"ay
|
normal! gv"ay
|
||||||
|
@ -116,7 +116,7 @@ function! s:grab_visual()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" TODO: Allow specifying an arbitrary snippets file
|
" TODO: Allow specifying an arbitrary snippets file
|
||||||
function! s:load_scopes(bang, ...)
|
function! s:load_scopes(bang, ...) abort
|
||||||
let gb = a:bang ? g: : b:
|
let gb = a:bang ? g: : b:
|
||||||
let gb.snipMate = get(gb, 'snipMate', {})
|
let gb.snipMate = get(gb, 'snipMate', {})
|
||||||
let gb.snipMate.scope_aliases = get(gb.snipMate, 'scope_aliases', {})
|
let gb.snipMate.scope_aliases = get(gb.snipMate, 'scope_aliases', {})
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
function! Setup(snip)
|
function! Setup(snip) abort
|
||||||
return snipMate#expandSnip(join(a:snip, "\n"), 1)
|
return snipMate#expandSnip(join(a:snip, "\n"), 1)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:to_be_file(expected)
|
function! s:to_be_file(expected) abort
|
||||||
return a:expected == getline(1,'$')
|
return a:expected == getline(1,'$')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:to_be_in(item, list)
|
function! s:to_be_in(item, list) abort
|
||||||
return !empty(filter(copy(a:list), 'v:val is a:item'))
|
return !empty(filter(copy(a:list), 'v:val is a:item'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ def _parse_comments(s):
|
||||||
if len(flags) == 0:
|
if len(flags) == 0:
|
||||||
rv.append((text, text, text, ""))
|
rv.append((text, text, text, ""))
|
||||||
# parse 3-part comment, but ignore those with O flag
|
# parse 3-part comment, but ignore those with O flag
|
||||||
elif flags[0] == 's' and 'O' not in flags:
|
elif 's' in flags and 'O' not in flags:
|
||||||
ctriple = []
|
ctriple = []
|
||||||
indent = ""
|
indent = ""
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ def _parse_comments(s):
|
||||||
ctriple.append(indent)
|
ctriple.append(indent)
|
||||||
|
|
||||||
rv.append(ctriple)
|
rv.append(ctriple)
|
||||||
elif flags[0] == 'b':
|
elif 'b' in flags:
|
||||||
if len(text) == 1:
|
if len(text) == 1:
|
||||||
rv.insert(0, (text,text,text, ""))
|
rv.insert(0, (text,text,text, ""))
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
|
|
|
@ -261,36 +261,56 @@ if (${1:/* condition */}) {
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet ns "namespace declaration" b
|
||||||
|
namespace ${1:`!p
|
||||||
|
abspath = os.path.abspath(path)
|
||||||
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
|
if m:
|
||||||
|
› snip.rv = m.group().replace('/', '\\')
|
||||||
|
`};
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet class "Class declaration template" b
|
snippet class "Class declaration template" b
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ${1:`!p
|
||||||
|
abspath = os.path.abspath(path)
|
||||||
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
|
if m:
|
||||||
|
› snip.rv = m.group().replace('/', '\\')
|
||||||
|
`};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ${2:`!p snip.rv=snip.fn.split('.')[0]`}
|
* Class ${1:`!p snip.rv=snip.basename`}
|
||||||
* @author ${3:`!v g:snips_author`}
|
* @author ${2:`!v g:snips_author`}
|
||||||
*/
|
*/
|
||||||
$1class $2
|
class $1
|
||||||
{
|
{
|
||||||
public function ${4:__construct}(${5:$options})
|
|
||||||
{
|
|
||||||
${6:// code}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$0
|
$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet interface "interface declaration template" b
|
snippet interface "Interface declaration template" b
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ${1:`!p
|
||||||
|
abspath = os.path.abspath(path)
|
||||||
|
m = re.search(r'[A-Z].+(?=/)', abspath)
|
||||||
|
if m:
|
||||||
|
› snip.rv = m.group().replace('/', '\\')
|
||||||
|
`};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface ${1:`!p snip.rv=snip.fn.split('.')[0]`}
|
* Interface ${1:`!p snip.rv=snip.basename`}
|
||||||
* @author ${2:`!v g:snips_author`}
|
* @author ${2:`!v g:snips_author`}
|
||||||
*/
|
*/
|
||||||
interface $1
|
interface $1
|
||||||
{
|
{
|
||||||
public function ${3:__construct}(${4:$options})
|
› public function ${3:someFunction}();$4
|
||||||
{
|
|
||||||
${5:// code}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$0
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet construct "__construct()" b
|
snippet construct "__construct()" b
|
||||||
/**
|
/**
|
||||||
* @param $2mixed ${1/, /\n * \@param mixed /g}
|
* @param $2mixed ${1/, /\n * \@param mixed /g}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
" surround.vim - Surroundings
|
" surround.vim - Surroundings
|
||||||
" Author: Tim Pope <http://tpo.pe/>
|
" Author: Tim Pope <http://tpo.pe/>
|
||||||
" Version: 2.0
|
" Version: 2.1
|
||||||
" GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim
|
" GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim
|
||||||
|
|
||||||
if exists("g:loaded_surround") || &cp || v:version < 700
|
if exists("g:loaded_surround") || &cp || v:version < 700
|
||||||
|
@ -457,7 +457,7 @@ function! s:dosurround(...) " {{{1
|
||||||
if newchar == ""
|
if newchar == ""
|
||||||
silent! call repeat#set("\<Plug>Dsurround".char,scount)
|
silent! call repeat#set("\<Plug>Dsurround".char,scount)
|
||||||
else
|
else
|
||||||
silent! call repeat#set("\<Plug>C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:inpur,scount)
|
silent! call repeat#set("\<Plug>C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:input,scount)
|
||||||
endif
|
endif
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ set grepprg=/bin/grep\ -nH
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" => Nerd Tree
|
" => Nerd Tree
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
let g:NERDTreeWinPos = "right"
|
||||||
map <leader>nn :NERDTreeToggle<cr>
|
map <leader>nn :NERDTreeToggle<cr>
|
||||||
map <leader>nb :NERDTreeFromBookmark
|
map <leader>nb :NERDTreeFromBookmark
|
||||||
map <leader>nf :NERDTreeFind<cr>
|
map <leader>nf :NERDTreeFind<cr>
|
||||||
|
|
Loading…
Reference in a new issue