-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
177 lines (139 loc) · 3.81 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
"==============================================================================="
" Common settings
"==============================================================================="
" First of all, configure pathogen
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
filetype plugin indent on
" Vi-compatibility clearly makes Vim not optimal
set nocompatible
" Tab setting
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" Make Vim behave better
set encoding=utf-8
set scrolloff=3
set autoindent
set copyindent
set showmode
set showcmd
set hidden
set wildmenu
set wildmode=list:longest
set wildignore=*.swp,*.bak,*.class,*.pyc
set ruler
set backspace=indent,eol,start
set laststatus=2
set number
set listchars=tab:↔\ ,eol:▼,trail:▪
set wrap
" Just please, don't clutter my filesystem
set nobackup
set noswapfile
" Set search setting
set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set hlsearch
" Turn syntax on
if &t_Co > 2 || has("gui_running")
syntax on
endif
" Disable toolbar and menubar for screen real estate
if has("gui_running")
set guioptions-=T
set guioptions-=m
endif
" Disable comment auto completion.
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
"==============================================================================="
" Various keyboard setting
"==============================================================================="
" Set the Leader key
let mapleader=","
" Binding for visualization
nnoremap <Leader>vh :nohlsearch<CR>
nnoremap <Leader>vl :set list!<CR>
" Find couple with Tab
nnoremap <Tab> %
vnoremap <Tab> %
" Enable more natural movement
nnoremap j gj
nnoremap k gk
nnoremap h <C-h>
nnoremap l <Space>
nnoremap <Down> gj
nnoremap <Up> gk
nnoremap <Left> <C-h>
nnoremap <Right> <Space>
" Make inserting lines easier on normal mode
nnoremap <S-CR> O<Esc>
nnoremap <CR> o<Esc>
" Make it easy to type command
nnoremap ; :
vnoremap ; :
" Window management configuration
noremap <A-h> <C-w><
noremap <A-j> <C-W>-
noremap <A-k> <C-W>+
noremap <A-l> <C-w>>
" Buffer movement configuration
noremap <C-Left> :bprevious<CR>
noremap <C-Right> :bnext<CR>
noremap <C-h> :bprevious<CR>
noremap <C-l> :bnext<CR>
" Make indenting easier in visual mode
vnoremap > >gv
vnoremap < <gv
" Get rid of F1
nnoremap <F1> <Esc>
inoremap <F1> <Esc>
vnoremap <F1> <Esc>
"==============================================================================="
" Plugin-specific settings
"==============================================================================="
" NERDTree
noremap <F2> :NERDTreeToggle<CR>
" Tlist
noremap <F4> :TlistToggle<CR>
" Unimpaired
nnoremap <S-Up> [e
nnoremap <S-Down> ]e
vnoremap <S-Up> [egv
vnoremap <S-Down> ]egv
" Ctags
"noremap <F8> :!ctags --recurse --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
" MiniBufExplorer
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
"==============================================================================="
" OS-specific settings
"==============================================================================="
if has("unix")
" Convenient command if I forgot to use sudo
cmap w!! w !sudo tee % > /dev/null
" Ensure display is 256 colors
if $DISPLAY != ''
set t_Co=256
endif
" My font choice for my linux laptop
if has("gui_running")
set guifont=Fira\ Mono\ OT\ 10
endif
elseif has("win32")
" My font choice for my workstation
if has("gui_running")
set guifont=Fira_Mono_OT:h10:cANSI
endif
endif
"==============================================================================="
" The holy mighty Colorscheme
"==============================================================================="
if &t_Co >= 256 || has("gui_running")
colorscheme molokai
endif