-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
144 lines (106 loc) · 2.78 KB
/
.vimrc
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
" ~/.vimrc
" Section: Important
set nocompatible
set pastetoggle=<F2>
filetype plugin indent on
" Section: Moving around, searching and patterns
set path+=**
set regexpengine=0
set incsearch
set ignorecase
set smartcase
" Section: Displaying text
set breakindent
set breakindentopt=shift:4,min:40,sbr
set showbreak=>>
set scrolloff=1
set sidescrolloff=1
set cmdheight=1
set lazyredraw
set number
" Section: Syntax, highlighting and spelling
" Make trailing whitespace obvious (set before `syntax on`)
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=1 guibg=darkred
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
syntax on
colorscheme monokai
set background=dark
set colorcolumn=81
" Section: GUI
" Redistribute panes on window resize
autocmd VimResized * :wincmd =
" No scrollbars
set guioptions-=l guioptions-=L guioptions-=r guioptions-=R
" Section: Messages and info
set showcmd
set confirm
" Section: Editing text
set undofile
let &undodir = $XDG_STATE_HOME . '/vim_undo'
if !isdirectory(&undodir)
call mkdir(&undodir, 'p')
endif
set infercase
set showmatch
set backspace=0
" Section: Tabs and indenting
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
set smarttab
set shiftround
" Section: Folding
set foldmethod=marker
" Section: Mapping
let mapleader=','
set timeoutlen=1200
set ttimeoutlen=50
" Always move by displayed (wrapped) lines
noremap j gj
noremap k gk
" Center line vertically when repeating a search
nnoremap n nzz
nnoremap N Nzz
" Manage vimrc
nnoremap <leader>ve :tabe $MYVIMRC<CR>
nnoremap <leader>vr :source $MYVIMRC<CR>
" Trim trailing whitespace
nnoremap <leader>tw :%s/\s\+$<CR>
" Quick window splits
nnoremap <silent> <leader>\| :Vexplore<CR>
nnoremap <silent> <leader>_ :Hexplore<CR>
" Disable backspace in normal, visual, select, & operator-pending modes
noremap <backspace> <nop>
" Disable arrow keys in normal, visual, select, & operator-pending modes
noremap <up> <nop>
noremap <down> <nop>
noremap <left> <nop>
noremap <right> <nop>
" Disable arrow keys in insert mode
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
" Section: Reading and writing files
set backupcopy=yes
set backupdir=$TMPDIR
set autowrite
set autoread
" Section: The swap file
set directory=$TMPDIR
" Section: Command line editing
set history=200
set wildmode=full
set wildignore+=*.o,*~,*.pyc,*/.DS_Store
set wildignore+=*/Library/*,*/node_modules/*,*/.git/*,*/.hg/*,*/.svn/*
set wildmenu
" Section: Multi-byte characters
set encoding=utf-8
" Section: Filetype settings
autocmd BufRead,BufNewFile *.m set filetype=objc
" Section: Various
let &viminfofile = $XDG_CACHE_HOME . '/viminfo'