Commit a83f8a0

mo khan <mo@mokhan.ca>
2021-07-23 21:50:08
tidy up config
1 parent dcdefca
Changed files (2)
ftplugin/vim.vim
@@ -0,0 +1,2 @@
+"autocmd!
+autocmd FileType vim setlocal foldmethod=marker
vimrc
@@ -1,131 +1,95 @@
 "" Basic Settings {{{{
 ""
 
-set nocompatible      " Use vim, no vi defaults
-set number            " Show line numbers
-set numberwidth=5
-set ruler             " Show line and column number
-set encoding=utf-8    " Set default encoding to UTF-8
-set modelines=0       " do not check file for set commands
-set scrolloff=3       " always show 3 lines above and below cursor
-set gdefault          " use global substitution by default
-set showmatch         " show matching bracket
-set showcmd           " show last command in last line of screen.
-set showmode          " display mode in last line (e.g VISUAL)
-set hidden            " hide buffers instead of closing them.
-set cursorline        " highlight current line
-set ttyfast           " fast terminal connection
-set visualbell        " turn on visual bell
-set t_vb=             " set visual bell to do nothing
-set noerrorbells      " turn off error bell
-set exrc              " enable per-directory .vimrc files
-set secure            " disable unsafe commands in local .vimrc files
-set nobackup          " do not make backup files
-set nowritebackup     " do not write a backup
-set splitright        " open new splits to the right
-set splitbelow        " open new splits below
-set autoread          " auto load changed files
-set title             " the title of the window will be set to the value of titlestring
-set clipboard^=unnamed,unnamedplus " use OS clipboard
-set noswapfile
+set autoindent
+set autoread
 set autowrite
-set tags=./.git/tags,./tmp/tags,./tags,tags,._tags
-set nowrap                        " don't wrap lines
-set tabstop=2                     " a tab is two spaces
-set softtabstop=2                 " number of spaces that a <Tab> counts for while performing editing
-set shiftwidth=2                  " an autoindent (with <<) is two spaces
-set shiftround                    " When shifting lines, round the indentation to the
-                                  " nearest multiple of 'shiftwidth.'
-set expandtab                     " use spaces, not tabs
-set list                          " Show invisible characters
-set backspace=indent,eol,start    " backspace through everything in insert mode
-set autoindent                    " copy indent from current line when starting a new one
-"set listchars=tab:\ \ ,trail:·,eol:¬,nbsp:_
-set listchars=""                  " Reset the listchars
-set listchars=tab:\ \             " a tab should display as "  ", trailing whitespace as "."
-set listchars+=trail:·            " show trailing spaces as copyright
-"set listchars+=eol:¬
-set listchars+=nbsp:_
-set listchars+=extends:>          " The character to show in the last column when wrap is
-                                  " off and the line continues beyond the right of the screen
-set listchars+=precedes:<         " The character to show in the last column when wrap is
-                                  " off and the line continues beyond the left of the screen
-"set colorcolumn=80,100            " show color columns at 80 and 100
-set nojoinspaces " Use one space, not two, after punctuation.
-set hlsearch    " highlight matches
-set incsearch   " incremental searching
-set ignorecase  " searches are case insensitive...
-set smartcase   " ... unless they contain at least one capital letter
-set showmatch   " briefly jump to the matching bracket.
-set cmdheight=1 " Give more space for displaying messages.
-set showtabline=2 " always show tab page labels
+set backspace=indent,eol,start
+set backupdir=~/tmp,/var/tmp,/tmp/
+set clipboard^=unnamed,unnamedplus
+set cmdheight=1
+set completeopt=menu,preview
+set cursorline
+set diffopt=vertical
+set directory=~/tmp,/var/tmp,/tmp/
+set encoding=utf-8
+set expandtab
+set exrc
+set gdefault
+set hidden
+set hlsearch
+set ignorecase
+set incsearch
+set modelines=0
+set nobackup
+set nocompatible
+set noerrorbells
+set nojoinspaces
+set noswapfile
+set nowrap
+set nowritebackup
+set number
+set numberwidth=5
+set re=1
+set ruler
+set scrolloff=3
+set secure
 set shell=bash
-
-if !has("nvim")
-  set signcolumn=number
-endif
-
-runtime macros/matchit.vim
-color happy_hacking
-syntax on
+set shiftround
+set shiftwidth=2
+set showcmd
+set showmatch
+set showmode
+set showtabline=2
+set signcolumn=number
+set smartcase
+set softtabstop=2
+set splitbelow
+set splitright
 set t_Co=256
-if has("termguicolors")
-  let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
-  let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
-  set termguicolors
-endif
+set t_vb=
+set tabstop=2
+set tags=./.git/tags,./tmp/tags,./tags,tags,._tags
 set termencoding=utf-8
-set encoding=utf-8
-set re=1
-set diffopt=vertical
+set title
+set ttyfast
 set updatetime=200
-set completeopt=menu,preview
+set visualbell
 
-" }}}}
-
-"" Wild settings {{{{
-""
+set list
+set listchars=""
+set listchars=tab:\ \
+set listchars+=trail:·
+set listchars+=nbsp:_
+set listchars+=extends:>
+set listchars+=precedes:<
 
 set wildmenu
 set wildmode=longest,list:longest
-
-" Disable output and VCS files
 set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem
-
-" Disable archive files
 set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.zst
-
-" Ignore bundler and sass cache
 set wildignore+=*/vendor/gems/*,*/vendor/cache/*,*/.bundle/*,*/.sass-cache/*
-
-" Ignore rails temporary asset caches
-set wildignore+=*/tmp/cache/assets/*/sprockets/*,*/tmp/cache/assets/*/sass/*
-
-" Disable temp and backup files
 set wildignore+=*.swp,*~,._*
-
-" Ignore tmp folder, so files and coverage directory.
 set wildignore+=*/tmp/*,*.so,*/coverage/*
-" }}}}
 
-"" Backup and swap files {{{{
-""
-
-" where to put backup files.
-set backupdir=~/tmp,/var/tmp,/tmp/
+if has("termguicolors")
+  let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
+  let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
+  set termguicolors
+endif
 
-" where to put swap files.
-set directory=~/tmp,/var/tmp,/tmp/
+runtime macros/matchit.vim
+color happy_hacking
+syntax on
 
 " }}}}
 
 "" File type-specific settings {{{{
 ""
 
-filetype plugin indent on " Turn on filetype plugins (:help filetype-plugin)
+filetype plugin indent on
 
 if has("autocmd")
-  au BufNewFile,BufRead *.html set nowrap
   au BufNewFile,BufRead *.json set ft=javascript
   au BufNewFile,BufRead *.muttrc set ft=muttrc
   au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} set ft=markdown
@@ -133,10 +97,6 @@ if has("autocmd")
   au FocusLost * :w
 endif
 
-augroup filetype_vim
-  autocmd!
-  autocmd FileType vim setlocal foldmethod=marker
-augroup END
 " }}}}
 "
 "" Command-Line Mappings {{{{
@@ -156,111 +116,82 @@ command! KillWhitespace :normal :%s/ *$//g<cr><c-o><cr>
 let mapleader = ","
 let localleader = "\\"
 
-" format the entire file
-nnoremap <leader>fef :normal! gg=G``<CR>
-
-" upper/lower word
-nnoremap <leader>u mQviwU`Q
-nnoremap <leader>l mQviwu`Q
-
-" upper/lower first char of word
-nnoremap <leader>U mQgewvU`Q
-nnoremap <leader>L mQgewvu`Q
-
-" cd to the directory containing the file in the buffer
-nnoremap <silent> <leader>cd :lcd %:h<CR>
-
-" Create the directory containing the file in the buffer
-nnoremap <silent> <leader>md :!mkdir -p %:p:h<CR>
-
-" Swap two words
-nnoremap <silent> gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR>`'
-
-" Underline the current line with '='
-nnoremap <silent> <leader>ul :t.<CR>Vr=
-
-" set text wrapping toggles
-nnoremap <silent> <leader>tw :set invwrap<CR>:set wrap?<CR>
-
-" find merge conflict markers
-nnoremap <silent> <leader>fc <ESC>/\v^[<=>]{7}( .*\|$)<CR>
-
-" Map the arrow keys to be based on display lines, not physical lines
-noremap <Down> gj
-noremap <Up> gk
-
-" Toggle hlsearch with <leader>hs
-nnoremap <leader>hs :set hlsearch! hlsearch?<CR>
-
-" Adjust viewports to the same size
-noremap <leader>= <C-w>=
-
-nnoremap <leader>ev :vsplit $MYVIMRC<cr>
-nnoremap <leader>sv :source $MYVIMRC<cr>
-nnoremap <leader><space> :noh<cr>
-nnoremap <tab> %
-vnoremap <tab> %
+inoremap jk <esc>
+nmap <localleader>/ <leader>c<space>
+nnoremap / /\v
 nnoremap ; :
-nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
-nnoremap <leader>v <C-w>v<C-w>l
-nnoremap <leader>h <C-w>s<C-w>l
+nnoremap <C-e> :Buffers<cr>
 nnoremap <C-h> <C-w>h
 nnoremap <C-j> <C-w>j<C-w>_
 nnoremap <C-k> <C-w>k<C-w>_
 nnoremap <C-l> <C-w>l
-nnoremap <leader>p "+p
+nnoremap <C-n> :GFiles<cr>
+nnoremap <C-p> :Files<cr>
+nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lel
+nnoremap <leader>' viw<esc>a'<esc>hbi'<esc>lel
+nnoremap <leader><space> :noh<cr>
+nnoremap <leader>L mQgewvu`Q
+nnoremap <leader>U mQgewvU`Q
+nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
+nnoremap <leader>ev :vsplit $MYVIMRC<cr>
+nnoremap <leader>fef :normal! gg=G``<CR>
+nnoremap <leader>gb :Git blame -w -M<cr>
+nnoremap <leader>gs :Gstatus<cr>
+nnoremap <leader>h <C-w>s<C-w>l
+nnoremap <leader>hs :set hlsearch! hlsearch?<CR>
+nnoremap <leader>l mQviwu`Q
 nnoremap <leader>n :NERDTreeFind<cr>
+nnoremap <leader>p "+p
+nnoremap <leader>sv :source $MYVIMRC<cr>
+nnoremap <leader>u mQviwU`Q
+nnoremap <leader>v <C-w>v<C-w>l
+nnoremap <localleader>F :Ag<space>
+nnoremap <localleader>f :Ack<space>
 nnoremap <localleader>n :NERDTreeClose<cr>
-" open fold
+nnoremap <silent> <leader>cd :lcd %:h<CR>
+nnoremap <silent> <leader>fc <ESC>/\v^[<=>]{7}( .*\|$)<CR>
+nnoremap <silent> <leader>md :!mkdir -p %:p:h<CR>
+nnoremap <silent> <leader>tw :set invwrap<CR>:set wrap?<CR>
+nnoremap <silent> <leader>ul :t.<CR>Vr=
+nnoremap <silent> gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR>`'
 nnoremap <space> za
-" create fold
-vnoremap <space> zf
-" surround with "
-nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lel
-nnoremap <leader>' viw<esc>a'<esc>hbi'<esc>lel
+nnoremap <tab> %
 nnoremap H ^
 nnoremap L $
-inoremap jk <esc>
-" NERDComToggleComment
-nmap <localleader>/ <leader>c<space>
+noremap <Down> gj
+noremap <Up> gk
+noremap <leader>= <C-w>=
 vmap <localleader>/ <leader>c<space>
-nnoremap <leader>gs :Gstatus<cr>
-nnoremap <leader>gb :Git blame -w -M<cr>
-
-nnoremap / /\v
 vnoremap / /\v
-nnoremap <localleader>F :Ag<space>
-nnoremap <localleader>f :Ack<space>
-nnoremap <C-n> :GFiles<cr>
-nnoremap <C-p> :Files<cr>
-nnoremap <C-e> :Buffers<cr>
-
-nmap <leader><tab> <plug>(fzf-maps-n)
-xmap <leader><tab> <plug>(fzf-maps-x)
-omap <leader><tab> <plug>(fzf-maps-o)
+vnoremap <space> zf
+vnoremap <tab> %
 
 imap <c-x><c-k> <plug>(fzf-complete-word)
 imap <c-x><c-l> <plug>(fzf-complete-line)
+nmap <leader><tab> <plug>(fzf-maps-n)
+omap <leader><tab> <plug>(fzf-maps-o)
+xmap <leader><tab> <plug>(fzf-maps-x)
 " }}}}
 
 "" Status Line {{{{
 ""
 
 if has("statusline") && !&cp
-  set laststatus=2  " always show the status bar
-  set statusline=%f                 " path to the file
-  set statusline+=\ -\              " separator
-  set statusline+=%y                " current file type
-  set statusline+=%=                " switch to right side
-  set statusline+=[buffer:%02n]     " current buffer
-  set statusline+=[column:%02v]     " current column
-  set statusline+=[line:%04l        " current line
-  set statusline+=/                 " separator
-  set statusline+=%04L]             " total lines
+  set laststatus=2
+  set statusline=%f
+  set statusline+=\ -\
+  set statusline+=%y
+  set statusline+=%=
+  set statusline+=[buffer:%02n]
+  set statusline+=[column:%02v]
+  set statusline+=[line:%04l
+  set statusline+=/
+  set statusline+=%04L]
   set statusline+=%#warningmsg#
   set statusline+=%{SyntasticStatuslineFlag()}
   set statusline+=%*
 endif
+
 " }}}}
 
 "" Abbreviations {{{{
@@ -278,6 +209,7 @@ iabbrev pwjs Co-authored-by: Jurre Stender <jurre@github.com>
 iabbrev pwph Co-authored-by: Philip Harrison <feelepxyz@github.com>
 iabbrev pwpw Co-authored-by: Peter Wagner <thepwagner@github.com>
 iabbrev pwns Co-authored-by: Nishant Sinha <nishnha@github.com>
+
 " }}}}
 
 "" Plugin Configuration {{{{