123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- call plug#begin('~/.vim/plugged')
- Plug 'tpope/vim-sensible'
- Plug 'tpope/vim-sleuth'
- Plug 'tpope/vim-fugitive'
- Plug 'tpope/vim-surround'
- Plug 'tpope/vim-abolish'
- Plug 'mhinz/vim-signify'
- Plug 'sjl/gundo.vim'
- Plug 'EinfachToll/DidYouMean'
- Plug 'idanarye/vim-merginal'
- Plug 'junegunn/fzf'
- Plug 'junegunn/fzf.vim'
- Plug 'itchyny/lightline.vim'
- Plug 'trusktr/seti.vim'
- if filereadable(expand('~/.vim/local-plugins.vim'))
- source ~/.vim/local-plugins.vim
- endif
- call plug#end()
- " ----- plugin settings ------
- let g:signify_vcs_list = [ 'git' ]
- let g:lightline = {
- \ 'colorscheme': 'wombat',
- \ 'active': {
- \ 'left': [ [ 'mode', 'paste' ],
- \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
- \ },
- \ 'component_function': {
- \ 'gitbranch': 'fugitive#head'
- \ },
- \ }
- " ------ 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
- " ------ 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
- " fzf
- nnoremap <C-P> :GitFiles -o -c --exclude-standard<CR>
- nnoremap <C-O> :Buffers<CR>
- if executable('rg')
- nnoremap <Leader>f :Rg<CR>
- elseif executable('ag')
- nnoremap <Leader>f :Ag<CR>
- endif
- " git
- nnoremap <Leader>gs :Gstatus<CR>
- nnoremap <Leader>gb :Merginal<CR>
- " undo tree
- nnoremap <Leader>ut :GundoToggle<CR>
- " vimrc
- nnoremap <Leader>ve :vsplit $MYVIMRC<CR>
- nnoremap <Leader>vs :source $MYVIMRC<CR>
- " ------ nvim specific ------
- if has('nvim')
- set inccommand=split
- tnoremap <M-j><M-j> <C-\><C-N>
- autocmd TermOpen * setlocal scrollback=10000 nonumber norelativenumber
- autocmd TermOpen * startinsert
- autocmd TermOpen *FZF* tnoremap <buffer> jj <ESC>
- autocmd BufWinEnter,WinEnter term://* startinsert
- autocmd BufLeave term://* stopinsert
- 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
- if filereadable(expand('~/.vim/local-config.vim'))
- source ~/.vim/local-config.vim
- endif
|