diff --git a/.chezmoiexternal.toml b/.chezmoiexternal.toml index 409de4a..c959525 100644 --- a/.chezmoiexternal.toml +++ b/.chezmoiexternal.toml @@ -3,43 +3,3 @@ url = "https://github.com/tmux-plugins/tpm/archive/master.tar.gz" exact = true stripComponents = 1 -[".config/vim/bundle/gruvbox"] - type = "archive" - url = "https://github.com/morhetz/gruvbox/archive/master.tar.gz" - stripComponents = 1 -[".config/vim/bundle/indentLine"] - type = "archive" - url = "https://github.com/Yggdroot/indentLine/archive/master.tar.gz" - stripComponents = 1 -[".config/vim/bundle/lightline.vim"] - type = "archive" - url = "https://github.com/itchyny/lightline.vim/archive/master.tar.gz" - stripComponents = 1 -[".config/vim/bundle/nerdcommenter"] - type = "archive" - url = "https://github.com/preservim/nerdcommenter/archive/master.tar.gz" - stripComponents = 1 -[".config/vim/bundle/nerdtree"] - type = "archive" - url = "https://github.com/preservim/nerdtree/archive/master.tar.gz" - stripComponents = 1 -[".config/vim/bundle/python-syntax"] - type = "archive" - url = "https://github.com/vim-python/python-syntax/archive/master.tar.gz" - stripComponents = 1 -[".config/vim/bundle/tabular"] - type = "archive" - url = "https://github.com/godlygeek/tabular/archive/master.tar.gz" - stripComponents = 1 -[".config/vim/bundle/vim-indent-guides"] - type = "archive" - url = "https://github.com/nathanaelkane/vim-indent-guides/archive/master.tar.gz" - stripComponents = 1 -[".config/vim/bundle/vim-markdown-toc"] - type = "archive" - url = "https://github.com/mzlogin/vim-markdown-toc/archive/master.tar.gz" - stripComponents = 1 -[".config/vim/bundle/vim-surround"] - type = "archive" - url = "https://github.com/tpope/vim-surround/archive/master.tar.gz" - stripComponents = 1 diff --git a/dot_config/vim/README.md b/dot_config/vim/README.md index 004853c..6f617d6 100644 --- a/dot_config/vim/README.md +++ b/dot_config/vim/README.md @@ -36,6 +36,12 @@ Note: Some features require version 8+ of vim. For instance, the ALE plugin whic ``` ## Plugins +Plugins are managed using [vim-plug](https://github.com/junegunn/vim-plug). `vim-plug` is downloaded automatically on first run. + +To update the plugins, run `PlugInstall` + +Below is a list of currently installed plugins: + * ~~[Easymotion](https://github.com/easymotion/vim-easymotion) - Easily navigate documents~~ Disabled recently as unused, although useful * [Gruvbox](https://github.com/morhetz/gruvbox) - Retro colorscheme (colorscheme in vimrc) * ~~[Matchit](https://github.com/adelarsq/vim-matchit) - For expanding % matching (matches start/end tags for html, for example)~~ Disabled recently as possibly unused diff --git a/dot_config/vim/UltiSnips/python.snippets b/dot_config/vim/UltiSnips/python.snippets deleted file mode 100644 index 014563d..0000000 --- a/dot_config/vim/UltiSnips/python.snippets +++ /dev/null @@ -1,10 +0,0 @@ -snippet dataclass "Create a dataclass" -@dataclass -class ${1:MyClass}: - ${0} -endsnippet - -snippet forkey "Enumerate an iterable for key/value pair" -for ${1:key}, ${2:value} in enumerate(${3}): - pass -endsnippet diff --git a/dot_config/vim/autoload/pathogen.vim b/dot_config/vim/autoload/pathogen.vim deleted file mode 100644 index 3582fbf..0000000 --- a/dot_config/vim/autoload/pathogen.vim +++ /dev/null @@ -1,264 +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/dot_config/vim/vimrc b/dot_config/vim/vimrc index 22e66c4..b70e947 100644 --- a/dot_config/vim/vimrc +++ b/dot_config/vim/vimrc @@ -53,21 +53,30 @@ let mapleader = "," " Leader key (default: \) " 02 - Plugin/Bundle Related - packadd! matchit - packloadall " Load plugins (for utilizing $XDG_CONFIG_HOME/vim/pack loading in vim 8+) - - " Pathogen - execute pathogen#infect() - call pathogen#helptags() " generate helptags for everything in ‘runtimepath’ - - " Python Syntax - let g:python_highlight_all = 1 + runtime! macros/matchit.vim + + " Install vim-plug if doesn't exist + let data_dir = '$XDG_CONFIG_HOME/vim' + let plug_dir = data_dir . '/plugged' + if empty(glob(data_dir . '/autoload/plug.vim')) + silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC + endif - " Plugin - indentLine - let g:indentLine_enabled = 0 " Disable by default (messes with syntax highlighting) + " Load Plugins + call plug#begin(plug_dir) + Plug 'morhetz/gruvbox' + Plug 'itchyny/lightline.vim' + Plug 'preservim/nerdcommenter' + Plug 'scrooloose/nerdtree' + Plug 'vim-python/python-syntax' + Plug 'godlygeek/tabular' + Plug 'mzlogin/vim-markdown-toc' + Plug 'tpope/vim-surround' + call plug#end() " Plugin - lightline - if isdirectory(expand("$XDG_CONFIG_HOME/vim/bundle/lightline.vim")) + if isdirectory(expand(plug_dir . '/lightline.vim')) let g:lightline = { \ 'active': { \ 'left': [ [ 'mode', 'paste' ], @@ -85,10 +94,10 @@ map _ NERDCommenterUncomment " Plugin - NERDTree related - if isdirectory(expand("$XDG_CONFIG_HOME/vim/bundle/nerdtree")) + if isdirectory(expand(plug_dir . '/nerdtree')) " Open NERDTree when opening nothing (just vim) - "autocmd StdinReadPre * let s:std_in=1 - "autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif + autocmd StdinReadPre * let s:std_in=1 + autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif " Open NERDTree when opening directory autocmd StdinReadPre * let s:std_in=1 @@ -100,8 +109,11 @@ let NERDTreeIgnore=['\\.pyc', '\\\~$', '\\.swo$', '\\.swp$', '\\.git', '\\.hg', '\\.svn', '\\.bzr'] endif + " Plugin - python-syntax + let g:python_highlight_all = 1 + " Plugin - Tabular - if isdirectory(expand("$XDG_CONFIG_HOME/vim/bundle/tabular")) + if isdirectory(expand(plug_dir . '/tabular')) nmap a& :Tab /& vmap a& :Tab /& nmap a# :Tab /# @@ -122,28 +134,6 @@ vmap a :Tab / endif - " Plugin - Vim Snippets (UltiSnips) - let g:UltiSnipsSnippetDirectories=["$XDG_CONFIG_HOME/vim/UltiSnips/", "UltiSnips"] " Add custom snippets - let g:UltiSnipsExpandTrigger="" - let g:UltiSnipsListSnippets="" " list all snippets for current filetype - let g:UltiSnipsJumpForwardTrigger="" - let g:UltiSnipsJumpBackwardTrigger="" - let g:UltiSnipsEditSplit="context" " Split horizontally or vertically with the custom snippets - - " Plugin - vim-surround - " This allows for surrounding test with something - " Note: In the following, [ will add a space around text, ] will not (e.g. [ TEST ] vs [TEST]) - " Examples: - " cs"' " Replace double quotes with single on the current line - " cs' " Replace single quote with

tagging - " ds" " Remove a delimeter (double quotes) - " ysiw] " Add delimeters around current work - " yss) " Add delimeters around entire line - " S( " Add delimeters around current selected line (Shift+V) - " - - silent! helptags ALL " Load all helptags after plugins loaded, all messages and errors are ignored - " 03 - VIM UI syntax on " Enable syntax highlighting match ErrorMsg '\s\+$' " Highlight spaces (makes it obvious when trailing)