-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
executable file
·125 lines (104 loc) · 3.32 KB
/
vimrc
File metadata and controls
executable file
·125 lines (104 loc) · 3.32 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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Moving around, tabs, windows and buffers
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Shortcut for moving between splits
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
set splitbelow
set splitright
silent! set winheight=30
silent! set winminheight=5
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Search
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <space> /
nnoremap <enter> :nohl<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Leadermaps
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader = ","
nmap <leader>t :nnoremap <lt>leader>r :w \\| :silent! ! & <lt>cr> \\| :redraw!<lt>cr><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left><left>
nmap <leader>d :redraw!<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Layout Settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
filetype plugin indent on
set number
set relativenumber
" Indents
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
autocmd Filetype html setlocal ts=2 sw=2 sts=2
autocmd Filetype ruby setlocal ts=2 sw=2 sts=2
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Multipurpose tab key
" Indents if at beginning of line, otherwise tab completes
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-n>"
endif
endfunction
inoremap <expr> <tab> InsertTabWrapper()
inoremap <s-tab> <c-n>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Statusline
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set laststatus=2
set statusline=
set statusline+=\ %f
set statusline+=%h%m%r%w
set statusline+=\ [%{strlen(&ft)?&ft:'none'},
set statusline+=\ %{strlen(&fenc)?&fenc:&enc},
set statusline+=\ %{&fileformat}]
set statusline+=\ %F
set statusline+=\ (%l,%c)
set statusline+=%=
set statusline+=%{getcwd()}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Misc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set clipboard=unnamed
set shellcmdflag=-ic
set mouse=a
" Move .swp files
set directory^=$HOME/.vim/tmp//
" Fix common typos
command! WQ wq
command! Wq wq
command! Wqa wqa
command! W w
command! Q q
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Autocommands
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
augroup AutoCommands
au!
" Remove trailing whitespace when saving
autocmd BufWritePre * :%s/\s\+$//e
autocmd bufreadpost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Plugins
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set rtp +=~/.vim/bundle/Vundle.vim/
call vundle#rc()
Plugin 'gmarik/Vundle.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'tmhedberg/matchit'
Plugin 'terryma/vim-multiple-cursors'
" HTML
Plugin 'rstacruz/sparkup'