Clean up neovim config
This commit is contained in:
parent
9a24e6c230
commit
ffc6d40741
7
apps/neovim/.gitignore
vendored
7
apps/neovim/.gitignore
vendored
|
@ -1,10 +1,3 @@
|
||||||
/*
|
/*
|
||||||
!/scripts/
|
|
||||||
!/ftplugin/
|
|
||||||
!/.gitignore
|
!/.gitignore
|
||||||
!/init.vim
|
!/init.vim
|
||||||
!/settings.vim
|
|
||||||
!/bindings.vim
|
|
||||||
!/plugins.vim
|
|
||||||
!/airline.vim
|
|
||||||
!/commands.vim
|
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
let g:airline_powerline_fonts = 1
|
|
||||||
let g:airline#extensions#tabline#enabled = 1 " automatically displays all buffers when there's only one tab open
|
|
||||||
let g:airline#extensions#tabline#fnamemod = ':t'
|
|
||||||
|
|
||||||
let g:airline#extensions#tabline#left_sep = ''
|
|
||||||
let g:airline#extensions#tabline#left_alt_sep = ''
|
|
||||||
let g:airline_right_alt_sep = ''
|
|
||||||
let g:airline_right_sep = ''
|
|
||||||
let g:airline_left_alt_sep= ''
|
|
||||||
let g:airline_left_sep = ''
|
|
||||||
let g:airline#extensions#tabline#buffers_label = ''
|
|
||||||
|
|
||||||
let g:airline_mode_map = {
|
|
||||||
\ '__' : '-',
|
|
||||||
\ 'n' : 'N',
|
|
||||||
\ 'i' : 'I',
|
|
||||||
\ 'R' : 'R',
|
|
||||||
\ 'T' : 'T',
|
|
||||||
\ 't' : 'T',
|
|
||||||
\ 'c' : 'C',
|
|
||||||
\ 'v' : 'V',
|
|
||||||
\ 'V' : 'V',
|
|
||||||
\ '' : 'V',
|
|
||||||
\ 's' : 'S',
|
|
||||||
\ 'S' : 'S',
|
|
||||||
\ '' : 'S',
|
|
||||||
\ }
|
|
||||||
|
|
|
@ -1,260 +0,0 @@
|
||||||
" common typo fixes
|
|
||||||
command! WQ wq
|
|
||||||
command! Wq wq
|
|
||||||
command! Wqa wqa
|
|
||||||
command! W w
|
|
||||||
command! Q q
|
|
||||||
|
|
||||||
" best leader
|
|
||||||
let mapleader = "\<Space>"
|
|
||||||
|
|
||||||
" enter insert mode when entering a terminal buffer
|
|
||||||
augroup InsertModeOnBlankTerminal
|
|
||||||
autocmd BufWinEnter,WinEnter term://* startinsert
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
" terminal mappings
|
|
||||||
nnoremap <leader>t :split term://$SHELL<CR><C-\><C-n>:resize 24<CR>i
|
|
||||||
nnoremap <C-t> :split term://$SHELL<CR><C-\><C-n>:resize 24<CR>i
|
|
||||||
nnoremap <leader><leader>t :vsplit term://$SHELL<CR><C-\><C-n>:vertical resize 120<CR>i
|
|
||||||
" nnoremap <C-S-T> :vsplit term://$SHELL<CR><C-\><C-n>:vertical resize 120<CR>i
|
|
||||||
nnoremap <C-y> :vsplit term://$SHELL<CR><C-\><C-n>:vertical resize 120<CR>i
|
|
||||||
|
|
||||||
" close the terminal
|
|
||||||
tnoremap <C-w> <C-\><C-n>:q!<CR>
|
|
||||||
tnoremap <leader>w <C-\><C-n>:q!<CR>
|
|
||||||
" tnoremap <C-n> <C-\><C-n>
|
|
||||||
tnoremap <C-[> <C-\><C-n>
|
|
||||||
|
|
||||||
" moving between terminal splits
|
|
||||||
tnoremap <C-h> <C-\><C-n>:TmuxNavigateLeft<CR>
|
|
||||||
tnoremap <C-j> <C-\><C-n>:TmuxNavigateDown<CR>
|
|
||||||
tnoremap <C-k> <C-\><C-n>:TmuxNavigateUp<CR>
|
|
||||||
tnoremap <C-l> <C-\><C-n>:TmuxNavigateRight<CR>
|
|
||||||
|
|
||||||
" Jump to the next or previous line that has the same level or a lower
|
|
||||||
" level of indentation than the current line.
|
|
||||||
"
|
|
||||||
" exclusive (bool): true: Motion is exclusive
|
|
||||||
" false: Motion is inclusive
|
|
||||||
" fwd (bool): true: Go to next line
|
|
||||||
" false: Go to previous line
|
|
||||||
" lowerlevel (bool): true: Go to line with lower indentation level
|
|
||||||
" false: Go to line with the same indentation level
|
|
||||||
" skipblanks (bool): true: Skip blank lines
|
|
||||||
" false: Don't skip blank lines
|
|
||||||
function! NextIndent(exclusive, fwd, lowerlevel, skipblanks)
|
|
||||||
let line = line('.')
|
|
||||||
let column = col('.')
|
|
||||||
let lastline = line('$')
|
|
||||||
let indent = indent(line)
|
|
||||||
let stepvalue = a:fwd ? 1 : -1
|
|
||||||
while (line > 0 && line <= lastline)
|
|
||||||
let line = line + stepvalue
|
|
||||||
if ( a:lowerlevel == 0 && indent(line) == indent ||
|
|
||||||
\ a:lowerlevel == 1 && indent(line) < indent ||
|
|
||||||
\ a:lowerlevel == -1 && indent(line) > indent)
|
|
||||||
if (! a:skipblanks || strlen(getline(line)) > 0)
|
|
||||||
if (a:exclusive)
|
|
||||||
let line = line - stepvalue
|
|
||||||
endif
|
|
||||||
exe line
|
|
||||||
exe 'normal ' (column+1) . '|'
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" moving back and forth between lines of same or lower indentation should be sane
|
|
||||||
nnoremap <silent> [l :call NextIndent(0, 0, 0, 1)<CR>
|
|
||||||
nnoremap <silent> ]l :call NextIndent(0, 1, 0, 1)<CR>
|
|
||||||
nnoremap <silent> [L :call NextIndent(0, 0, 1, 1)<CR>
|
|
||||||
nnoremap <silent> ]L :call NextIndent(0, 1, 1, 1)<CR>
|
|
||||||
nnoremap <silent> [<C-l> :call NextIndent(0, 0, -1, 1)<CR>
|
|
||||||
nnoremap <silent> ]<C-l> :call NextIndent(0, 1, -1, 1)<CR>
|
|
||||||
vnoremap <silent> [l <Esc>:call NextIndent(0, 0, 0, 1)<CR>m'gv''
|
|
||||||
vnoremap <silent> ]l <Esc>:call NextIndent(0, 1, 0, 1)<CR>m'gv''
|
|
||||||
vnoremap <silent> [L <Esc>:call NextIndent(0, 0, 1, 1)<CR>m'gv''
|
|
||||||
vnoremap <silent> ]L <Esc>:call NextIndent(0, 1, 1, 1)<CR>m'gv''
|
|
||||||
onoremap <silent> [l :call NextIndent(0, 0, 0, 1)<CR>
|
|
||||||
onoremap <silent> ]l :call NextIndent(0, 1, 0, 1)<CR>
|
|
||||||
onoremap <silent> [L :call NextIndent(1, 0, 1, 1)<CR>
|
|
||||||
onoremap <silent> ]L :call NextIndent(1, 1, 1, 1)<CR>
|
|
||||||
|
|
||||||
" run make with leader,m
|
|
||||||
nnoremap <leader>m :call RunMake()<CR>
|
|
||||||
|
|
||||||
" NERDTree bindings
|
|
||||||
" show file manager in current directory
|
|
||||||
nnoremap <C-f> :NERDTreeToggle<CR>
|
|
||||||
" show file manager in git repo root
|
|
||||||
nnoremap <leader>n :call NERDProjectViewer()<CR>
|
|
||||||
" focus the current file in NERDTree
|
|
||||||
nnoremap <leader>gn :NERDTreeFind<CR>
|
|
||||||
|
|
||||||
" don't kill vim
|
|
||||||
" REBIND
|
|
||||||
nnoremap <leader>K <Nop>
|
|
||||||
nnoremap <S-K> <NOP>
|
|
||||||
|
|
||||||
" quick paragraph formatting
|
|
||||||
vmap Q gq
|
|
||||||
nmap Q gqap
|
|
||||||
|
|
||||||
" launch fzf for the current git repo
|
|
||||||
nnoremap <C-p> :GitFiles<CR>
|
|
||||||
|
|
||||||
" launch fzf for files in the current directory
|
|
||||||
nnoremap <C-o> :Files<CR>
|
|
||||||
|
|
||||||
" launch fzf for files modified or not in git
|
|
||||||
nnoremap <C-u> :GFiles?<CR>
|
|
||||||
|
|
||||||
" launch fzf for open buffers (files)
|
|
||||||
nnoremap <C-b> :Buffers<CR>
|
|
||||||
|
|
||||||
" launch fzf for open buffers (files)
|
|
||||||
nnoremap <leader>l :Buffers<CR>
|
|
||||||
|
|
||||||
if has("nvim")
|
|
||||||
au FileType fzf tnoremap <Esc> <C-c><C-c>
|
|
||||||
endif
|
|
||||||
|
|
||||||
" switch to previous buffer
|
|
||||||
nnoremap <leader>h :b#<CR>
|
|
||||||
|
|
||||||
" use leader j and k to switch buffers as well
|
|
||||||
nnoremap <leader>k :bnext<CR>
|
|
||||||
nnoremap <leader>j :bprevious<CR>
|
|
||||||
|
|
||||||
" window/pane navigation
|
|
||||||
nnoremap <C-h> :TmuxNavigateLeft<CR>
|
|
||||||
nnoremap <C-j> :TmuxNavigateDown<CR>
|
|
||||||
nnoremap <C-k> :TmuxNavigateUp<CR>
|
|
||||||
nnoremap <C-l> :TmuxNavigateRight<CR>
|
|
||||||
|
|
||||||
if has('nvim')
|
|
||||||
nnoremap <leader>r :source $vimdir/init.vim<CR>
|
|
||||||
else
|
|
||||||
nnoremap <leader>r :source $HOME/.vimrc<CR>
|
|
||||||
endif
|
|
||||||
|
|
||||||
" change buffers with leader,tab
|
|
||||||
nnoremap <leader><Tab> :bnext<CR>
|
|
||||||
nnoremap <leader><S-Tab> :bprevious<CR>
|
|
||||||
|
|
||||||
" fast word change
|
|
||||||
nnoremap <leader>c ciw
|
|
||||||
nnoremap <leader>C ciW
|
|
||||||
|
|
||||||
" fast splits
|
|
||||||
nnoremap <silent> <leader>s :split<CR>
|
|
||||||
nnoremap <silent> <leader>v :vsplit<CR>
|
|
||||||
|
|
||||||
" fast split closing
|
|
||||||
nnoremap <silent> <leader>q <C-w>q
|
|
||||||
|
|
||||||
" fast force quit
|
|
||||||
nnoremap <silent> <leader>Q :qall!<CR>
|
|
||||||
|
|
||||||
" clear search higlight
|
|
||||||
nnoremap <silent> <leader>/ :let @/ = ""<CR>:<BACKSPACE>
|
|
||||||
|
|
||||||
" remap jk/jj and its variants to escape
|
|
||||||
inoremap jj <Esc>
|
|
||||||
inoremap Jj <Esc>
|
|
||||||
inoremap Jj <Esc>
|
|
||||||
inoremap JJ <Esc>
|
|
||||||
inoremap jk <Esc>
|
|
||||||
inoremap Jk <Esc>
|
|
||||||
inoremap jK <Esc>
|
|
||||||
inoremap JK <Esc>
|
|
||||||
|
|
||||||
" use hjkl-movement between rows when soft wrapping:
|
|
||||||
nnoremap j gj
|
|
||||||
nnoremap k gk
|
|
||||||
vnoremap j gj
|
|
||||||
vnoremap k gk
|
|
||||||
|
|
||||||
" camel case motions
|
|
||||||
map <silent> ,w <Plug>CamelCaseMotion_w
|
|
||||||
map <silent> ,b <Plug>CamelCaseMotion_b
|
|
||||||
map <silent> ,e <Plug>CamelCaseMotion_e
|
|
||||||
map <silent> ,ge <Plug>CamelCaseMotion_ge
|
|
||||||
|
|
||||||
" inner _ objects
|
|
||||||
omap <silent> ib <Plug>CamelCaseMotion_ib
|
|
||||||
xmap <silent> ib <Plug>CamelCaseMotion_ib
|
|
||||||
omap <silent> ie <Plug>CamelCaseMotion_ie
|
|
||||||
xmap <silent> ie <Plug>CamelCaseMotion_ie
|
|
||||||
|
|
||||||
" remove trailing whitespace
|
|
||||||
map <F3> mw:%s/\s\+$//<CR>:let @/ = ""<CR>'w
|
|
||||||
|
|
||||||
" close buffer with leader-w
|
|
||||||
nnoremap <silent> <leader>w :bd<CR>
|
|
||||||
|
|
||||||
" toggle spell checking:
|
|
||||||
map <F4> :setlocal spell!<CR>
|
|
||||||
|
|
||||||
" open urls, files, etc. example: http://google.com:
|
|
||||||
noremap <leader>o :!xdg-open <cfile><CR><CR>
|
|
||||||
|
|
||||||
" insert newline
|
|
||||||
" NOTE: doesn't work in terminals?
|
|
||||||
" noremap <S-Enter> i<Enter><Esc>
|
|
||||||
" noremap <C-o> i<Enter><Esc>
|
|
||||||
|
|
||||||
" prevent wildmenu
|
|
||||||
map q: :q
|
|
||||||
noremap qqq: q:
|
|
||||||
|
|
||||||
" sane n/N behavior
|
|
||||||
nnoremap <expr> n 'Nn'[v:searchforward]
|
|
||||||
nnoremap <expr> N 'nN'[v:searchforward]
|
|
||||||
|
|
||||||
" better command history navigation
|
|
||||||
cnoremap <c-n> <down>
|
|
||||||
cnoremap <c-p> <up>
|
|
||||||
|
|
||||||
" keep selection after indenting visual selection
|
|
||||||
xnoremap < <gv
|
|
||||||
xnoremap > >gv
|
|
||||||
|
|
||||||
" distraction-free mode
|
|
||||||
nnoremap <silent> <leader>df :DistractionFreeMode<CR>
|
|
||||||
|
|
||||||
" recalc syntax highlighting
|
|
||||||
nnoremap <leader>gs :syntax sync fromstart<CR>
|
|
||||||
|
|
||||||
" lsp bindings
|
|
||||||
|
|
||||||
" coc
|
|
||||||
|
|
||||||
" open coc config
|
|
||||||
nnoremap <leader><space>c :CocConfig<CR>
|
|
||||||
|
|
||||||
" smart jumps
|
|
||||||
nmap <silent> gd <Plug>(coc-definition)
|
|
||||||
nmap <silent> gy <Plug>(coc-type-definition)
|
|
||||||
nmap <silent> gi <Plug>(coc-implementation)
|
|
||||||
nmap <silent> gr <Plug>(coc-references)
|
|
||||||
|
|
||||||
nmap <silent> g[ <Plug>(coc-diagnostic-prev)
|
|
||||||
nmap <silent> g] <Plug>(coc-diagnostic-next)
|
|
||||||
|
|
||||||
nmap <leader>ac <Plug>(coc-codeaction)
|
|
||||||
nmap <leader>qf <Plug>(coc-fix-current)
|
|
||||||
nmap <leader>f <Plug>(coc-format)
|
|
||||||
vmap <leader>f <Plug>(coc-format-selected)
|
|
||||||
|
|
||||||
" ale
|
|
||||||
|
|
||||||
" go to definitions
|
|
||||||
" nnoremap <leader>gd :ALEGoToDefinition<CR>
|
|
||||||
" nnoremap <leader>gh :ALEGoToDefinitionInSplit<CR>
|
|
||||||
" nnoremap <leader>gv :ALEGoToDefinitionInVSplit<CR>
|
|
||||||
|
|
||||||
" misc plugins
|
|
||||||
nmap <leader>aa :%ArrangeColumn!<CR>
|
|
|
@ -1,84 +0,0 @@
|
||||||
" TODO: need a way to toggle this and maybe make it on by default except in
|
|
||||||
" files where space indentation is expected
|
|
||||||
fun! ShowSpaceIndentation()
|
|
||||||
hi LeadingWhiteSpaces ctermfg=black ctermbg=8
|
|
||||||
endfunction
|
|
||||||
fun! HideSpaceIndentation()
|
|
||||||
hi LeadingWhiteSpaces ctermfg=black ctermbg=black
|
|
||||||
endfunction
|
|
||||||
hi LeadingWhiteSpaces ctermfg=black ctermbg=black
|
|
||||||
|
|
||||||
:command! SpaceIndents call ShowSpaceIndentation()
|
|
||||||
:command! ShowSpaceIndents call ShowSpaceIndentation()
|
|
||||||
:command! HideSpaceIndents call HideSpaceIndentation()
|
|
||||||
|
|
||||||
" jump to last opened position in file except in git commits
|
|
||||||
let jump_to_pos_blacklist = ['gitcommit']
|
|
||||||
if has("autocmd")
|
|
||||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") && index(jump_to_pos_blacklist, &ft) | exe "normal! g'\"" | endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" make any necessary directories in the path when saving a file
|
|
||||||
fun! <SID>AutoMakeDirectory()
|
|
||||||
let s:directory = expand("<afile>:p:h")
|
|
||||||
if !isdirectory(s:directory)
|
|
||||||
call mkdir(s:directory, "p")
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
autocmd BufWritePre,FileWritePre * :call <SID>AutoMakeDirectory()
|
|
||||||
|
|
||||||
" run make from vim smartly
|
|
||||||
if !exists("g:make_args")
|
|
||||||
let g:make_args="default"
|
|
||||||
endif
|
|
||||||
fun! RunMake()
|
|
||||||
split
|
|
||||||
if has('nvim')
|
|
||||||
" run from the root of the current git repository
|
|
||||||
let path = system("git rev-parse --show-toplevel | tr -d '\\n'")
|
|
||||||
" TODO: handle non-git situations
|
|
||||||
execute 'terminal cd ' . path . ' && make ' . g:make_args
|
|
||||||
startinsert
|
|
||||||
else
|
|
||||||
execute '!make ' . g:make_args
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" kill the terminal buffer when the process exits
|
|
||||||
autocmd TermClose * call feedkeys('<cr>')
|
|
||||||
|
|
||||||
fun! NERDProjectViewer()
|
|
||||||
let path = system("git rev-parse --show-toplevel | tr -d '\\n'")
|
|
||||||
execute 'NERDTree' path
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" a toggle-able minimalistic distraction-free text editing mode
|
|
||||||
let s:distractionFreeMode = 0
|
|
||||||
fun! DistractionFreeModeFunc()
|
|
||||||
if s:distractionFreeMode == 0
|
|
||||||
let s:distractionFreeMode = 1
|
|
||||||
AirlineToggle
|
|
||||||
Goyo
|
|
||||||
else
|
|
||||||
let s:distractionFreeMode = 0
|
|
||||||
Goyo!
|
|
||||||
AirlineToggle
|
|
||||||
AirlineRefresh
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" prevents normal window navigation and closing while in DistractionFreeMode
|
|
||||||
fun! CheckCloseDistractionFreeMode()
|
|
||||||
if s:distractionFreeMode == 1
|
|
||||||
call DistractionFreeModeFunc()
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" run the previous checking function every time we leave a window
|
|
||||||
if has('autocmd')
|
|
||||||
" autocmd WinLeave * call CheckCloseDistractionFreeMode()
|
|
||||||
endif
|
|
||||||
|
|
||||||
" AddTabularPattern! ssv /\s/r0c0l0
|
|
||||||
|
|
||||||
command! DistractionFreeMode call DistractionFreeModeFunc()
|
|
|
@ -1,28 +1,130 @@
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
set fileencoding=utf8
|
set fileencoding=utf8
|
||||||
|
|
||||||
let $vimdir = $HOME.'/.vim'
|
|
||||||
if has('nvim')
|
|
||||||
let $vimdir = $XDG_CONFIG_HOME.'/nvim'
|
let $vimdir = $XDG_CONFIG_HOME.'/nvim'
|
||||||
|
|
||||||
|
if empty(glob($vimdir.'/autoload/plug.vim'))
|
||||||
|
silent !curl -fLo $vimdir/autoload/plug.vim --create-dirs
|
||||||
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
autocmd VimEnter * PlugInstall --sync | source $vimdir.'init.vim'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if filereadable("$ENV_PATH/vim")
|
let g:indent_guide_auto_colors = 1
|
||||||
source "$ENV_PATH/vim"
|
let g:indent_guides_enable_on_vim_startup = 1
|
||||||
endif
|
let g:prosession_dir = $vimdir."/session/"
|
||||||
|
let g:jsonnet_fmt_on_save = 0
|
||||||
|
|
||||||
call plug#begin($vimdir.'/bundle')
|
call plug#begin($vimdir.'/plugged')
|
||||||
source $vimdir/plugins.vim
|
Plug 'junegunn/vim-plug' " plugin manager should manage itself
|
||||||
source $vimdir/airline.vim
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||||
|
Plug 'junegunn/fzf.vim' " helpers for using fzf in vim
|
||||||
|
Plug 'nathanaelkane/vim-indent-guides' " indentation guides
|
||||||
|
Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements
|
||||||
|
Plug 'vim-scripts/LargeFile' " gracefully handle very large files
|
||||||
|
Plug 'tpope/vim-commentary' " toggle comments in code easily
|
||||||
|
Plug 'tpope/vim-repeat' " better vim repeating for plugin-provided actions
|
||||||
|
Plug 'christoomey/vim-tmux-navigator' " allow window navigation to play nicely with tmux
|
||||||
|
Plug 'machakann/vim-sandwich' " quickly modify text surrounding objects
|
||||||
|
Plug 'michaeljsmith/vim-indent-object' " adds an indentation level text object
|
||||||
|
Plug 'wellle/targets.vim' " adds some more handy text objects
|
||||||
|
Plug 'junegunn/goyo.vim' " better distraction-free editing
|
||||||
|
Plug 'tpope/vim-sleuth' " try and detect indent method
|
||||||
|
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
|
||||||
|
Plug 'google/vim-jsonnet', {'for': ['jsonnet', 'libsonnet']}
|
||||||
|
Plug 'calviken/vim-gdscript3', {'for': ['gdscript']}
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
filetype on
|
filetype on
|
||||||
filetype indent on
|
filetype indent on
|
||||||
filetype plugin on
|
filetype plugin on
|
||||||
|
|
||||||
source $vimdir/settings.vim
|
" use :h option-list if you need to know what these do
|
||||||
source $vimdir/commands.vim
|
set encoding=utf8
|
||||||
source $vimdir/bindings.vim
|
set tabstop=2 shiftwidth=2 softtabstop=2 noexpandtab
|
||||||
|
set autoindent smartindent
|
||||||
|
set list nostartofline listchars=trail:·,tab:\ \ ,trail:~
|
||||||
|
set linebreak formatoptions=crql1jn " TODO: anything else useful? :h fo-table
|
||||||
|
set synmaxcol=200
|
||||||
|
set lazyredraw
|
||||||
|
set scrolloff=8 sidescrolloff=15
|
||||||
|
set mouse=a
|
||||||
|
set splitright splitbelow
|
||||||
|
set noerrorbells visualbell t_vb=
|
||||||
|
set nobackup nowritebackup noswapfile
|
||||||
|
set timeout ttimeoutlen=100 timeoutlen=150
|
||||||
|
set hidden shortmess+=Ia
|
||||||
|
set history=1000
|
||||||
|
set undofile undodir=$vimdir/undo undolevels=1000 undoreload=10000
|
||||||
|
set spellfile=$vimdir/spell/en.utf-8.add
|
||||||
|
set ignorecase smartcase incsearch wrapscan hlsearch
|
||||||
|
set foldmethod=syntax foldlevel=99 foldnestmax=10 foldlevelstart=99 " TODO: get good at folding
|
||||||
|
set noautowrite autochdir autoread
|
||||||
|
set nomodeline noshowmode noshowcmd laststatus=0 " TODO: custom modeline and buffer list?
|
||||||
|
set clipboard+=unnamedplus
|
||||||
|
set t_Co=256
|
||||||
|
|
||||||
if filereadable("$ENV_PATH/vim-after")
|
syntax enable
|
||||||
source "$ENV_PATH/vim-after"
|
colorscheme base16-donokai
|
||||||
endif
|
|
||||||
|
call matchadd('ColorColumn', '\%81v', 100)
|
||||||
|
|
||||||
|
hi Search cterm=NONE ctermbg=blue ctermfg=black
|
||||||
|
hi LineNr ctermbg=none ctermfg=8
|
||||||
|
hi CursorLineNr ctermbg=18 ctermfg=gray
|
||||||
|
hi IndentGuidesEven ctermbg=18
|
||||||
|
hi Normal ctermbg=NONE
|
||||||
|
hi ColorColumn ctermbg=7 ctermfg=0
|
||||||
|
|
||||||
|
" jump to last opened position in file except in git commits
|
||||||
|
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") && index(['gitcommit'], &ft) | exe "normal! g'\"" | endif
|
||||||
|
|
||||||
|
inoremap jj <Esc>
|
||||||
|
inoremap jk <Esc>
|
||||||
|
|
||||||
|
nnoremap <C-p> :GitFiles<CR>
|
||||||
|
nnoremap <C-o> :Files<CR>
|
||||||
|
nnoremap <C-u> :GFiles?<CR>
|
||||||
|
nnoremap <C-b> :Buffers<CR>
|
||||||
|
au FileType fzf tnoremap <Esc> <C-c><C-c>
|
||||||
|
|
||||||
|
nnoremap <C-h> :TmuxNavigateLeft<CR>
|
||||||
|
nnoremap <C-j> :TmuxNavigateDown<CR>
|
||||||
|
nnoremap <C-k> :TmuxNavigateUp<CR>
|
||||||
|
nnoremap <C-l> :TmuxNavigateRight<CR>
|
||||||
|
tnoremap <C-h> <C-\><C-n>:TmuxNavigateLeft<CR>
|
||||||
|
tnoremap <C-j> <C-\><C-n>:TmuxNavigateDown<CR>
|
||||||
|
tnoremap <C-k> <C-\><C-n>:TmuxNavigateUp<CR>
|
||||||
|
tnoremap <C-l> <C-\><C-n>:TmuxNavigateRight<CR>
|
||||||
|
|
||||||
|
map <silent> ,w <Plug>CamelCaseMotion_w
|
||||||
|
map <silent> ,b <Plug>CamelCaseMotion_b
|
||||||
|
map <silent> ,e <Plug>CamelCaseMotion_e
|
||||||
|
map <silent> ,ge <Plug>CamelCaseMotion_ge
|
||||||
|
omap <silent> ib <Plug>CamelCaseMotion_ib
|
||||||
|
xmap <silent> ib <Plug>CamelCaseMotion_ib
|
||||||
|
omap <silent> ie <Plug>CamelCaseMotion_ie
|
||||||
|
xmap <silent> ie <Plug>CamelCaseMotion_ie
|
||||||
|
|
||||||
|
map <F3> mw:%s/\s\+$//<CR>:let @/ = ""<CR>'w
|
||||||
|
map <F4> :setlocal spell!<CR>
|
||||||
|
|
||||||
|
nnoremap <expr> n 'Nn'[v:searchforward]
|
||||||
|
nnoremap <expr> N 'nN'[v:searchforward]
|
||||||
|
|
||||||
|
cnoremap <c-n> <down>
|
||||||
|
cnoremap <c-p> <up>
|
||||||
|
|
||||||
|
xnoremap < <gv
|
||||||
|
xnoremap > >gv
|
||||||
|
|
||||||
|
let mapleader = "\<Space>"
|
||||||
|
nnoremap <silent> <leader>w :bd<CR>
|
||||||
|
nnoremap <leader>h :b#<CR>
|
||||||
|
nnoremap <leader>k :bnext<CR>
|
||||||
|
nnoremap <leader>j :bprevious<CR>
|
||||||
|
nnoremap <silent> <leader>/ :let @/ = ""<CR>:<BACKSPACE>
|
||||||
|
|
||||||
|
nnoremap <leader>t :split<CR>:term<CR>:resize 24<CR>:startinsert<CR>
|
||||||
|
tnoremap <C-w> <C-\><C-n>:q!<CR>
|
||||||
|
|
||||||
|
" TODO: learn about the wildmenu `q:`
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
" install plugin manager if needed
|
|
||||||
augroup PluginManagerInstaller
|
|
||||||
if empty(glob("$vimdir/autoload/plug.vim"))
|
|
||||||
silent !curl -fLo "$vimdir/autoload/plug.vim" --create-dirs 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
|
||||||
autocmd VimEnter * PlugInstall
|
|
||||||
endif
|
|
||||||
augroup End
|
|
||||||
|
|
||||||
let g:indent_guide_auto_colors = 1
|
|
||||||
let g:indent_guides_enable_on_vim_startup = 1
|
|
||||||
let g:prosession_dir = $vimdir."/session/"
|
|
||||||
let g:polyglot_disabled = ['cue', 'cuesheet']
|
|
||||||
let g:jsonnet_fmt_on_save = 0
|
|
||||||
|
|
||||||
" let g:fzf_layout = { 'window': 'enew' }
|
|
||||||
|
|
||||||
" check if we're using vim as the manpage viewer before loading session plugins
|
|
||||||
if exists('asmanviewer') || exists('nosession')
|
|
||||||
let g:prosession_dir = '/dev/null'
|
|
||||||
else
|
|
||||||
Plug 'tpope/vim-obsession' " session ease-of-use
|
|
||||||
Plug 'dhruvasagar/vim-prosession' " more session ease-of-use
|
|
||||||
endif
|
|
||||||
|
|
||||||
Plug 'junegunn/vim-plug' " plugin manager should manage itself
|
|
||||||
Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'} " fuzzy file finding
|
|
||||||
Plug 'junegunn/fzf.vim' " helpers for using fzf in vim
|
|
||||||
Plug 'vim-airline/vim-airline' " status line
|
|
||||||
Plug 'vim-airline/vim-airline-themes' " more minimal status line
|
|
||||||
Plug 'nathanaelkane/vim-indent-guides' " indentation guides
|
|
||||||
" Plug 'SirVer/ultisnips' " snippet manager
|
|
||||||
Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements
|
|
||||||
Plug 'vim-scripts/LargeFile' " gracefully handle very large files
|
|
||||||
Plug 'tpope/vim-commentary' " toggle comments in code easily
|
|
||||||
Plug 'tpope/vim-repeat' " better vim repeating for plugin-provided actions
|
|
||||||
Plug 'vim-scripts/SyntaxRange' " define syntax ranges
|
|
||||||
Plug 'tmux-plugins/vim-tmux-focus-events' " allow transitions from tmux
|
|
||||||
Plug 'christoomey/vim-tmux-navigator' " allow transitions to tmux
|
|
||||||
Plug 'godlygeek/tabular' " commands for aligning text
|
|
||||||
Plug 'lytedev/vim-superman' " view man pages with vim
|
|
||||||
Plug 'machakann/vim-sandwich' " quickly modify text surrounding objects
|
|
||||||
Plug 'tpope/vim-speeddating' " date-like text objects
|
|
||||||
Plug 'tpope/vim-fugitive' " git commands
|
|
||||||
Plug 'michaeljsmith/vim-indent-object' " adds an indentation level text object
|
|
||||||
Plug 'wellle/targets.vim' " adds some more handy text objects
|
|
||||||
Plug 'dbakker/vim-projectroot' " adds helper functions for getting to a project's root directory
|
|
||||||
Plug 'junegunn/goyo.vim' " better distraction-free editing
|
|
||||||
Plug 'junegunn/limelight.vim' " dim inactive blocks of code
|
|
||||||
Plug 'tpope/vim-sleuth' " try and detect indent method
|
|
||||||
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
|
|
||||||
Plug 'tpope/vim-eunuch' " unix helper commands
|
|
||||||
Plug 'mbbill/undotree' " undo tree visualizer
|
|
||||||
" Plug 'junegunn/vim-peekaboo' " preview registers
|
|
||||||
|
|
||||||
" language support
|
|
||||||
Plug 'sheerun/vim-polyglot' " vim plugin loader for many languages
|
|
||||||
Plug 'OmniSharp/omnisharp-vim', {'for': ['cs']} " C# language
|
|
||||||
Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']} " moonscript language
|
|
||||||
Plug 'OmniSharp/omnisharp-vim', {'for': ['cs']} " C# language
|
|
||||||
" Plug 'neoclide/coc.nvim', {'branch': 'release'} " language server interface
|
|
||||||
Plug 'tpope/vim-dadbod' " vim database functions
|
|
||||||
Plug 'lytedev/elm-vim', {'for': ['elm']} " elm lang
|
|
||||||
Plug 'google/vim-jsonnet', {'for': ['jsonnet', 'libsonnet']} " jsonnet
|
|
||||||
Plug 'sirtaj/vim-openscad', {'for': ['scad']} " openscad
|
|
||||||
Plug 'jjo/vim-cue' " cuelang
|
|
||||||
Plug 'calviken/vim-gdscript3', {'for': ['gdscript']} " godot scripts
|
|
||||||
" Plug 'chrisbra/csv.vim'
|
|
||||||
" Plug 'ssh://git@git.lyte.dev:2222/lytedev/vim-lytlang.git'
|
|
|
@ -1,165 +0,0 @@
|
||||||
scriptencoding utf-8
|
|
||||||
set fileencoding=utf8
|
|
||||||
set encoding=utf8
|
|
||||||
|
|
||||||
" ALE completeopt recommendation
|
|
||||||
set completeopt=menu,menuone,preview,noselect,noinsert
|
|
||||||
|
|
||||||
" line number defaults
|
|
||||||
set nonumber
|
|
||||||
set norelativenumber
|
|
||||||
|
|
||||||
" different settings if using vim as a manpage viewer
|
|
||||||
" if exists('asmanviewer')
|
|
||||||
" set nonumber " no line numbers when viewing a man page
|
|
||||||
" set norelativenumber " no line numbers when viewing a man page
|
|
||||||
" else
|
|
||||||
" set nonumber " line numbers
|
|
||||||
" set norelativenumber " line numbers
|
|
||||||
" endif
|
|
||||||
|
|
||||||
" use tabs at a two-space width like God intended
|
|
||||||
set tabstop=2
|
|
||||||
set shiftwidth=2
|
|
||||||
set softtabstop=2
|
|
||||||
set noexpandtab
|
|
||||||
|
|
||||||
" auto/smart indent
|
|
||||||
set autoindent smartindent
|
|
||||||
|
|
||||||
" show certain whitespace characters
|
|
||||||
set list
|
|
||||||
set nostartofline
|
|
||||||
set listchars=trail:·,tab:\ \ ,trail:~
|
|
||||||
" set listchars=eol:\ ,tab:>-,trail:~,extends:>,precedes:<,space:·
|
|
||||||
|
|
||||||
" try and keep text (and code) to a width of 80 characters
|
|
||||||
set wrap
|
|
||||||
set linebreak
|
|
||||||
set breakindent
|
|
||||||
set textwidth=80
|
|
||||||
set formatoptions=crql1j " :h fo-table
|
|
||||||
|
|
||||||
" handle window title
|
|
||||||
set title
|
|
||||||
|
|
||||||
" limit syntax highlighting line length
|
|
||||||
set synmaxcol=500
|
|
||||||
|
|
||||||
" don't highlight the current line
|
|
||||||
set nocursorline
|
|
||||||
|
|
||||||
" don't highlight the current column
|
|
||||||
" set nocursorcolumn
|
|
||||||
|
|
||||||
" OBSOLETE: colors columns past 80
|
|
||||||
" let &colorcolumn=join(range(81,400),",")
|
|
||||||
|
|
||||||
" highlight the 81st character in a line where it exists
|
|
||||||
highlight ColorColumn ctermbg=magenta ctermfg=7
|
|
||||||
call matchadd('ColorColumn', '\%81v', 100)
|
|
||||||
|
|
||||||
" set noshowcmd
|
|
||||||
" set nowildmenu
|
|
||||||
" set wildmode=longest,list,full
|
|
||||||
set cpoptions-=$ " make buffer options more global
|
|
||||||
set noshowmatch " don't briefly highlight matching brackets
|
|
||||||
set mouse=a " enable mouse use
|
|
||||||
set mousehide " hide mouse when typing
|
|
||||||
set backspace=indent,eol,start " sane backspace
|
|
||||||
set noruler " hide the ruler - we have airline
|
|
||||||
set lazyredraw " don't draw during macros and other such things
|
|
||||||
set scrolloff=8 " keep lines above and below cursor (padding)
|
|
||||||
set sidescrolloff=15 " same but for columns
|
|
||||||
set splitright " don't split left
|
|
||||||
set splitbelow " don't split top
|
|
||||||
set noerrorbells " shhhh, vim
|
|
||||||
set visualbell " but visual noise for alerts is ok
|
|
||||||
set nobackup " sessions handle this quite nicely
|
|
||||||
set nowritebackup " no, but really, they do
|
|
||||||
set noswapfile " no, seriously, sessions are cool
|
|
||||||
set timeout " key combo mapping timeout
|
|
||||||
set ttimeoutlen=100 " ms delay for tapping key combos
|
|
||||||
set timeoutlen=150 " ms for key combo mapping timeout
|
|
||||||
set isfname+=32 " allow filenames to show them 32s
|
|
||||||
set updatetime=300 " recommended for coc.nvim
|
|
||||||
|
|
||||||
" no freakin' bell
|
|
||||||
set visualbell t_vb=
|
|
||||||
if has('autocmd')
|
|
||||||
augroup DisableVisualBell
|
|
||||||
autocmd GUIEnter * set visualbell t_vb=
|
|
||||||
augroup END
|
|
||||||
endif
|
|
||||||
|
|
||||||
syntax enable
|
|
||||||
colorscheme base16-donokai
|
|
||||||
|
|
||||||
" hide stuff
|
|
||||||
highlight SignColumn ctermbg=black guibg=black
|
|
||||||
highlight GitGutterAdd ctermbg=black guibg=black
|
|
||||||
highlight GitGutterDelete ctermbg=black guibg=black
|
|
||||||
highlight GitGutterChange ctermbg=black guibg=black
|
|
||||||
highlight GitGutterChangeDelete ctermbg=black guibg=black
|
|
||||||
|
|
||||||
hi NonText ctermfg=black guifg=black
|
|
||||||
|
|
||||||
hi DiffAdd ctermfg=black ctermbg=2
|
|
||||||
hi DiffChange ctermfg=black ctermbg=4
|
|
||||||
hi DiffDelete ctermfg=black ctermbg=10
|
|
||||||
hi DiffText ctermfg=white ctermbg=10
|
|
||||||
|
|
||||||
set hidden " allows buffer switching without saving
|
|
||||||
set shortmess+=Ia " hide vim intro, skip lots of file messages/prompts
|
|
||||||
set history=1000
|
|
||||||
|
|
||||||
" undo files
|
|
||||||
set undofile
|
|
||||||
set undodir=$vimdir/undo
|
|
||||||
set undolevels=1000
|
|
||||||
set undoreload=10000
|
|
||||||
|
|
||||||
" spell file
|
|
||||||
set spellfile=$vimdir/spell/en.utf-8.add
|
|
||||||
|
|
||||||
" more sane search settings
|
|
||||||
set ignorecase
|
|
||||||
set smartcase
|
|
||||||
set incsearch
|
|
||||||
set wrapscan
|
|
||||||
|
|
||||||
" highlight search matches
|
|
||||||
set hlsearch
|
|
||||||
|
|
||||||
" enable syntax folding
|
|
||||||
set foldmethod=syntax
|
|
||||||
set foldlevel=99
|
|
||||||
set foldnestmax=10
|
|
||||||
set foldlevelstart=99
|
|
||||||
|
|
||||||
set noautowrite " let me do the writing
|
|
||||||
set autochdir " `:e` all day
|
|
||||||
set autoread " this is fine with `u`
|
|
||||||
set nomodeline " airline wins
|
|
||||||
set noshowmode " airline is really good
|
|
||||||
set noshowcmd " be clean
|
|
||||||
|
|
||||||
set laststatus=0 " be clean
|
|
||||||
|
|
||||||
" yank to OS clipboard by default
|
|
||||||
set clipboard+=unnamedplus
|
|
||||||
|
|
||||||
" no empty buffer on startup
|
|
||||||
augroup DisableEmptyBuffer
|
|
||||||
autocmd VimEnter * nested if bufname('')=='' && line('$') == 1 && col('$')==1 && !&modified | bd % | endif
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
" modify higlight colors
|
|
||||||
hi Search cterm=NONE ctermbg=blue ctermfg=black
|
|
||||||
highlight LineNr ctermbg=none ctermfg=8
|
|
||||||
highlight CursorLineNr ctermbg=18 ctermfg=gray
|
|
||||||
hi IndentGuidesEven ctermbg=18
|
|
||||||
|
|
||||||
hi Normal ctermbg=NONE
|
|
||||||
|
|
||||||
let b:csv_arrange_align = 'l*'
|
|
4
env/common/colors/vim
vendored
4
env/common/colors/vim
vendored
|
@ -1,7 +1,3 @@
|
||||||
" Base16 Donokai (https://github.com/chriskempson/base16)
|
|
||||||
" Scheme: Daniel Flanagan(https://lytedev.io)
|
|
||||||
|
|
||||||
" GUI color definitions
|
|
||||||
let s:gui00 = "111111"
|
let s:gui00 = "111111"
|
||||||
let s:gui01 = "383830"
|
let s:gui01 = "383830"
|
||||||
let s:gui02 = "49483e"
|
let s:gui02 = "49483e"
|
||||||
|
|
Reference in a new issue