diff --git a/.gitignore b/.gitignore index d0299cf..ea1c065 100644 --- a/.gitignore +++ b/.gitignore @@ -140,3 +140,5 @@ i3/config *.sqlite i3/scripts/dmenu/database.sqlite albert/*.db +vim/plugged/ +vim/autoload/plug.vim diff --git a/.gitmodules b/.gitmodules index d77862b..35a98cf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,87 +1,3 @@ -[submodule "vim/plugins/emmet-vim"] - path = vim/plugins/emmet-vim - url = https://github.com/mattn/emmet-vim -[submodule "vim/plugins/neco-vim"] - path = vim/plugins/neco-vim - url = https://github.com/Shougo/neco-vim -[submodule "vim/plugins/nerdcommenter"] - path = vim/plugins/nerdcommenter - url = https://github.com/scrooloose/nerdcommenter -[submodule "vim/plugins/supertab"] - path = vim/plugins/supertab - url = https://github.com/ervandew/supertab -[submodule "vim/plugins/vim-airline"] - path = vim/plugins/vim-airline - url = https://github.com/vim-airline/vim-airline.git -[submodule "vim/plugins/vim-airline-themes"] - path = vim/plugins/vim-airline-themes - url = https://github.com/vim-airline/vim-airline-themes.git -[submodule "vim/plugins/vim-better-whitespace"] - path = vim/plugins/vim-better-whitespace - url = git://github.com/ntpeters/vim-better-whitespace.git -[submodule "vim/plugins/vim-easymotion"] - path = vim/plugins/vim-easymotion - url = https://github.com/easymotion/vim-easymotion -[submodule "vim/plugins/vim-fugitive"] - path = vim/plugins/vim-fugitive - url = git://github.com/tpope/vim-fugitive.git -[submodule "vim/plugins/vim-yankstack"] - path = vim/plugins/vim-yankstack - url = https://github.com/maxbrunsfeld/vim-yankstack -[submodule "vim/plugins/indentline"] - path = vim/plugins/indentline - url = https://github.com/yggdroot/indentline -[submodule "vim/plugins/simpylfold"] - path = vim/plugins/simpylfold - url = https://github.com/tmhedberg/simpylfold -[submodule "vim/plugins/FastFold"] - path = vim/plugins/FastFold - url = https://github.com/Konfekt/fastfold.git -[submodule "vim/plugins/vim-nerdtree-tabs"] - path = vim/plugins/vim-nerdtree-tabs - url = https://github.com/jistr/vim-nerdtree-tabs -[submodule "vim/plugins/ultisnips"] - path = vim/plugins/ultisnips - url = https://github.com/SirVer/ultisnips.git -[submodule "vim/snippets/vim-snippets"] - path = vim/snippets/vim-snippets - url = https://github.com/honza/vim-snippets -[submodule "vim/snippets/bootstrap-snippets"] - path = vim/snippets/bootstrap-snippets - url = https://github.com/bonsaiben/bootstrap-snippets.git -[submodule "vim/snippets/snipmate-snippets-bib"] - path = vim/snippets/snipmate-snippets-bib - url = https://github.com/rbonvall/snipmate-snippets-bib.git -[submodule "vim/plugins/singlecompile"] - path = vim/plugins/singlecompile - url = https://github.com/xuhdev/singlecompile -[submodule "vim/plugins/javacomplete"] - path = vim/plugins/javacomplete - url = https://github.com/vim-scripts/javacomplete -[submodule "vim/plugins/vim-python-pep8-indent"] - path = vim/plugins/vim-python-pep8-indent - url = https://github.com/Vimjas/vim-python-pep8-indent -[submodule "vim/plugins/auto-pairs"] - path = vim/plugins/auto-pairs - url = https://github.com/jiangmiao/auto-pairs.git -[submodule "vim/plugins/kotlin-vim"] - path = vim/plugins/kotlin-vim - url = https://github.com/udalov/kotlin-vim.git -[submodule "vim/plugins/vim-hug-neovim-rpc"] - path = vim/plugins/vim-hug-neovim-rpc - url = https://github.com/roxma/vim-hug-neovim-rpc -[submodule "vim/plugins/deoplete.nvim"] - path = vim/plugins/deoplete.nvim - url = https://github.com/Shougo/deoplete.nvim.git -[submodule "vim/plugins/nvim-yarp"] - path = vim/plugins/nvim-yarp - url = https://github.com/roxma/nvim-yarp -[submodule "vim/plugins/deoplete-jedi"] - path = vim/plugins/deoplete-jedi - url = https://github.com/zchee/deoplete-jedi -[submodule "vim/plugins/vim-latex-live-preview"] - path = vim/plugins/vim-latex-live-preview - url = https://github.com/xuhdev/vim-latex-live-preview [submodule "zsh/modules/history-substring-search/external"] path = zsh/modules/history-substring-search/external url = https://github.com/zsh-users/zsh-history-substring-search.git @@ -127,33 +43,3 @@ [submodule "tmux/plugins/tpm"] path = tmux/plugins/tpm url = https://github.com/tmux-plugins/tpm.git -[submodule "vim/plugins/python-mode"] - path = vim/plugins/python-mode - url = https://github.com/klen/python-mode.git -[submodule "vim/plugins/ale"] - path = vim/plugins/ale - url = https://github.com/w0rp/ale.git -[submodule "vim/plugins/pydoc"] - path = vim/plugins/pydoc - url = https://github.com/fs111/pydoc.vim -[submodule "vim/plugins/vim-gitgutter"] - path = vim/plugins/vim-gitgutter - url = git://github.com/airblade/vim-gitgutter.git -[submodule "vim/plugins/fzf"] - path = vim/plugins/fzf - url = git://github.com/junegunn/fzf.vim -[submodule "vim/plugins/vim-markdown"] - path = vim/plugins/vim-markdown - url = https://github.com/plasticboy/vim-markdown.git -[submodule "vim/plugins/ansible-vim"] - path = vim/plugins/ansible-vim - url = https://github.com/pearofducks/ansible-vim -[submodule "vim/plugins/vim-window-resize-easy"] - path = vim/plugins/vim-window-resize-easy - url = https://github.com/roxma/vim-window-resize-easy -[submodule "vim/plugins/traces.vim"] - path = vim/plugins/traces.vim - url = https://github.com/markonm/traces.vim -[submodule "vim/plugins/nerdtree"] - path = vim/plugins/nerdtree - url = https://github.com/scrooloose/nerdtree diff --git a/vim/.vimrc b/vim/.vimrc index 687e2d1..bbb9cc7 100755 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -1,9 +1,17 @@ " Plugin Manager -execute pathogen#infect('plugins/{}') -execute pathogen#infect('snippets/{}') +source ~/.vim/config/plugins.vim + +" Make sure plug.vim is present +if empty(glob('~/.vim/autoload/plug.vim')) + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + source ~/.vim/autoload/plug.vim + autocmd VimEnter * PlugInstall --sync +endif + " Prepare central backup/swap/undo directory -let &undodir = expand('~/.vim/.undo') +let &undodir = expand('~/.vim/.undo//') let &backupdir = expand('~/.vim/.backup//') let &directory = expand('~/.vim/.swp//') @@ -39,7 +47,7 @@ colorscheme happy_hacking " Apply plugin configurations -source ~/.vim/config/plugin.vim +source ~/.vim/config/pluginconfig.vim " Apply custom keybindings source ~/.vim/config/keybindings.vim @@ -47,8 +55,5 @@ source ~/.vim/config/keybindings.vim " Apply settings for custom filetypes source ~/.vim/config/filetypes.vim -" Rebuild help files on startup -autocmd vimenter * Helptags - " Transparency hi Normal guibg=NONE ctermbg=NONE diff --git a/vim/autoload/pathogen.vim b/vim/autoload/pathogen.vim deleted file mode 100755 index 2ec30e1..0000000 --- a/vim/autoload/pathogen.vim +++ /dev/null @@ -1,266 +0,0 @@ -" pathogen.vim - path option manipulation -" Maintainer: Tim Pope -" Version: 2.4 - -" Install in ~/.vim/autoload (or ~\vimfiles\autoload). -" -" For management of individually installed plugins in ~/.vim/bundle (or -" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your -" .vimrc is the only other setup necessary. -" -" The API is documented inline below. - -if exists("g:loaded_pathogen") || &cp - finish -endif -let g:loaded_pathogen = 1 - -" Point of entry for basic default usage. Give a relative path to invoke -" pathogen#interpose() or an absolute path to invoke pathogen#surround(). -" Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all -" subdirectories inside "bundle" inside all directories in the runtime path. -" If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}" -" on versions of Vim without native package support. -function! pathogen#infect(...) abort - if a:0 - let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")') - else - let paths = ['bundle/{}', 'pack/{}/start/{}'] - endif - if has('packages') - call filter(paths, 'v:val !~# "^pack/[^/]*/start/[^/]*$"') - endif - let static = '^\%([$~\\/]\|\w:[\\/]\)[^{}*]*$' - for path in filter(copy(paths), 'v:val =~# static') - call pathogen#surround(path) - endfor - for path in filter(copy(paths), 'v:val !~# static') - if path =~# '^\%([$~\\/]\|\w:[\\/]\)' - call pathogen#surround(path) - else - call pathogen#interpose(path) - endif - endfor - call pathogen#cycle_filetype() - if pathogen#is_disabled($MYVIMRC) - return 'finish' - endif - return '' -endfunction - -" Split a path into a list. -function! pathogen#split(path) abort - if type(a:path) == type([]) | return a:path | endif - if empty(a:path) | return [] | endif - let split = split(a:path,'\\\@]','\\&','') - endif -endfunction - -" Like findfile(), but hardcoded to use the runtimepath. -function! pathogen#runtime_findfile(file,count) abort - let rtp = pathogen#join(1,pathogen#split(&rtp)) - let file = findfile(a:file,rtp,a:count) - if file ==# '' - return '' - else - return fnamemodify(file,':p') - endif -endfunction - -" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': diff --git a/vim/config/plugin.vim b/vim/config/pluginconfig.vim similarity index 100% rename from vim/config/plugin.vim rename to vim/config/pluginconfig.vim diff --git a/vim/config/plugins.vim b/vim/config/plugins.vim new file mode 100644 index 0000000..bbdca3c --- /dev/null +++ b/vim/config/plugins.vim @@ -0,0 +1,42 @@ +call plug#begin('~/.vim/plugged') + +Plug 'mattn/emmet-vim' +Plug 'Shougo/neco-vim' +Plug 'scrooloose/nerdcommenter' +Plug 'ervandew/supertab' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'ntpeters/vim-better-whitespace' +Plug 'easymotion/vim-easymotion' +Plug 'tpope/vim-fugitive' +Plug 'maxbrunsfeld/vim-yankstack' +Plug 'yggdroot/indentline' +Plug 'tmhedberg/simpylfold' +Plug 'Konfekt/fastfold' +Plug 'jistr/vim-nerdtree-tabs' +Plug 'SirVer/ultisnips' +Plug 'honza/vim-snippets' +Plug 'bonsaiben/bootstrap-snippets' +Plug 'rbonvall/snipmate-snippets-bib' +Plug 'xuhdev/singlecompile' +Plug 'vim-scripts/javacomplete' +Plug 'Vimjas/vim-python-pep8-indent' +Plug 'jiangmiao/auto-pairs' +Plug 'udalov/kotlin-vim' +Plug 'roxma/vim-hug-neovim-rpc' +Plug 'Shougo/deoplete.nvim' +Plug 'roxma/nvim-yarp' +Plug 'zchee/deoplete-jedi' +Plug 'xuhdev/vim-latex-live-preview' +Plug 'klen/python-mode' +Plug 'w0rp/ale' +Plug 'fs111/pydoc.vim' +Plug 'airblade/vim-gitgutter' +Plug 'junegunn/fzf.vim' +Plug 'plasticboy/vim-markdown' +Plug 'pearofducks/ansible-vim' +Plug 'roxma/vim-window-resize-easy' +Plug 'markonm/traces.vim' +Plug 'scrooloose/nerdtree' + +call plug#end() diff --git a/vim/plugins/FastFold/.gitignore b/vim/plugins/FastFold/.gitignore deleted file mode 100644 index 926ccaa..0000000 --- a/vim/plugins/FastFold/.gitignore +++ /dev/null @@ -1 +0,0 @@ -doc/tags diff --git a/vim/plugins/FastFold/README.md b/vim/plugins/FastFold/README.md deleted file mode 100644 index 1c51fb0..0000000 --- a/vim/plugins/FastFold/README.md +++ /dev/null @@ -1,106 +0,0 @@ -# What good will FastFold do? - -Automatic folds (that is, folds generated by a fold method different -from `manual`), bog down VIM noticeably in insert mode. They are also often -recomputed too early (for example, when inserting an opening fold marker -whose closing counterpart is yet missing to complete the fold.) - -See http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text -for a discussion. - -With this plug-in, the folds in the currently edited buffer are updated by an -automatic fold method only - -- when saving the buffer -- when closing or opening folds (zo, za, zc, etc...) -- when moving or operating fold-wise (zj,zk,[z,]z) -- when typing `zuz` in normal mode - -and are kept as is otherwise (by keeping the fold method set to `manual`). - -# Example Setup - -Each of these triggers for updating folds can be modified or disabled by adding -the lines - -```vim -nmap zuz (FastFoldUpdate) -let g:fastfold_savehook = 1 -let g:fastfold_fold_command_suffixes = ['x','X','a','A','o','O','c','C'] -let g:fastfold_fold_movement_commands = [']z', '[z', 'zj', 'zk'] -``` - -to the file `~/.vimrc` (respectively `%USERPROFILE%/_vimrc` on Microsoft Windows). - -For example, by adding - -```vim -let g:tex_fold_enabled=1 -let g:vimsyn_folding='af' -let g:xml_syntax_folding = 1 -let g:php_folding = 1 -let g:perl_fold = 1 -``` - -to the `.vimrc` file and installing this plug-in, the folds in a TeX, Vim, XML, -PHP or Perl file are updated by the `syntax` fold method when saving the -buffer, opening, closing, moving or operating on folds, or typing `zuz` in -normal mode and are kept as is otherwise. - -*Set fold methods for every file type only*! Setting it globally risks that FastFold assumes the wrong, global, fold method instead of that intended by the file type plug-in, for example TagList. - -# Configuration - -- If you prefer that folds are only updated manually but not when saving the buffer, - then add `let g:fastfold_savehook = 0` to your `.vimrc`. - -- If you prefer that folds are updated whenever you close or open folds by a - standard keystroke such as `zx`,`zo` or `zc`, then add `let - g:fastfold_fold_command_suffixes = []` to your `.vimrc`. - - The exact list of these standard keystrokes is `zx,zX,za,zA,zo,zO,zc,zC` and - it can be customized by changing the global variable - `g:fastfold_mapsuffixes`. If you wanted to intercept all possible fold - commands (such as zr,zm,...), change this to: - - ```vim - let g:fastfold_fold_command_suffixes = - ['x','X','a','A','o','O','c','C','r','R','m','M','i','n','N'] - ``` - -- If you prefer that this plug-in does not add a normal mode mapping that updates - folds (that defaults to `zuz`), then add - `nmap (DisableFastFoldUpdate) (FastFoldUpdate) ` to your `.vimrc`. - - You can remap `zuz` to your favorite keystroke, say ``, by adding - `nmap (FastFoldUpdate)` to your `.Vimrc`. - - There is also a command `FastFoldUpdate` that updates all folds and its - variant `FastFoldUpdate!` that updates all folds and echos by which fold - method the folds were updated. - -# Addons - -## Vim-Stay - -`FastFold` integrates with the plug-in -[vim-stay](https://github.com/kopischke/vim-stay/issues) that restores the -folds of a file buffer by `:mkview` and `:loadview`. - -## Custom Fold Text - -A `CustomFoldText()` function that displays the percentage of the number of buffer lines that the folded text takes up and indents folds according to their nesting level, similar to [that](http://www.gregsexton.org/2011/03/improving-the-text-displayed-in-a-fold/) by Greg Sexton, is available at - -http://www.github.com/Konfekt/FoldText - -## Fold Text-Object - -Create a fold text object, mapped to `iz` and `az`, by adding the lines - -```vim -xnoremap iz :FastFoldUpdate:normal! ]zv[z -xnoremap az :FastFoldUpdate:normal! ]zV[z -``` - -to the file `~/.vimrc` (respectively `%USERPROFILE%/_vimrc` on Microsoft Windows). - diff --git a/vim/plugins/FastFold/doc/FastFold.txt b/vim/plugins/FastFold/doc/FastFold.txt deleted file mode 100644 index 42484ea..0000000 --- a/vim/plugins/FastFold/doc/FastFold.txt +++ /dev/null @@ -1,153 +0,0 @@ - FastFold, folding optimization *FastFold* *fastfold* - -=========================================================================== -0. Introduction ~ - *FastFold-intro* *fastfold-intro* - -Automatic folds - that is, folds generated by a fold method different -from `manual` - bog down VIM considerably in insert mode. Also, they are often -re-evaluated prematurely for example, when inserting an opening fold marker -whose closing counterpart has yet to be added to complete the fold. - -See http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text -for a discussion. - -With this plug-in, the folds in the currently edited buffer are updated when -certain triggers are met: - -- when saving the buffer -- when closing or opening folds (zo, za, zc, etc...) -- when moving or operating fold-wise (zj,zk,[z,]z) -- when typing `zuz` in normal mode - -=========================================================================== -1. Commands ~ - *FastFold-commands* *fastfold-commands* - *FastFoldUpdate!* - -- `:FastFoldUpdate` updates all folds in the current buffer. -- `:FastFoldUpdate!` updates all folds & echoes what fold method was used - -- The mapping `zuz` that invokes `:FastFoldUpdate!` can be changed to your - favorite keystroke, say ``, by adding -> - nmap (FastFoldUpdate) -< - to your `.vimrc`. It can be disabled by adding -> - nmap (DisableFastFoldUpdate) (FastFoldUpdate) -< -=========================================================================== -2. Config ~ - *FastFold-config* *fastfold-config* - -Each of the above triggers can be enabled or disabled by setting the -matching global flags in your `.vimrc`. Default values are shown. -> - let g:fastfold_savehook = 1 - let g:fastfold_fdmhook = 0 - nmap zuz (FastFoldUpdate) - let g:fastfold_fold_command_suffixes = ['x','X','a','A','o','O','c','C'] - let g:fastfold_fold_movement_commands = [']z', '[z', 'zj', 'zk'] -< -For example, by adding the following to your `.vimrc` -> - let g:tex_fold_enabled=1 - let g:vimsyn_folding='af' - let g:xml_syntax_folding = 1 - let g:php_folding = 1 - let g:perl_fold = 1 -< -You will enable tex, vim, xml, php and perl syntax folding. - -Set fold methods for every file type only! Setting it globally risks that -FastFold assumes the wrong, global, fold method instead of that intended by the -file type plug-in, for example TagList. - ------------------------------ - -- FastFold updates all folds when you open or close folds by the commands - zx, zX, za, zA, zo, zO, zc, zC. This list of commands is configured by -> - let g:fastfold_fold_command_suffixes = ['x','X','a','A','o','O','c','C'] -< - To intercept all possible fold commands (such as zr,zm,...),change this to -> - let g:fastfold_fold_command_suffixes = - ['x','X','a','A','o','O','c','C','r','R','m','M','i','n','N'] -< - To disable all interceptions, change this to -> - let g:fastfold_fold_command_suffixes = [] -< -- FastFold updates all fold when you move or operate fold-wise by - the commands zj,zk,[z or ]z. This list of commands is configured by -> - let g:fastfold_fold_movement_commands = [']z', '[z', 'zj', 'zk'] -< - It can be disabled by -> - let g:fastfold_fold_movement_commands = [] -< -- FastFold updates all folds when you save a buffer. This hook is set by -> - let g:fastfold_savehook = 1 -< -- FastFold intercepts every change of the fold method by -> - let g:fastfold_fdmhook = 1 -< - This is disabled by default as it could interfere with other plugins such as - `easymotion`. - -- To disable FastFold for a list of file types, such as 'taglist', add -> -` let g:fastfold_skip_filetypes`= [ 'taglist' ] -< - to your 'vimrc'. Default value is []. - -- Add a fold text-object, mapped to `iz` and `az`, by adding the lines - - xnoremap iz :FastFoldUpdate:normal! ]zv[z - xnoremap az :FastFoldUpdate:normal! ]zV[z - - to your 'vimrc'. -=========================================================================== -3. Extra Notes ~ - -3.1 Related Plugins ~ - -`FastFold` integrates with the plug-in `vim-stay` available at - -https://github.com/kopischke/vim-stay - -that stores and restores the last folds by `:mkview` and `:loadview`. - ------------------------------- - -A fold-text function `CustomFoldText()` that displays the percentage of the -number of buffer lines that the folded text takes up and indents folds -according to their nesting level is available at - -http://www.github.com/Konfekt/FoldText - -3.2 Warning ~ - -FastFold overwrites your manual folds when saving the currently edited buffer, -unless - -- FastFold is disabled for this filetype by `g:fastfold_skip_filetypes`, or -- the `foldmethod=manual` since having entered the buffer. - -3.3 API ~ - -The last used fold method by which FastFold updates the folds in the current -buffer can be read off from the window local variable `w:lastdfm`. - -3.4 Thanks go to... ~ - -- starcraftman for providing this documentation, and -- blueyed, kopischke, sabauma, willywampa, and many others for reporting -issues and suggesting code improvements. - -vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl diff --git a/vim/plugins/FastFold/plugin/fastfold.vim b/vim/plugins/FastFold/plugin/fastfold.vim deleted file mode 100644 index 19de8f8..0000000 --- a/vim/plugins/FastFold/plugin/fastfold.vim +++ /dev/null @@ -1,224 +0,0 @@ -scriptencoding utf-8 - -" LICENCE PUBLIQUE RIEN À BRANLER -" Version 1, Mars 2009 -" -" Copyright (C) 2009 Sam Hocevar -" 14 rue de Plaisance, 75014 Paris, France -" -" La copie et la distribution de copies exactes de cette licence sont -" autorisées, et toute modification est permise à condition de changer -" le nom de la licence. -" -" CONDITIONS DE COPIE, DISTRIBUTON ET MODIFICATION -" DE LA LICENCE PUBLIQUE RIEN À BRANLER -" -" 0. Faites ce que vous voulez, j’en ai RIEN À BRANLER. - -if exists('g:loaded_fastfold') || &cp - finish -endif -let g:loaded_fastfold = 1 - -let s:keepcpo = &cpo -set cpo&vim -" ------------------------------------------------------------------------------ - -if !exists('g:fastfold_fdmhook') | let g:fastfold_fdmhook = 0 | endif -if !exists('g:fastfold_savehook') | let g:fastfold_savehook = 1 | endif -if !exists('g:fastfold_fold_command_suffixes') - let g:fastfold_fold_command_suffixes = ['x','X','a','A','o','O','c','C'] -endif -if !exists('g:fastfold_fold_movement_commands') - let g:fastfold_fold_movement_commands = [']z', '[z', 'zj', 'zk'] -endif -if !exists('g:fastfold_skip_filetypes') | let g:fastfold_skip_filetypes = [] | endif - -function! s:EnterWin() - if exists('w:unchanged') - unlet w:unchanged - elseif s:Skip() - if exists('w:lastfdm') - unlet w:lastfdm - endif - else - let w:lastfdm = &l:foldmethod - setlocal foldmethod=manual - endif -endfunction - -function! s:LeaveWin() - if exists('w:predifffdm') - if empty(&l:foldmethod) || &l:foldmethod is# 'manual' - let &l:foldmethod = w:predifffdm - unlet w:predifffdm - return - elseif &l:foldmethod isnot# 'diff' - unlet w:predifffdm - endif - endif - - if exists('w:lastfdm') && &l:foldmethod is# 'diff' - let w:predifffdm = w:lastfdm - endif - - if exists('w:lastfdm') && &l:foldmethod is# 'manual' - if !exists('b:last_changedtick') || b:changedtick > b:last_changedtick - let &l:foldmethod = w:lastfdm - let b:last_changedtick = b:changedtick - else - let w:unchanged = 1 - endif - endif -endfunction - -" Like windo but restore the current buffer. -" See http://vim.wikia.com/wiki/Run_a_command_in_multiple_buffers#Restoring_position -function! s:WinDo( command ) - " avoid errors in CmdWin - if exists('*getcmdwintype') && !empty(getcmdwintype()) - return - endif - " Work around Vim bug. - " See https://groups.google.com/forum/#!topic/vim_dev/LLTw8JV6wKg - let curaltwin = winnr('#') ? winnr('#') : 1 - let currwin=winnr() - if &scrollopt =~# '\' - set scrollopt-=jump - let l:restore = 'set scrollopt+=jump' - endif - silent! execute 'keepjumps noautocmd windo ' . a:command - silent! execute 'noautocmd ' . curaltwin . 'wincmd w' - silent! execute 'noautocmd ' . currwin . 'wincmd w' - if exists('l:restore') - exe l:restore - endif -endfunction - -" WinEnter then TabEnter then BufEnter then BufWinEnter -function! s:UpdateWin(check) - " skip if another session still loading - if a:check && exists('g:SessionLoad') | return | endif - - let s:curwin = winnr() - call s:WinDo('if winnr() is s:curwin | call s:LeaveWin() | endif') - call s:WinDo('if winnr() is s:curwin | call s:EnterWin() | endif') -endfunction - -function! s:UpdateBuf(feedback) - let s:curbuf = bufnr('%') - call s:WinDo("if bufnr('%') is s:curbuf | call s:LeaveWin() | endif") - call s:WinDo("if bufnr('%') is s:curbuf | call s:EnterWin() | endif") - - if !a:feedback | return | endif - - if !exists('w:lastfdm') - echomsg "'" . &l:foldmethod . "' folds already continuously updated" - else - echomsg "updated '" . w:lastfdm . "' folds" - endif -endfunction - -function! s:UpdateTab() - " skip if another session still loading - if exists('g:SessionLoad') | return | endif - - call s:WinDo('call s:LeaveWin()') - call s:WinDo('call s:EnterWin()') -endfunction - -function! s:Skip() - if !s:isReasonable() | return 1 | endif - if !&l:modifiable | return 1 | endif - if s:inSkipList() | return 1 | endif - - return 0 -endfunction - -function! s:isReasonable() - if &l:foldmethod is# 'syntax' || &l:foldmethod is# 'expr' - return 1 - else - return 0 - endif -endfunction - -function! s:inSkipList() - for ifiles in g:fastfold_skip_filetypes - if index(g:fastfold_skip_filetypes, &l:filetype) >= 0 - return 1 - endif - endfor - return 0 -endfunction - -command! -bar -bang FastFoldUpdate call s:UpdateBuf(0) - -nnoremap (FastFoldUpdate) :FastFoldUpdate! - -if !hasmapto('(FastFoldUpdate)', 'n') && empty(mapcheck('zuz', 'n')) - nmap zuz (FastFoldUpdate) -endif - -for suffix in g:fastfold_fold_command_suffixes - execute 'nnoremap z'.suffix.' :call UpdateWin(0)z'.suffix -endfor - -for cmd in g:fastfold_fold_movement_commands - exe "nnoremap " . cmd. " ':call UpdateWin(0)'.v:count." . "'".cmd."'" - exe "xnoremap " . cmd. " ':call UpdateWin(0)gv'.v:count." . "'".cmd."'" - exe "onoremap " . cmd. " ':call UpdateWin(0)' . '\"' . v:register . v:operator . v:count1 . " . "'".cmd."'" -endfor - -augroup FastFold - autocmd! - autocmd VimEnter * call s:init() - autocmd BufEnter,WinEnter * - \ if !exists('b:last_changedtick') | let b:last_changedtick = b:changedtick | endif -augroup end - -function! s:init() - call s:UpdateTab() - augroup FastFoldEnter - autocmd! - " Make &l:foldmethod local to Buffer and NOT Window. - autocmd BufEnter,WinEnter * - \ if exists('b:lastfdm') | let w:lastfdm = b:lastfdm | call s:LeaveWin() | call s:EnterWin() | endif - autocmd BufLeave,WinLeave * - \ call s:LeaveWin() | call s:EnterWin() | - \ if exists('w:lastfdm') | let b:lastfdm = w:lastfdm | - \ elseif exists('b:lastfdm') | unlet b:lastfdm | endif - - autocmd BufEnter,WinEnter * - \ if &l:foldmethod isnot# 'diff' && exists('b:predifffdm') | call s:UpdateBuf(0) | endif - autocmd BufLeave,WinLeave * - \ if exists('w:predifffdm') | let b:predifffdm = w:predifffdm | - \ elseif exists('b:predifffdm') | unlet b:predifffdm | endif - - " UpdateBuf/Win(1) = skip if another session is still loading. - autocmd TabEnter * call s:UpdateTab() - - " BufWinEnter = to change &l:foldmethod by modelines. - autocmd BufWinEnter,FileType * call s:UpdateWin(1) - " So that FastFold functions correctly after :loadview. - autocmd SessionLoadPost * call s:UpdateWin(0) - - " Update folds on reload. - autocmd BufReadPost * - \ if !exists('b:already_loaded') | let b:already_loaded = 1 | - \ else | call s:UpdateBuf(0) | endif - " Update folds on saving. - if g:fastfold_savehook - autocmd BufWritePost * call s:UpdateBuf(0) - endif - if g:fastfold_fdmhook - if exists('##OptionSet') - autocmd OptionSet foldmethod call s:UpdateBuf(0) - endif - endif - augroup end -endfunction - -" ------------------------------------------------------------------------------ -let &cpo= s:keepcpo -unlet s:keepcpo diff --git a/vim/plugins/ale b/vim/plugins/ale deleted file mode 160000 index 3f0e1cd..0000000 --- a/vim/plugins/ale +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3f0e1cd05dc526b073946ad96c64f6a5e2f9e4e6 diff --git a/vim/plugins/ansible-vim b/vim/plugins/ansible-vim deleted file mode 160000 index f1c9be3..0000000 --- a/vim/plugins/ansible-vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f1c9be3cdca55c90cc190f8fc38c6c8ac7e8d371 diff --git a/vim/plugins/auto-pairs/.gitignore b/vim/plugins/auto-pairs/.gitignore deleted file mode 100644 index 926ccaa..0000000 --- a/vim/plugins/auto-pairs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -doc/tags diff --git a/vim/plugins/auto-pairs/README.md b/vim/plugins/auto-pairs/README.md deleted file mode 100644 index 7cdcbf9..0000000 --- a/vim/plugins/auto-pairs/README.md +++ /dev/null @@ -1,325 +0,0 @@ -Auto Pairs -========== -Insert or delete brackets, parens, quotes in pair. - -Installation ------------- -copy plugin/auto-pairs.vim to ~/.vim/plugin - -or if you are using `pathogen`: - -```git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairs``` - -Features --------- -* Insert in pair - - input: [ - output: [|] - -* Delete in pair - - input: foo[] - output: foo - -* Insert new indented line after Return - - input: {|} (press at |) - output: { - | - } - -* Insert spaces before closing characters, only for [], (), {} - - input: {|} (press at |) - output: { | } - - input: {|} (press foo} at |) - output: { foo }| - - input: '|' (press at |) - output: ' |' - -* Skip ' when inside a word - - input: foo| (press ' at |) - output: foo' - -* Skip closed bracket. - - input: [] - output: [] - -* Ignore auto pair when previous character is \ - - input: "\' - output: "\'" - -* Fast Wrap - - input: |'hello' (press ( at |) - output: ('hello') - - wrap string, only support c style string - input: |'h\\el\'lo' (press ( at |) - output ('h\\ello\'') - - input: |[foo, bar()] (press ( at |) - output: ([foo, bar()]) - -* Quick move char to closed pair - - input: (|){["foo"]} (press at |) - output: ({["foo"]}|) - - input: |[foo, bar()] (press ( at |) - output: ([foo, bar()]|) - -* Quick jump to closed pair. - - input: - { - something;| - } - - (press } at |) - - output: - { - - }| - -* Support ``` ''' and """ - - input: - ''' - - output: - '''|''' - -* Delete Repeated Pairs in one time - - input: """|""" (press at |) - output: | - - input: {{|}} (press at |) - output: | - - input: [[[[[[|]]]]]] (press at |) - output: | - -* Fly Mode - - input: if(a[3) - output: if(a[3])| (In Fly Mode) - output: if(a[3)]) (Without Fly Mode) - - input: - { - hello();| - world(); - } - - (press } at |) - - output: - { - hello(); - world(); - }| - - (then press at | to do backinsert) - output: - { - hello();}| - world(); - } - - See Fly Mode section for details - -Fly Mode --------- -Fly Mode will always force closed-pair jumping instead of inserting. only for ")", "}", "]" - -If jumps in mistake, could use AutoPairsBackInsert(Default Key: ``) to jump back and insert closed pair. - -the most situation maybe want to insert single closed pair in the string, eg ")" - -Fly Mode is DISABLED by default. - -add **let g:AutoPairsFlyMode = 1** .vimrc to turn it on - -Default Options: - - let g:AutoPairsFlyMode = 0 - let g:AutoPairsShortcutBackInsert = '' - -Shortcuts ---------- - - System Shortcuts: - : Insert new indented line after return if cursor in blank brackets or quotes. - : Delete brackets in pair - : Toggle Autopairs (g:AutoPairsShortcutToggle) - : Fast Wrap (g:AutoPairsShortcutFastWrap) - : Jump to next closed pair (g:AutoPairsShortcutJump) - : BackInsert (g:AutoPairsShortcutBackInsert) - - If or conflict with another keys or want to bind to another keys, add - - let g:AutoPairsShortcutToggle = '' - - to .vimrc, if the key is empty string '', then the shortcut will be disabled. - -Options -------- -* g:AutoPairs - - Default: {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'} - -* b:AutoPairs - - Default: g:AutoPairs - - Buffer level pairs set. - -* g:AutoPairsShortcutToggle - - Default: '' - - The shortcut to toggle autopairs. - -* g:AutoPairsShortcutFastWrap - - Default: '' - - Fast wrap the word. all pairs will be consider as a block (include <>). - (|)'hello' after fast wrap at |, the word will be ('hello') - (|) after fast wrap at |, the word will be () - -* g:AutoPairsShortcutJump - - Default: '' - - Jump to the next closed pair - -* g:AutoPairsMapBS - - Default : 1 - - Map to delete brackets, quotes in pair - execute 'inoremap =AutoPairsDelete()' - -* g:AutoPairsMapCh - - Default : 1 - - Map to delete brackets, quotes in pair - -* g:AutoPairsMapCR - - Default : 1 - - Map to insert a new indented line if cursor in (|), {|} [|], '|', "|" - execute 'inoremap =AutoPairsReturn()' - -* g:AutoPairsCenterLine - - Default : 1 - - When g:AutoPairsMapCR is on, center current line after return if the line is at the bottom 1/3 of the window. - -* g:AutoPairsMapSpace - - Default : 1 - - Map to insert a space after the opening character and before the closing one. - execute 'inoremap =AutoPairsSpace()' - -* g:AutoPairsFlyMode - - Default : 0 - - set it to 1 to enable FlyMode. - see FlyMode section for details. - -* g:AutoPairsMultilineClose - - Default : 1 - - When you press the key for the closing pair (e.g. `)`) it jumps past it. - If set to 1, then it'll jump to the next line, if there is only whitespace. - If set to 0, then it'll only jump to a closing pair on the same line. - -* g:AutoPairsShortcutBackInsert - - Default : - - Work with FlyMode, insert the key at the Fly Mode jumped postion - -* g:AutoPairsMoveCharacter - - Default: "()[]{}\"'" - - Map to - move character under the cursor to the pair. - -Buffer Level Pairs Setting --------------------------- - -Set b:AutoPairs before BufEnter - -eg: - - " When the filetype is FILETYPE then make AutoPairs only match for parenthesis - au Filetype FILETYPE let b:AutoPairs = {"(": ")"} - -TroubleShooting ---------------- - The script will remap keys ([{'"}]) , - If auto pairs cannot work, use :imap ( to check if the map is corrected. - The correct map should be =AutoPairsInsert("\(") - Or the plugin conflict with some other plugins. - use command :call AutoPairsInit() to remap the keys. - - -* How to insert parens purely - - There are 3 ways - - 1. use Ctrl-V ) to insert paren without trigger the plugin. - - 2. use Alt-P to turn off the plugin. - - 3. use DEL or x to delete the character insert by plugin. - -* Swedish Character Conflict - - Because AutoPairs uses Meta(Alt) key as shortcut, it is conflict with some Swedish character such as å. - To fix the issue, you need remap or disable the related shortcut. - -Known Issues ------------------------ -Breaks '.' - [issue #3](https://github.com/jiangmiao/auto-pairs/issues/3) - - Description: After entering insert mode and inputing `[hello` then leave insert - mode by ``. press '.' will insert 'hello' instead of '[hello]'. - Reason: `[` actually equals `[]\` and \ will break '.'. - After version 7.4.849, Vim implements new keyword U to avoid the break - Solution: Update Vim to 7.4.849+ - -Contributors ------------- -* [camthompson](https://github.com/camthompson) - - -License -------- - -Copyright (C) 2011-2013 Miao Jiang - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vim/plugins/auto-pairs/doc/AutoPairs.txt b/vim/plugins/auto-pairs/doc/AutoPairs.txt deleted file mode 100644 index 49ff549..0000000 --- a/vim/plugins/auto-pairs/doc/AutoPairs.txt +++ /dev/null @@ -1,356 +0,0 @@ -*AutoPairs.txt* Insert or delete brackets, parens, quotes in pair - -Author: jiangmiao -License: MIT -URL: https://github.com/jiangmiao/auto-pairs - -============================================================================== -CONTENTS *autopairs-contents* - - 1. Installation ............................. |autopairs-installation| - 2. Features ..................................... |autopairs-features| - 3. Fly Mode ..................................... |autopairs-fly-mode| - 4. Shortcuts ................................... |autopairs-shortcuts| - 5. Options ....................................... |autopairs-options| - 6. Troubleshooting ...................... |autopairs-troubleshooting| - -============================================================================== -1. Introduction *autopairs-installation* - -Copy `plugin/auto-pairs.vim` to `~/.vim/plugin`. - -Or if you are using `pathogen`: > - - git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairs - -============================================================================== -2. Features *autopairs-features* - -Insert in pair: > - - input: [ - output: [|] - -Delete in pair: > - - input: foo[] - output: foo - -Insert new indented line after Return: > - - input: {|} (press at |) - output: { - | - } - -Insert spaces before closing characters, only for [], (), {}: > - - input: {|} (press at |) - output: { | } - - input: {|} (press foo} at |) - output: { foo }| - - input: '|' (press at |) - output: ' |' - -Skip ' when inside a word: > - - input: foo| (press ' at |) - output: foo' - -Skip closed bracket: > - - input: [] - output: [] - -Ignore auto pair when previous character is '\': > - - input: "\' - output: "\'" - -Fast Wrap: > - - input: |'hello' (press ( at |) - output: ('hello') - - Wrap string, only support c style string. - input: |'h\\el\'lo' (press ( at |) - output ('h\\ello\'') - - input: |[foo, bar()] (press ( at |) - output: ([foo, bar()]) - -Quick jump to closed pair: > - - input: - { - something;| - } - - (press } at |) - - output: - { - - }| - -Support ```, ''' and """: > - - input: - ''' - - output: - '''|''' - -Delete Repeated Pairs in one time: > - - input: """|""" (press at |) - output: | - - input: {{|}} (press at |) - output: | - - input: [[[[[[|]]]]]] (press at |) - output: | - -Fly Mode (|autopairs-flymode|): > - - input: if(a[3) - output: if(a[3])| (In Fly Mode) - output: if(a[3)]) (Without Fly Mode) - - input: - { - hello();| - world(); - } - - (press } at |) - - output: - { - hello(); - world(); - }| - - (then press at | to do backinsert) - output: - { - hello();}| - world(); - } - - See |Fly Mode| section for details - -============================================================================== -3. Fly Mode *autopairs-flymode* - -Fly Mode will always force closed-pair jumping instead of inserting. Only for -")", "}", "]". If jumps in mistake, you can use |g:AutoPairsBackInsert| (default -Key: ) to jump back and insert closed pair. - -The most situation maybe you want to insert single closed pair in the string, -eg: > - - ")" - -Fly Mode is DISABLED by default. To enable Fly Mode add following to your -'.vimrc': > - - let g:AutoPairsFlyMode = 1 - -Default Options: > - - let g:AutoPairsFlyMode = 0 - let g:AutoPairsShortcutBackInsert = '' - -============================================================================== -4. Shortcuts *autopairs-shortcuts* - -System Shortcuts: - : Insert new indented line after return if cursor in blank brackets - or quotes. - : Delete brackets in pair - : Toggle Autopairs (|g:AutoPairsShortcutToggle|) - : Fast Wrap (|g:AutoPairsShortcutFastWrap|) - : Jump to next closed pair (|g:AutoPairsShortcutJump|) - : BackInsert (|g:AutoPairsShortcutBackInsert|) - - - To rebind keys , or or in case of conflicts conflicts with - another keys: - - let g:AutoPairsShortcutToggle = '' - - If the key is empty string '', then the shortcut will be disabled. - -============================================================================== -5. Options *autopairs-options* - - *g:AutoPairs* -|g:AutoPairs| dict - -Default: > - {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'} - -Specifies which symbols should be automatically paired. - -To append new pairs without overwriting defaults, add values in your `.vimrc`.: - - let g:AutoPairs['<']='>' - -This example will enable matching of `<` with `>`. - - - *b:AutoPairs* -|b:AutoPairs| dict - -Default: |g:AutoPairs| - -Buffer level pairs set. - -You can set |b:AutoPairs| before |BufEnter|: > - - au Filetype FILETYPE let b:AutoPairs = {"(": ")"} - -This sets |AutoPairs| to only match for parenthesis for 'FILETYPE'. - - - - *g:AutoPairsShortcutToggle* -|g:AutoPairsShortcutToggle| string - -Default: - -The shortcut to toggle autopairs. - - - - *g:AutoPairsShortcutFastWrap* -|g:AutoPairsShortcutFastWrap| string - -Default: - -Fast wrap the word. All pairs will be considered as a block (including <>). - - (|)'hello' after fast wrap at |, the word will be ('hello') - (|) after fast wrap at |, the word will be () - - - - *g:AutoPairsShortcutJump* -|g:AutoPairsShortcutJump| string - -Default: - -Jump to the next closed pair. - - - *g:AutoPairsShortcutBackInsert* -|g:AutoPairsShortcutBackInsert| string - -Default: - -Work with |autopairs-flymode|, insert the key at the Fly Mode jumped position. - - - - *g:AutoPairsMapBS* -|g:AutoPairsMapBS| int - -Default: 1 - -Map to delete brackets and quotes in pair, executes: - - inoremap =AutoPairsDelete() - - - *g:AutoPairsMapCh* -|g:AutoPairsMapCh| int - -Default: 1 - -Map to delete brackets and quotes in pair. - - - *g:AutoPairsMapCR* -|g:AutoPairsMapCR| int - -Default: 1 - -Map to insert a new indented line if cursor in (|), {|} [|], '|', "|". -Executes: - - inoremap =AutoPairsReturn() - - - *g:AutoPairsCenterLine* -|g:AutoPairsCenterLine| int - -Default: 1 - -When |g:AutoPairsMapCR| is on, center current line after return if the line -is at the bottom 1/3 of the window. - - - *g:AutoPairsMapSpace* -|g:AutoPairsMapSpace| int - -Default: 1 - -Map to insert a space after the opening character and before the -closing one. - -Executes: - - inoremap =AutoPairsSpace() - - - *g:AutoPairsFlyMode* -|g:AutoPairsFlyMode| int - -Default: 0 - -Set it to 1 to enable |autopairs-flymode|. - - - *g:AutoPairsMultilineClose* -|g:AutoPairsMultilineClose| int - -Default: 1 - -When you press the key for the closing pair (e.g. `)`) it jumps past it. -If set to 1, then it'll jump to the next line, if there is only 'whitespace'. -If set to 0, then it'll only jump to a closing pair on the same line. - -============================================================================== -6. Troubleshooting *autopairs-troubleshooting* - -This plugin remaps keys `([{'"}]) ` - -If auto pairs cannot work, use |:imap| to check if the map is corrected. - -The correct map should be: > - - =AutoPairsInsert("\(") - -Or the plugin conflicts with some other plugins. Use command: > - - :call AutoPairsInit() to remap the keys. - ---- How to insert parens purely? --- - -There are 3 ways: - - 1. Use Ctrl-V ) to insert paren without trigger the plugin. - - 2. Use Alt-P to turn off the plugin. - - 3. Use DEL or x to delete the character insert by plugin. - ---- Swedish Character Conflict --- - -Because AutoPairs uses Meta(Alt) key as a shortcut, it conflicts with some -Swedish character such as å. To fix the issue, you need remap or disable the -related shortcut. diff --git a/vim/plugins/auto-pairs/plugin/auto-pairs.vim b/vim/plugins/auto-pairs/plugin/auto-pairs.vim deleted file mode 100644 index b2a9af7..0000000 --- a/vim/plugins/auto-pairs/plugin/auto-pairs.vim +++ /dev/null @@ -1,582 +0,0 @@ -" Insert or delete brackets, parens, quotes in pairs. -" Maintainer: JiangMiao -" Contributor: camthompson -" Last Change: 2017-06-17 -" Version: 1.3.3 -" Homepage: http://www.vim.org/scripts/script.php?script_id=3599 -" Repository: https://github.com/jiangmiao/auto-pairs -" License: MIT - -if exists('g:AutoPairsLoaded') || &cp - finish -end -let g:AutoPairsLoaded = 1 - -if !exists('g:AutoPairs') - let g:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'} -end - -if !exists('g:AutoPairsParens') - let g:AutoPairsParens = {'(':')', '[':']', '{':'}'} -end - -if !exists('g:AutoPairsMapBS') - let g:AutoPairsMapBS = 1 -end - -" Map as the same BS -if !exists('g:AutoPairsMapCh') - let g:AutoPairsMapCh = 1 -end - -if !exists('g:AutoPairsMapCR') - let g:AutoPairsMapCR = 1 -end - -if !exists('g:AutoPairsMapSpace') - let g:AutoPairsMapSpace = 1 -end - -if !exists('g:AutoPairsCenterLine') - let g:AutoPairsCenterLine = 1 -end - -if !exists('g:AutoPairsShortcutToggle') - let g:AutoPairsShortcutToggle = '' -end - -if !exists('g:AutoPairsShortcutFastWrap') - let g:AutoPairsShortcutFastWrap = '' -end - -if !exists('g:AutoPairsMoveCharacter') - let g:AutoPairsMoveCharacter = "()[]{}\"'" -end - -if !exists('g:AutoPairsShortcutJump') - let g:AutoPairsShortcutJump = '' -endif - -" Fly mode will for closed pair to jump to closed pair instead of insert. -" also support AutoPairsBackInsert to insert pairs where jumped. -if !exists('g:AutoPairsFlyMode') - let g:AutoPairsFlyMode = 0 -endif - -" When skipping the closed pair, look at the current and -" next line as well. -if !exists('g:AutoPairsMultilineClose') - let g:AutoPairsMultilineClose = 1 -endif - -" Work with Fly Mode, insert pair where jumped -if !exists('g:AutoPairsShortcutBackInsert') - let g:AutoPairsShortcutBackInsert = '' -endif - -if !exists('g:AutoPairsSmartQuotes') - let g:AutoPairsSmartQuotes = 1 -endif - -" 7.4.849 support U to avoid breaking '.' -" Issue talk: https://github.com/jiangmiao/auto-pairs/issues/3 -" Vim note: https://github.com/vim/vim/releases/tag/v7.4.849 -if v:version > 704 || v:version == 704 && has("patch849") - let s:Go = "\U" -else - let s:Go = "" -endif - -let s:Left = s:Go."\" -let s:Right = s:Go."\" - - -" Will auto generated {']' => '[', ..., '}' => '{'}in initialize. -let g:AutoPairsClosedPairs = {} - - -function! AutoPairsInsert(key) - if !b:autopairs_enabled - return a:key - end - - let line = getline('.') - let pos = col('.') - 1 - let before = strpart(line, 0, pos) - let after = strpart(line, pos) - let next_chars = split(after, '\zs') - let current_char = get(next_chars, 0, '') - let next_char = get(next_chars, 1, '') - let prev_chars = split(before, '\zs') - let prev_char = get(prev_chars, -1, '') - - let eol = 0 - if col('$') - col('.') <= 1 - let eol = 1 - end - - " Ignore auto close if prev character is \ - if prev_char == '\' - return a:key - end - - " The key is difference open-pair, then it means only for ) ] } by default - if !has_key(b:AutoPairs, a:key) - let b:autopairs_saved_pair = [a:key, getpos('.')] - - " Skip the character if current character is the same as input - if current_char == a:key - return s:Right - end - - if !g:AutoPairsFlyMode - " Skip the character if next character is space - if current_char == ' ' && next_char == a:key - return s:Right.s:Right - end - - " Skip the character if closed pair is next character - if current_char == '' - if g:AutoPairsMultilineClose - let next_lineno = line('.')+1 - let next_line = getline(nextnonblank(next_lineno)) - let next_char = matchstr(next_line, '\s*\zs.') - else - let next_char = matchstr(line, '\s*\zs.') - end - if next_char == a:key - return "\e^a" - endif - endif - endif - - " Fly Mode, and the key is closed-pairs, search closed-pair and jump - if g:AutoPairsFlyMode && has_key(b:AutoPairsClosedPairs, a:key) - let n = stridx(after, a:key) - if n != -1 - return repeat(s:Right, n+1) - end - if search(a:key, 'W') - " force break the '.' when jump to different line - return "\" - endif - endif - - " Insert directly if the key is not an open key - return a:key - end - - let open = a:key - let close = b:AutoPairs[open] - - if current_char == close && open == close - return s:Right - end - - " Ignore auto close ' if follows a word - " MUST after closed check. 'hello|' - if a:key == "'" && prev_char =~ '\v\w' - return a:key - end - - " support for ''' ``` and """ - if open == close - " The key must be ' " ` - let pprev_char = line[col('.')-3] - if pprev_char == open && prev_char == open - " Double pair found - return repeat(a:key, 4) . repeat(s:Left, 3) - end - end - - let quotes_num = 0 - " Ignore comment line for vim file - if &filetype == 'vim' && a:key == '"' - if before =~ '^\s*$' - return a:key - end - if before =~ '^\s*"' - let quotes_num = -1 - end - end - - " Keep quote number is odd. - " Because quotes should be matched in the same line in most of situation - if g:AutoPairsSmartQuotes && open == close - " Remove \\ \" \' - let cleaned_line = substitute(line, '\v(\\.)', '', 'g') - let n = quotes_num - let pos = 0 - while 1 - let pos = stridx(cleaned_line, open, pos) - if pos == -1 - break - end - let n = n + 1 - let pos = pos + 1 - endwhile - if n % 2 == 1 - return a:key - endif - endif - - return open.close.s:Left -endfunction - -function! AutoPairsDelete() - if !b:autopairs_enabled - return "\" - end - - let line = getline('.') - let pos = col('.') - 1 - let current_char = get(split(strpart(line, pos), '\zs'), 0, '') - let prev_chars = split(strpart(line, 0, pos), '\zs') - let prev_char = get(prev_chars, -1, '') - let pprev_char = get(prev_chars, -2, '') - - if pprev_char == '\' - return "\" - end - - " Delete last two spaces in parens, work with MapSpace - if has_key(b:AutoPairs, pprev_char) && prev_char == ' ' && current_char == ' ' - return "\\" - endif - - " Delete Repeated Pair eg: '''|''' [[|]] {{|}} - if has_key(b:AutoPairs, prev_char) - let times = 0 - let p = -1 - while get(prev_chars, p, '') == prev_char - let p = p - 1 - let times = times + 1 - endwhile - - let close = b:AutoPairs[prev_char] - let left = repeat(prev_char, times) - let right = repeat(close, times) - - let before = strpart(line, pos-times, times) - let after = strpart(line, pos, times) - if left == before && right == after - return repeat("\\", times) - end - end - - - if has_key(b:AutoPairs, prev_char) - let close = b:AutoPairs[prev_char] - if match(line,'^\s*'.close, col('.')-1) != -1 - " Delete (|___) - let space = matchstr(line, '^\s*', col('.')-1) - return "\". repeat("\", len(space)+1) - elseif match(line, '^\s*$', col('.')-1) != -1 - " Delete (|__\n___) - let nline = getline(line('.')+1) - if nline =~ '^\s*'.close - if &filetype == 'vim' && prev_char == '"' - " Keep next line's comment - return "\" - end - - let space = matchstr(nline, '^\s*') - return "\\". repeat("\", len(space)+1) - end - end - end - - return "\" -endfunction - -function! AutoPairsJump() - call search('["\]'')}]','W') -endfunction -" string_chunk cannot use standalone -let s:string_chunk = '\v%(\\\_.|[^\1]|[\r\n]){-}' -let s:ss_pattern = '\v''' . s:string_chunk . '''' -let s:ds_pattern = '\v"' . s:string_chunk . '"' - -func! s:RegexpQuote(str) - return substitute(a:str, '\v[\[\{\(\<\>\)\}\]]', '\\&', 'g') -endf - -func! s:RegexpQuoteInSquare(str) - return substitute(a:str, '\v[\[\]]', '\\&', 'g') -endf - -" Search next open or close pair -func! s:FormatChunk(open, close) - let open = s:RegexpQuote(a:open) - let close = s:RegexpQuote(a:close) - let open2 = s:RegexpQuoteInSquare(a:open) - let close2 = s:RegexpQuoteInSquare(a:close) - if open == close - return '\v'.open.s:string_chunk.close - else - return '\v%(' . s:ss_pattern . '|' . s:ds_pattern . '|' . '[^'.open2.close2.']|[\r\n]' . '){-}(['.open2.close2.'])' - end -endf - -" Fast wrap the word in brackets -function! AutoPairsFastWrap() - let line = getline('.') - let current_char = line[col('.')-1] - let next_char = line[col('.')] - let open_pair_pattern = '\v[({\[''"]' - let at_end = col('.') >= col('$') - 1 - normal! x - " Skip blank - if next_char =~ '\v\s' || at_end - call search('\v\S', 'W') - let line = getline('.') - let next_char = line[col('.')-1] - end - - if has_key(b:AutoPairs, next_char) - let followed_open_pair = next_char - let inputed_close_pair = current_char - let followed_close_pair = b:AutoPairs[next_char] - if followed_close_pair != followed_open_pair - " TODO replace system searchpair to skip string and nested pair. - " eg: (|){"hello}world"} will transform to ({"hello})world"} - call searchpair('\V'.followed_open_pair, '', '\V'.followed_close_pair, 'W') - else - call search(s:FormatChunk(followed_open_pair, followed_close_pair), 'We') - end - return s:Right.inputed_close_pair.s:Left - else - normal! he - return s:Right.current_char.s:Left - end -endfunction - -function! AutoPairsMap(key) - " | is special key which separate map command from text - let key = a:key - if key == '|' - let key = '' - end - let escaped_key = substitute(key, "'", "''", 'g') - " use expr will cause search() doesn't work - execute 'inoremap '.key." =AutoPairsInsert('".escaped_key."')" - -endfunction - -function! AutoPairsToggle() - if b:autopairs_enabled - let b:autopairs_enabled = 0 - echo 'AutoPairs Disabled.' - else - let b:autopairs_enabled = 1 - echo 'AutoPairs Enabled.' - end - return '' -endfunction - -function! AutoPairsMoveCharacter(key) - let c = getline(".")[col(".")-1] - let escaped_key = substitute(a:key, "'", "''", 'g') - return "\\:call search("."'".escaped_key."'".")\a".c."\" -endfunction - -function! AutoPairsReturn() - if b:autopairs_enabled == 0 - return '' - end - let line = getline('.') - let pline = getline(line('.')-1) - let prev_char = pline[strlen(pline)-1] - let cmd = '' - let cur_char = line[col('.')-1] - if has_key(b:AutoPairs, prev_char) && b:AutoPairs[prev_char] == cur_char - if g:AutoPairsCenterLine && winline() * 3 >= winheight(0) * 2 - " Recenter before adding new line to avoid replacing line content - let cmd = "zz" - end - - " If equalprg has been set, then avoid call = - " https://github.com/jiangmiao/auto-pairs/issues/24 - if &equalprg != '' - return "\".cmd."O" - endif - - " conflict with javascript and coffee - " javascript need indent new line - " coffeescript forbid indent new line - if &filetype == 'coffeescript' || &filetype == 'coffee' - return "\".cmd."k==o" - else - return "\".cmd."=ko" - endif - end - return '' -endfunction - -function! AutoPairsSpace() - let line = getline('.') - let prev_char = line[col('.')-2] - let cmd = '' - let cur_char =line[col('.')-1] - if has_key(g:AutoPairsParens, prev_char) && g:AutoPairsParens[prev_char] == cur_char - let cmd = "\".s:Left - endif - return "\".cmd -endfunction - -function! AutoPairsBackInsert() - if exists('b:autopairs_saved_pair') - let pair = b:autopairs_saved_pair[0] - let pos = b:autopairs_saved_pair[1] - call setpos('.', pos) - return pair - endif - return '' -endfunction - -function! AutoPairsInit() - let b:autopairs_loaded = 1 - if !exists('b:autopairs_enabled') - let b:autopairs_enabled = 1 - end - let b:AutoPairsClosedPairs = {} - - if !exists('b:AutoPairs') - let b:AutoPairs = g:AutoPairs - end - - if !exists('b:AutoPairsMoveCharacter') - let b:AutoPairsMoveCharacter = g:AutoPairsMoveCharacter - end - - " buffer level map pairs keys - for [open, close] in items(b:AutoPairs) - call AutoPairsMap(open) - if open != close - call AutoPairsMap(close) - end - let b:AutoPairsClosedPairs[close] = open - endfor - - for key in split(b:AutoPairsMoveCharacter, '\s*') - let escaped_key = substitute(key, "'", "''", 'g') - execute 'inoremap =AutoPairsMoveCharacter('".escaped_key."')" - endfor - - " Still use level mapping for - if g:AutoPairsMapBS - " Use instead of for issue #14 sometimes press BS output strange words - execute 'inoremap =AutoPairsDelete()' - end - - if g:AutoPairsMapCh - execute 'inoremap =AutoPairsDelete()' - endif - - if g:AutoPairsMapSpace - " Try to respect abbreviations on a - let do_abbrev = "" - if v:version == 703 && has("patch489") || v:version > 703 - let do_abbrev = "" - endif - execute 'inoremap '.do_abbrev.'=AutoPairsSpace()' - end - - if g:AutoPairsShortcutFastWrap != '' - execute 'inoremap '.g:AutoPairsShortcutFastWrap.' =AutoPairsFastWrap()' - end - - if g:AutoPairsShortcutBackInsert != '' - execute 'inoremap '.g:AutoPairsShortcutBackInsert.' =AutoPairsBackInsert()' - end - - if g:AutoPairsShortcutToggle != '' - " use to ensure showing the status when toggle - execute 'inoremap '.g:AutoPairsShortcutToggle.' AutoPairsToggle()' - execute 'noremap '.g:AutoPairsShortcutToggle.' :call AutoPairsToggle()' - end - - if g:AutoPairsShortcutJump != '' - execute 'inoremap ' . g:AutoPairsShortcutJump. ' :call AutoPairsJump()a' - execute 'noremap ' . g:AutoPairsShortcutJump. ' :call AutoPairsJump()' - end - -endfunction - -function! s:ExpandMap(map) - let map = a:map - let map = substitute(map, '\(\w\+\)', '\=maparg(submatch(1), "i")', 'g') - return map -endfunction - -function! AutoPairsTryInit() - if exists('b:autopairs_loaded') - return - end - - " for auto-pairs starts with 'a', so the priority is higher than supertab and vim-endwise - " - " vim-endwise doesn't support AutoPairsReturn - " when use AutoPairsReturn will cause isn't expanded - " - " supertab doesn't support AutoPairsReturn - " when use AutoPairsReturn will cause Duplicated - " - " and when load after vim-endwise will cause unexpected endwise inserted. - " so always load AutoPairs at last - - " Buffer level keys mapping - " comptible with other plugin - if g:AutoPairsMapCR - if v:version == 703 && has('patch32') || v:version > 703 - " VIM 7.3 supports advancer maparg which could get info - " then auto-pairs could remap in any case. - let info = maparg('', 'i', 0, 1) - if empty(info) - let old_cr = '' - let is_expr = 0 - else - let old_cr = info['rhs'] - let old_cr = s:ExpandMap(old_cr) - let old_cr = substitute(old_cr, '', '' . info['sid'] . '_', 'g') - let is_expr = info['expr'] - let wrapper_name = 'AutoPairsOldCRWrapper73' - endif - else - " VIM version less than 7.3 - " the mapping's info is lost, so guess it is expr or not, it's - " not accurate. - let old_cr = maparg('', 'i') - if old_cr == '' - let old_cr = '' - let is_expr = 0 - else - let old_cr = s:ExpandMap(old_cr) - " old_cr contain (, I guess the old cr is in expr mode - let is_expr = old_cr =~ '\V(' && toupper(old_cr) !~ '\V' - - " The old_cr start with " it must be in expr mode - let is_expr = is_expr || old_cr =~ '\v^"' - let wrapper_name = 'AutoPairsOldCRWrapper' - end - end - - if old_cr !~ 'AutoPairsReturn' - if is_expr - " remap to `name` to avoid mix expr and non-expr mode - execute 'inoremap ', '', 'g') - let res = '' - let max = 0 - let mx = '\(]\{-}>\)\|\(<\/td>\)\|\(]\{-}>\)\|\(<\/div>\)' - let m = split(buf, mx) - for str in m - let c = split(str, '<[^>]*?>') - let str = substitute(str, '<[^>]\{-}>', ' ', 'g') - let str = substitute(str, '>', '>', 'g') - let str = substitute(str, '<', '<', 'g') - let str = substitute(str, '"', '"', 'g') - let str = substitute(str, ''', '''', 'g') - let str = substitute(str, ' ', ' ', 'g') - let str = substitute(str, '¥', '\¥', 'g') - let str = substitute(str, '&', '\&', 'g') - let str = substitute(str, '^\s*\(.*\)\s*$', '\1', '') - let str = substitute(str, '\s\+', ' ', 'g') - let l = len(str) - if l > threshold_len - let per = (l+0.0) / len(c) - if max < l && per > threshold_per - let max = l - let res = str - endif - endif - endfor - let res = substitute(res, '^\s*\(.*\)\s*$', '\1', 'g') - return res -endfunction - -function! emmet#util#getImageSize(fn) abort - let fn = a:fn - - if emmet#util#isImageMagickInstalled() - return emmet#util#imageSizeWithImageMagick(fn) - endif - - if filereadable(fn) - let hex = substitute(system('xxd -p "'.fn.'"'), '\n', '', 'g') - else - if fn !~# '^\w\+://' - let path = fnamemodify(expand('%'), ':p:gs?\\?/?') - if has('win32') || has('win64') | - let path = tolower(path) - endif - for k in keys(g:emmet_docroot) - let root = fnamemodify(k, ':p:gs?\\?/?') - if has('win32') || has('win64') | - let root = tolower(root) - endif - if stridx(path, root) == 0 - let v = g:emmet_docroot[k] - let fn = (len(v) == 0 ? k : v) . fn - break - endif - endfor - endif - let hex = substitute(system(g:emmet_curl_command.' "'.fn.'" | xxd -p'), '\n', '', 'g') - endif - - let [width, height] = [-1, -1] - if hex =~# '^89504e470d0a1a0a' - let width = eval('0x'.hex[32:39]) - let height = eval('0x'.hex[40:47]) - endif - if hex =~# '^ffd8' - let pos = 4 - while pos < len(hex) - let bs = hex[pos+0:pos+3] - let pos += 4 - if bs ==# 'ffc0' || bs ==# 'ffc2' - let pos += 6 - let height = eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3]) - let pos += 4 - let width = eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3]) - break - elseif bs =~# 'ffd[9a]' - break - elseif bs =~# 'ff\(e[0-9a-e]\|fe\|db\|dd\|c4\)' - let pos += (eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3])) * 2 - endif - endwhile - endif - if hex =~# '^47494638' - let width = eval('0x'.hex[14:15].hex[12:13]) - let height = eval('0x'.hex[18:19].hex[16:17]) - endif - - return [width, height] -endfunction - -function! emmet#util#imageSizeWithImageMagick(fn) abort - let img_info = system('identify -format "%wx%h" "'.a:fn.'"') - let img_size = split(substitute(img_info, '\n', '', ''), 'x') - if len(img_size) != 2 - return [-1, -1] - endif - return img_size -endfunction - -function! emmet#util#isImageMagickInstalled() abort - if !get(g:, 'emmet_use_identify', 1) - return 0 - endif - return executable('identify') -endfunction - -function! emmet#util#unique(arr) abort - let m = {} - let r = [] - for i in a:arr - if !has_key(m, i) - let m[i] = 1 - call add(r, i) - endif - endfor - return r -endfunction - -let s:seed = localtime() -function! emmet#util#srand(seed) abort - let s:seed = a:seed -endfunction - -function! emmet#util#rand() abort - let s:seed = s:seed * 214013 + 2531011 - return (s:seed < 0 ? s:seed - 0x80000000 : s:seed) / 0x10000 % 0x8000 -endfunction - -function! emmet#util#cache(name, ...) abort - let content = get(a:000, 0, '') - let dir = expand('~/.emmet/cache') - if !isdirectory(dir) - call mkdir(dir, 'p', 0700) - endif - let file = dir . '/' . substitute(a:name, '\W', '_', 'g') - if len(content) == 0 - if !filereadable(file) - return '' - endif - return join(readfile(file), "\n") - endif - call writefile(split(content, "\n"), file) -endfunction - -function! emmet#util#getcurpos() abort - let pos = getpos('.') - if mode(0) ==# 'i' && pos[2] > 0 - let pos[2] -=1 - endif - return pos -endfunction - -function! emmet#util#closePopup() abort - return pumvisible() ? "\" : '' -endfunction diff --git a/vim/plugins/emmet-vim/doc/emmet.txt b/vim/plugins/emmet-vim/doc/emmet.txt deleted file mode 100644 index ffa5e0a..0000000 --- a/vim/plugins/emmet-vim/doc/emmet.txt +++ /dev/null @@ -1,1773 +0,0 @@ -*emmet.txt* *Emmet* for Vim - - ------------------------------------------------------- - Emmet: vim plugins for HTML and CSS hi-speed coding - ------------------------------------------------------- - -Author: Yasuhiro Matsumoto -WebSite: http://mattn.kaoriya.net/ -Repository: https://github.com/mattn/emmet-vim -Site: https://mattn.github.com/emmet-vim -License: BSD style license - -============================================================================== -CONTENTS *emmet-contents* - -Introduction |emmet-introduction| -Install |emmet-install| -Tutorial |emmet-tutorial| - 1. Expand abbreviation |emmet-expand-abbr| |,| - 2. Expand word |emmet-expand-word| |;| - 3. Update tag |emmet-update-tag| |u| - 4. Wrap with abbreviation |emmet-wrap-with-abbreviation| |v_,| - 5. Balance tag inward |emmet-balance-tag-inward| |d| - 6. Balance tag outward |emmet-balance-tag-outward| |D| - 7. Go to next edit point |emmet-goto-next-point| |n| - 8. Go to previous edit point |emmet-goto-previous-point| |N| - 9. Add and update size |emmet-update-image-size| |i| - 10. Merge lines |emmet-merge-lines| |m| - 11. Remove tag |emmet-remove-tag| |k| - 12. Split/join tag |emmet-split-join-tag| |j| - 13. Toggle comment |emmet-toggle-comment| |/| - 14. Make anchor from URL |emmet-make-anchor-url| |a| - 15. Make quoted text from URL |emmet-quoted-text-url| |A| - 16. Code pretty |emmet-code-pretty| |c| - 17. Lorem ipsum |emmet-lorem-ipsum| -HTML expression syntax |emmet-html-expression-syntax| - 1. Elements |emmet-html-syntax-elements| - 2. Nesting operators |emmet-html-syntax-nesting-operators| - 2.1. Child |emmet->| - 2.2. Sibling |emmet-+| - 2.3. Climb-up |emmet-^| - 2.4. Multiplication |emmet-star| - 2.5. Grouping |emmet-()| - 3. Attribute operators |emmet-html-syntax-attribute-operators| - 3.1. ID and CLASS |emmet-.| |emmet-#| - 3.2. Custom attributes |emmet-[]| - 3.3. Item numbering |emmet-$| - 3.3.1. Changing numbering origin and direction |emmet-@| - 3.4. Quote character |emmet-html-attr-quote-char| - 4. Text |emmet-{}| - 5. Implicit tag names |emmet-html-implicit-tag-names| - 6. Notes on abbreviation formatting |emmet-html-syntax-notes| - 7. Choose position to insert text when wrap abbreviation |emmet-$#| -CSS expression syntax |emmet-css-expression-syntax| - 1. Properties |emmet-css-properties| - 2. Values |emmet-css-values| - 3. Units |emmet-css-units| - 4. Vendor prefixes |emmet-css-vendor-prefixes| -Commands |emmet-commands| - :Emmet |:Emmet| - :EmmetInstall |:EmmetInstall| -Variables |emmet-variables| - g:emmet_html5 |g:emmet_html5| - g:emmet_docroot |g:emmet_docroot| - g:emmet_curl_command |g:emmet_curl_command| - g:user_emmet_complete_tag |g:user_emmet_complete_tag| - g:user_emmet_leader_key |g:user_emmet_leader_key| - g:user_emmet_install_global |g:user_emmet_install_global| - g:user_emmet_install_command |g:user_emmet_install_command| - g:user_emmet_settings |g:user_emmet_settings| - g:user_emmet_mode |g:user_emmet_mode| -Customize |emmet-customize| - 1. Key mappings |emmet-customize-key-mappings| - 2. Indent size |emmet-indent-size| - 3. Define tag's behavior |emmet-define-tags-behavior| - 4. Adding custom snippets |emmet-custom-snippets| -Filters |emmet-filters-list| - Escapes XML-unsafe characters |emmet-filter-e| - Add comments around 'important tags' |emmet-filter-c| - Outputs as a single line |emmet-filter-s| - Trim list markers |emmet-filter-t| -Links |emmet-links| -ToDo |emmet-todo| - -============================================================================== -INTRODUCTION *emmet-introduction* *emmet* - -Emmet is an editor plugin for high-speed HTML, XML, XSL (or any other -structured code format) coding and editing. The core of this plugin is a -powerful abbreviation engine which allows you to expand expressions, -similar to CSS selectors, into HTML code: -> - div#page>div.logo+ul#navigation>li*5>a -< -can be expanded into: -> -
- - -
-< -Read more about current Emmet syntax - |emmet-html-expression-syntax| - |emmet-css-expression-syntax| - http://docs.emmet.io/abbreviations/ - -Abbreviation engine has a modular structure which allows you -to expand abbreviations into different languages. -Emmet currently supports CSS, HTML, XML/XSL and HAML, Slim languages -via filters (see |emmet-filter|). - -============================================================================== -INSTALL *emmet-install* - -Install the distributed files into Vim runtime directory which is usually -'~/.vim/', or '$HOME/vimfiles' on Windows. - -If you install pathogen (https://github.com/tpope/vim-pathogen) -that provided by Tim Pope, you should extract the -file into 'bundle' directory. - -============================================================================== -TUTORIAL *emmet-tutorial* - -If you are seeing this file as :help, then you can't edit this file. -You should copy this section and create new buffer, paste and write as -'emmet-tutor.txt'. Formally, open the file to start tutorial. - -1. Expand abbreviation *emmet-expand-abbr* *,* - - Type abbreviation as 'div>p#foo$*3>a' and type ','. -> -
-

- -

-

- -

-

- -

-
-< -2. Expand abbreviation *emmet-expand-word* *;* - - When you want to expand word except html tokens like below, use this. -> - foo -< - This will be expanded like: -> - - -3. Update tag *emmet-update-tag* *u* - - The begining of tags '
' on below -> -
foo
-< - Type 'u' request 'Enter Abbreviation:'. Then type -> - .global -< - This will be expanded like: -> -
foo
-< -4. Wrap with abbreviation *emmet-wrap-with-abbreviation* *v_,* - - Write as below. -> - test1 - test2 - test3 -< - Then do visual select (line wise) and type ','. - If you request 'Tag:', then type -> - ul>li* -< - Result: -> -
    -
  • test1
  • -
  • test2
  • -
  • test3
  • -
-< - If you type tag name, for example -> - blockquote -< - then you'll see as following: -> -
- test1 - test2 - test3 -
-< - See also: |emmet-filter-t|, |emmet-$#| - -5. Balance tag inward *emmet-balance-tag-inward* *d* - - To select inward of '
    ' tag, type 'd' in insert mode. -> -
      - *
    • -
    • -
    • -
    -< - If cursor is at '*', 'd' select from begin of '
      ' to end of '
    '. - If cursor is at first of '
  • ', it select '
  • '. - -6. Balance tag outward *emmet-balance-tag-outward* *D* - - To select outward of '
      ' tag type 'D' in insert mode. -> -
        - *
      • -
      • -
      • -
      -< - If cursor is at '*', 'D' select from next letter of '
        ' - to previous letter of '
      '. - If cursor is at first of '
    • ', it select '
    • '. - -7. Go to next edit point *emmet-goto-next-point* *n* - - To jump next point that need to edit, type 'n' in insert mode. -> - *
      foo
      -
      -< - If cursor is at '*', type 'n' to move a cursor - into attribute value of '
      ' specified id as 'foo'. - And type again 'n' to move a cursor - into inner of '
      ' specified id as 'bar'. - -8. Go to previous edit point *emmet-goto-previous-point* *N* - - To jump previous point that need to edit, type 'N' in insert mode. -> -
      foo
      -
      * -< - If cursor is at '*', type 'N' to move a cursor - into '
      ' specified id as 'bar'. - And type again 'N' to move a cursor - into attribute value of 'foo'. - -9. Add and update size *emmet-update-image-size* *i* - - To add or update 'width' and 'height' attributes of image, - type 'i' on '' tag -> - -< - Type 'i' on '' tag -> - -< - If you change image, then type it again. it will be following. -> - -< - Image size retrieved using 'identify' (ImageMagick.org) (if available) - or |xxd|. - -10. Merge lines *emmet-merge-lines* *m* - - To join multi line text like following, type |J|. -> -
        -
      • -
      • -
      • -
      -< - If you select part of line include '
    • ' and type |m|, - it will be following. -> -
        -
      • -
      -< -11. Remove tag *emmet-remove-tag* *k* - - To remove tag in the block, type 'k'. -> - -< - Type 'k' in insert mode, then -> -
      - -
      -< - And type 'k' in there again, then '
      ' will be removed. - -12. Split/join tag *emmet-split-join-tag* *j* - - To join block, type 'j'. -> -
      - cursor is here -
      -< - Type 'j' in insert mode. Then, -> -
      -< - And type 'j' in there again. -> -
      -
      -< -13. Toggle comment *emmet-toggle-comment* */* - - Move cursor to block -> -
      - hello world -
      -< - Type '/' in insert mode. -> - -< - Type '/' in there again. -> -
      - hello world -
      -< -14. Make anchor from URL *emmet-make-anchor-url* *a* - - Move cursor to URL -> - http://www.google.com/ -< - Type 'a' -> - Google -< - Text retrieved using command, specified by |g:emmet_curl_command|. - -15. Make quoted text from URL *emmet-quoted-text-url* *A* - - Move cursor to URL -> - https://github.com/ -< - Type 'A' -> -
      - Secure source code hosting and collaborative development - GitHub
      -

      How does it work? Get up and running in seconds by forking a project, pushing an existing repository...

      - https://github.com/ -
      -< - Text retrieved using command, specified by |g:emmet_curl_command|. - -16. Code pretty *emmet-code-pretty* *c* - - Select code block, for example select following code from 'int main()'. -> -

      Writing in C language

      - - int main() { - puts("hello world"); - } -< - Type 'c' -> - int main() {
      -   puts("hello world");
      - }
      -< - To convert text into html used command |:TOhtml|. - -17. Lorem ipsum *emmet-lorem-ipsum* - - To insert dummy text (30 words by default). -> - div>lorem -< - Type |,| -> -
      Adipisicing asperiores deleniti ipsum fuga deserunt perferendis - molestiae sunt excepturi aut quo nihil! Optio accusantium corporis molestiae - deserunt ab, veritatis commodi. Eius nobis ab deserunt magni iure quo - laboriosam laboriosam.
      -< - For japanese user, put like follow into your |g:user_emmet_settings|: -> - let g:user_emmet_settings = { - ... - - \ 'custom_expands1' : { - \ '^\%(lorem\|lipsum\)\(\d*\)$' : function('emmet#lorem#ja#expand'), - \ }, - - ... -< - You will get japanese dummy text. Text retrieved from url - 'http://www.aozora.gr.jp/cards/000081/files/470_15407.html' - using command, specified by |g:emmet_curl_command|. - - To insert 3 words of dummy text. -> - div>lorem3 -< - Type |,| -> -
      - Elit libero id. -
      -< -============================================================================== -HTML EXPRESSION SYNTAX *emmet-html-expression-syntax* - -Emmet uses syntax similar to CSS selectors for describing elements' positions -inside generated tree and elements' attributes. - -1. Elements *emmet-html-syntax-elements* - - You can use elements' names like 'div' or 'p' to generate HTML tags. -> - p ->

      - div ->
      -< - You can write any word and transform it into a tag: -> - foo -> - bar -> -< - Emmet knowns set of empty elements: -> - br ->
      or
      - meta -> or -< - To choose between HTML '>' and XHTML ' />' use |g:emmet_html5| or - |g:user_emmet_settings|: -> - let g:user_emmet_settings = { - \ ... - \ 'html': { - \ ... - \ 'empty_element_suffix': ' />', - \ ... - \ }, - \ ... - \} -< - Emmet will automatically insert some attributes: -> - a -> - link -> -< - Set of inserted attributes can be changed using |g:user_emmet_settings|: -> - let s:emmet_settings = { - \ ... - \ 'html': { - \ ... - \ 'default_attributes': { - \ ... - \ 'a': {'href': ''}, - \ 'ins': {'datetime': '${datetime}'}, - \ 'iframe': [{'src': ''}, {'frameborder': '0'}], - \ 'textarea': [{'name': ''}, {'id': ''}, {'cols': '30'}, {'rows': '10'}], - \ ... - \ }, - \ ... - \ }, - \ ... - \} -< -2. Nesting operators *emmet-html-syntax-nesting-operators* - - Nesting operators are used to position abbreviation elements - inside generated tree: whether it should be placed - inside or near the context element. - - Operator Description Link ~ - > Child |emmet->| - + Sibling |emmet-+| - ^ Climb-up |emmet-^| - * Multiplication |emmet-star| - () Grouping |emmet-()| - -2.1. Child *emmet->* - - You can use '>' operator to nest elements inside each other: -> - div>ul>li -< - will produce -> -
      -
        -
      • -
      -
      -< -2.2. Sibling *emmet-+* - - Use '+' operator to place elements near each other, on the same level: -> - div+p+bq -< - will output -> -
      -

      -
      -< -2.3. Climb-up *emmet-^* - - With '>' operator you're descending down the generated tree and - positions of all sibling elements will be resolved - against the most deepest element: -> - div+div>p>span+em -< - will be expanded to -> -
      -
      -

      - - -

      -
      -< - With '^' operator, you can climb one level up the tree and change context - where following elements should appear: -> - div+div>p>span+em^bq -< - outputs to -> -
      -
      -

      - - -

      -
      -
      -< - You can use as many '^' operators as you like, - each operator will move one level up: -> - div+div>p>span+em^^^bq -< - will output to -> -
      -
      -

      - - -

      -
      -
      -< -2.4. Multiplication *emmet-star* - - With '*' operator you can define how many times element should be outputted: -> - ul>li*5 -< - outputs to -> -
        -
      • -
      • -
      • -
      • -
      • -
      -< - Expression may contain several '*' operators: -> - tr*2>td*3 -< - become -> - - - - - - - - - - -< -2.5. Grouping *emmet-()* - - Parentheses '()' are used by Emmets' power users for grouping subtrees - in complex abbreviations: -> - div>(header>ul>li*2>a)+footer>p -< - expands to -> -
      -
      -
        -
      • -
      • -
      -
      -
      -

      -
      -
      -< - If you're working with browser's DOM, you may think of groups - as Document Fragments: each group contains abbreviation subtree and - all the following elements are inserted at the same level - as the first element of group. - - You can nest groups inside each other and - combine them with multiplication '*' operator: -> - (div>dl>(dt+dd)*3)+footer>p -< - produces -> -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -

      -
      -< - With groups, you can literally write full page mark-up - with a single abbreviation, but please don't do that. - -3. Attribute operators *emmet-html-syntax-attribute-operators* - - Attribute operators are used to modify attributes of outputted elements. - For example, in HTML and XML you can quickly add 'class' attribute - to generated element. - - Operator Description Link ~ - . Attribute 'class' |emmet-.| - # Attribute 'id' |emmet-#| - [] Custom attributes |emmet-[]| - $ Number |emmet-$| - @ Number origin and direction |emmet-@| - -3.1. ID and CLASS *emmet-.* *emmet-#* - - In CSS, you use 'elem#id' and 'elem.class' notation to reach the elements - with specified 'id' or 'class' attributes. - In Emmet, you can use the very same syntax to add these attributes - to specified element: -> - span.class1 -> - span.class1.class2 -> - div#wrapper ->
      - div#wrapper.content ->
      -< - More complex expression: -> - div#header+div.page+div#footer.class1.class2.class3 -< - will output -> - -
      - -< -3.2. Custom attributes *emmet-[]* - - You can use '[attr]' notation (as in CSS) - to add custom attributes to your element: -> - td[title="Hello world!" colspan=3] -< - outputs -> - -< - You can place as many attributes as you like inside square brackets. - - Attribute values may be omitted: -> - td[colspan title] -< - will produce -> - -< - You can use single or double quotes for quoting attribute values. -> - div[a='value1' b="value2"] -< - become -> -
      -< - You don't need to quote values if they don't contain spaces: -> - td[title=hello colspan=3] -< - will output -> - -< -3.3. Item numbering *emmet-$* - - With multiplication '*' operator you can repeat elements, - but with '$' you can number them. - Place '$' operator inside element's name, attribute's name or - attribute's value to output current number of repeated element: -> - ul>li.item_$*5 -< - outputs to -> -
        -
      • -
      • -
      • -
      • -
      • -
      -< - You can use multiple '$' in a row to pad number with zeroes: -> - ul>li.item_$$$*5 -< - outputs to -> -
        -
      • -
      • -
      • -
      • -
      • -
      -< - Also '$' can be used in element name and in text (|emmet-{}|): -> - h$[title=item$]{Header $}*3 -< - transformed to -> -

      Header 1

      -

      Header 2

      -

      Header 3

      -< -3.3.1. Changing numbering origin and direction *emmet-@* - - With '@' modifier, you can change - - numbering direction (ascending or descending) and - - origin (i. e. start value). - - For example, to change direction, add '@-' after '$': -> - ul>li.item_$@-*5 -< - outputs to -> -
        -
      • -
      • -
      • -
      • -
      • -
      -< - To change counter origin value, add '@N' modifier to '$': -> - ul>li.item_$@3*5 -< - transforms to -> -
        -
      • -
      • -
      • -
      • -
      • -
      -< - You can use these modifiers together: -> - ul>li.item_$@-3*5 -< - is transformed to -> -
        -
      • -
      • -
      • -
      • -
      • -
      -> -3.4. Quote character *emmet-html-attr-quote-char* - - |g:user_emmet_settings| may be used to change attribute quote character: -> - let g:user_emmet_settings = { - ... - \ 'html' : { - ... - \ 'quote_char': "'", - ... - \ }, - ... - \} -< - Then abbreviation -> - a[target=_blank] -< - will expand to -> - -< - instead of -> - -< - Default quote is '"'. - -4. Text *emmet-{}* - - You can use curly braces to add text to element: -> - a{Click me} -< - will produce -> - Click me -< - Note that '{text}' is used and parsed as a separate element - (like, 'div', 'p' etc), but has a special meaning - when written right after element. For example, -> - a{click} -< - and -> - a>{click} -< - will produce the same output, but -> - a{click}+b{here} -< - and -> - a>{click}+b{here} -< - won't: -> - - clickhere - - - clickhere -< - In second example the '' element is placed inside '' element. - And that's the difference: when '{text}' is written right after element, - it doesn't change parent context. - Here's more complex example showing why it is important: -> - p>{Click }+a{here}+{ to continue} -< - produces -> -

      Click here to continue

      -< - In this example, to write 'Click here to continue' inside '

      ' element - we have explicitly move down the tree with '>' operator after 'p', - but in case of 'a' element we don't have to, since we need '' element - with here word only, without changing parent context. - - For comparison, here's the same abbreviation - written without child '>' operator: -> - p{Click }+a{here}+{ to continue} -< - produces -> -

      Click

      - here to continue -< -5. Implicit tag names *emmet-html-implicit-tag-names* - - Even with such a powerful abbreviation engine, - which can expand large HTML structures from short abbreviation, - writing tag names may be very tedious. - - In many cases you can skip typing tag names and - Emmet will substitute it for you. - For example, instead of > - div.content -< you can simply write > - .content -< and expand it into > -
      -< - Other examples: -> - .wrapper ->
      - #popup -> -< - When you expand abbreviation, Emmet tries to grab parent context, - e. g. the HTML element, inside which you're expanding the abbreviation. - If the context was grabbed successfully, - Emmet uses its name to resolve implicit names. - Emmet looks at the parent tag name every time - you're expanding the abbreviation with an implicit name. - Here's how it resolves the names for some parent elements: - - Inserted element Parent elements ~ - li ul, ol - tr table, tbody, thead, tfoot - td tr - option select, optgroup - span Inline elements - div Block elements - - Take a look at some abbreviations equivalents - with implicit and explicit tag names: -> - .wrap>.content -> div.wrap>div.content - em>.info -> em>span.info - ul>.item*3 -> ul>li.item*3 - table>.row>.col -> table>tr.row>td.col - table>#row$*4>[colspan=2] -> table>tr#row$*4>td[colspan=2] -< -6. Notes on abbreviation formatting *emmet-html-syntax-notes* - - When you get familiar with Emmet's abbreviations syntax, - you may want to use some formatting to make your abbreviations more readable. - For example, use spaces between elements and operators, like this: -> - (header > ul.nav > li*5) + footer -< - But it won't work, because space is a stop symbol - where Emmet stops abbreviation parsing. - - Many users mistakenly think that each abbreviation - should be written in a new line, but they are wrong: - you can type and expand abbreviation anywhere in the text: - - This is why Emmet needs some indicators (like spaces) - where it should stop parsing to not expand anything that you don't need. - If you're still thinking that such formatting is required - for complex abbreviations to make them more readable: - - abbreviations are not a template language, - they don't have to be "readable", - they have to be "quickly expandable and removable"; - - you don't really need to write complex abbreviations. - Stop thinking that "typing" is the slowest process in web-development. - You'll quickly find out that constructing a single complex abbreviation - is much slower and error-prone than constructing and typing - a few short ones. - -7. Choose position to insert text when wrap abbreviation *emmet-$#* - - When wrap abbreviation (|emmet-wrap-with-abbreviation|) you can choose - position to insert text using '$#' operator. - Operator '$#' may be used only inside |emmet-[]| and/or |emmet-{}|. - - For example, do visual select (line wise) following text: -> - First - Second - Third -< - Then press ',' and type -> - ul>li[ title="[$#]" ]* -< - Result: -> -
        -
      • First
      • -
      • Second
      • -
      • Third
      • -
      -< - You may type -> - input[ type=input value=$# ] -< - to get -> - - - -< - Using '$#' you can type text (|emmet-{}|) only once: -> - a[title=$#]{foo} -< - will be expanded to -> - foo -< -============================================================================== -CSS EXPRESSION SYNTAX *emmet-css-expression-syntax* - -1. Properties *emmet-css-properties* - - Emmet has a lot of predefined snippets for CSS properties. -> - -< - become -> - -< - In above example '|' denotes a cursor (caret) position. - - Other examples: -> - t -> top: ; - d -> display: ; - o -> outline: ; - ov -> overflow: ; - cu -> cursor: ; - bdrs -> border-radius: ; -< - '+' operator may be used to insert number of properties: -> - m1+p2 -< - become -> - margin: 1px; - padding: 2px; -< -2. Values *emmet-css-values* - - Some properties have default values: -> - c -> color: #000; - bgc -> background-color: #FFF; - zoo -> zoom: 1; -< - To insert predefined property value after abbreviation - type colon ':' and first character of predefined keyword: -> - d:n -> display: none; - d:b -> display: block; - d:i -> display: inline; -< - Numerical value can be typed directly after abbreviation: -> - m10 -> margin: 10px; - m2e -> margin: 2em; -< - Use a hyphen '-' to separate some numerical values: -> - m10-20 -> margin: 10px 20px; - p1-2-3 -> padding: 1px 2px 3px; -< - To negative values - precede the first value with hyphen and all the rest with double hyphens: -> - m-10 -> margin: -10px; - m-1--2 -> margin: -1px -2px; - p-2--1-0-1 -> padding: -2px -1px 0 1px; -< - To insert '!important' append '!' to property abbreviation: -> - m! -> margin: !important; - bac! -> background: !important; -< - You can use special abbreviation 'lg(...)' - to insert definition of linear gradient. Example: -> - lg(left, #fc0 30%, red) -< - will expand to -> - background-image: -webkit-gradient(left, 0 0, 0 100, from(#fc0 30%), to(red)); - background-image: -webkit-linear-gradient(#fc0 30%, red); - background-image: -moz-linear-gradient(#fc0 30%, red); - background-image: -o-linear-gradient(#fc0 30%, red); - background-image: linear-gradient(#fc0 30%, red); -< -3. Units *emmet-css-units* - - By default, when you expand an abbreviation with integer value, - Emmet outputs it with a 'px' unit: -> - bor2 -> border: 2px; - fs100 -> font-size: 100px; - miw20 -> min-width: 20px; -< - By default, if you're expanding an abbreviation with a float value, - it is outputted with an 'em' unit: -> - fs1.5 -> font-style: 1.5em; -< - But you can explicitly provide the unit name - by putting one of characters right after value: - - Character Unit ~ - p % - e em - - Examples: -> - fs2e -> font-style: 2em; - w100p -> width: 100%; -< -4. Vendor prefixes *emmet-css-vendor-prefixes* - - To automatically create vendor-prefixed copies of property, - precede abbreviation with a hyphen '-'. For example, abbreviation -> - -bdrs -< - will be expanded into -> - -webkit-border-radius: ; - -moz-border-radius: ; - border-radius: ; -< -============================================================================== -COMMANDS *emmet-commands* - -:Emmet {expression} *:Emmet* - Expand {expression} and insert result under cursor. - {expression} is |emmet-html-expression|. - Also see |g:user_emmet_install_command|. - -:EmmetInstall *:EmmetInstall* - Create Emmet mappings to current buffer - (|mapping|, |:map-|) and, - if set |g:user_emmet_complete_tag|, - change |'omnifunc'| option to emmet#completeTag() - -============================================================================== -VARIABLES *emmet-variables* - -g:emmet_html5 *g:emmet_html5* - If set to 1, enable HTML 5 support: - - use ">" instead of "/>": > - - -< - omit some HTML 4 attributes: > -