-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
222 lines (182 loc) · 9.23 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
" Modeline and Notes {
" Heavily inspired by spf13-vim.
" }
" Environment {
" Identify platform {
silent function! OSX()
return has('macunix')
endfunction
silent function! LINUX()
return has('unix') && !has('macunix') && !has('win32unix')
endfunction
silent function! WINDOWS()
return (has('win32') || has('win64'))
endfunction
" }
" Basics {
set nocompatible " Must be first line
if !WINDOWS()
set shell=/bin/sh
endif
" }
" Windows Compatible {
" On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization
" across (heterogeneous) systems easier.
if WINDOWS()
set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
endif
" }
" Arrow Key Fix {
" https://github.com/spf13/spf13-vim/issues/780
if &term[:4] == "xterm" || &term[:5] == 'screen' || &term[:3] == 'rxvt'
inoremap <silent> <C-[>OC <RIGHT>
endif
" }
" }
" General {
execute pathogen#infect()
set background=dark " Assume a dark background
filetype plugin indent on " Automatically detect file types.
syntax on " Syntax highlighting
set mouse=a " Automatically enable mouse usage
set mousehide " Hide the mouse cursor while typing
set fileformat=unix " Determine line ending characters in unix format
set encoding=utf-8
"scriptencoding utf-8
if has('clipboard')
if has('unnamedplus') " When possible use + register for copy-paste
set clipboard=unnamed,unnamedplus
else " On mac and Windows, use * register for copy-paste
set clipboard=unnamed
endif
endif
"set autowrite " Automatically write a file when leaving a modified buffer
"set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
"set viewoptions=folds,options,cursor,unix,slash " Better Unix / Windows compatibility
"set virtualedit=onemore " Allow for cursor beyond last character
"set history=1000 " Store a ton of history (default is 20)
"set spell " Spell checking on
"set hidden " Allow buffer switching without saving
"set iskeyword-=. " '.' is an end of word designator
"set iskeyword-=# " '#' is an end of word designator
"set iskeyword-=- " '-' is an end of word designator
set visualbell " vim will flash screen instead of sounding a beep
au BufRead,BufNewFile Vagrantfile set filetype=ruby " set vagrant syntax highlight like ruby
" }
" Vim UI {
color solarized " Load a colorscheme
set tabpagemax=15 " Only show 15 tabs
set showmode " Display the current mode
set cursorline " Highlight current line
highlight clear SignColumn " SignColumn should match background
highlight clear LineNr " Current line number row will have same background color in relative mode
"highlight clear CursorLineNr " Remove highlight color from current line number
if has('cmdline_info')
set ruler " Show the ruler
"set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids
"set showcmd " Show partial commands in status line and
" Selected characters/lines in visual mode
endif
if has('statusline')
set laststatus=2
" Broken down into easily includeable segments
"set statusline=%<%f\ " Filename
"set statusline+=%w%h%m%r " Options
"if !exists('g:override_spf13_bundles')
" set statusline+=%{fugitive#statusline()} " Git Hotness
"endif
"set statusline+=\ [%{&ff}/%Y] " Filetype
"set statusline+=\ [%{getcwd()}] " Current dir
"set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
endif
set backspace=indent,eol,start " Backspace for dummies
set linespace=0 " No extra spaces between rows
set number " Line numbers on
set showmatch " Show matching brackets/parenthesis
set incsearch " Find as you type search
set hlsearch " Highlight search terms
"set winminheight=0 " Windows can be 0 line high
set ignorecase " Case insensitive search
set smartcase " Case sensitive when uc present
set wildmenu " Show list instead of just completing in command-line on pressing wildchar
"set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
"set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too
"set scrolljump=5 " Lines to scroll when cursor leaves screen
"set scrolloff=3 " Minimum lines to keep above and below cursor
set nofoldenable " Disable fold code
"set list
"set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace
" }
" Formatting {
set nowrap " Do not wrap long lines
set autoindent " Indent at the same level of the previous line
set smartindent " Add one extra level of indentation in some cases
set shiftwidth=4 " Number of spaces in reindent operations
set expandtab " Tabs are spaces, not tabs
set tabstop=4 " Number of visual spaces per tab
set softtabstop=4 " Number of spaces per tab in insert mode
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
"set matchpairs+=<:> " Match, to be used with %
"set pastetoggle=<F12> " pastetoggle (sane indentation on pastes)
"set comments=sl:/*,mb:*,elx:*/ " auto format comment blocks
" Remove trailing whitespaces and ^M chars
" To disable the stripping of whitespace, add the following to your
" .vimrc.before.local file:
" let g:spf13_keep_trailing_whitespace = 1
"autocmd FileType c,cpp,java,go,php,javascript,puppet,python,rust,twig,xml,yml,perl,sql autocmd BufWritePre <buffer> if !exists('g:spf13_keep_trailing_whitespace') | call StripTrailingWhitespace() | endif
"autocmd FileType go autocmd BufWritePre <buffer> Fmt
"autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
"autocmd FileType haskell,puppet,ruby,yml setlocal expandtab shiftwidth=2 softtabstop=2
" preceding line best in a plugin but here for now.
"autocmd BufNewFile,BufRead *.coffee set filetype=coffee
" Workaround vim-commentary for Haskell
"autocmd FileType haskell setlocal commentstring=--\ %s
" Workaround broken colour highlighting in Haskell
"autocmd FileType haskell,rust setlocal nospell
" }
" Key (re)Mappings {
" remap window switch keyboard shortcuts
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" }
" Plugins {
" NerdTree {
" close vim when NERDTree is the last window
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" use ctrl+n to toggle NERDTree
map <C-n> :NERDTreeToggle<CR>
let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
"let NERDTreeChDirMode=0
"let NERDTreeQuitOnOpen=1
"let NERDTreeMouseMode=2
let NERDTreeShowHidden=1
"let NERDTreeKeepTreeInNewTab=1
"let g:nerdtree_tabs_open_on_gui_startup=0
" }
" }
" GUI Settings {
" GVIM- (here instead of .gvimrc)
if has('gui_running')
set guioptions-=T " remove the toolbar
set guioptions-=m " remove GUI menu
set guioptions=-L " remove left scrollbar
set guioptions=-r " remove right scrollbar
set lines=40 " 40 lines of text instead of 24
if LINUX() && has("gui_running")
set guifont=Andale\ Mono\ Regular\ 12,Menlo\ Regular\ 11,Consolas\ Regular\ 12,Courier\ New\ Regular\ 14
elseif OSX() && has("gui_running")
set guifont=Andale\ Mono\ Regular:h12,Menlo\ Regular:h11,Consolas\ Regular:h12,Courier\ New\ Regular:h14
elseif WINDOWS() && has("gui_running")
set guifont=Andale_Mono:h11,Menlo:h11,Consolas:h11,Courier_New:h11
endif
else
if &term == 'xterm' || &term == 'screen'
set t_Co=256 " Enable 256 colors to stop the CSApprox warning and make xterm vim shine
endif
"set term=builtin_ansi " Make arrow and other keys work
endif
" }