forked from markscholtz/markscholtz-Vim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
198 lines (167 loc) · 7.47 KB
/
Copy pathvimrc
File metadata and controls
198 lines (167 loc) · 7.47 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
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
" Modeline and Notes {
" vim: set foldmarker={,} foldlevel=0 foldmethod=marker spell:
"
" I have copied a lot of Steve Francia's .vimrc file which can
" be found here: http://spf13.com/post/ultimate-vim-config
"
" }
" Setup Bundle Support (pathogen plugin) {
" The next two lines ensure that the ~/.vim/bundle/ system works
filetype off
runtime! autoload/pathogen.vim
silent! call pathogen#runtime_append_all_bundles()
silent! call pathogen#helptags()
" }
" Basics {
set nocompatible " must be first line
set background=dark " Assume a dark background
set hidden " Not sure what this does, but apparently it should be a default setting
" }
" General {
filetype plugin indent on " Automatically detect file types.
syntax enable " syntax highlighting
scriptencoding utf-8
set autowrite
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 visualbell
" Setting up the directories {
set backup " backups are nice ...
set backupdir=$HOME/.vim/backup// " but not when they clog .
set directory=$HOME/.vim/swap// " Same for swap files
set viewdir=$HOME/.vim/view// " same but for view files
" Creating directories if they don't exist
silent execute '!mkdir -p $HOME/.vim/backup'
silent execute '!mkdir -p $HOME/.vim/swap'
silent execute '!mkdir -p $HOME/.vim/view'
autocmd BufWinEnter * silent! loadview "make vim load view (state) (folds, cursor, etc)
autocmd BufWinLeave * silent! mkview "make vim save view (state) (folds, cursor, etc)
" }
" }
" Filetype Specifics {
autocmd BufRead *.json set filetype=json
" }
" Vim UI {
set showmode " display the current mode
set cursorline " highlight current line
color zenburn
hi cursorline guibg=#333333 " highlight bg color of current line
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
endif
if has('statusline')
set laststatus=2 " always show statusline
" Use the commented line if fugitive isn't installed
"set statusline=%<%f\ %=\:\b%n%y%m%r%w\ %l,%c%V\ %P " a statusline, also on steroids
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
endif
set backspace=indent,eol,start " backspace for dummys
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 ignorecase " case insensitive search
set smartcase " case sensitive when uc present
set winminheight=0 " windows can be 0 line high
set wildmenu " show list instead of just completing
set wildmode=list:longest,full " comand <Tab> completion, list matches, then longest common part, then all.
set whichwrap=b,s,h,l,<,>,[,] " backspace and cursor keys wrap to
"set scrolljump=5 " lines to scroll when cursor leaves screen
set scrolloff=3 " minimum lines to keep above and below cursor
set foldenable " auto fold code
set gdefault " the /g flag on :s substitutions by default
" }
" Formatting {
set nowrap " turn text wrap off by default
set autoindent " indent at the same level of the previous line
set shiftwidth=2 " use indents of 2 spaces
set tabstop=2 " an indentation every two columns
set expandtab " tabs are expanded to spaces
"set matchpairs+=<:> " match, to be used with %
"set pastetoggle=<F12> " pastetoggle (sane indentation on pastes)
"set comments=sl:/*,mb:*,elx:*/ " auto format comment blocks
" Show all whitespace (from http://stackoverflow.com/questions/1675688/make-vim-show-all-white-spaces-as-a-character)
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:< " This shows spaces as ~ when using the 'set list" command
" }
" Key Mappings {
" Change mapleader key
let mapleader = ","
" Easier moving in tabs and windows
"map <C-J> <C-W>j<C-W>_
"map <C-K> <C-W>k<C-W>_
"map <C-L> <C-W>l<C-W>_
"map <C-H> <C-W>h<C-W>_
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
map <C-H> <C-W>h
map <S-H> gT
map <S-L> gt
" Quickly jump between two most recent buffers
map <Space> <C-^>
" Easier moving between wrapped lines
nmap <silent> j gj
nmap <silent> k gk
" Yank from the cursor to the end of the line, to be consistent with C and D.
nnoremap Y y$
" Toggle settings
nnoremap <Leader>c :set cursorline!<CR>
" Shortcut for commands
nnoremap <silent> <Leader>fb :FufBuffer<CR>
nnoremap <silent> <Leader>ff :FufFile<CR>
nnoremap <silent> <Leader>n :NERDTreeToggle<CR>
" nnoremap <silent> <Leader>t :TlistToggle<CR>
" Shortcut to edit my .vimrc
nmap <silent> <leader>ev :e $MYVIMRC<cr>
" Reload my .vimrc to apply any changes made
nmap <silent> <leader>sv :so $MYVIMRC<cr>
" cmd-ENTER like Textmate
inoremap <D-CR> <ESC>o
" }
" Plugins {
" Taglist {
let Tlist_Use_Right_Window = 1
" }
" NERDTree {
let NERDTreeChDirMode = 2
let NERDTreeQuitOnOpen = 0
" }
" Vimwiki {
let wiki_index = {}
let wiki_index.path = '~/Dropbox/Text\ Files/Vim\ Wikis/'
let g:vimwiki_list = [wiki_index]
" }
" }
" GUI Settings {
" GVIM- (here instead of .gvimrc)
if has('gui_running')
set anti " antialias font
set guioptions-=T " remove the toolbar
set guioptions-=L " turn off left scrollbar
"set guioptions+=rb " turn on right and horizontal scrollbars
set lines=50 " 50 lines of text instead of 24,
set columns=200 " 200 columns
"set guitablabel'%t guitabtooltip'%F " Tab headings
else
color ir_black
endif
" Version specific settings {
if has("gui_macvim")
set guifont=DroidSansMono:h14 " use Monaco 10pt
set fuoptions=maxvert,maxhorz " fullscreen options (MacVim only), resized window when changed to fullscreen (max lines and columns)
"autocmd GUIEnter * set fullscreen " enter fullscreen mode when GUI opens
elseif has("gui_gtk2")
set guifont=Monaco
elseif has("x11")
elseif has("gui_win32")
set guifont=Monaco
au GUIEnter * simalt ~x "Always open in maximized window state (Windows only I think)
endif
" }
" }