-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
192 lines (147 loc) · 3.52 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
" enable compatibility with Vim features
set nocompatible
" load plugins, set indent and syntax highlighting based on detected file type
filetype plugin indent on
syntax on
" indentation settings
set autoindent
set expandtab
set softtabstop=4
set shiftwidth=4
set shiftround
" backspace settings
set backspace=indent,eol,start
" buffer settings
set hidden
set laststatus=2
set display=lastline
" show settings
set showmode
set showcmd
" search settings
set incsearch
set hlsearch
" redraw settings
set ttyfast
set lazyredraw
" window settings
set splitbelow
set splitright
" cursor and search settings
set cursorline
set wrapscan
" editing settings
set report=0
set synmaxcol=200
" show non-printable characters
set nolist
set listchars=tab:»-,trail:-,extends:»,precedes:«,nbsp:%,eol:ƶ
" encoding settings
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8
set bomb
set binary
" file format settings
set fileformats=unix,dos,mac
" ruler and line number settings
set ruler
set number
" scrolling settings
set scrolloff=3
" modeline settings
set modeline
set modelines=10
" title settings
set title
set titleold="Terminal"
set titlestring=%F
" status line settings
set laststatus=2
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)
" auto read setting
set autoread
" visual settings
set noerrorbells
set visualbell
set t_vb=
" clipboard settings
set clipboard+=unnamed,autoselect
" mouse settings
set mouse=a
" whichwrap settings
set whichwrap=b,s,h,l,<,>,[,]
" display double-width symbols properly
set ambiwidth=double
" highlight settings
highlight Pmenu ctermbg=233 ctermfg=241
highlight PmenuSel ctermbg=233 ctermfg=166
highlight Search ctermbg=166 ctermfg=233
highlight Visual ctermbg=166 ctermfg=233
" vimdiff color settings
highlight DiffAdd cterm=bold ctermfg=10 ctermbg=22
highlight DiffDelete cterm=bold ctermfg=10 ctermbg=52
highlight DiffChange cterm=bold ctermfg=10 ctermbg=17
highlight DiffText cterm=bold ctermfg=10 ctermbg=21
" Set mapleader to Space
let mapleader="\<Space>"
" Save file
nnoremap <Leader>w :w<CR>
" Quit without saving
nnoremap <Leader>qqq :q!<CR>
" Edit file
nnoremap <Leader>eee :e<CR>
" Save and quit
nnoremap <Leader>wq :wq<CR>
" Clear search highlighting
nnoremap <Leader>nn :noh<CR>
" Split window
nnoremap <Leader>s :<C-u>split<CR>
" Split window vertically
nnoremap <Leader>v :<C-u>vsplit<CR>
" Navigate tabs
nnoremap <Tab> gt
nnoremap <S-Tab> gT
nnoremap <Leader>t :tabnew<CR>
" Move cursor without wrapping
nnoremap j gj
nnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
nnoremap gj j
nnoremap gk k
" Yank to end of line
nnoremap Y y$
" No yank on delete key
nnoremap x "_x
nnoremap d "_d
nnoremap D "_D
xnoremap d "_d
xnoremap p "_dP
" Increment number under cursor
nnoremap + <C-a>
" Decrement number under cursor
nnoremap - <C-x>
" Clear search highlighting
nnoremap <Esc><Esc> :<C-u>nohlsearch<CR>
" Move between windows with Ctrl + hjkl
nnoremap <Leader>h <C-w>h
nnoremap <Leader>j <C-w>j
nnoremap <Leader>k <C-w>k
nnoremap <Leader>l <C-w>l
" Move line/word with Ctrl + ea, fb
nmap <C-e> $
nmap <C-a> 0
nmap <C-f> W
nmap <C-b> B
imap <C-e> <C-o>$
imap <C-a> <C-o>0
imap <C-f> <C-o>W
imap <C-b> <C-o>B
" Toggle between absolute and relative display of line numbers
map <Leader>n :set relativenumber!<CR>
" Search move including another line
command -nargs=1 MyLineSearch let @m=<q-args> | call search('^\s*'. @m)
command -nargs=1 MyLineBackSearch let @m=<q-args> | call search('^\s*'. @m, 'b')
nnoremap <Space>f :MyLineSearch<Space>
nnoremap <Space>F :MyLineBackSearch<Space>