-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
120 lines (116 loc) · 4.06 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
" --- Eckhardt's vim file --- "
" Tim Pope's Pathogen
" https://github.com/tpope/vim-pathogen
" ---
call pathogen#infect()
call pathogen#runtime_append_all_bundles()
filetype plugin indent on
set nocompatible
colors desert
syntax on
set gfn=Inconsolata\ Medium\ 14
set cursorline " Highlight current line
set hlsearch
set incsearch
set laststatus=2 " Always show status line
set listchars=tab:▸\ ,eol:¬
set mat=5 " Bracket blinking.
set modelines=0
set mouse=a " Mouse in all modes
set mousehide " Hide mouse after chars typed
set noerrorbells " No noise.
set novisualbell " No blinking .
set nowrap " Line wrapping off
set nu " Line numbers on
set relativenumber
set ruler " show line & column no. of cursor
set scrolloff=3 " min no. of screen lines above & below cursor
set shiftwidth=2
set showmatch
set smarttab
set textwidth=79
set visualbell
set wrap
set encoding=utf-8
set autoindent " self-explanatory
set showmode " indicate input or replace mode at bottom
set showcmd " show information about current command
set hidden " don't destroy buffer when abandonded
set wildmenu " cli completion via <Tab>
set wildmode=list:longest
set ttyfast
set backspace=indent,eol,start
set undofile
"let mapleader = ","
"nnoremap / /\v
"vnoremap / /\v
set ignorecase
set smartcase
set gdefault
"nnoremap <leader><space> :noh<cr>
"nnoremap <tab> %
"vnoremap <tab> %
set formatoptions=qrn1
set colorcolumn=80
set list
"nnoremap ; :
"au FocusLost * :wa
"comment/uncomment blocks of code (in vmode)
"vmap _c :s/^/#/gi<Enter>
"vmap _C :s/^#//gi<Enter>
" Set formatting based on FileType
autocmd FileType make set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab
autocmd FileType python set tabstop=4 softtabstop=4 shiftwidth=4 expandtab
autocmd FileType ruby set tabstop=2 softtabstop=2 shiftwidth=2 expandtab
autocmd FileType c set tabstop=8 softtabstop=8 shiftwidth=8 expandtab
autocmd FileType java set tabstop=4 softtabstop=4 shiftwidth=4 expandtab
" Perl specific
let perl_include_pod = 1 " include pod
" RSpec
" http://drasticcode.com/2009/8/27/how-to-run-rspec-specs-from-vim
" Execute open rspec buffer
function! RunSpec(args)
if exists("b:rails_root") && filereadable(b:rails_root . "/script/rspec")
let rspec = b:rails_root . "script/rspec"
else
let rspec = "rspec"
end
let cmd = ":! " . rspec . " % -cfn " . a:args
execute cmd
endfunction
" Mappings
" run one rspec example or describe block based on cursor position
"map !s :call RunSpec("-l " . <C-r>=line('.')<CR>)
" run full rspec file
"map !S :call RunSpec("")
" ---
" Rails IDE
" http://biodegradablegeek.com/2007/12/using-vim-as-a-complete-ruby-on-rails-ide
" --- Add recently accessed projects menu (project plugin)
set viminfo^=!
" --- Minibuffer Explorer Settings
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
" --- alt+n or alt+p to navigate between entries in QuickFix
"map :cp
"map :cn
" --- Change which file opens after executing :Rails command
let g:rails_default_file='config/database.yml'
set cf " Enable error files & error jumping.
set clipboard+=unnamed " Yanks go on clipboard instead.
set history=256 " Number of things to remember in history.
set autowrite " Writes on make/shell commands
set timeoutlen=250 " Time to wait after ESC (default causes an annoying delay)
" --- Formatting (some of these are for coding in C and C++)
set nocp incsearch
set cinoptions=:0,p0,t0
set cinwords=if,else,while,do,for,switch,case
set formatoptions=tcqr
set cindent
" --- Backups & Files
" --- The following requires creation of the target directories
set backup " Enable creation of backup files
set backupdir=~/.vim/backups " Where backups will go
set directory=~/.vim/tmp " Where temporary files will go