blob: 869188a17e8e9ae07246a93aee7f2c40b50ae0c9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
colorscheme gruvbox
set background=dark
let mapleader=" "
set visualbell
set laststatus=2
set ruler
set title
" 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!
" write directory
" nnoremap <leader>d :!mkdir -p %:h<CR>
" 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
|