Mercurial > ec-dotfiles
annotate rc/vimrc @ 544:75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
| author | edogawaconan <me@myconan.net> | 
|---|---|
| date | Tue, 24 Feb 2015 19:17:26 +0900 | 
| parents | fc429d39ce9e | 
| children | c9ea8dd9d382 | 
| rev | line source | 
|---|---|
| 525 
1dd96a55b7ac
Invoke nocompatible earliest so it doesn't override anything preceeded it.
 edogawaconan <me@myconan.net> parents: 
503diff
changeset | 1 set nocompatible | 
| 424 | 2 set showmode " shows mode insert/replace/visual | 
| 3 set showcmd " shows last command on screen | |
| 4 set nomodeline " disallow automatic vim command execution on arbitrary file | |
| 3 | 5 set autoindent | 
| 6 set lazyredraw | |
| 424 | 7 set vb t_vb= " disables visual bell | 
| 3 | 8 set ruler | 
| 424 | 9 set backspace=2 " make backspace work like most other apps | 
| 3 | 10 set esckeys | 
| 11 set noerrorbells | |
| 544 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 12 | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 13 set tabstop=4 | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 14 set shiftwidth=4 | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 15 set softtabstop=4 | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 16 | 
| 535 
70d4fb4f7d9f
copyindent instead of expandtab.
 edogawaconan <me@myconan.net> parents: 
531diff
changeset | 17 set copyindent | 
| 32 | 18 set title | 
| 531 | 19 set incsearch | 
| 20 set ignorecase | |
| 21 set smartcase | |
| 424 | 22 set hlsearch | 
| 23 set ls=2 " always show status line | |
| 24 set list listchars=tab:>-,trail:.,extends:> | |
| 25 set number | |
| 26 | |
| 529 
de3ff51840a3
Skip clipboard loading for speedup in current setup.
 edogawaconan <me@myconan.net> parents: 
525diff
changeset | 27 " http://stackoverflow.com/questions/14635295/vim-takes-a-very-long-time-to-start-up | 
| 
de3ff51840a3
Skip clipboard loading for speedup in current setup.
 edogawaconan <me@myconan.net> parents: 
525diff
changeset | 28 set clipboard=exclude:.* | 
| 
de3ff51840a3
Skip clipboard loading for speedup in current setup.
 edogawaconan <me@myconan.net> parents: 
525diff
changeset | 29 | 
| 424 | 30 if has('call') | 
| 31 call pathogen#infect() | |
| 32 endif | |
| 33 if has('filetype') | |
| 34 filetype plugin indent on | |
| 35 endif | |
| 33 | 36 | 
| 37 map <C-t><up> :tabr<cr> | |
| 38 map <C-t><down> :tabl<cr> | |
| 39 map <C-t><left> :tabp<cr> | |
| 40 map <C-t><right> :tabn<cr> | |
| 35 
a8dc309a1b8a
Misc adjusments for vim keys
 Edho Prima Arief <me@myconan.net> parents: 
33diff
changeset | 41 map <C-t>p :tabp<cr> | 
| 
a8dc309a1b8a
Misc adjusments for vim keys
 Edho Prima Arief <me@myconan.net> parents: 
33diff
changeset | 42 map <C-t>n :tabn<cr> | 
| 33 | 43 map <C-t><C-t> :NERDTreeToggle<cr> | 
| 44 map <C-t><C-m> :NERDTreeMirror<cr> | |
| 45 | |
| 531 | 46 " clears out highlight | 
| 47 nmap <leader>c :nohlsearch<cr> | |
| 48 | |
| 49 " toggles paste mode | |
| 50 nmap <leader>p :set paste!<cr> | |
| 51 | |
| 52 " removes prefix for windows copypasta | |
| 424 | 53 nmap _pa :set number! list!<cr> | 
| 54 | |
| 467 | 55 " format JSON | 
| 56 map <leader>j <esc>:%!python -m json.tool<cr> | |
| 57 | |
| 531 | 58 " visual navigation instead of logical | 
| 59 nmap j gj | |
| 60 nmap k gk | |
| 61 | |
| 33 | 62 "autocmd VimEnter * NERDTree | 
| 63 "autocmd BufEnter * NERDTreeMirror | |
| 64 | |
| 329 
ea82caf6c059
Added test to verify vim version (lite or full).
 Edho Arief <edho@myconan.net> parents: 
315diff
changeset | 65 if has('syntax') | 
| 
ea82caf6c059
Added test to verify vim version (lite or full).
 Edho Arief <edho@myconan.net> parents: 
315diff
changeset | 66 syntax on | 
| 431 | 67 set foldmethod=syntax | 
| 432 | 68 set nofoldenable | 
| 446 
3022c5d1f8ed
Back to dark theme for compatibility with non-personal systems.
 Edho Arief <edho@myconan.net> parents: 
432diff
changeset | 69 set background=dark | 
| 503 
e2b52663763b
Replace solarized with base16.
 edogawaconan <me@myconan.net> parents: 
496diff
changeset | 70 set t_Co=256 | 
| 
e2b52663763b
Replace solarized with base16.
 edogawaconan <me@myconan.net> parents: 
496diff
changeset | 71 colorscheme base16-default | 
| 329 
ea82caf6c059
Added test to verify vim version (lite or full).
 Edho Arief <edho@myconan.net> parents: 
315diff
changeset | 72 endif | 
| 350 | 73 | 
| 74 if has("autocmd") | |
| 544 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 75 function In2() | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 76 set softtabstop=2 tabstop=2 shiftwidth=2 expandtab | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 77 endfunction | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 78 | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 79 function In4() | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 80 set softtabstop=4 tabstop=4 shiftwidth=4 noexpandtab | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 81 endfunction | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 82 | 
| 467 | 83 augroup json_autocmd | 
| 84 autocmd! | |
| 85 autocmd FileType json set autoindent | |
| 86 autocmd FileType json set formatoptions=tcq2l | |
| 87 autocmd FileType json set textwidth=78 shiftwidth=2 | |
| 88 autocmd FileType json set softtabstop=2 tabstop=8 | |
| 89 autocmd FileType json set expandtab | |
| 90 autocmd FileType json set foldmethod=syntax | |
| 539 
05785a85d603
Fix json syntax highlighter config.
 edogawaconan <me@myconan.net> parents: 
538diff
changeset | 91 | 
| 
05785a85d603
Fix json syntax highlighter config.
 edogawaconan <me@myconan.net> parents: 
538diff
changeset | 92 " required by syntax file | 
| 
05785a85d603
Fix json syntax highlighter config.
 edogawaconan <me@myconan.net> parents: 
538diff
changeset | 93 " reference: https://github.com/elzr/vim-json/blob/master/ftplugin/json.vim | 
| 
05785a85d603
Fix json syntax highlighter config.
 edogawaconan <me@myconan.net> parents: 
538diff
changeset | 94 let g:vim_json_syntax_conceal = 1 | 
| 467 | 95 augroup END | 
| 544 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 96 | 
| 539 
05785a85d603
Fix json syntax highlighter config.
 edogawaconan <me@myconan.net> parents: 
538diff
changeset | 97 autocmd BufNewFile,BufRead *.json set filetype=json | 
| 
05785a85d603
Fix json syntax highlighter config.
 edogawaconan <me@myconan.net> parents: 
538diff
changeset | 98 autocmd BufNewFile,BufRead *.jsonp set filetype=json | 
| 541 | 99 autocmd BufRead,BufNewFile *.blade.php set filetype=blade | 
| 100 autocmd BufRead,BufNewFile *.coffee set filetype=coffee | |
| 101 autocmd BufRead,BufNewFile *.erb set filetype=eruby | |
| 102 autocmd BufRead,BufNewFile *.less set filetype=less | |
| 103 autocmd BufRead,BufNewFile *.scss set filetype=scss | |
| 104 autocmd BufRead,BufNewFile *.slim set filetype=slim | |
| 105 autocmd BufRead,BufNewFile Gemfile set filetype=ruby | |
| 106 autocmd BufRead,BufNewFile config.ru set filetype=ruby | |
| 107 autocmd BufRead,BufNewFile supervisord.conf set filetype=dosini | |
| 544 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 108 | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 109 autocmd FileType ruby call In2() | 
| 
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
 edogawaconan <me@myconan.net> parents: 
542diff
changeset | 110 autocmd FileType coffee call In2() | 
| 350 | 111 endif | 
| 412 
7ceec4404caf
Add restore cursor position for vim.
 Edho Arief <edho@myconan.net> parents: 
410diff
changeset | 112 | 
| 448 
e0e8de4135bc
Testing for function never returns true. Replaced with autocmd.
 Edho Arief <edho@myconan.net> parents: 
446diff
changeset | 113 if has('autocmd') | 
| 418 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 114 "Restore cursor position | 
| 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 115 set viminfo='10,\"100,:20,%,n~/.viminfo | 
| 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 116 function! ResCur() | 
| 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 117 if line("'\"") <= line("$") | 
| 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 118 normal! g`" | 
| 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 119 return 1 | 
| 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 120 endif | 
| 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 121 endfunction | 
| 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 122 augroup resCur | 
| 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 123 autocmd! | 
| 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 124 autocmd BufWinEnter * call ResCur() | 
| 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 125 augroup END | 
| 496 
6bdf99bfbe97
Newer git use different filename, I think.
 edogawaconan <me@myconan.net> parents: 
494diff
changeset | 126 autocmd BufWinEnter */.git/COMMIT_EDITMSG exe "normal! gg" | 
| 451 
abb434518e1f
Always start editing git commit message from line 1.
 Edho Arief <edho@myconan.net> parents: 
448diff
changeset | 127 autocmd BufWinEnter .git/COMMIT_EDITMSG exe "normal! gg" | 
| 418 
c0ac21407903
Disable features on vim basic.
 Edho Arief <edho@myconan.net> parents: 
412diff
changeset | 128 endif | 
| 424 | 129 | 
| 130 if has('statusline') | |
| 131 " Status line detail: | |
| 132 " %f file path | |
| 133 " %y file type between braces (if defined) | |
| 134 " %([%R%M]%) read-only, modified and modifiable flags between braces | |
| 135 " %{'!'[&ff=='default_file_format']} | |
| 136 " shows a '!' if the file format is not the platform | |
| 137 " default | |
| 138 " %{'$'[!&list]} shows a '*' if in list mode | |
| 139 " %{'~'[&pm=='']} shows a '~' if in patchmode | |
| 140 " (%{synIDattr(synID(line('.'),col('.'),0),'name')}) | |
| 141 " only for debug : display the current syntax item name | |
| 142 " %= right-align following items | |
| 143 " #%n buffer number | |
| 144 " %l/%L,%c%V line number, total number of lines, and column number | |
| 145 function SetStatusLineStyle() | |
| 146 if &stl == '' || &stl =~ 'synID' | |
| 147 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}%{'~'[&pm=='']}%=#%n %l/%L,%c%V " | |
| 148 else | |
| 149 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]} (%{synIDattr(synID(line('.'),col('.'),0),'name')})%=#%n %l/%L,%c%V " | |
| 150 endif | |
| 151 endfunc | |
| 152 " Switch between the normal and vim-debug modes in the status line | |
| 153 nmap _ds :call SetStatusLineStyle()<CR> | |
| 154 call SetStatusLineStyle() | |
| 155 " Window title | |
| 156 if has('title') | |
| 493 
1ad9091c464e
Properly set window name for vim.
 edogawaconan <me@myconan.net> parents: 
476diff
changeset | 157 if &term == "screen" | 
| 
1ad9091c464e
Properly set window name for vim.
 edogawaconan <me@myconan.net> parents: 
476diff
changeset | 158 set t_ts=]0; | 
| 
1ad9091c464e
Properly set window name for vim.
 edogawaconan <me@myconan.net> parents: 
476diff
changeset | 159 set t_fs= | 
| 
1ad9091c464e
Properly set window name for vim.
 edogawaconan <me@myconan.net> parents: 
476diff
changeset | 160 endif | 
| 494 | 161 set title | 
| 162 let &titlestring = $user | |
| 424 | 163 endif | 
| 164 endif | 
