Repository navigation
Expand file tree
/
Copy pathvimrc
More file actions
265 lines (203 loc) · 6.6 KB
/
Copy pathvimrc
File metadata and controls
265 lines (203 loc) · 6.6 KB
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
" .vimrc File
" Maintained by: Chamnan Nop
" Email: chamnan.nop@gmail.com
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My bundles here:
"
" original repos on GitHub
Bundle 'vim-ruby/vim-ruby'
Bundle 'tpope/vim-rails'
Bundle 'tpope/vim-rake'
Bundle 'tpope/vim-bundler'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-endwise'
Bundle 'tpope/vim-cucumber'
Bundle 'tpope/vim-haml'
Bundle 'pangloss/vim-javascript'
Bundle 'kchmck/vim-coffee-script'
Bundle 'othree/html5.vim'
Bundle 'kien/ctrlp.vim'
Bundle 'scrooloose/syntastic'
Bundle 'scrooloose/nerdtree'
Bundle 'bling/vim-airline'
Bundle 'vim-scripts/tComment'
Bundle 'edkolev/tmuxline.vim'
Bundle 'vim-scripts/php.vim-html-enhanced'
" ...
" Set filetype detection on, load plugins and indent.
filetype plugin indent on
filetype plugin on
" A couple options to make vim-airline work correctly.
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" Tabs, Spaces and Indentation.
set expandtab " Use spaces for tabs.
set tabstop=2 " Number of spaces to use for tabs.
set shiftwidth=2 " Number of spaces to autoindent.
set softtabstop=2 " Number of spaces for a tab.
set autoindent " Set autoindenting on.
set smartindent
set encoding=utf-8
set t_Co=256
set background=dark
syntax enable
" Fixed vim scrolls very slow
set ttyfast
set ttyscroll=3
set lazyredraw " to avoid scrolling problems
" Forget compatibility with Vi. Who cares.
set nocompatible
" Enable filetypes
filetype on
filetype plugin on
filetype indent on
syntax on
" Backup.
set nobackup
set nowritebackup
set noswapfile
" Write the old file out when switching between files.
set autowrite
" Display current cursor position in lower right corner.
set ruler
" Want a different map leader than \
let mapleader = ","
" Ever notice a slight lag after typing the leader key + command? This lowers
" the timeout.
set timeoutlen=500
" Switch between buffers without saving
set hidden
" Set the color scheme. Change this to your preference.
" Here's 100 to choose from: http://www.vim.org/scripts/script.php?script_id=625
colorscheme hybrid
" Set font type and size. Depends on the resolution. Larger screens, prefer h15
" set guifont=Ubuntu:h15
" Show command in bottom right portion of the screen
set showcmd
" Show lines numbers
set number
" Always show the status line
set laststatus=2
" Prefer a slightly higher line height
set linespace=3
" Better line wrapping
set wrap
set textwidth=79
set formatoptions=qrn1
" Set incremental searching"
set incsearch
" Highlight searching
set hlsearch
" case insensitive search
set ignorecase
set smartcase
" Hard-wrap paragraphs of text
nnoremap <leader>q gqip
" Enable code folding
set foldenable
" Hide mouse when typing
set mousehide
" Shortcut to fold tags with leader (usually \) + ft
nnoremap <leader>ft Vatzf
" Create dictionary for custom expansions
set dictionary+=/Users/Home/.vim/dict.txt
" Opens a vertical split and switches over (\v)
nnoremap <leader>v <C-w>v<C-w>l
" Split windows below the current window.
set splitbelow
" Session settings
set sessionoptions=resize,winpos,winsize,buffers,tabpages,folds,curdir,help
" Set up an HTML5 template for all new .html files
" autocmd BufNewFile * silent! 0r $VIMHOME/templates/%:e.tpl
" Shortcut for editing vimrc file in a new tab
nmap ev :tabedit $MYVIMRC<cr>
" Change zen coding plugin expansion key to shift + e
let g:user_zen_expandabbr_key = '<C-e>'
" Faster shortcut for commenting. Requires T-Comment plugin
" From https://github.com/tomtom/tcomment_vim
map c <c-_><c-_>
" Saves time; maps the spacebar to colon
nmap <space> :
" omni completion
inoremap <expr> <C-Space> pumvisible() \|\| &omnifunc == '' ?
\ "\<lt>C-n>" :
\ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
\ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
\ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
imap <C-@> <C-Space>
" Map escape key to jj -- much faster
imap jj <esc>
" Delete all buffers (via Derek Wyatt)
nmap <silent> da :exec "1," . bufnr('$') . "bd"<cr>
" Bubble single lines (kicks butt)
"http://vimcasts.org/episodes/bubbling-text/
nmap <C-Up> ddkP
nmap <C-Down> ddp
" Bubble multiple lines
vmap <C-Up> xkP`[V`]
vmap <C-Down> xp`[V`]
" Source the vimrc file after saving it. This way, you don't have to reload
" Vim to see the changes.
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
endif
"
" easier window navigation
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
"------------------------"
"NERDTREE PLUGIN SETTINGS
"------------------------"
"Shortcut for NERDTreeToggle
nmap <silent>nt :NERDTreeToggle<CR>
" Show hidden files in NerdTree
let NERDTreeShowHidden=1
" autopen NERDTree and focus cursor in new document
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
" Helpeful abbreviations
iab lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
iab llorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
" Spelling corrects. Just for example. Add yours below.
iab teh the
iab Teh The
"--------------------------"
" PERSONAL SETTINGS
" -------------------------"
" Switching Tab
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Right> :tabnext<CR>
" On/Off Paste mode
set pastetoggle=<F2>
"Clear search Highlight
nnoremap <silent><Leader><space> :noh<CR>
"# ctrlp.vim
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " for Linux/MacOSX
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
" On ubuntu (running Vim in gnome-terminal)
" " The reason for the double-command on <C-c> is due to some weirdness with
"the X clipboard system.
vmap <C-c> y:call system("xclip -i -selection clipboard", getreg("\""))<CR>:call system("xclip -i", getreg("\""))<CR>
nmap <C-v> :call setreg("\"",system("xclip -o -selection clipboard"))<CR>p
map <C-a> GVgg
map <C-x> d
map <C-z> u
" Vim completion popup menu enhancement
set completeopt=menuone
if has("autocmd")
autocmd FileType ruby,eruby,haml set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby,haml let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby,haml let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby,haml let g:rubycomplete_classes_in_global = 1
autocmd FileType ruby,eruby,haml let g:rubycomplete_include_object = 1
autocmd FileType ruby,eruby,haml let g:rubycomplete_include_objectspace = 1
endif