forked from BinaryMuse/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvimrc
128 lines (94 loc) · 2.64 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
call pathogen#infect()
call pathogen#helptags()
if has("autocmd")
autocmd bufwritepost vimrc source $MYVIMRC
endif
" Enable matchit
runtime macros/matchit.vim
set nocompatible
set t_Co=256
" Leader
let mapleader = ","
let g:mapleader = ","
" Misc. file types
au BufRead,BufNewFile *.md set filetype=markdown
nmap <leader>v :tabedit $MYVIMRC<CR>
:command Q q
:command W w
" jj in insert mode to get to normal mode
:imap jj <Esc>
" Set the command height to 2 lines
set cmdheight=2
" Always show the status line
set laststatus=2
" Allow me to switch buffers if my buffer has changes
set hidden
set splitbelow
set splitright
" Search options
:nnoremap <silent> <space> :nohlsearch<Bar>:echo<CR>
" Stealing some guy's status line
" since I don't know the formatting
set stl=%f\ %m\ %r\ Line:%l/%L[%p%%]\ Col:%c\ Buf:%n\ [%b][0x%B]
" Causes the cursor to briefly jump back
" to a brace/paren/etc. match whenever
" you type a closing one.
set showmatch
" Toggle NERDTree
" map <leader>t :NERDTreeToggle<CR>
nmap <silent> <Leader>t :CommandT<CR>
nmap <silent> <Leader>b :CommandTBuffer<CR>
" Git status
map <leader>g !git status<CR>
" Colors and Syntax {{{1
" -----------------------------------------------------------------
" Turn syntax hightlighting on
syntax on
colors solarized
" Display an incomplete cmmand in the lower right
set showcmd
" Scrolling margin and number of lines when leaving screen
set scrolloff=4
set scrolljump=5
" Highlight the cursor line
set cursorline
" Line numbers, fool!
set number
" Toggle line numbers with leader-n
map <silent> <leader>n :set number!<CR>
" Make :w!! save the file as sudo
" (in case you forget)
cmap w!! %w !sudo tee % > /dev/null
" Don't split words if a linebreak is required
set linebreak
" Tabs and spaces {{{1
" -----------------------------------------------------------------
set softtabstop=2
set shiftwidth=2
set shiftround
set expandtab
" Auto indent?
" set smartindent
" set autoindent
if has("autocmd")
filetype plugin indent on
endif
" set cindent
" Call strip trailing whitespaces as a command
command! StripTrailingWhitespace call s:StripTrailingWhitespace()
function! s:StripTrailingWhitespace()
" Save last search and cursor position
let _s=@/
let l = line(".")
let c = col(".")
" Do it!
%s/\s\+$//e
" Clean up by restoring the saved search and cursor
let @/=_s
call cursor(l, c)
endfunction
map <leader>w :StripTrailingWhitespace<CR>
autocmd BufWritePre * :StripTrailingWhitespace
au BufRead,BufNewFile *.ino set filetype=cpp
" Vagrantfile
autocmd BufRead,BufNewFile Vagrantfile set filetype=ruby