diff --git a/sources_non_forked/lightline.vim/.travis.yml b/sources_non_forked/lightline.vim/.travis.yml index 9c8184a2..e7e41c51 100644 --- a/sources_non_forked/lightline.vim/.travis.yml +++ b/sources_non_forked/lightline.vim/.travis.yml @@ -16,8 +16,7 @@ cache: - $HOME/vim-$VIM_VERSION env: - - VIM_VERSION=8.1.1775 - - VIM_VERSION=8.1.1700 + - VIM_VERSION=8.2.0000 - VIM_VERSION=8.1.0000 - VIM_VERSION=8.0.0000 - VIM_VERSION=7.4 diff --git a/sources_non_forked/lightline.vim/README.md b/sources_non_forked/lightline.vim/README.md index d47c02eb..f4061bd5 100644 --- a/sources_non_forked/lightline.vim/README.md +++ b/sources_non_forked/lightline.vim/README.md @@ -87,6 +87,13 @@ For screenshots of all available colorshemes, see [this file](colorscheme.md). 2. Install with `:PlugInstall`. +### [dein.vim](https://github.com/Shougo/dein.vim) +1. Add the following configuration to your `.vimrc`. + + call dein#add('itchyny/lightline.vim') + +2. Install with `:call dein#install()` + ## Introduction After installing this plugin, you restart the editor and will get a cool statusline. ![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/1.png) @@ -323,7 +330,7 @@ let g:lightline = { \ } function! LightlineMode() - return expand('%:t') ==# '__Tagbar__' ? 'Tagbar': + return expand('%:t') =~# '^__Tagbar__' ? 'Tagbar': \ expand('%:t') ==# 'ControlP' ? 'CtrlP' : \ &filetype ==# 'unite' ? 'Unite' : \ &filetype ==# 'vimfiler' ? 'VimFiler' : @@ -377,6 +384,40 @@ endfunction You can control the visibility and contents by writing simple functions. Now you notice how much function component is important for the configurability of lightline.vim. +### more tips +#### Mode names are too long. Can I use shorter mode names? +Yes, configure `g:lightline.mode_map`. +```vim +let g:lightline = { + \ 'mode_map': { + \ 'n' : 'N', + \ 'i' : 'I', + \ 'R' : 'R', + \ 'v' : 'V', + \ 'V' : 'VL', + \ "\": 'VB', + \ 'c' : 'C', + \ 's' : 'S', + \ 'S' : 'SL', + \ "\": 'SB', + \ 't': 'T', + \ }, + \ } +``` + +#### How can I truncate the components from the right in narrow windows? +Please include `%<` to one of the right components. +```vim +let g:lightline = { + \ 'component': { + \ 'lineinfo': '%3l:%-2v%<', + \ }, + \ } +``` + +#### Where can I find the default components? +See `:h g:lightline.component`. + ## Note for developers of other plugins Appearance consistency matters. diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index cf64523b..5bb51eee 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -4,7 +4,7 @@ Version: 0.1 Author: itchyny (https://github.com/itchyny) License: MIT License Repository: https://github.com/itchyny/lightline.vim -Last Change: 2019/08/14 10:46:55. +Last Change: 2019/12/27 18:23:29. CONTENTS *lightline-contents* @@ -674,11 +674,11 @@ In order to define your own component: \ } \ } function! LightlineFilename() - return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') . - \ (&ft == 'vimfiler' ? vimfiler#get_status_string() : - \ &ft == 'unite' ? unite#get_status_string() : - \ '' != expand('%:t') ? expand('%:t') : '[No Name]') . - \ ('' != LightlineModified() ? ' ' . LightlineModified() : '') + return (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . + \ (&ft ==# 'vimfiler' ? vimfiler#get_status_string() : + \ &ft ==# 'unite' ? unite#get_status_string() : + \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]') . + \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineReadonly() return &ft !~? 'help' && &readonly ? 'RO' : '' @@ -728,18 +728,18 @@ A nice example for non-patched font users. \ } \ } function! LightlineModified() - return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-' + return &ft =~# 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-' endfunction function! LightlineReadonly() return &ft !~? 'help\|vimfiler' && &readonly ? 'RO' : '' endfunction function! LightlineFilename() - return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') . - \ (&ft == 'vimfiler' ? vimfiler#get_status_string() : - \ &ft == 'unite' ? unite#get_status_string() : - \ &ft == 'vimshell' ? vimshell#get_status_string() : - \ '' != expand('%:t') ? expand('%:t') : '[No Name]') . - \ ('' != LightlineModified() ? ' ' . LightlineModified() : '') + return (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . + \ (&ft ==# 'vimfiler' ? vimfiler#get_status_string() : + \ &ft ==# 'unite' ? unite#get_status_string() : + \ &ft ==# 'vimshell' ? vimshell#get_status_string() : + \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]') . + \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineFugitive() if &ft !~? 'vimfiler' && exists('*fugitive#head') @@ -763,18 +763,18 @@ A nice example for |vim-powerline| font users: \ 'subseparator': { 'left': '⮁', 'right': '⮃' } \ } function! LightlineModified() - return &ft =~ 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-' + return &ft =~# 'help\|vimfiler' ? '' : &modified ? '+' : &modifiable ? '' : '-' endfunction function! LightlineReadonly() return &ft !~? 'help\|vimfiler' && &readonly ? '⭤' : '' endfunction function! LightlineFilename() - return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') . - \ (&ft == 'vimfiler' ? vimfiler#get_status_string() : - \ &ft == 'unite' ? unite#get_status_string() : - \ &ft == 'vimshell' ? vimshell#get_status_string() : - \ '' != expand('%:t') ? expand('%:t') : '[No Name]') . - \ ('' != LightlineModified() ? ' ' . LightlineModified() : '') + return (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . + \ (&ft ==# 'vimfiler' ? vimfiler#get_status_string() : + \ &ft ==# 'unite' ? unite#get_status_string() : + \ &ft ==# 'vimshell' ? vimshell#get_status_string() : + \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]') . + \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineFugitive() if &ft !~? 'vimfiler' && exists('*fugitive#head') @@ -815,7 +815,7 @@ For users who uses lots of plugins: \ } function! LightlineModified() - return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-' + return &ft ==# 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-' endfunction function! LightlineReadonly() @@ -824,15 +824,14 @@ For users who uses lots of plugins: function! LightlineFilename() let fname = expand('%:t') - return fname == 'ControlP' && has_key(g:lightline, 'ctrlp_item') ? g:lightline.ctrlp_item : - \ fname == '__Tagbar__' ? g:lightline.fname : - \ fname =~ '__Gundo\|NERD_tree' ? '' : - \ &ft == 'vimfiler' ? vimfiler#get_status_string() : - \ &ft == 'unite' ? unite#get_status_string() : - \ &ft == 'vimshell' ? vimshell#get_status_string() : - \ ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') . - \ ('' != fname ? fname : '[No Name]') . - \ ('' != LightlineModified() ? ' ' . LightlineModified() : '') + return fname ==# 'ControlP' && has_key(g:lightline, 'ctrlp_item') ? g:lightline.ctrlp_item : + \ fname =~# '^__Tagbar__\|__Gundo\|NERD_tree' ? '' : + \ &ft ==# 'vimfiler' ? vimfiler#get_status_string() : + \ &ft ==# 'unite' ? unite#get_status_string() : + \ &ft ==# 'vimshell' ? vimshell#get_status_string() : + \ (LightlineReadonly() !=# '' ? LightlineReadonly() . ' ' : '') . + \ (fname !=# '' ? fname : '[No Name]') . + \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineFugitive() @@ -861,19 +860,19 @@ For users who uses lots of plugins: function! LightlineMode() let fname = expand('%:t') - return fname == '__Tagbar__' ? 'Tagbar' : - \ fname == 'ControlP' ? 'CtrlP' : - \ fname == '__Gundo__' ? 'Gundo' : - \ fname == '__Gundo_Preview__' ? 'Gundo Preview' : - \ fname =~ 'NERD_tree' ? 'NERDTree' : - \ &ft == 'unite' ? 'Unite' : - \ &ft == 'vimfiler' ? 'VimFiler' : - \ &ft == 'vimshell' ? 'VimShell' : + return fname =~# '^__Tagbar__' ? 'Tagbar' : + \ fname ==# 'ControlP' ? 'CtrlP' : + \ fname ==# '__Gundo__' ? 'Gundo' : + \ fname ==# '__Gundo_Preview__' ? 'Gundo Preview' : + \ fname =~# 'NERD_tree' ? 'NERDTree' : + \ &ft ==# 'unite' ? 'Unite' : + \ &ft ==# 'vimfiler' ? 'VimFiler' : + \ &ft ==# 'vimshell' ? 'VimShell' : \ winwidth(0) > 60 ? lightline#mode() : '' endfunction function! CtrlPMark() - if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item') + if expand('%:t') ==# 'ControlP' && has_key(g:lightline, 'ctrlp_item') call lightline#link('iR'[g:lightline.ctrlp_regex]) return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item \ , g:lightline.ctrlp_next], 0) @@ -902,7 +901,6 @@ For users who uses lots of plugins: let g:tagbar_status_func = 'TagbarStatusFunc' function! TagbarStatusFunc(current, sort, fname, ...) abort - let g:lightline.fname = a:fname return lightline#statusline(0) endfunction diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index fe5d51aa..cec006c9 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -7,6 +7,9 @@ in an unordered list. The format is: - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> +#### 6.4 +- **.1**: Ensure backward compatibility. v:t_func is not available before Vim 8.0 (Phil Runninger) +- **.0**: Allow use of function references as callbacks (HiPhish) [#1067](https://github.com/scrooloose/nerdtree/pull/1067) #### 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 diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index e88a6802..be0011d2 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -1315,6 +1315,10 @@ following code conventions are used: See this blog post for more details: http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html +A number of API functions take a callback argument to call. The callback can +be either a string with the name of a function to call, or a |Funcref| object +which will be called directly. + ------------------------------------------------------------------------------ 4.1. Key map API *NERDTreeKeymapAPI* diff --git a/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim b/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim index 584da1f1..6714ee41 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim @@ -66,7 +66,7 @@ endfunction "FUNCTION: KeyMap.invoke() {{{1 "Call the KeyMaps callback function function! s:KeyMap.invoke(...) - let Callback = function(self.callback) + let Callback = type(self.callback) == type(function("tr")) ? self.callback : function(self.callback) if a:0 call Callback(a:1) else diff --git a/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim b/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim index 92c1bbbf..8a74bb1a 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim @@ -79,7 +79,7 @@ endfunction "specified function! s:MenuItem.enabled() if self.isActiveCallback != -1 - return {self.isActiveCallback}() + return type(self.isActiveCallback) == type(function("tr")) ? self.isActiveCallback() : {self.isActiveCallback}() endif return 1 endfunction @@ -94,7 +94,11 @@ function! s:MenuItem.execute() call mc.showMenu() else if self.callback != -1 - call {self.callback}() + if type(self.callback) == type(function("tr")) + call self.callback() + else + call {self.callback}() + endif endif endif endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim index d24fc8f8..dfd48b33 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim @@ -14,8 +14,9 @@ endfunction function! s:Notifier.NotifyListeners(event, path, nerdtree, params) let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params) - for listener in s:Notifier.GetListenersForEvent(a:event) - call {listener}(event) + for Listener in s:Notifier.GetListenersForEvent(a:event) + let Callback = type(Listener) == type(function("tr")) ? Listener : function(Listener) + call Callback(event) endfor endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index ccb94238..4ececf9e 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -500,8 +500,9 @@ function! s:Path.ignore(nerdtree) endif endfor - for callback in g:NERDTree.PathFilters() - if {callback}({'path': self, 'nerdtree': a:nerdtree}) + for Callback in g:NERDTree.PathFilters() + let Callback = type(Callback) == type(function("tr")) ? Callback : function(Callback) + if Callback({'path': self, 'nerdtree': a:nerdtree}) return 1 endif endfor diff --git a/sources_non_forked/rust.vim/doc/rust.txt b/sources_non_forked/rust.vim/doc/rust.txt index 9ab018ed..c3efb461 100644 --- a/sources_non_forked/rust.vim/doc/rust.txt +++ b/sources_non_forked/rust.vim/doc/rust.txt @@ -128,15 +128,14 @@ g:rustfmt_autosave~ *g:rustfmt_autosave_if_config_present* g:rustfmt_autosave_if_config_present~ - Set this option to 1 to to have *b:rustfmt_autosave* be set automatically - if a `rustfmt.toml` file is present in any parent directly leading to + Set this option to 1 to have *b:rustfmt_autosave* be set automatically + if a `rustfmt.toml` file is present in any parent directly leading to the file being edited. If not set, default to 0: > - let g:rustfmt_autosave_if_config_present = 0 < This is useful to have `rustfmt` only execute on save, on projects that have `rustfmt.toml` configuration. - + There is also a buffer-local b:rustfmt_autosave_if_config_present that can be set for the same purpose, which can overrides the global setting. @@ -161,6 +160,7 @@ g:rustfmt_emit_files~ provided) instead of '--write-mode=overwrite'. > let g:rustfmt_emit_files = 0 + *g:rust_playpen_url* g:rust_playpen_url~ Set this option to override the url for the playpen to use: > @@ -192,9 +192,9 @@ Integration with Syntastic *rust-syntastic* -------------------------- This plugin automatically integrates with the Syntastic checker. There are two -checkers provided: 'rustc', and 'cargo'. The later invokes 'Cargo' in order to +checkers provided: 'rustc', and 'cargo'. The latter invokes 'Cargo' in order to build code, and the former delivers a single edited '.rs' file as a compilation -target directly to the Rust compiler, `rustc`. +target directly to the Rust compiler, `rustc`. Because Cargo is almost exclusively being used for building Rust code these days, 'cargo' is the default checker. > @@ -354,7 +354,8 @@ Playpen integration |g:rust_clip_command| is the command to run to copy the playpen url to the clipboard of your system. -Evaulation of a single Rust file + +Evaluation of a single Rust file -------------------------------- NOTE: These commands are useful only when working with standalone Rust files, diff --git a/sources_non_forked/typescript-vim/README.md b/sources_non_forked/typescript-vim/README.md index fdce308d..c4873812 100644 --- a/sources_non_forked/typescript-vim/README.md +++ b/sources_non_forked/typescript-vim/README.md @@ -11,11 +11,16 @@ and other features for TypeScript editing. Install ------- -From Vim 8 onward, the plugin can be installed as simply as: +From Vim 8 onward, the plugin can be installed as simply as (Unix/Mac): ``` git clone https://github.com/leafgarland/typescript-vim.git ~/.vim/pack/typescript/start/typescript-vim ``` +On Windows/Powershell, use the following: +``` +git clone https://github.com/leafgarland/typescript-vim.git $home/vimfiles/pack/typescript/start/typescript-vim +``` + For older versions of Vim, the simplest way to install is via a Vim add-in manager such as [Plug](https://github.com/junegunn/vim-plug), [Vundle](https://github.com/gmarik/vundle) or diff --git a/sources_non_forked/typescript-vim/syntax/typescript.vim b/sources_non_forked/typescript-vim/syntax/typescript.vim index 09f2ef68..705016d1 100644 --- a/sources_non_forked/typescript-vim/syntax/typescript.vim +++ b/sources_non_forked/typescript-vim/syntax/typescript.vim @@ -87,22 +87,22 @@ syntax keyword typescriptPrototype contained prototype """""""""""""""""""""""" if get(g:, 'typescript_ignore_browserwords', 0) syntax keyword typescriptBrowserObjects window navigator screen history location - + syntax keyword typescriptDOMObjects document event HTMLElement Anchor Area Base Body Button Form Frame Frameset Image Link Meta Option Select Style Table TableCell TableRow Textarea syntax keyword typescriptDOMMethods contained createTextNode createElement insertBefore replaceChild removeChild appendChild hasChildNodes cloneNode normalize isSupported hasAttributes getAttribute setAttribute removeAttribute getAttributeNode setAttributeNode removeAttributeNode getElementsByTagName hasAttribute getElementById adoptNode close compareDocumentPosition createAttribute createCDATASection createComment createDocumentFragment createElementNS createEvent createExpression createNSResolver createProcessingInstruction createRange createTreeWalker elementFromPoint evaluate getBoxObjectFor getElementsByClassName getSelection getUserData hasFocus importNode syntax keyword typescriptDOMProperties contained nodeName nodeValue nodeType parentNode childNodes firstChild lastChild previousSibling nextSibling attributes ownerDocument namespaceURI prefix localName tagName - + syntax keyword typescriptAjaxObjects XMLHttpRequest syntax keyword typescriptAjaxProperties contained readyState responseText responseXML statusText syntax keyword typescriptAjaxMethods contained onreadystatechange abort getAllResponseHeaders getResponseHeader open send setRequestHeader - + syntax keyword typescriptPropietaryObjects ActiveXObject syntax keyword typescriptPropietaryMethods contained attachEvent detachEvent cancelBubble returnValue - + syntax keyword typescriptHtmlElemProperties contained className clientHeight clientLeft clientTop clientWidth dir href id innerHTML lang length offsetHeight offsetLeft offsetParent offsetTop offsetWidth scrollHeight scrollLeft scrollTop scrollWidth style tabIndex target title - + syntax keyword typescriptEventListenerKeywords contained blur click focus mouseover mouseout load item - + syntax keyword typescriptEventListenerMethods contained scrollIntoView addEventListener dispatchEvent removeEventListener preventDefault stopPropagation endif " }}} @@ -267,7 +267,7 @@ if version >= 508 || !exists("did_typescript_syn_inits") HiLink typescriptStorageClass StorageClass HiLink typescriptRepeat Repeat HiLink typescriptStatement Statement - HiLink typescriptFuncKeyword Function + HiLink typescriptFuncKeyword Keyword HiLink typescriptMessage Keyword HiLink typescriptDeprecated Exception HiLink typescriptError Error diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index f29aeac8..302d074b 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -934,7 +934,7 @@ function! fugitive#Find(object, ...) abort let commit = matchstr(s:ChompDefault('', [dir, 'merge-base'] + commits + ['--']), '\<[0-9a-f]\{40,\}\>') endif if commit !~# '^[0-9a-f]\{40,\}$' - let commit = matchstr(s:ChompDefault('', [dir, 'rev-parse', '--verify', commit, '--']), '\<[0-9a-f]\{40,\}\>') + let commit = matchstr(s:ChompDefault('', [dir, 'rev-parse', '--verify', commit . (len(file) ? '^{}' : ''), '--']), '\<[0-9a-f]\{40,\}\>') endif if len(commit) let f = 'fugitive://' . dir . '//' . commit . file @@ -1559,7 +1559,7 @@ function! s:ReplaceCmd(cmd) abort endtry call delete(temp) if s:cpath(fnamemodify(bufname('$'), ':p'), temp) - silent execute 'bwipeout '.bufnr('$') + silent! execute 'bwipeout '.bufnr('$') endif endtry endfunction diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index fbdb0e9e..e98f437d 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -304,6 +304,9 @@ function! s:ProjectionistDetect() abort endif endfunction +if v:version + has('patch061') < 703 + runtime! autoload/fugitive.vim +endif let g:io_fugitive = { \ 'simplify': function('fugitive#simplify'), \ 'resolve': function('fugitive#resolve'), diff --git a/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets b/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets index 7b39094c..eacc8fc8 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets @@ -67,7 +67,8 @@ endsnippet snippet exec "Exec resource type" b exec { '${1:command}': - refreshonly => true, + command => "${2:$1}", + user => "${3:root}", } endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/sh.snippets b/sources_non_forked/vim-snippets/UltiSnips/sh.snippets index 9bacc725..37bf0c4f 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/sh.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/sh.snippets @@ -29,14 +29,14 @@ snippet #! "#!/usr/bin/env (!env)" b `!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n" ` endsnippet -snippet sbash "safe bash options" +snippet sbash "safe bash options" b #!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' `!p snip.rv ='\n\n' ` endsnippet -snippet temp "Tempfile" +snippet temp "Tempfile" b ${1:TMPFILE}="$(mktemp -t ${3:--suffix=${4:.SUFFIX}} ${2:`!p snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled" `}.XXXXXX)" @@ -44,27 +44,27 @@ ${5:${6/(.+)/trap "/}${6:rm -f '$${1/.*\s//}'}${6/(.+)/" 0 # EXIT\ endsnippet -snippet case "case .. esac (case)" +snippet /case|sw(itch)?/ "case .. esac (case)" rb case ${1:word} in ${2:pattern} ) - $0;; + ${0:${VISUAL}};; esac endsnippet -snippet elif "elif .. (elif)" +snippet elif "elif .. (elif)" b elif ${2:[[ ${1:condition} ]]}; then - ${0:#statements} + ${0:${VISUAL}} endsnippet -snippet for "for ... done (for)" +snippet for "for ... done (for)" b for (( i = 0; i < ${1:10}; i++ )); do - ${0:#statements} + ${0:${VISUAL}} done endsnippet -snippet forin "for ... in ... done (forin)" +snippet forin "for ... in ... done (forin)" b for ${1:i}${2/.+/ in /}${2:words}; do - ${0:#statements} + ${0:${VISUAL}} done endsnippet @@ -74,21 +74,21 @@ snippet here "here document (here)" ${1/['"`](.+)['"`]/$1/} endsnippet -snippet if "if ... then (if)" +snippet if "if ... then (if)" b if ${2:[[ ${1:condition} ]]}; then - ${0:#statements} + ${0:${VISUAL}} fi endsnippet -snippet until "until ... (done)" +snippet until "until ... (done)" b until ${2:[[ ${1:condition} ]]}; do - ${0:#statements} + ${0:${VISUAL}} done endsnippet -snippet while "while ... (done)" +snippet /wh(ile)?/ "while ... (done)" rb while ${2:[[ ${1:condition} ]]}; do - ${0:#statements} + ${0:${VISUAL}} done endsnippet