forked from adamjreilly/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
151 lines (129 loc) · 5.59 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
" .vimrc
"
" Credits: http://zanshin.net/2011/11/15/using-vim/
" https://gist.github.com/1367558#file_.vimrc
"
" Dependencies: https://github.com/gmarik/vundle
"
"==============================================================================
" Use Vim settings rather than vi settings (must be first)
"------------------------------------------------------------------------------
set nocompatible
"==============================================================================
" Setup Vundle and plugins
" Refresh with :BundleInstall
"------------------------------------------------------------------------------
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
"==============================================================================
" Basic options
"------------------------------------------------------------------------------
set encoding=utf-8
set history=50 " Longer command history for q:
set vb " No audible bell
let mapleader="," " Remapped from \"
set laststatus=2 " Always show status bar for powerline
let g:Powerline_symbols = 'compatible'
let g:signify_vcs_list = [ 'git' ]
set ignorecase " Searches are case insenstive by default
set smartcase " unless search contains Uppercase character
set wildmode=longest,list,full " more natural tab completion
set backspace=indent,eol,start
set wildmenu
set incsearch
set vb t_vb=
set mouse+=a
if &term =~ '^screen'
set ttymouse=xterm2 " tmux knows the extended mouse mode
endif
runtime macros/matchit.vim
set hlsearch
"==============================================================================
" Key Mappings
"------------------------------------------------------------------------------
nmap <leader>v :tabedit $MYVIMRC<CR>
nmap <leader>sl :set list!<CR>
nmap <leader>g :Gstatus<CR>
imap <C-l> <Space>=><Space>
noremap <leader>y "+y
noremap <leader>yy "+Y
noremap <leader>p "+p
map <Leader>ct :!ctags -R .<CR>
map <Leader>h :TagbarToggle<CR>
map <Leader>q :NERDTreeTabsToggle<CR>
" Rspec.vim mappings
map <leader>s :call RunCurrentSpecFile()<CR>
map <leader>n :call RunNearestSpec()<CR>
map <leader>l :call RunLastSpec()<CR>
map <leader>a :call RunAllSpecs()<CR>
"==============================================================================
" Appearance options
"------------------------------------------------------------------------------
syntax on
set number " Turn this off for copy with 'set nonumber'
if exists('+colorcolumn') " Marks the 80th character column
set colorcolumn=120
endif
set listchars=tab:▸\ ,eol:¬
set showbreak=↪
highlight NonText guifg=#4a4a59
highlight SpecialKey guifg=#4a4a59
"==============================================================================
" Tab and indent options
"------------------------------------------------------------------------------
set tabstop=5 " Number of spaces to use for displaying tabs
set shiftwidth=2 " Number of spaces to use for autoindenting
set softtabstop=2 " When <BS>, pretend a tab is removed, even if spaces
set expandtab " Expand tabs to spaces (overloadable by file type later)
set smartindent " Increases indent on the next line for '{' and others
"autocmd Filetype ruby setlocal ts=2 sts=2 sw=2 expandtab
"autocmd Filetype yaml setlocal ts=2 sts=2 sw=2 expandtab
"autocmd Filetype puppet setlocal ts=2 sts=2 sw=2 expandtab
"autocmd Filetype markdown setlocal ts=2 sts=2 sw=2 expandtab
"autocmd Filetype sh setlocal ts=4 noexpandtab
"==============================================================================
" Add "C-p" insert paste mode toggle for pasting indented code into console VIM
"------------------------------------------------------------------------------
nnoremap <C-p> :set invpaste paste?<CR>
set pastetoggle=<C-p>
set showmode
"==============================================================================
" Forced file types
"------------------------------------------------------------------------------
au! BufRead,BufNewFile *.jst.ejs setfiletype html "for Puppet
"==============================================================================
" If none found file types
"------------------------------------------------------------------------------
"if exists("did_load_filetypes")
"finish
"endif
"augroup filetypedetect
""au! BufRead,BufNewFile *.ext setfiletype type
"augroup END
"==============================================================================
" Vim-fugitive settings
"------------------------------------------------------------------------------
if has("autocmd")
autocmd QuickFixCmdPost *grep* cwindow "open quickfix for Ggrep
autocmd QuickFixCmdPost *Glog* cwindow "open quickfix for Glog
endif
"==============================================================================
" Source the vimrc file after saving it; Map leader-v to edit
"------------------------------------------------------------------------------
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
endif
"==============================================================================
" When editing a file, always jump to the last known cursor position
"------------------------------------------------------------------------------
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
"==============================================================================
" Load .vimrc.local if it exists (for easy colorscheme changes, etc.)
"------------------------------------------------------------------------------
if filereadable(glob("~/.vimrc.local"))
source ~/.vimrc.local
endif