-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
174 lines (139 loc) · 5 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
" ### General
set nocompatible " no legacy compat. must be first.
call pathogen#infect() " load pathgen bundles
filetype plugin indent on " load file type plugins + indentation
set modelines=0 " prevent modelines security exploits by disabling them
set encoding=utf-8
" ### UI
syntax enable
set background=dark
colorscheme solarized
set encoding=utf-8
set scrolloff=8 " provide context when editing
set autoread " reload files (no local changes only)
set showmode " Show current mode down the bottom
set hidden " Hide buffers when they are abandoned
set cursorline " highlight current line
set laststatus=2 " Show the status line all the time
set ruler " show the cursor position all the time
set ttyfast " we have a fast terminal
set showcmd " display incomplete commands
"set nolazyredraw " turn off lazy redraw
if v:version >= 703
set relativenumber " show relative line numbers
else
set number " show line numbers
endif
set wildmenu " turn on wild menu :e <Tab>
set wildmode=list:longest,full
set ch=2 " command line height
set backspace=2 " allow backspacing over everything in insert mode
set whichwrap+=<,>,h,l,[,] " backspace and cursor keys wrap to
set shortmess=filtIoOA " shorten messages
set report=0 " tell us about changes
set nostartofline " don't jump to the start of line when scrolling
set gdefault " substitutions are global on lines
set backspace=indent,eol,start " backspace through everything in insert mode
" ### Visual Cues
set showmatch " brackets/braces that is
set mat=5 " duration to show matching brace (1/10 sec)
set laststatus=2 " always show the status line
set visualbell " shut the fuck up
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
" ### Text Formatting
set autoindent
set smartindent
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4)
set softtabstop=2
set expandtab " use spaces, not tabs (optional)
" show invisible chars
set list
set listchars=tab:▸\ ,eol:¬
" ### Backups
set nobackup " do not keep backups after close
set nowritebackup " do not keep a backup while working
set noswapfile " don't keep swp files either
set backupdir=$HOME/.vim/backup " store backups under ~/.vim/backup
set backupcopy=yes " keep attributes of original file
set backupskip=/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*
set directory=~/.vim/swap,~/tmp,. " keep swp files under ~/.vim/swap
" ### Mappings
" remap leader key from default '\'
let mapleader = ","
" clear search buffer on return
nnoremap <CR> :noh<cr>
nnoremap <tab> %
vnoremap <tab> %
" start searches with \v to disable vim-specific regex
nnoremap / /\v
vnoremap / /\v
" disable arrow keys (force me to do the right thing)
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
" what do these do?
"nnoremap j gj<CR>
nnoremap k gk
" map 'jj' to ESC in insert mode for quicker exiting
inoremap jj <ESC>
" open new vertical split and switch to it
nnoremap <leader>w <C-w>v<C-w>l
" map <C-[h/j/k/l]> to move around splits
"nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" map <C-h> to :FufHelp (fuzzyfinder help)
nnoremap <C-h> :FufHelp<CR>
" ### Autocommands
" auto save on focus lost
"au FocusLost * :wa
" ### Filetypes
" Set File type to 'text' for files ending in .txt
autocmd BufNewFile,BufRead *.txt setfiletype text
" Enable soft-wrapping for text files
autocmd FileType text,markdown,html,xhtml,eruby setlocal wrap linebreak nolist
" ### Open URL on current line in browser
function! Browser ()
let line0 = getline (".")
let line = matchstr (line0, "http[^ )]*")
let line = escape (line, "#?&;|%")
exec ':silent !open ' . "\"" . line . "\""
endfunction
map <leader>w :call Browser ()<CR>
" ### PDI
" peepopen
" nerdtree
" lusty explorer
" command-t
" nerdcommenter
" nerdtree
" tpope's commenter
" bufexplorer
" ack
" snipmate
" yankring
" tpope's surround and repeat
" rainbow parenthesis
" fugitive (for git)
" fuzzyfinder
" commentary
" endwise
" markdown
" coffee-script
" ### Reference
" http://mislav.uniqpath.com/2011/12/vim-revisited/
" http://stevelosh.com/blog/2010/09/coming-home-to-vim/#getting-started
" http://stackoverflow.com/questions/164847/what-is-in-your-vimrc
" http://mislav.uniqpath.com/2011/12/vim-revisited/
" https://github.com/ryanb/dotfiles
" https://github.com/rtomayko/dotfiles/blob/rtomayko/.vimrc