From 36089d092544eeb18ef4c02ab75022c093fb58f3 Mon Sep 17 00:00:00 2001 From: Ian Keane Date: Thu, 23 Jan 2020 13:29:11 -0500 Subject: [PATCH] vimrc refactor --- vim/.vimrc | 212 +++++++++++++++++++++++++---------------------------- 1 file changed, 100 insertions(+), 112 deletions(-) diff --git a/vim/.vimrc b/vim/.vimrc index ef7fbfa..59d8335 100755 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -1,6 +1,6 @@ -"vim-plug {{{ - "automatic installation +" vim-plug {{{ + " Automatic installation 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 @@ -31,116 +31,129 @@ Plug 'relastle/bluewery.vim' Plug 'sainnhe/vim-color-forest-night' Plug 'justinmk/vim-sneak' - - " Plug 'metakirby5/codi.vim' + " Todo: + " GV + " Gundo (or undotree?) + " Emmett + " Fugitive + " Vimwiki + " Plug 'ryanss/vim-hackernews' + " Plug 'mbbill/undotree' or Plug 'sjl/gundo.vim' + " Plug 'tpope/vim-projectionist' + " Plug 'mileszs/ack.vim' + " Plug 'vim-pandoc/vim-pandoc' + " Plug 'alfredodeza/pytest.vim' + " Plug 'docker/docker' + " Plug vim-scripts/indentpython.vim + " call plug#end() "}}} -"appearance {{{ +" appearance {{{ colorscheme zenburn - syntax on "enable syntax - set encoding=utf-8 "keep utf-8 encoding - set scrolloff=3 "keep at least 3 lines above and below cursor - set showmode "something something buffers - set showcmd "show command in bottom bar - set wildmenu "visual autocomplete for command menu - set wildmode=list:longest "show all completions on tab - set laststatus=2 "last window will always have statusline - set showmatch "highlight matching [{()}] - set cursorline "highlight current line + syntax on " Enable syntax + set encoding=utf-8 " Keep utf-8 encoding + set scrolloff=3 " Keep at least 3 lines above and below cursor + set showmode " Something something buffers + set showcmd " Show command in bottom bar + set wildmenu " Visual autocomplete for command menu + set wildmode=list:longest " Show all completions on tab + set laststatus=2 " Last window will always have statusline + set showmatch " Highlight matching [{()}] + set cursorline " Highlight current line - "remove underline on current line number + " remove underline on current line number hi CursorLineNr cterm=bold - "lightline + " Lightline let g:lightline = { 'colorscheme': 'sceaduhelm', } set fillchars+=vert:│ " }}} -"movement {{{ +" Movement {{{ " TODO: map alt-j and k to move text lines vertically, maintaining indent " }}} -"folding {{{ - set foldenable "enable folding - set foldmethod=marker "fold sections by marker - set foldlevel=0 "fold by default - set modelines=1 "check final line of file for modeline +" Folding {{{ + set foldenable " Enable folding + set foldmethod=marker " Fold sections by marker + set foldlevel=0 " Fold by default + set modelines=1 " Check final line of file for modeline "}}} -"behavior {{{ - set nocompatible "turn off vi compatability nonsense - set hidden "hide buffer when opening new file - set visualbell "use visual bell instead of beeping - set ttyfast "improves smoothness and drawing - set backspace=indent,eol,start "always allow backspacing - set undofile "make .un file for persistent undo - set relativenumber "make numbers relative to current line - set lazyredraw "redraw only when necessary - set updatetime=100 "make updates happen faster (gitgutter) - set splitright "make split to right by default +" behavior {{{ + set nocompatible " Turn off vi compatability nonsense + set hidden " Hide buffer when opening new file + set visualbell " Use visual bell instead of beeping + set ttyfast " Improves smoothness and drawing + set backspace=indent,eol,start " Always allow backspacing + set undofile " Make .un file for persistent undo + set relativenumber " Make numbers relative to current line + set lazyredraw " Redraw only when necessary + set updatetime=100 " Make updates happen faster (gitgutter) + set splitright " Make split to right by default "}}} -"searching {{{ - set gdefault "remove default g flag on search - set ignorecase "ignore case for searches - set smartcase "case-specific only when uppercase - set hlsearch "don't continue to highlight searched phrases. - set incsearch "but do search as characters are entered - "remap tab to jump by brackets - " nnoremap % - " vnoremap % - " remp tab to jump by window +" searching {{{ + set gdefault " Remove default g flag on search + set ignorecase " Ignore case for searches + set smartcase " Case-specific only when uppercase + set hlsearch " Don't continue to highlight searched phrases. + set incsearch " But do search as characters are entered + " Remap tab to jump by brackets + " Nnoremap % + " Vnoremap % + " Remp tab to jump by window nnoremap w vnoremap w "}}} -"tab settings {{{ - set tabstop=4 " number of visual spaces per tab - set softtabstop=4 "should always = tabstop - set shiftwidth=4 "indent/outdent by 4 columns - set expandtab "tabs are spaces - set shiftround "always indent/outdent to the nearest tabstop - "make search terms more visible +" tab settings {{{ + set tabstop=4 " Number of visual spaces per tab + set softtabstop=4 " Should always = tabstop + set shiftwidth=4 " Indent/outdent by 4 columns + set expandtab " Tabs are spaces + set shiftround " Always indent/outdent to the nearest tabstop + " Make search terms more visible highlight Visual ctermbg=DarkGreen ctermfg=Black - set autoindent "auto indentation + set autoindent " Auto indentation "}}} -"ruler settings {{{ - set rulerformat=%l,%-2v\|%4L\ Lines "display line, column, and total lines - set ruler "turn on ruler +" ruler settings {{{ + set rulerformat=%l,%-2v\|%4L\ Lines " Display line, column, and total lines + set ruler " Turn on ruler "}}} -"long line handling {{{ +" long line handling {{{ set textwidth=79 set fo= set fo=t " set colorcolumn=85 "}}} -"leaders {{{ +" leaders {{{ :let mapleader = "," - "clear search highlighting with leader-space + " Clear search highlighting with leader-space nnoremap :noh - "underline with line of the same length + " Underline with line of the same length nnoremap - yypv$r- - "insert date on current line + " Insert date on current line nnoremap d k :r !date nnoremap k :vert new ~/.vim/bindings.md "}}} -"invisible characters {{{ +" invisible characters {{{ set list set listchars=tab:▸\ ,eol:¬ "}}} -"hjkl {{{ - "disable arrow keys in normal and visual mode +" hjkl {{{ + " Disable arrow keys in normal and visual mode nnoremap nnoremap nnoremap @@ -149,30 +162,30 @@ inoremap inoremap inoremap - "disable h and l + " Disable h and l " nnoremap h " nnoremap l - "make j and k move by screen line, not file line + " Make j and k move by screen line, not file line nnoremap j gj nnoremap k gk "}}} -"split pane navigation {{{ - "map vertical split to \ w, switch to it, open explorer, prompt for filename - "TODO: make new window prompt use fzf +" split pane navigation {{{ + " Map vertical split to \ w, switch to it, open explorer, prompt for filename + " TODO: make new window prompt use fzf nnoremap w vl:e open - "switch panes wit ctrl + h/j/k/l + " Switch panes wit ctrl + h/j/k/l nnoremap h nnoremap j nnoremap k nnoremap l nnoremap :close nnoremap :bn - "map resize pane - "TODO: remap pane resize to something else (leader?) + " Map resize pane + " TODO: remap pane resize to something else (leader?) map + :vertical resize +5 map - :vertical resize -5 - "quick-scope + " quick-scope " Trigger a highlight in the appropriate direction when pressing these keys: let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] @@ -184,19 +197,19 @@ "}}} -"launch love game, check youtube love2d roguelike+rpg day 1 if broken {{{ +" launch love game, check youtube love2d roguelike+rpg day 1 if broken {{{ map ,t :! /Applications/love.app/Contents/MacOS/love . "}}} -"file specific {{{ - "in markdown files, when writing add two spaces to each line to fix spacing - "in compiled version +" file specific {{{ + " In markdown files, when writing add two spaces to each line to fix spacing + " In compiled version " au BufWritePost *.md silent! %s/[^ ]\zs$/\1 / - "TODO: find a better solution - "bold something in a markdown file + " TODO: find a better solution + " Bold something in a markdown file " :au FileType markdown nmap b i**ea**b - "python - "au BufNewFile,BufRead *.py + " Python + " au BufNewFile,BufRead *.py "\ set tabstop=4 "\ set softtabstop=4 "\ set shiftwidth=4 @@ -204,15 +217,15 @@ "\ set expandtab "\ set autoindent "\ set fileformat=unix - ""webdev - "au BufNewFile,BufRead *.js, *.html, *.css + "" Webdev + " au BufNewFile,BufRead *.js, *.html, *.css "\ set tabstop=2 "\ set softtabstop=2 "\ set shiftwidth=2 "}}} -"plugin modification {{{ - "FZF +" plugin modification {{{ + " FZF map :FZF " This is the default extra key bindings let g:fzf_action = { @@ -250,43 +263,18 @@ " git commands {{{ " TODO: map fugitive commands " TODO: check out gv etc - " gitgutter hunk view + " Gitgutter hunk view nmap ghv (GitGutterPreviewHunk) nmap ghn (GitGutterNextHunk) nmap ghp (GitGutterPrevHunk) nmap ghf (GitGutterFold) "}}} -"plugin modification {{{ +" plugin modification {{{ " "}}} -"folding options, this must be last in file +" folding options, this must be last in file " vim:foldmethod=marker:foldlevel=0 -"todo: - "clean up folding - "make windows-specific plugin install using conditional activation setting here: - "https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation - "to install: - "emmett - "codi - "fugitive - "vimwiki - " Plug 'terryma/vim-multiple-cursors' - " Plug 'ryanss/vim-hackernews' - " Plug 'mbbill/undotree' or Plug 'sjl/gundo.vim' - " Plugin 'tpope/vim-projectionist' - " Plug 'mileszs/ack.vim' - " Plug 'vim-scripts/grep.vim' - " Plug 'jpalardy/vim-slime' (maybe not with codi?) - " Plug 'vim-pandoc/vim-pandoc' - " Plugin 'alfredodeza/pytest.vim' - " Plug 'docker/docker' - " Plug 'tyrannicaltoucan/vim-quantum' - " Plug vim-scripts/indentpython.vim - " bind :bnext :blast (leader n, leader p?) map gn :bn (:bd for - " delete and unload) (unimpaired?) (buffer fzf?) - " csv.vim - "