-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
179 lines (139 loc) · 5.34 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
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
" My Vimrc file
" Maintainer: Donovan Muelle <[email protected]>
" Reference: Initially based on http://dev.gentoo.org/~ciaranm/docs/vim-guide/
" with great help from http://nvie.com/posts/how-i-boosted-my-vim/
" and http://stevelosh.com/blog/2010/09/coming-home-to-vim/
" License: www.opensource.org/licenses/bsd-license.php
" Disable Vi compatibility mode
set nocompatible
" Helps keep plugins organzied.
" Each plugin has its own directory in
" ~/.vim/bundles
filetype off " Force reloading plugins _after_ pathogen loads
call pathogen#helptags() " Add plugin docs as well
call pathogen#runtime_append_all_bundles()
filetype plugin indent on " enable detection, plugins & indenting in one step
" Disable possibly security exploit
" modelines are basically comments in files that
" help configure Vi(m). I don't use them.
set modelines=0
" change the mapleader from \ to ,
"let mapleader=","
" Hide buffers, don't close them
" This avoids always having to undo or
" save changes on buffer switch
set hidden
" Quickly edit/reload the vimrc file
nmap <leader>ev :e $MYVIMRC<CR>
nmap <leader>sv :so $MYVIMRC<CR>
" Misc.
inoremap jj <Esc>
" Convenient way to get out of insert mode.
nnoremap ; :
" make writing commands a bit faster
set scrolloff=5 " Minimal number of screen lines to keep above and below the cursor.
set encoding=utf-8 " Use UTF8 encoding
set wildmenu " enable (WILD!!!) file tab completion
set wildignore=*.swp,*.bak,*.pyc,*.class,*.DS_Store
" files tab completion should ignore
set title " change the terminal's title
set visualbell " don't beep
set noerrorbells " don't beep
if has("gui_macvim")
let macvim_hig_shift_movement = 1
" Enable shift+arrow key selection of text in insert mode
endif
set pastetoggle=<F2>
" Toggle paste mode for large pasting
cmap w!! w !sudo tee % >/dev/null
" Write a file requiring sudo permissions
set showmatch " set show matching parenthesis
" Tabs & indenting
set tabstop=3 " A tab is X spaces
set expandtab " Expand tabs into spaces
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set shiftwidth=3 " Number of spaces for auto-indenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set smarttab " insert tabs on the start of a line according to
" shiftwidth, not tabstop
"set smartindent " Automatically indent when adding a curly bracket, etc.
" line wrapping
"set nowrap " don't wrap lines
set linebreak " soft wrap long lines
let &showbreak='# ' " marker to show wrapped lines
set backspace=indent,eol,start
" allow backspacing over everything in insert mode
set colorcolumn=80 " add a colored column
" --- SEARCH ---
" These fix Vim's weird default regex when searching
" regex should now behave more like Perl/Python
"nnoremap / /\v
"vnoremap / /\v
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set hlsearch " highlight search terms
set incsearch " show search matches as you type
nmap <silent> ,/ :nohlsearch<CR>
" Clear highlights from search
" History & Undo
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set nobackup
set noswapfile
" Splits
map <C-h> <C-w>h " Single step split navigation
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" --- FOR THE EYES ---
if has("gui_running")
colorscheme mayansmoke " liquidcarbon is a nice, dark theme
elseif &t_Co >= 256
colorscheme mayansmoke
endif
if &t_Co > 2 || has("gui_running")
" turn on syntax highlighting when colors are available.
syntax on
endif
set cursorline " highlight current line
set relativenumber " adds relative-to-current line numbering
" Status line
set laststatus=2
set statusline=
set statusline+=%-3.3n\ " buffer number
set statusline+=%f\ " filename
set statusline+=%h%m%r%w " status flags
set statusline+=\[%{strlen(&ft)?&ft:'none'}] " file type
set statusline+=%= " right align remainder
set statusline+=0x%-8B " character value
set statusline+=%-14(%l,%c%V%) " line, character
set statusline+=%<%P " file position
" Editing
nmap <D-M-l> ^v$h
" select line contents
" Display incomplete commands.
set showcmd
" To insert timestamp, press F3.
nmap <F3> a<C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR><Esc>
imap <F3> <C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR>
" To save, press ctrl-s.
nmap <c-s> :w<CR>
imap <c-s> <Esc>:w<CR>a
" Show editing mode
set showmode
" --- Filetype settings ---
if has('autocmd')
au BufRead,BufNewFile *.less set ft=less syntax=less
endif
" --- PLUGINS ---
" CommandT Plugin Settings
let g:CommandTMatchWindowAtTop=1 " Best match sticks to the top of window
nmap <leader>t :CommandT<CR>
" Invoke CommandT
nnoremap <leader>T :CommandTFlush<CR>
" Rescans the current directory structure
let g:CommandTCancelMap='<C-x>'
" Sparkup
let g:sparkupExecuteMapping='<C-e>'