forked from dmac/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
156 lines (136 loc) · 5.41 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
" ====================
" Plugins
" ====================
" I add my plugins to the runtime manually because
" calling pathogen#runtime_append_all_bundles increases
" the startup time of vim by a few seconds.
"set runtimepath+=~/.vim/bundle/The-NERD-tree
"set runtimepath+=~/.vim/bundle/The-NERD-Commenter
"set runtimepath+=~/.vim/bundle/git-vim
"set runtimepath+=~/.vim/bundle/vim-repeat
"set runtimepath+=~/.vim/bundle/vim-surround
"set runtimepath+=~/.vim/bundle/taglist
"set runtimepath+=~/.vim/bundle/bufkill
"set runtimepath+=~/.vim/bundle/Command-T
"set runtimepath+=~/.vim/bundle/supertab
set runtimepath+=~/.vim/bundle/vim-pathogen
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
filetype off " ensure pathogen will pick up plugins with ftdetect directories
" ====================
" Plugin Options
" ====================
let g:CommandTCancelMap=['<C-c>', '<C-[>'] " cancel out of CommandT
let g:SuperTabDefaultCompletionType="context" " contextual autocomplete
let g:SuperTabContextDefaultCompletionType="<C-n>" " tab complete forward with autocomplete
let g:NERDTreeChDirMode=2 " change pwd when NERDTree root changes
let g:NERDChristmasTree=1 " more colorful NERDTree
let vimclojure#HighlightBuiltins=1 " Highlight Clojure's builtins
let vimclojure#ParenRainbow=1 " Rainbow parenthesis in Clojure
" android configuration for javaimp plugin
if $ANDROID_HOME != ""
let g:JavaImpPaths=$ANDROID_HOME."/platforms/android-7"
let g:JavaImpDataDir=$HOME."/.javaimp"
end
" ====================
" General
" ====================
set nocompatible " duh
set history=1000 " longer history
set incsearch " perform search as you type
set autoread " reload changed files when focus returns
set modeline " enable modelines
syntax on " enable syntax highlighting
filetype plugin indent on " detect filetypes
" ====================
" Colors and Skins
" ====================
if &t_Co > 8
colorscheme jellybeans
endif
if exists("+colorcolumn") " use colorcolumn if supported
let &colorcolumn = &textwidth
hi ColorColumn ctermbg=DarkGray guibg=#2D2D2D
endif
" ====================
" Backups
" ====================
set nobackup " don't save backup files
set nowritebackup " don't save backup files
set noswapfile " don't create .swp files
"set backupdir=~/.vim/backup
"set backupcopy=yes
" ====================
" UI
" ====================
set ruler " show cursor position, etc.
set showcmd " display commands in progress at the bottom
set wildmenu " tab completion menu for commands
set wildmode=list:longest,full " tab completion menu options
set number " show line numbers
" ====================
" Highlights
" ====================
hi LineNr ctermfg=DarkGray ctermbg=Black
"hi Comment ctermfg=cyan cterm=none
"hi Directory ctermfg=cyan cterm=none
" better git diff colors
hi diffAdded ctermfg=DarkGreen ctermbg=Black
hi diffRemoved ctermfg=DarkRed ctermbg=Black
hi diffFile ctermfg=darkcyan ctermbg=Black
" ====================
" Visual Cues
" ====================
set showmatch " show matching brace when closed
set ignorecase " ignore case when searching...
set smartcase " ...unless a capital letter was typed
set nohlsearch " don't highlight search results
set list listchars=trail:.,tab:>. " highlight trailing whitespace
hi SpecialKey ctermfg=DarkGray ctermbg=Black
" ====================
" Text Formatting
" ====================
set autoindent " continue indentation
set smartindent " add indentation for code
set backspace=indent,eol,start " make backspace work correctly
set tabstop=2 " 2 space tabs, all the time
let &softtabstop=&tabstop
let &shiftwidth=&tabstop
set expandtab
set nosmarttab
set textwidth=110 " wrap text at 110 columns
" ====================
" Mappings
" ====================
let mapleader=","
" treat moving vertically on a wrapped line as two different lines
nnoremap j gj
nnoremap k gk
" custom shortcuts
nnoremap <LEADER>e :e **/*
nnoremap <LEADER>bb :ls<CR>:b
nnoremap <LEADER>B :b *
nnoremap <LEADER>f :NERDTreeToggle<CR>
nnoremap <LEADER>T :TlistToggle<CR>
nnoremap <LEADER>d :BD<CR>
nnoremap <LEADER>h :set hlsearch!<CR>
nnoremap <LEADER>m :%w ! markdown_doctor \| bcat<CR><CR>
nnoremap <LEADER>s :Sscratch<CR>
nnoremap <LEADER>S :Scratch<CR>
" underlining
nnoremap <LEADER>= yyp<C-v>$r=
nnoremap <LEADER>- yyp<C-v>$r-
" ====================
" Auto Commands
" ====================
if has("autocmd")
autocmd BufWinLeave * silent! mkview " automatically save folds
autocmd BufWinEnter * silent! loadview " automatically load folds
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif " close autocomplete preview when cursor moves
autocmd InsertLeave * if pumvisible() == 0|pclose|endif " close autocomplete preview on insert mode exit
autocmd BufWritePre * :%s/\s\+$//e " strip trailing whitespace on save
autocmd BufReadPost * " set cursor to the last position when opening
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
endif