diff options
Diffstat (limited to '.vim/vimrc')
-rw-r--r-- | .vim/vimrc | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/.vim/vimrc b/.vim/vimrc new file mode 100644 index 0000000..c42d0c1 --- /dev/null +++ b/.vim/vimrc @@ -0,0 +1,85 @@ +colorscheme desert + +let mapleader=" " +set visualbell +set laststatus=2 +set ruler + +" use 4-wide hard tabs by default +set autoindent +set shiftwidth=4 +set tabstop=4 + +" enable filetype settings +filetype plugin indent on +syntax on +set smartindent + +" line wrapping +set wrap +set breakindent +" scroll by visual lines without breaking <count>(j|k) +" <http://reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/cliuz1o/> +nnoremap <expr> j v:count?'j':'gj' +nnoremap <expr> k v:count?'k':'gk' +vnoremap <expr> j v:count?'j':'gj' +vnoremap <expr> k v:count?'k':'gk' + +" command line tab completion +set wildmenu +set wildignorecase + +" search settings +set ignorecase +set smartcase +set incsearch +set wrapscan +" highlight on search, clear on redraw +set hlsearch +nnoremap <silent> <C-L> :nohl<CR><C-L> +" center screen when going to next or previous match +nnoremap <silent> n nzz +nnoremap <silent> N Nzz + +" adjustments to other builtin commands +set tildeop +set whichwrap=b,s,<,>,[,] + +" setup whitespace display but leave it off +set listchars=eol:$,tab:→\ ,space:· +set nolist + +" open new files in insert mode +autocmd BufNewFile * startinsert + +" easier access to escape +inoremap jj <ESC> + +" window splitting +nnoremap <leader>s :vsplit<CR><C-W>l +nnoremap <leader>h <C-W>h +nnoremap <leader>j <C-W>j +nnoremap <leader>k <C-W>k +nnoremap <leader>l <C-W>l + +" format json with =j <https://coderwall.com/p/faceag/format-json-in-vim> +nnoremap =j :%!python -m json.tool<CR> + +" sudo write with w!! <https://stackoverflow.com/a/48237738> +cnoremap w!! execute 'silent! write !sudo /usr/bin/tee % >/dev/null' <bar> edit! + +" windows settings +if has('win64') || has('win32unix') + " yank to system clipboard + set clipboard=unnamed + + " prefer unix format for new files even on windows machines + set fileformats=unix,dos + + " fix cursor in conemu + if !empty($ConEmuBuild) + let &t_SI="\e[6 q" " insert mode line + let &t_EI="\e[2 q" " normal mode block + let &t_SR="\e[4 q" " replace mode underscore + endif +endif |