set nocompatible set number relativenumber autoindent set ignorecase smartcase incsearch set hidden nowrap nobackup noswapfile autoread set wildmenu wildmode=longest,list,full laststatus=2 set encoding=utf8 spelllang=en_us set backspace=2 scrolloff=4 set shiftwidth=4 tabstop=4 set path+=** gp=grep\ -irn filetype plugin indent on syntax enable nnoremap :bnext nnoremap :bprevious nnoremap :buffers:buffer nnoremap :copen " Personal tabs/spaces settings. autocmd Filetype make,go,sh setlocal noexpandtab tabstop=4 shiftwidth=4 autocmd Filetype c,cpp,lua,zig setlocal expandtab tabstop=4 shiftwidth=4 autocmd Filetype nix,html,javascript,css setlocal expandtab tabstop=2 shiftwidth=2 " Commenting blocks of code. " https://stackoverflow.com/a/1676672 augroup CodeCommenting autocmd! autocmd FileType c,cpp,go,zig let b:comment_leader = '// ' autocmd FileType sh,ruby,python let b:comment_leader = '# ' autocmd FileType conf,fstab let b:comment_leader = '# ' autocmd FileType lua,sql let b:comment_leader = '-- ' autocmd FileType vim let b:comment_leader = '" ' augroup END noremap cc :silent s/^/=escape(b:comment_leader,'\/')/:nohlsearch noremap cu :silent s/^\(\s*\)\V=escape(b:comment_leader,'\/')//e:nohlsearch " External auto-format programs. autocmd FileType c,cpp setlocal formatprg=clang-format autocmd FileType go setlocal formatprg=gofmt " FZF integration. function! FZF() let t=tempname() silent execute '!fzf --preview=''cat {}'' --multi|awk ''{print $1":1:0"}'' > '.fnameescape(t) execute 'cfile '.t|redraw! call delete(t) endfunction nnoremap :call FZF()