123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- " ------ settings ------
- " change terminal title
- set title
- " xdg-ish settings
- set undodir=~/.cache/vim/undo,.
- set backupdir=~/.cache/vim/backup,.
- set directory=~/.cache/vim/swap//,.
- " default indentation
- set shiftwidth=2
- set tabstop=4
- set expandtab
- " permanent undo history
- set undofile
- " allow switching buffers
- set hidden
- " always scroll
- set scrolloff=99
- " show line numbers
- set number
- set relativenumber
- " show gutter
- set signcolumn=yes
- " set wordwrap indent
- set nowrap
- set linebreak
- if exists("&breakindent")
- set breakindent
- set breakindentopt=shift:2,sbr
- endif
- " show whitespace
- set list
- " make a new copy of the file for backup
- " setting to no or auto messes with filewatchers
- set backupcopy=yes
- " disable modelines
- set nomodeline
- " ------ key bindings ------
- " ; as :
- nnoremap ; :
- vnoremap ; :
- " allow <ESC> via jj in insert mode
- inoremap jj <ESC>
- " tab switching
- nnoremap <C-T>h :tabprev<cr>
- nnoremap <C-T>l :tabnext<cr>
- " fix j/k with wraps
- nnoremap j gj
- nnoremap k gk
- vnoremap j gj
- vnoremap k gk
- " cursor display
- nnoremap <Leader>c :set cursorline! cursorcolumn!<CR>
- " fzf
- nnoremap <C-P> :GitFiles -o -c --exclude-standard<CR>
- nnoremap <C-O> :Buffers<CR>
- if executable('rg')
- nnoremap <Leader>f :Rg<SPACE>
- elseif executable('ag')
- nnoremap <Leader>f :Ag<SPACE>
- endif
- " git
- nnoremap <Leader>gs :Git<CR>
- nnoremap <Leader>gb :Merginal<CR>
- " undo tree
- nnoremap <Leader>ut :UndotreeToggle<CR>
- " vimrc
- nnoremap <Leader>ve :vsplit $MYVIMRC<CR>
- nnoremap <Leader>vs :source $MYVIMRC<CR>
- " ------ nvim specific ------
- if has('nvim')
- set inccommand=split
- tnoremap <C-[><C-[> <C-\><C-N>
- autocmd TermOpen * setlocal scrollback=10000 nonumber norelativenumber
- autocmd TermOpen * startinsert
- autocmd FileType fzf tnoremap <buffer> jj <ESC>
- autocmd BufWinEnter,WinEnter term://* startinsert
- autocmd BufLeave term://* stopinsert
- " fix flickering when clearing terminal
- autocmd TermEnter * setlocal scrolloff=0
- autocmd TermLeave * setlocal scrolloff=99
- nnoremap <Leader>tv :vsp term://$SHELL<CR>
- nnoremap <Leader>to :term<CR>
- endif
- augroup formatting
- au!
- " strip trailing whitespace
- autocmd BufWritePre * :%s/\s\+$//e
- autocmd FileType markdown :set tw=80
- augroup end
- colorscheme seti
- " Use unset background so that syntax-highlighted text does not overwrite the
- " base color. This might cause problems on white backgrounded terminals but I
- " don't use those
- highlight Normal ctermbg=NONE
- " Add a background for popups and floats to distinguish from regular text
- highlight Pmenu ctermbg=235 guibg=#282a2b
- highlight link FloatBorder Pmenu
- highlight MiniStatuslineModeNormal ctermbg=117 ctermfg=0
- highlight MiniStatuslineModeCommand ctermbg=117 ctermfg=0
- highlight MiniStatuslineModeInsert ctermbg=119 ctermfg=0
- highlight MiniStatuslineModeVisual ctermbg=216 ctermfg=0
- highlight MiniStatuslineModeReplace ctermbg=216 ctermfg=0
- highlight MiniStatuslineModeOther ctermbg=119 ctermfg=0
|