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