Mercurial > ec-dotfiles
annotate rc/vimrc @ 564:e80a3ce5d72f
Also update vim ignores for hg.
author | nanaya <me@myconan.net> |
---|---|
date | Thu, 04 Jun 2015 18:37:50 +0900 |
parents | 7cac401e5c78 |
children | 85dca9054bac |
rev | line source |
---|---|
525
1dd96a55b7ac
Invoke nocompatible earliest so it doesn't override anything preceeded it.
edogawaconan <me@myconan.net>
parents:
503
diff
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:
542
diff
changeset
|
12 |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
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:
542
diff
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:
542
diff
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:
542
diff
changeset
|
16 |
535
70d4fb4f7d9f
copyindent instead of expandtab.
edogawaconan <me@myconan.net>
parents:
531
diff
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 | |
556 | 24 |
424 | 25 set list listchars=tab:>-,trail:.,extends:> |
556 | 26 autocmd colorscheme * highlight specialkey ctermfg=gray |
557
bd3c7affdade
Force line number to be dark colored.
nanaya <me@myconan.net>
parents:
556
diff
changeset
|
27 autocmd colorscheme * highlight linenr ctermfg=gray ctermbg=black |
556 | 28 |
424 | 29 set number |
30 | |
529
de3ff51840a3
Skip clipboard loading for speedup in current setup.
edogawaconan <me@myconan.net>
parents:
525
diff
changeset
|
31 " 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:
525
diff
changeset
|
32 set clipboard=exclude:.* |
de3ff51840a3
Skip clipboard loading for speedup in current setup.
edogawaconan <me@myconan.net>
parents:
525
diff
changeset
|
33 |
424 | 34 if has('call') |
35 call pathogen#infect() | |
36 endif | |
37 if has('filetype') | |
38 filetype plugin indent on | |
39 endif | |
33 | 40 |
41 map <C-t><up> :tabr<cr> | |
42 map <C-t><down> :tabl<cr> | |
43 map <C-t><left> :tabp<cr> | |
44 map <C-t><right> :tabn<cr> | |
35
a8dc309a1b8a
Misc adjusments for vim keys
Edho Prima Arief <me@myconan.net>
parents:
33
diff
changeset
|
45 map <C-t>p :tabp<cr> |
a8dc309a1b8a
Misc adjusments for vim keys
Edho Prima Arief <me@myconan.net>
parents:
33
diff
changeset
|
46 map <C-t>n :tabn<cr> |
33 | 47 map <C-t><C-t> :NERDTreeToggle<cr> |
48 map <C-t><C-m> :NERDTreeMirror<cr> | |
49 | |
531 | 50 " clears out highlight |
51 nmap <leader>c :nohlsearch<cr> | |
52 | |
53 " toggles paste mode | |
54 nmap <leader>p :set paste!<cr> | |
55 | |
56 " removes prefix for windows copypasta | |
424 | 57 nmap _pa :set number! list!<cr> |
58 | |
467 | 59 " format JSON |
60 map <leader>j <esc>:%!python -m json.tool<cr> | |
61 | |
531 | 62 " visual navigation instead of logical |
63 nmap j gj | |
64 nmap k gk | |
65 | |
33 | 66 "autocmd VimEnter * NERDTree |
67 "autocmd BufEnter * NERDTreeMirror | |
68 | |
329
ea82caf6c059
Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
69 if has('syntax') |
ea82caf6c059
Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
70 syntax on |
431 | 71 set foldmethod=syntax |
432 | 72 set nofoldenable |
446
3022c5d1f8ed
Back to dark theme for compatibility with non-personal systems.
Edho Arief <edho@myconan.net>
parents:
432
diff
changeset
|
73 set background=dark |
554 | 74 |
555 | 75 colorscheme vividchalk |
329
ea82caf6c059
Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
76 endif |
350 | 77 |
78 if has("autocmd") | |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
79 function In2() |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
80 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:
542
diff
changeset
|
81 endfunction |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
82 |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
83 function In4() |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
84 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:
542
diff
changeset
|
85 endfunction |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
86 |
563
7cac401e5c78
Add configurable to always assume two spaces/no tab in vim.
nanaya <me@myconan.net>
parents:
560
diff
changeset
|
87 if $EC_VIM_SPACING == "2" |
7cac401e5c78
Add configurable to always assume two spaces/no tab in vim.
nanaya <me@myconan.net>
parents:
560
diff
changeset
|
88 call In2() |
7cac401e5c78
Add configurable to always assume two spaces/no tab in vim.
nanaya <me@myconan.net>
parents:
560
diff
changeset
|
89 endif |
7cac401e5c78
Add configurable to always assume two spaces/no tab in vim.
nanaya <me@myconan.net>
parents:
560
diff
changeset
|
90 |
545
c9ea8dd9d382
Remove unnecessary json configs.
edogawaconan <me@myconan.net>
parents:
544
diff
changeset
|
91 " required by syntax file |
c9ea8dd9d382
Remove unnecessary json configs.
edogawaconan <me@myconan.net>
parents:
544
diff
changeset
|
92 " reference: https://github.com/elzr/vim-json/blob/master/ftplugin/json.vim |
c9ea8dd9d382
Remove unnecessary json configs.
edogawaconan <me@myconan.net>
parents:
544
diff
changeset
|
93 let g:vim_json_syntax_conceal = 1 |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
94 |
539
05785a85d603
Fix json syntax highlighter config.
edogawaconan <me@myconan.net>
parents:
538
diff
changeset
|
95 autocmd BufNewFile,BufRead *.json set filetype=json |
05785a85d603
Fix json syntax highlighter config.
edogawaconan <me@myconan.net>
parents:
538
diff
changeset
|
96 autocmd BufNewFile,BufRead *.jsonp set filetype=json |
541 | 97 autocmd BufRead,BufNewFile *.blade.php set filetype=blade |
98 autocmd BufRead,BufNewFile *.coffee set filetype=coffee | |
99 autocmd BufRead,BufNewFile *.erb set filetype=eruby | |
100 autocmd BufRead,BufNewFile *.less set filetype=less | |
101 autocmd BufRead,BufNewFile *.scss set filetype=scss | |
102 autocmd BufRead,BufNewFile *.slim set filetype=slim | |
103 autocmd BufRead,BufNewFile Gemfile set filetype=ruby | |
560 | 104 autocmd BufRead,BufNewFile Vagrantfile set filetype=ruby |
541 | 105 autocmd BufRead,BufNewFile config.ru set filetype=ruby |
106 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:
542
diff
changeset
|
107 |
550 | 108 autocmd FileType coffee call In2() |
109 autocmd FileType eruby call In2() | |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
110 autocmd FileType ruby call In2() |
550 | 111 autocmd FileType scss call In2() |
112 autocmd FileType yaml call In2() | |
350 | 113 endif |
412
7ceec4404caf
Add restore cursor position for vim.
Edho Arief <edho@myconan.net>
parents:
410
diff
changeset
|
114 |
448
e0e8de4135bc
Testing for function never returns true. Replaced with autocmd.
Edho Arief <edho@myconan.net>
parents:
446
diff
changeset
|
115 if has('autocmd') |
418
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
116 "Restore cursor position |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
117 set viminfo='10,\"100,:20,%,n~/.viminfo |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
118 function! ResCur() |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
119 if line("'\"") <= line("$") |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
120 normal! g`" |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
121 return 1 |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
122 endif |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
123 endfunction |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
124 augroup resCur |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
125 autocmd! |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
126 autocmd BufWinEnter * call ResCur() |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
127 augroup END |
496
6bdf99bfbe97
Newer git use different filename, I think.
edogawaconan <me@myconan.net>
parents:
494
diff
changeset
|
128 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:
448
diff
changeset
|
129 autocmd BufWinEnter .git/COMMIT_EDITMSG exe "normal! gg" |
418
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
130 endif |
424 | 131 |
132 if has('statusline') | |
133 " Status line detail: | |
134 " %f file path | |
135 " %y file type between braces (if defined) | |
136 " %([%R%M]%) read-only, modified and modifiable flags between braces | |
137 " %{'!'[&ff=='default_file_format']} | |
138 " shows a '!' if the file format is not the platform | |
139 " default | |
140 " %{'$'[!&list]} shows a '*' if in list mode | |
141 " %{'~'[&pm=='']} shows a '~' if in patchmode | |
142 " (%{synIDattr(synID(line('.'),col('.'),0),'name')}) | |
143 " only for debug : display the current syntax item name | |
144 " %= right-align following items | |
145 " #%n buffer number | |
146 " %l/%L,%c%V line number, total number of lines, and column number | |
147 function SetStatusLineStyle() | |
148 if &stl == '' || &stl =~ 'synID' | |
149 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}%{'~'[&pm=='']}%=#%n %l/%L,%c%V " | |
150 else | |
151 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]} (%{synIDattr(synID(line('.'),col('.'),0),'name')})%=#%n %l/%L,%c%V " | |
152 endif | |
153 endfunc | |
154 " Switch between the normal and vim-debug modes in the status line | |
155 nmap _ds :call SetStatusLineStyle()<CR> | |
156 call SetStatusLineStyle() | |
157 " Window title | |
158 if has('title') | |
493
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
159 if &term == "screen" |
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
160 set t_ts=]0; |
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
161 set t_fs= |
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
162 endif |
494 | 163 set title |
164 let &titlestring = $user | |
424 | 165 endif |
166 endif |