mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated vimrc
This commit is contained in:
@ -31,6 +31,7 @@ additional contributions from:
|
||||
* [MicahElliott](https://github.com/MicahElliott)
|
||||
* [mikeastock](https://github.com/mikeastock)
|
||||
* [muffinresearch](https://github.com/muffinresearch)
|
||||
* [munyari](https://github.com/munyari)
|
||||
* [pielgrzym](https://github.com/pielgrzym)
|
||||
* [pose](https://github.com/pose)
|
||||
* [r00k](https://github.com/r00k)
|
||||
|
@ -39,12 +39,12 @@ looking at the [vim-snippets][vim-snippets] repository.
|
||||
* Using [Vundle][vundle], add the following to your `vimrc` then run
|
||||
`:PluginInstall`
|
||||
|
||||
Plugin "MarcWeber/vim-addon-mw-utils"
|
||||
Plugin "tomtom/tlib_vim"
|
||||
Plugin "garbas/vim-snipmate"
|
||||
Plugin 'MarcWeber/vim-addon-mw-utils'
|
||||
Plugin 'tomtom/tlib_vim'
|
||||
Plugin 'garbas/vim-snipmate'
|
||||
|
||||
" Optional:
|
||||
Plugin "honza/vim-snippets"
|
||||
Plugin 'honza/vim-snippets'
|
||||
|
||||
## FAQ ##
|
||||
|
||||
@ -67,7 +67,7 @@ Try all of the following:
|
||||
path of the snippet file or the scope explicitly loaded.
|
||||
|
||||
* Check if any snippets from your snippets file are available. This can be done
|
||||
with the "show available snips` map, by default bound to `<C-R><Tab>` in
|
||||
with the "show available snips" map, by default bound to `<C-R><Tab>` in
|
||||
insert mode.
|
||||
|
||||
If all of the above check out, please open an issue stating your Vim version,
|
||||
@ -98,19 +98,13 @@ does `:SnipMateLoadScope rails` when editing a Rails project for example.
|
||||
|
||||
## Release Notes ##
|
||||
|
||||
### Master ###
|
||||
### 0.88 - 2015-04-04 ###
|
||||
|
||||
* Implement simple caching
|
||||
* Remove expansion guards
|
||||
* Fix bug with mirrors in the first column
|
||||
* Fix bug with tabs in indents ([#143][143])
|
||||
* Fix bug with mirrors in placeholders
|
||||
* Fix reading single snippet files
|
||||
* Fix the use of the visual map at the end of a line
|
||||
* Add `:SnipMateLoadScope` command and buffer-local scope aliases
|
||||
* Load `<scope>_*.snippets` files
|
||||
* Indent visual placeholder expansions and remove extraneous lines ([#177][177]
|
||||
and [#178][178])
|
||||
* Use CursorMoved autocmd events entirely
|
||||
|
||||
* The nested branch has been merged
|
||||
* A new snippet parser has been added. The g:snipmate.version as well as
|
||||
@ -127,6 +121,16 @@ does `:SnipMateLoadScope rails` when editing a Rails project for example.
|
||||
the snippet file
|
||||
* Otherwise, SnipMate tries to preserve all snippets loaded
|
||||
|
||||
* Fix bug with mirrors in the first column
|
||||
* Fix bug with tabs in indents ([#143][143])
|
||||
* Fix bug with mirrors in placeholders
|
||||
* Fix reading single snippet files
|
||||
* Fix the use of the visual map at the end of a line
|
||||
* Fix expansion of stops containing only the zero tab stop
|
||||
* Remove select mode mappings
|
||||
* Indent visual placeholder expansions and remove extraneous lines ([#177][177]
|
||||
and [#178][178])
|
||||
|
||||
### 0.87 - 2014-01-04 ###
|
||||
|
||||
* Stop indenting empty lines when expanding snippets
|
||||
|
@ -410,10 +410,10 @@ function! snipMate#OpenSnippetFiles() abort
|
||||
let exists = []
|
||||
let notexists = []
|
||||
for scope in s:AddScopeAliases(snipMate#ScopesByFile())
|
||||
let files += split(s:snippet_filenames(scope, ''))
|
||||
let files += s:snippet_filenames(scope, '')
|
||||
endfor
|
||||
call filter(files, "v:val !~# '\\*'")
|
||||
for path in split(g:snipMate.snippet_dirs, ',')
|
||||
for path in g:snipMate.snippet_dirs
|
||||
let fullpaths = map(copy(files), 'printf("%s/%s", path, v:val)')
|
||||
let exists += filter(copy(fullpaths), 'filereadable(v:val)')
|
||||
let notexists += map(filter(copy(fullpaths),
|
||||
|
@ -25,7 +25,8 @@ function! snipmate#legacy#process_snippet(snip) abort
|
||||
let isexp = 0
|
||||
for i in snip
|
||||
if isexp
|
||||
call add(new, substitute(eval(i), "\n\\%$", '', ''))
|
||||
call add(new, substitute(snipmate#util#eval(i),
|
||||
\ "\n\\%$", '', ''))
|
||||
else
|
||||
call add(new, i)
|
||||
endif
|
||||
@ -86,9 +87,9 @@ function! snipmate#legacy#build_stops(snip, lnum, col, indent) abort
|
||||
|
||||
let stops[i] = {}
|
||||
let stops[i].line = a:lnum + s:count(beforeTabStop, "\n")
|
||||
let stops[i].col = a:indent + len(matchstr(withoutOthers, '.*\(\n\|^\)\zs.*\ze'.s:sigil .'{'.i.'\D'))
|
||||
let stops[i].placeholder = 0
|
||||
let stops[i].mirrors = []
|
||||
let stops[i].col = a:indent + len(matchstr(withoutOthers, '\_^.*\ze'.s:sigil .'{'.i.'\D'))
|
||||
let stops[i].placeholder = 0
|
||||
let stops[i].mirrors = []
|
||||
if stops[i].line == a:lnum
|
||||
let stops[i].col += a:col
|
||||
endif
|
||||
|
@ -99,9 +99,8 @@ endfunction
|
||||
|
||||
function! s:parser_expr() dict abort
|
||||
let str = join(self.text('`', 1))
|
||||
let ret = eval(str)
|
||||
call self.same('`')
|
||||
return type(ret) == type('') ? ret : string(ret)
|
||||
return snipmate#util#eval(str)
|
||||
endfunction
|
||||
|
||||
function! s:parser_text(...) dict abort
|
||||
|
@ -8,3 +8,15 @@ function! snipmate#util#add_methods(sfile, namespace, methods) abort
|
||||
endfor
|
||||
return dict
|
||||
endfunction
|
||||
|
||||
function! snipmate#util#eval(arg)
|
||||
try
|
||||
let ret = eval(a:arg)
|
||||
catch
|
||||
echohl ErrorMsg
|
||||
echom 'SnipMate:Expression: ' . v:exception
|
||||
echohl None
|
||||
let ret = ''
|
||||
endtry
|
||||
return type(ret) == type('') ? ret : string(ret)
|
||||
endfunction
|
||||
|
@ -177,6 +177,8 @@ tab stop, >
|
||||
:imap <C-J> <Plug>snipMateNextOrTrigger
|
||||
:smap <C-J> <Plug>snipMateNextOrTrigger
|
||||
|
||||
Note: The noremap variants of the map commands must NOT be used.
|
||||
|
||||
The list of possible <Plug> mappings is as follows:
|
||||
|
||||
<Plug>snipMateNextOrTrigger Default: <Tab> Mode: Insert, Select
|
||||
@ -259,6 +261,10 @@ specified with a version line, e.g.: >
|
||||
|
||||
version 1
|
||||
|
||||
Specification of a version applies to the snippets following it. Multiple
|
||||
version specifications can appear in a single file to intermix version 0 and
|
||||
version 1 snippets.
|
||||
|
||||
Comments can be made in .snippets files by starting a line with a # character.
|
||||
However these can't be used inside of snippet definitions: >
|
||||
|
||||
@ -374,6 +380,9 @@ is expanded. Expressions are specified inside backticks: >
|
||||
snippet date
|
||||
`strftime("%Y-%m-%d")`
|
||||
|
||||
If the expression results in any Vim error, the error will be displayed (or
|
||||
found in :messages) and the result of the expression will be the empty string.
|
||||
|
||||
Filename([{expr}] [, {defaultText}]) *SnipMate-Filename()*
|
||||
|
||||
Since the current filename is used often in snippets, a default function
|
||||
@ -423,17 +432,14 @@ SNIPPET SOURCES *SnipMate-snippet-sources*
|
||||
|
||||
SnipMate is configurable.
|
||||
|
||||
plugin/SnipMate.vim assigns three important keys: >
|
||||
plugin/SnipMate.vim assigns a couple important keys: >
|
||||
|
||||
" default implementation collecting snippets by handlers
|
||||
let g:SnipMate['get_snippets'] = SnipMate#GetSnippets
|
||||
" default handler:
|
||||
let g:SnipMateSources['default'] = SnipMate#DefaultPool
|
||||
" default directories containing snippets:
|
||||
let g:SnipMate['snippet_dirs']
|
||||
\ = funcref#Function('return split(&runtimepath,",")')
|
||||
|
||||
You can override all of those settings.
|
||||
You can override both of those settings.
|
||||
|
||||
You can see that the default set of snippets is determined by Vim's 'rtp'.
|
||||
|
||||
@ -493,6 +499,42 @@ Perhaps some of these features will be added in a later release.
|
||||
==============================================================================
|
||||
CHANGELOG *SnipMate-changelog*
|
||||
|
||||
0.88 - 2015-04-04
|
||||
-----------------
|
||||
|
||||
* Implement simple caching
|
||||
* Remove expansion guards
|
||||
* Add `:SnipMateLoadScope` command and buffer-local scope aliases
|
||||
* Load `<scope>_*.snippets` files
|
||||
* Use CursorMoved autocmd events entirely
|
||||
|
||||
* The nested branch has been merged
|
||||
* A new snippet parser has been added. The g:snipmate.version as well as
|
||||
version lines in snippet files determines which is used
|
||||
* The new parser supports tab stops placed within placeholders,
|
||||
substitutions, non-consecutive stop numbers, and fewer ambiguities
|
||||
* The stop jumping code has been updated
|
||||
* Tests have been added for the jumping code and the new parser
|
||||
|
||||
* The override branch has been merged
|
||||
* The g:snipMate.override option is added. When enabled, if two snippets
|
||||
share the same name, the later-loaded one is kept and the other discarded
|
||||
* Override behavior can be enabled on a per-snippet basis with a bang (!) in
|
||||
the snippet file
|
||||
* Otherwise, SnipMate tries to preserve all snippets loaded
|
||||
|
||||
* Fix bug with mirrors in the first column
|
||||
* Fix bug with tabs in indents
|
||||
<http://github.com/garbas/vim-snipmate/issues/143>
|
||||
* Fix bug with mirrors in placeholders
|
||||
* Fix reading single snippet files
|
||||
* Fix the use of the visual map at the end of a line
|
||||
* Fix expansion of stops containing only the zero tab stop
|
||||
* Remove select mode mappings
|
||||
* Indent visual placeholder expansions and remove extraneous lines
|
||||
<http://github.com/garbas/vim-snipmate/issues/177>
|
||||
<http://github.com/garbas/vim-snipmate/issues/178>
|
||||
|
||||
0.87 - 2014-01-04
|
||||
-----------------
|
||||
|
||||
|
@ -90,8 +90,7 @@ endif
|
||||
|
||||
let g:snipMate['get_snippets'] = get(g:snipMate, 'get_snippets', funcref#Function("snipMate#GetSnippets"))
|
||||
|
||||
" List of paths where snippets/ dirs are located, or a function returning such
|
||||
" a list
|
||||
" List of paths where snippets/ dirs are located
|
||||
let g:snipMate['snippet_dirs'] = get(g:snipMate, 'snippet_dirs', split(&rtp, ','))
|
||||
if type(g:snipMate['snippet_dirs']) != type([])
|
||||
echohl WarningMsg
|
||||
|
Reference in New Issue
Block a user