-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
116 lines (82 loc) · 3.66 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
" Reload ~/.vimrc after write
autocmd!
autocmd BufWritePost ~/.vimrc so ~/.vimrc
" GENERAL
" --------------------------------------------------------------------------
let mapleader = "," " Use , as leader
set hidden " Hide abandoned buffer (no unload)
" COMMAND LINE
" --------------------------------------------------------------------------
set wildmenu " Enhanced command-line completion
set wildmode=list:longest " - List all matches
set wildignore+=.git,node_modules " - Ignore folders in completion
" Browse command history with <c-j/k>
cmap <c-j> <down>
cmap <c-k> <up>
" UI
" --------------------------------------------------------------------------
set number " Show line numbers
set numberwidth=4 " Use 4 character wide line numbers
set ruler " Show ruler
set t_Co=256 " Use 256 colors
set background=dark " Background color
set showmatch " Show matching bracket
set linebreak " Use word-wrapping
syntax on " Enable syntax highlighting
" NAVIGATION
" --------------------------------------------------------------------------
set smartcase " Match all for lowercase pattern
set incsearch " Incremental search while typing
set scrolloff=10 " Lines above/below cursor
" Move up/down into wrapped lines
nnoremap j gj
nnoremap k gk
" Goto tab using <leader>1..9
for i in [1,2,3,4,5,6,7,8,9]
exec "map <leader>" . i . " :normal " . i . "gt<cr>"
endfor
" EDITING
" --------------------------------------------------------------------------
set autoindent " Copy indent when starting new line
set smartindent " Add indent, i.e. on line after {
set encoding=utf-8 " Use utf-8 encoding
set softtabstop=2 " Make a tab correspond to 2 spaces
set shiftwidth=2 " Make indents 2 spaces
set shiftround " Round indents to multiple of shiftwidth
set expandtab " Insert spaces instead of tabs
" Move line(s) up/down
nnoremap <c-k> mz:m-2<cr>`z
nnoremap <c-j> mz:m+<cr>`z
vnoremap <c-k> :m'<-2<cr>`>my`<mzgv`yo`z
vnoremap <c-j> :m'>+<cr>`<my`>mzgv`yo`z
" Don't exit visual mode when shifting
vnoremap < <gv2h
vnoremap > >gv2l
" Remove trailing spaces before save
autocmd BufWritePre * :%s/\s\+$//e
" Toggle paste mode
noremap <f4> :setlocal paste!<cr>
" Write buffer using <leader>w
nnoremap <leader>w :w<cr>
vnoremap <leader>w <esc>:w<cr>
inoremap <leader>w <esc>:w<cr>
" Replace word under cursor
nnoremap <leader>r :%s/\<<c-r><c-w>\>/
" VUNDLE CONFIGURATION
" --------------------------------------------------------------------------
filetype off " Disable filetype detection
set runtimepath+=~/.vim/bundle/vundle/ " Add Vundle path to run time path
call vundle#rc() " Load Vundle
" Configure Vundle itself
Bundle 'gmarik/vundle'
" Configure other bundles
Bundle 'kien/ctrlp.vim'
Bundle 'guns/vim-clojure-static'
Bundle 'xptemplate'
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/syntastic'
filetype plugin indent on " Re-enable filetype detection
" BUNDLES CONFIGURATION
" --------------------------------------------------------------------------
let g:ctrlp_working_path_mode = 0 " Dont't manage working directory
let g:xptemplate_key = '<Tab>' " Use tab to expand templates