diff --git a/src/os/installs/vim.sh b/src/os/installs/vim.sh index c5093cbd9..74f66a295 100755 --- a/src/os/installs/vim.sh +++ b/src/os/installs/vim.sh @@ -7,39 +7,23 @@ cd "$(dirname "${BASH_SOURCE[0]}")" \ install_plugins() { - declare -r VUNDLE_DIR="$HOME/.vim/plugins/Vundle.vim" - declare -r VUNDLE_GIT_REPO_URL="https://github.com/VundleVim/Vundle.vim.git" + declare -r VIM_PACK_DIR="$HOME/.vim/pack" + declare -r MINPAC_DIR="$VIM_PACK_DIR/minpac/opt/minpac" + declare -r MINPAC_GIT_REPO_URL="https://github.com/k-takata/minpac.git" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Install plugins. execute \ - "rm -rf '$VUNDLE_DIR' \ - && git clone --quiet '$VUNDLE_GIT_REPO_URL' '$VUNDLE_DIR' \ - && printf '\n' | vim +PluginInstall +qall" \ + "rm -rf $VIM_PACK_DIR \ + && git clone --quiet $MINPAC_GIT_REPO_URL $MINPAC_DIR" \ "Install plugins" \ || return 1 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Install additional things required by some plugins. - # In the case of fresh installs, in order for `npm` to be - # available, the `~/bash.local` file needs to be sourced - - execute \ - ". $HOME/.bash.local \ - && cd $HOME/.vim/plugins/tern_for_vim \ - && npm install" \ - "Install plugins (extra installs for 'tern_for_vim')" - -} - -update_plugins() { - - execute \ - "vim +PluginUpdate +qall" \ - "Update plugins" + vim +PluginsSetup } @@ -51,7 +35,6 @@ main() { "./$(get_os)/vim.sh" install_plugins - update_plugins } diff --git a/src/vim/vim/pack/minpac/opt/.gitkeep b/src/vim/vim/pack/minpac/opt/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/src/vim/vim/pack/minpac/start/.gitkeep b/src/vim/vim/pack/minpac/start/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/src/vim/vim/plugins/Vundle.vim b/src/vim/vim/plugins/Vundle.vim deleted file mode 160000 index 0765c5c4f..000000000 --- a/src/vim/vim/plugins/Vundle.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0765c5c4f485fa111f190e2d7dd89ec9f5b3f554 diff --git a/src/vim/vim/plugins/ctrlp.vim b/src/vim/vim/plugins/ctrlp.vim deleted file mode 160000 index 564176f01..000000000 --- a/src/vim/vim/plugins/ctrlp.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 564176f01d7f3f7f8ab452ff4e1f5314de7b0981 diff --git a/src/vim/vim/plugins/delimitmate b/src/vim/vim/plugins/delimitmate deleted file mode 160000 index 537a1da0f..000000000 --- a/src/vim/vim/plugins/delimitmate +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 537a1da0fa5eeb88640425c37e545af933c56e1b diff --git a/src/vim/vim/plugins/editorconfig-vim b/src/vim/vim/plugins/editorconfig-vim deleted file mode 160000 index 0d54ea863..000000000 --- a/src/vim/vim/plugins/editorconfig-vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0d54ea863089fb13be423b4aed6cca35f3a5d778 diff --git a/src/vim/vim/plugins/emmet-vim b/src/vim/vim/plugins/emmet-vim deleted file mode 160000 index def5d57a1..000000000 --- a/src/vim/vim/plugins/emmet-vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit def5d57a1ae5afb1b96ebe83c4652d1c03640f4d diff --git a/src/vim/vim/plugins/html5.vim b/src/vim/vim/plugins/html5.vim deleted file mode 160000 index 7c9f6f38c..000000000 --- a/src/vim/vim/plugins/html5.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7c9f6f38ce4f9d35db7eeedb764035b6b63922c6 diff --git a/src/vim/vim/plugins/jshint2.vim b/src/vim/vim/plugins/jshint2.vim deleted file mode 160000 index eef949d18..000000000 --- a/src/vim/vim/plugins/jshint2.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit eef949d182487888a5abb7e4c652bc19dfa9d71a diff --git a/src/vim/vim/plugins/neocomplcache.vim b/src/vim/vim/plugins/neocomplcache.vim deleted file mode 160000 index 1e6ff11e6..000000000 --- a/src/vim/vim/plugins/neocomplcache.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1e6ff11e6c9b057f35534a43d1c5da53d27b415c diff --git a/src/vim/vim/plugins/neosnippet b/src/vim/vim/plugins/neosnippet deleted file mode 160000 index efb2a615d..000000000 --- a/src/vim/vim/plugins/neosnippet +++ /dev/null @@ -1 +0,0 @@ -Subproject commit efb2a615df2e6df9364087686dacca223fcfa16a diff --git a/src/vim/vim/plugins/neosnippet-snippets b/src/vim/vim/plugins/neosnippet-snippets deleted file mode 160000 index 725c989f1..000000000 --- a/src/vim/vim/plugins/neosnippet-snippets +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 725c989f18e9c134cddd63a7c6b15bed5c244657 diff --git a/src/vim/vim/plugins/nerdtree b/src/vim/vim/plugins/nerdtree deleted file mode 160000 index 4c588f182..000000000 --- a/src/vim/vim/plugins/nerdtree +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4c588f182090e01edadeecb127a353cb08d1e39f diff --git a/src/vim/vim/plugins/syntastic b/src/vim/vim/plugins/syntastic deleted file mode 160000 index 8d5e37c29..000000000 --- a/src/vim/vim/plugins/syntastic +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8d5e37c29cf5952fbf300b9230bffe424c61a488 diff --git a/src/vim/vim/plugins/tabular b/src/vim/vim/plugins/tabular deleted file mode 160000 index 339091ac4..000000000 --- a/src/vim/vim/plugins/tabular +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 339091ac4dd1f17e225fe7d57b48aff55f99b23a diff --git a/src/vim/vim/plugins/tcomment_vim b/src/vim/vim/plugins/tcomment_vim deleted file mode 160000 index 90eaf7590..000000000 --- a/src/vim/vim/plugins/tcomment_vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 90eaf759099bcd47aa0471f974109d7fd78e4eea diff --git a/src/vim/vim/plugins/tern_for_vim b/src/vim/vim/plugins/tern_for_vim deleted file mode 160000 index 994ffbe78..000000000 --- a/src/vim/vim/plugins/tern_for_vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 994ffbe783da36d67786b6c66a4bf784c5eab300 diff --git a/src/vim/vim/plugins/unicode.vim b/src/vim/vim/plugins/unicode.vim deleted file mode 160000 index bc20d0fb3..000000000 --- a/src/vim/vim/plugins/unicode.vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bc20d0fb3331a7b41708388c56bb8221c2104da7 diff --git a/src/vim/vim/plugins/vim-colors-solarized b/src/vim/vim/plugins/vim-colors-solarized deleted file mode 160000 index 528a59f26..000000000 --- a/src/vim/vim/plugins/vim-colors-solarized +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 528a59f26d12278698bb946f8fb82a63711eec21 diff --git a/src/vim/vim/plugins/vim-commentary b/src/vim/vim/plugins/vim-commentary deleted file mode 160000 index e87cd90dc..000000000 --- a/src/vim/vim/plugins/vim-commentary +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e87cd90dc09c2a203e13af9704bd0ef79303d755 diff --git a/src/vim/vim/plugins/vim-css-color b/src/vim/vim/plugins/vim-css-color deleted file mode 160000 index 6cc65734b..000000000 --- a/src/vim/vim/plugins/vim-css-color +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6cc65734bc7105d9677ca54e2255fcbc953ba6bf diff --git a/src/vim/vim/plugins/vim-es6 b/src/vim/vim/plugins/vim-es6 deleted file mode 160000 index 3f080e31d..000000000 --- a/src/vim/vim/plugins/vim-es6 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3f080e31dc712ca52e4cb443b5e9cbfd543ba73c diff --git a/src/vim/vim/plugins/vim-fugitive b/src/vim/vim/plugins/vim-fugitive deleted file mode 160000 index 46eaf8918..000000000 --- a/src/vim/vim/plugins/vim-fugitive +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 46eaf8918b347906789df296143117774e827616 diff --git a/src/vim/vim/plugins/vim-indent-guides b/src/vim/vim/plugins/vim-indent-guides deleted file mode 160000 index a1e1390c0..000000000 --- a/src/vim/vim/plugins/vim-indent-guides +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a1e1390c0136e63e813d051de2003bf0ee18ae30 diff --git a/src/vim/vim/plugins/vim-javascript-syntax b/src/vim/vim/plugins/vim-javascript-syntax deleted file mode 160000 index 7b8e2ee76..000000000 --- a/src/vim/vim/plugins/vim-javascript-syntax +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7b8e2ee761e5d81f2bff57a728909a7968df098b diff --git a/src/vim/vim/plugins/vim-markdown b/src/vim/vim/plugins/vim-markdown deleted file mode 160000 index 46add6c30..000000000 --- a/src/vim/vim/plugins/vim-markdown +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 46add6c3017d3e4035dc10ffa9cb54221d8dfe1a diff --git a/src/vim/vim/plugins/vim-repeat b/src/vim/vim/plugins/vim-repeat deleted file mode 160000 index 24afe922e..000000000 --- a/src/vim/vim/plugins/vim-repeat +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 24afe922e6a05891756ecf331f39a1f6743d3d5a diff --git a/src/vim/vim/plugins/vim-surround b/src/vim/vim/plugins/vim-surround deleted file mode 160000 index 3d188ed21..000000000 --- a/src/vim/vim/plugins/vim-surround +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3d188ed2113431cf8dac77be61b842acb64433d9 diff --git a/src/vim/vim/plugins/webapi-vim b/src/vim/vim/plugins/webapi-vim deleted file mode 160000 index 70c49ada7..000000000 --- a/src/vim/vim/plugins/webapi-vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 70c49ada7827d3545a65cbdab04c5c89a3a8464e diff --git a/src/vim/vimrc b/src/vim/vimrc index c910b5d45..b7bb10826 100644 --- a/src/vim/vimrc +++ b/src/vim/vimrc @@ -2,243 +2,414 @@ " | General Settings | " ---------------------------------------------------------------------- -set nocompatible " Don't make Vim vi-compatibile. +" Don't make Vim vi-compatibile. -syntax on " Enable syntax highlighting. +set nocompatible + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Enable syntax highlighting. + +syntax on if has('autocmd') filetype plugin indent on - " │ │ └──────── Enable file type detection. - " │ └───────────── Enable loading of indent file. - " └─────────────────── Enable loading of plugin files. + " │ │ └─ Enable file type detection. + " │ └────── Enable loading of indent file. + " └──────────── Enable loading of plugin files. endif -set autoindent " Copy indent to the new line. +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Copy indent to the new line. + +set autoindent + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Allow backspace in insert mode. + +set backspace=indent +set backspace+=eol +set backspace+=start -set backspace=indent " ┐ -set backspace+=eol " │ Allow `backspace` -set backspace+=start " ┘ in insert mode. +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Set directory for backup files. -set backupdir=~/.vim/backups " Set directory for backup files. +set backupdir=~/.vim/backups if has('wildignore') - set backupskip=/tmp/* " ┐ Don't create backups - set backupskip+=/private/tmp/* " ┘ for certain files. + + " Don't create backups for certain files. + + set backupskip='/tmp/*' + set backupskip+='/private/tmp/*' + +endif + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Use the system clipboard as the default register. + +set clipboard=unnamed + +if has('unnamedplus') + set clipboard+=unnamedplus endif -set clipboard=unnamed " ┐ - " │ Use the system clipboard -if has('unnamedplus') " │ as the default register. - set clipboard+=unnamedplus " │ -endif " ┘ +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" When making a change don't redisplay the line and +" instead put a `$` sign at the end of the changed text. + +set cpoptions+=$ -set cpoptions+=$ " When making a change, don't - " redisplay the line, and instead, - " put a `$` sign at the end of - " the changed text. +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if has('syntax') - set colorcolumn=73 " Highlight certain column(s). - set cursorline " Highlight the current line. + + " Highlight certain column(s). + set colorcolumn=73 + + " Highlight the current line. + set cursorline + endif -set directory=~/.vim/swaps " Set directory for swap files. -set encoding=utf-8 nobomb " Use UTF-8 without BOM. +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Set directory for swap files. + +set directory=~/.vim/swaps + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Use UTF-8 without BOM. + +set encoding=utf-8 nobomb + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Increase command line history. if has('cmdline_hist') - set history=5000 " Increase command line history. + set history=5000 endif +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Search settings. + if has('extra_search') - set hlsearch " Enable search highlighting. + " Enable search highlighting. + set hlsearch + + " Highlight search pattern as it is being typed. + set incsearch - set incsearch " Highlight search pattern - " as it is being typed. endif -set ignorecase " Ignore case in search patterns. +" Ignore case in search patterns. + +set ignorecase +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Always show the status line. + +set laststatus=2 + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Do not redraw the screen while executing macros, +" registers, and other commands that have not been typed. + +set lazyredraw + + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Use custom symbols to represent invisible characters. + +set listchars=tab:▸\ +set listchars+=trail:· +set listchars+=eol:↴ +set listchars+=nbsp:_ + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Enable extended regexp. + +set magic + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Enable use of mouse clicks + +set mouse=a + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set laststatus=2 " Always show the status line. +" Hide mouse pointer while typing. -set lazyredraw " Do not redraw the screen while - " executing macros, registers - " and other commands that have - " not been typed. +set mousehide -set listchars=tab:▸\ " ┐ -set listchars+=trail:· " │ Use custom symbols to -set listchars+=eol:↴ " │ represent invisible characters. -set listchars+=nbsp:_ " ┘ +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Disable error bells. + +set noerrorbells + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" When using the join command only insert a single +" space after a `.`, `?`, or `!`. + +set nojoinspaces + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Disable for security reasons. +" https://github.com/numirias/security/blob/cf4f74e0c6c6e4bbd6b59823aa1b85fa913e26eb/doc/2019-06-04_ace-vim-neovim.md#readme + +set nomodeline -set magic " Enable extended regexp. -set mouse=a " Enable use of mouse clicks -set mousehide " Hide mouse pointer while typing. -set noerrorbells " Disable error bells. +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Kept the cursor on the same column. + +set nostartofline -set nojoinspaces " When using the join command, - " only insert a single space - " after a `.`, `?`, or `!`. +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Show line number. -set nomodeline " Disable for security reasons. - " https://github.com/numirias/security/blob/cf4f74e0c6c6e4bbd6b59823aa1b85fa913e26eb/doc/2019-06-04_ace-vim-neovim.md#readme +set number -set nostartofline " Kept the cursor on the same column. -set number " Show line number. +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Increase the minimal number of columns used for the `line number`. if has('linebreak') - set numberwidth=5 " Increase the minimal number of - " columns used for the `line number`. + set numberwidth=5 endif -set report=0 " Report the number of lines changed. +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Report the number of lines changed. + +set report=0 + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Show cursor position. if has('cmdline_info') - set ruler " Show cursor position. + set ruler endif -set scrolloff=5 " When scrolling, keep the cursor - " 5 lines below the top and 5 lines - " above the bottom of the screen. +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" When scrolling keep the cursor 5 lines below +" the top and 5 lines above the bottom of the screen. + +set scrolloff=5 + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Avoid all the hit-enter prompts. + +set shortmess=aAItW + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set shortmess=aAItW " Avoid all the hit-enter prompts. +" Show the command being typed. if has('cmdline_info') - set showcmd " Show the command being typed. + set showcmd endif -set showmode " Show current mode. +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Show current mode. + +set showmode + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Set the spellchecking language. if has('syntax') - set spelllang=en_au " Set the spellchecking language. + set spelllang=en_us endif -set smartcase " Override `ignorecase` option - " if the search pattern contains - " uppercase characters. +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Override `ignorecase` option if the search pattern +" contains uppercase characters. + +set smartcase + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Limit syntax highlighting. +" This avoids the very slow redrawing when files contain long lines. if has('syntax') - set synmaxcol=2500 " Limit syntax highlighting (this - " avoids the very slow redrawing - " when files contain long lines). + set synmaxcol=2500 endif -set tabstop=4 " ┐ -set softtabstop=4 " │ Set global settings. -set shiftwidth=4 " │ -set expandtab " ┘ +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Set global settings. + +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set expandtab + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set ttyfast " Enable fast terminal connection. +" Enable fast terminal connection. + +set ttyfast + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if has('persistent_undo') - set undodir=~/.vim/undos " Set directory for undo files. - set undofile " Automatically save undo history. -endif -if has('virtualedit') - set virtualedit=all " Allow cursor to be anywhere. + " Set directory for undo files. + set undodir=~/.vim/undos + + " Automatically save undo history. + set undofile + endif -set visualbell " ┐ -set noerrorbells " │ Disable beeping and window flashing. -set t_vb= " ┘ https://vim.wikia.com/wiki/Disable_beeping +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Allow cursor to be anywhere. -if has('wildmenu') - set wildmenu " Enable enhanced command-line -endif " completion (by hitting in - " command mode, Vim will show the - " possible matches just above the - " command line with the first - " match highlighted). -if has('windows') - set winminheight=0 " Allow windows to be squashed. +if has('virtualedit') + set virtualedit=all endif -" Prevent `Q` in `normal` mode from entering `Ex` mode. -nmap Q +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" ---------------------------------------------------------------------- -" | Plugins | -" ---------------------------------------------------------------------- +" Disable beeping and window flashing. +" https://vim.wikia.com/wiki/Disable_beeping -" Use Vundle to manage the Vim plugins. -" https://github.com/VundleVim/Vundle.vim +set visualbell +set noerrorbells +set t_vb= " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" Disable file type detection -" (this is required by Vundle). +" Enable enhanced command-line completion. +" +" By hitting in command mode, Vim will show the possible +" matches just above the command line with the first match being +" highlighted. + +if has('wildmenu') + set wildmenu +endif -filetype off " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" Include Vundle in the runtime path. +" Allow windows to be squashed. -set runtimepath+=~/.vim/plugins/Vundle.vim +if has('windows') + set winminheight=0 +endif " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" Initialize Vundle and specify the path -" where the plugins should be installed. +" Prevent `Q` in `normal` mode from entering `Ex` mode. + +nmap Q -call vundle#begin("~/.vim/plugins") +" ---------------------------------------------------------------------- +" | Plugins | +" ---------------------------------------------------------------------- - " Let Vundle manage Vundle (this is important!) - Plugin 'VundleVim/Vundle.vim' +" Use `minpac` to manage the Vim plugins. +" https://github.com/k-takata/minpac + +function! InitPlugins() abort + + packadd minpac + + call minpac#init() + call minpac#add('k-takata/minpac', { 'type': 'opt' }) + + call minpac#add('altercation/vim-colors-solarized') + call minpac#add('ap/vim-css-color') + call minpac#add('chrisbra/unicode.vim') + call minpac#add('chrisbra/vim-xml-runtime') + call minpac#add('editorconfig/editorconfig-vim') + call minpac#add('godlygeek/tabular') + call minpac#add('isRuslan/vim-es6') + call minpac#add('jelera/vim-javascript-syntax') + call minpac#add('ctrlpvim/ctrlp.vim') + call minpac#add('marijnh/tern_for_vim', { 'do': ':silent ! cd $HOME/.vim/pack/minpac/start/tern_for_vim && npm i &> /dev/null' }) + call minpac#add('mattn/emmet-vim') + call minpac#add('mattn/webapi-vim', { 'type': 'opt' }) + call minpac#add('mhinz/vim-signify') + call minpac#add('moll/vim-node') + call minpac#add('mtscout6/syntastic-local-eslint.vim') + call minpac#add('nathanaelkane/vim-indent-guides') + call minpac#add('raimondi/delimitmate') + call minpac#add('scrooloose/nerdtree') + call minpac#add('scrooloose/syntastic') + call minpac#add('sheerun/vim-polyglot', { 'type': 'opt' }) + call minpac#add('shougo/neocomplcache.vim') + call minpac#add('shougo/neosnippet') + call minpac#add('shougo/neosnippet-snippets') + call minpac#add('thiagoalessio/rainbow_levels.vim') + call minpac#add('tomtom/tcomment_vim') + call minpac#add('tpope/vim-commentary') + call minpac#add('tpope/vim-fugitive') + call minpac#add('tpope/vim-repeat') + call minpac#add('tpope/vim-surround') + call minpac#add('tpope/vim-unimpaired') + call minpac#add('wellle/targets.vim') - Plugin 'altercation/vim-colors-solarized' - Plugin 'ap/vim-css-color' - Plugin 'chrisbra/unicode.vim' - Plugin 'editorconfig/editorconfig-vim' - Plugin 'godlygeek/tabular' - Plugin 'isRuslan/vim-es6' - Plugin 'jelera/vim-javascript-syntax' - Plugin 'kien/ctrlp.vim' - Plugin 'marijnh/tern_for_vim' - Plugin 'mattn/emmet-vim' - Plugin 'mattn/webapi-vim' - Plugin 'nathanaelkane/vim-indent-guides' - Plugin 'othree/html5.vim' - Plugin 'plasticboy/vim-markdown' - Plugin 'raimondi/delimitmate' - Plugin 'scrooloose/nerdtree' - Plugin 'scrooloose/syntastic' - Plugin 'shougo/neocomplcache.vim' - Plugin 'shougo/neosnippet' - Plugin 'shougo/neosnippet-snippets' - Plugin 'tomtom/tcomment_vim' - Plugin 'tpope/vim-commentary' - Plugin 'tpope/vim-fugitive' - Plugin 'tpope/vim-repeat' - Plugin 'tpope/vim-surround' +endfunction -call vundle#end() +silent! packadd webapi-vim " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" Re-enable file type detection -" (disabling it was required by Vundle). - -filetype on +" Define custom commands for managing plugins. +command! PluginsClean call InitPlugins() | call minpac#clean() +command! PluginsSetup call InitPlugins() | call minpac#update('', { 'do': 'quit! | quit!' }) +command! PluginsStatus call InitPlugins() | call minpac#status() +command! PluginsUpdate call InitPlugins() | call minpac#update('', { 'do': 'call minpac#status() | quit! | quit!' }) " ---------------------------------------------------------------------- " | Plugins - Emmet | " ---------------------------------------------------------------------- -" Redefine trigger key for Emmet. -" http://docs.emmet.io/cheat-sheet/ +" Redefine trigger key. + +let g:user_emmet_leader_key="," -let g:user_emmet_leader_key="" +" Only enable normal mode functions. + +let g:user_emmet_mode='a' " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" Load custom Emmet snippets. -" http://docs.emmet.io/customization/snippets/ +" Load custom snippets. -let g:user_emmet_settings = webapi#json#decode(join(readfile(expand("~/.vim/snippets/emmet.json")), "\n")) +if &runtimepath =~ 'webapi-vim' + let g:user_emmet_settings = webapi#json#decode(join(readfile(expand("~/.vim/snippets/emmet.json")), "\n")) +endif " ---------------------------------------------------------------------- @@ -280,20 +451,34 @@ let g:neocomplcache_enable_at_startup=1 " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" Make `` autocomplete. +" Make `Tab` autocomplete. inoremap pumvisible() ? "\" : "\" +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" Make `Shift+Tab` insert `Tab` character. + +inoremap + +" ---------------------------------------------------------------------- +" | Plugins - Signify | +" ---------------------------------------------------------------------- + +" Disable Signify by default. +" https://github.com/mhinz/vim-signify + +let g:signify_disable_by_default=1 + " ---------------------------------------------------------------------- " | Plugins - Syntastic | " ---------------------------------------------------------------------- " Inform Syntastic which checkers to use based on file types. -" https://github.com/scrooloose/syntastic#3-faq +" https://github.com/scrooloose/syntastic#faq -let g:syntastic_html_checkers = [ "eslint" ] -let g:syntastic_javascript_checkers = [ "eslint" ] +let g:syntastic_javascript_checkers = [ 'eslint' ] " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -367,6 +552,7 @@ function! StripTrailingWhitespaces() let @/ = searchHistory call cursor(cursorLine, cursorColumn) + endfunction " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -474,11 +660,11 @@ if has("autocmd") autocmd InsertLeave * :set relativenumber + augroup END " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " Automatically strip whitespaces when files are saved. augroup strip_whitespaces @@ -507,15 +693,19 @@ endif " | Color Scheme | " ---------------------------------------------------------------------- -set t_Co=256 " Enable full-color support. +" Enable full-color support. + +set t_Co=256 + +" Use colors that look good on a dark background. + +set background=dark -set background=dark " Use colors that look good - " on a dark background. " Set custom configurations for when the -" Solarized theme is used from vim's Terminal mode. +" Solarized theme is used from Vim's Terminal mode. " -" http://ethanschoonover.com/solarized/vim-colors-solarized#advanced-configuration +" https://github.com/altercation/vim-colors-solarized if !has("gui_running") let g:solarized_contrast = "high" @@ -524,8 +714,7 @@ if !has("gui_running") let g:solarized_visibility = "high" endif -colorscheme solarized " Use custom color scheme. - +silent! colorscheme solarized " Use custom color scheme. " ---------------------------------------------------------------------- " | Key Mappings | @@ -537,108 +726,120 @@ let mapleader = "," " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,* ] Search and replace the word under the cursor. +" [,* ] Search and replace the word under the cursor. -nmap * :%s/\<\>// +nmap * :%s/\<\>// " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,cc] Toggle code comments. +" [,cc ] Toggle code comments. " https://github.com/tomtom/tcomment_vim -map cc :TComment +map cc :TComment " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,cr] Calculate result. +" [,cr ] Calculate result. " http://vimcasts.org/e/56 -nmap cr 0yt=A=" +nmap cr 0yt=A=" + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" [,cs ] Clear search. + +map cs :noh " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,cs] Clear search. +" [,gd ] Toggle Git differences. -map cs :noh +map gd :SignifyToggle " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " [,ffu] Convert file to use Unix line endings. " See also: https://vim.fandom.com/wiki/File_format -map ffu :edit ++fileformat=dos :setlocal fileformat=unix :write! +map ffu :edit ++fileformat=dos :setlocal fileformat=unix :write! + +" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +" [,h ] Show hex dump. + +nmap h :%!xxd " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,h] Show hex dump. +" [,l ] Toggle `set list`. -nmap h :%!xxd +nmap l :set list! " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,l ] Toggle `set list`. +" [,n ] Toggle `set relativenumber`. -nmap l :set list! +nmap n :call ToggleRelativeLineNumbers() " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,n ] Toggle `set relativenumber`. +" [,pp ] Pretty print -nmap n :call ToggleRelativeLineNumbers() +map pp :call PrettyPrint() " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,pp] Pretty print +" [,rl ] Toggle `RainbowLevels`. -map pp :call PrettyPrint() +map rl :RainbowLevelsToggle " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,sb] Strip BOM (Byte Order Mark). +" [,sb ] Strip BOM (Byte Order Mark). -nmap sb :call StripBOM() +nmap sb :call StripBOM() " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,sw] Strip trailing whitespace. +" [,sw ] Strip trailing whitespace. -nmap sw :call StripTrailingWhitespaces() +nmap sw :call StripTrailingWhitespaces() " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,t ] Toggle NERDTree. +" [,t ] Toggle NERDTree. -map t :NERDTreeToggle +map t :NERDTreeToggle " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,ti] Toggle indent. +" [,ti ] Toggle indent. -nmap ti IndentGuidesToggle +nmap ti IndentGuidesToggle " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,tl] Toggle show limits. +" [,tl ] Toggle show limits. -nmap tl :call ToggleLimits() +nmap tl :call ToggleLimits() " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,ts] Toggle Syntastic. +" [,ts ] Toggle Syntastic. -nmap ts :SyntasticToggleMode +nmap ts :SyntasticToggleMode \| w " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,v ] Make the opening of the `.vimrc` file easier. +" [,v ] Make the opening of the `.vimrc` file easier. -nmap v :vsp $MYVIMRC +nmap v :vsp $MYVIMRC " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" [,W ] Sudo write. +" [,W ] Sudo write. -map W :w !sudo tee % +map W :w !sudo tee % " ---------------------------------------------------------------------- @@ -679,27 +880,27 @@ highlight User1 " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - set statusline= -set statusline+=%1* " User1 highlight -set statusline+=\ [%n] " Buffer number -set statusline+=\ %{GetGitBranchName()} " Git branch name -set statusline+=\ [%f] " File path -set statusline+=%m " Modified flag -set statusline+=%r " Readonly flag -set statusline+=%h " Help file flag -set statusline+=%w " Preview window flag -set statusline+=%y " File type +set statusline+=%1* " User1 highlight +set statusline+=\ [%n] " Buffer number +set statusline+=\ %{GetGitBranchName()} " Git branch name +set statusline+=\ [%f] " File path +set statusline+=%m " Modified flag +set statusline+=%r " Readonly flag +set statusline+=%h " Help file flag +set statusline+=%w " Preview window flag +set statusline+=%y " File type set statusline+=[ -set statusline+=%{&ff} " File format +set statusline+=%{&ff} " File format set statusline+=: -set statusline+=%{strlen(&fenc)?&fenc:'none'} " File encoding +set statusline+=%{strlen(&fenc)?&fenc:'none'} " File encoding set statusline+=] -set statusline+=%= " Left/Right separator -set statusline+=%c " File encoding +set statusline+=%= " Left/Right separator +set statusline+=%c " File encoding set statusline+=, -set statusline+=%l " Current line number +set statusline+=%l " Current line number set statusline+=/ -set statusline+=%L " Total number of lines -set statusline+=\ (%P)\ " Percent through file +set statusline+=%L " Total number of lines +set statusline+=\ (%P)\ " Percent through file " Example result: " @@ -712,9 +913,9 @@ set statusline+=\ (%P)\ " Percent through file " Load local settings if they exist. " -" [!]: The following needs to remain at the end of this file in -" order to allow any of the above settings to be overwritten -" by the local ones. +" [!] The following needs to remain at the end of this file in +" order to allow any of the above settings to be overwritten +" by the local ones. if filereadable(glob("~/.vimrc.local")) source ~/.vimrc.local