-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
101 lines (77 loc) · 2.09 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
syntax on
set nocompatible
set ruler
set backspace=indent,eol,start
set backup
set backupdir=~/.vimbak
set directory=~/.vimbak
set history=500
set showcmd " display incomplete commands
set incsearch " jump to search results while typing
set title " set the title to something sensible
set hlsearch " highlight all search results
set number " show line numbers
set scrolloff=3 " keep 3 lines of context around the cursor
set laststatus=2 " always show the last status line
set ignorecase smartcase " ignore case unless upper chars in search pattern
set expandtab
set tabstop=8
set shiftwidth=2
set textwidth=80
set showmode
let g:no_rust_conceal = 1
set viminfo='10,\"100,:20,%,n~/.viminfo
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END
set foldmethod=marker
set wildmode=longest,list,full
set wildmenu
filetype plugin indent on
inoremap jk <Esc>
map Q gqip
" C-U in insert mode deletes a lot. Use C-G u to first break undo, so that you
" can undo C-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
nnoremap <silent><F3> :set number!<CR>
noremap <silent><F10> :set spell!<CR>
noremap <silent><F9> :set paste!<CR>
" Move around splits with <c-hjkl>
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
nmap <c-n> :bnext<CR>
nmap <c-p> :bprev<CR>
" Can't be bothered to understand ESC vs <c-c> in insert mode
imap <c-c> <esc>
" Clear the search buffer when hitting return
function! MapCR()
nnoremap <cr> :nohlsearch<cr>
endfunction
call MapCR()
" Force 256 colors
set t_Co=256
colorscheme molokai
" Disable arrow keys
map <Left> <Nop>
map <Right> <Nop>
map <Up> <Nop>
map <Down> <Nop>
map <ESC>Od <Nop>
map <ESC>Oc <Nop>
map <ESC>Oa <Nop>
map <ESC>Ob <Nop>
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()