diff options
Diffstat (limited to '')
-rw-r--r-- | configs/rcs/vimrc | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/configs/rcs/vimrc b/configs/rcs/vimrc new file mode 100644 index 0000000..76efc1c --- /dev/null +++ b/configs/rcs/vimrc @@ -0,0 +1,91 @@ +set encoding=utf-8 +scriptencoding utf-8 + +call plug#begin('~/.local/share/nvim/plugged') +Plug 'fatih/vim-go' +Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' } +Plug 'junegunn/fzf.vim' +Plug 'mileszs/ack.vim' +Plug 'plasticboy/vim-markdown' + +call plug#end() + + +set ttyfast " assume fast terminal and send more chars for smooth redraw +set lazyredraw " don't redraw while executing macros, register and cmds + +syntax off + +let &statusline = '[%n] %<%F %m%r%w%y %= (%l,%c) %P of %L' +set laststatus=2 " every window gets a statusline, always(=2) +set scrolloff=5 " scroll edge offset (to keep some context) +set shortmess=a " abbreviate all(=a) messages when possible +set showcmd " show last command + +" command line completion similar to zsh default +" complete up to longest match and display the list of possible matches +set wildmode=list:longest + +set list listchars=tab:»‧,trail:░,precedes:◄,extends:►,nbsp:‧ +set fillchars+=vert:\ + +set hidden " don't unload but hide buffers when dismissed +set splitbelow splitright " new window split to below, vsplit to right +set autochdir " change cwd to file's in selected buffer +set autoread " pickup file changes under unmodified buffer +set autowrite " write to before :next, :make, :suspend, ... +set autoindent " always-be-indenting +set copyindent " copy the existing indenting behavior of file +set expandtab " spaces over tabs for indentation +set shiftwidth=2 " without wasting too much screen estate +set softtabstop=-1 " equal to 'shiftwidth' +set ignorecase smartcase " case insensitive search if all lowercase +set incsearch " incrementally move to match and highlight +set hlsearch " highlight previous search pattern +set history=1000 " command and search pattern history size +set novisualbell " use visual bell instead of beeping +set backspace=indent,eol,start " backspace over everything + +let g:mapleader = "\<Space>" + +" Detect file types. Load '&rtp/{ftplugin, indent}/<ft>.vim'. +filetype plugin indent on + +" 'undofile' is off by default but when enabled keep them together under +" a well-known location instead of same directory with edited files. +set undodir=~/.local/share/vim/.undo/ + +" Keep viminfo file under ~/.vim instead of home. +set viminfo+=n~/.local/share/vim/.viminfo + +" Plugins configuration +let g:ackprg = 'ag --vimgrep --smart-case' + +let g:fzf_command_prefix = 'Fzf' +let g:fzf_layout = { 'down': '~20%' } + +nmap <C-f> :FzfFiles<cr> +imap <C-f> <esc>:<C-u>FzfFiles<cr> + +nmap <C-b> :FzfBuffers<cr> +imap <C-b> <esc>:<C-u>FzfBuffers<cr> + +let g:rg_command = ' + \ rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --color "always" + \ -g "*.{js,json,php,md,styl,jade,html,config,py,cpp,c,go,hs,rb,conf}" + \ -g "!{.git,node_modules,vendor}/*" ' + +augroup filetypedetect + autocmd BufNewFile,BufRead .tmux.conf*,tmux.conf* setf tmux + autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 + autocmd BufNewFile,BufRead *.md setlocal noet tabstop=4 shiftwidth=4 + autocmd BufNewFile,BufRead *.sh setlocal expandtab shiftwidth=2 tabstop=2 + autocmd BufNewFile,BufRead *.proto setlocal expandtab shiftwidth=2 tabstop=2 + + autocmd FileType json setlocal expandtab shiftwidth=2 tabstop=2 + autocmd FileType ruby setlocal expandtab shiftwidth=2 tabstop=2 +augroup END + +" Local additions and overrides +let $LOCALVIMRC = expand('~/.vimrc.local') +if filereadable($LOCALVIMRC) | source $LOCALVIMRC | endif |