-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxvimrc
130 lines (101 loc) · 3.41 KB
/
xvimrc
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
" .xvimrc file
" Maintainer: Max Wang <[email protected]>
" URL: https://github.com/mxw/dotfiles
" vim >> vi.
set nocompatible
""""""""""""""""""""""""""""""""""""""""""
" General
""""""""""""""""""""""""""""""""""""""""""
" Display.
set nonumber " hide line numbers
set showcmd " show normal mode commands as they are entered
set showmode " show editing mode in status line
set showmatch " flash matching delimiters
set nolist " no metacharacters
set listchars=tab:>- " but show tabs if we turn it on
" Search.
set nohlsearch " don't persist search highlighting
set incsearch " search with a typeahead
set magic " use (some) regexp special characters
set ignorecase " ignore case...
set smartcase " ...iff all characters are lower case
set infercase " case-sensitive completion
" Scrolling.
set wrap " wrap overlong lines
set scrolloff=0 " don't scroll unless necessary
set scrolljump=1 " scroll one line at a time
" Turn things off.
set nofoldenable " no folding
set mouse= " no mouse
set noerrorbells " no error bells
set vb t_vb= " no visual bells
" Backspace over everything.
set backspace=indent,eol,start
" Get rid of security holes.
set nomodeline
set modelines=0
" Tab and indent.
set autoindent " carry indent over to new lines
set shiftwidth=2 " two spaces per indent
set tabstop=2 " number of spaces per tab when viewing
set softtabstop=2 " number of spaces per tab when inserting
set expandtab " sub spaces for tabs
set smarttab " make tab key obey indent rules specified above
set formatoptions+=ro " autoindent on `o` and <CR>
" History and undo caches.
set history=50 " not too much history
set undolevels=1000 " lots of undo!
""""""""""""""""""""""""""""""""""""""""""
" Buffers and windows
""""""""""""""""""""""""""""""""""""""""""
" Settings.
set hidden " keep hidden buffers around
set autoread " automatically re-read modified files
set splitright " hsplit to the right
set splitbelow " vsplit to the left
set laststatus=2 " always show a status line
" Window navigation.
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-h> <C-w>h
noremap <C-l> <C-w>l
" Buffer navigation.
nnoremap <C-n> :bnext<CR>
nnoremap <C-p> :bprev<CR>
""""""""""""""""""""""""""""""""""""""""""
" Maps
""""""""""""""""""""""""""""""""""""""""""
" Switch modes more easily.
nnoremap ; :
inoremap jj <Esc>
inoremap kjk <Esc>
" Make Y behave more like other operators.
nnoremap Y y$
" Make Q formatting; replace Ex mode with ,q.
noremap Q gq
nnoremap ,q Q
" Replace <C-a> to accommodate screen escape character.
inoremap <C-z> <C-a>
nnoremap ,a <C-a>
nnoremap ,x <C-x>
" Jump to matching delimiters more easily.
nnoremap ,<Tab> %
vnoremap ,<Tab> %
" Other useful leader maps.
nnoremap ,m :make<CR>
nnoremap ,r :run<CR>
nnoremap ,l <C-l>
nnoremap ,v <C-w>v
" Toggle spellchecking and paste.
nnoremap ,s :setl spell!<CR>:setl spell?<CR>
nnoremap ,p :setl paste!<CR>:setl paste?<CR>
nnoremap ,t :setl list!<CR>:setl list?<CR>
" Remove trailing whitespace.
nnoremap <silent> ,w :%s/\s\+$//<CR>:let @/=''<CR>''
" Make <C-Right> and <C-Left> behave as in emacs.
noremap <ESC>[1;5C <C-Right>
noremap <ESC>[1;5D <C-Left>
noremap! <ESC>[1;5C <C-Right>
noremap! <ESC>[1;5D <C-Left>
" Fewer fat fingers.
noremap ZZ <C-z>