annotate rc/vimrc @ 521:fb2d37acca81

Reducing bashism.
author edogawaconan <me@myconan.net>
date Wed, 18 Jun 2014 16:08:22 +0900
parents e2b52663763b
children 1dd96a55b7ac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
1 set showmode " shows mode insert/replace/visual
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
2 set showcmd " shows last command on screen
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
3 set nomodeline " disallow automatic vim command execution on arbitrary file
3
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
4 set autoindent
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
5 set lazyredraw
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
6 set vb t_vb= " disables visual bell
3
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
7 set ruler
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
8 set nocompatible
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
9 set backspace=2 " make backspace work like most other apps
3
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
10 set esckeys
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
11 set noerrorbells
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
12 set ts=8
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
13 set sw=2
3
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
14 set expandtab
32
2cf5492ac78d Vim title.
Edho Prima Arief <me@myconan.net>
parents: 3
diff changeset
15 set title
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
16 set hlsearch
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
17 set ls=2 " always show status line
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
18 set list listchars=tab:>-,trail:.,extends:>
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
19 set number
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
20
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
21 if has('call')
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
22 call pathogen#infect()
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
23 endif
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
24 if has('filetype')
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
25 filetype plugin indent on
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
26 endif
33
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
27
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
28 map <C-t><up> :tabr<cr>
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
29 map <C-t><down> :tabl<cr>
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
30 map <C-t><left> :tabp<cr>
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
31 map <C-t><right> :tabn<cr>
35
a8dc309a1b8a Misc adjusments for vim keys
Edho Prima Arief <me@myconan.net>
parents: 33
diff changeset
32 map <C-t>p :tabp<cr>
a8dc309a1b8a Misc adjusments for vim keys
Edho Prima Arief <me@myconan.net>
parents: 33
diff changeset
33 map <C-t>n :tabn<cr>
33
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
34 map <C-t><C-t> :NERDTreeToggle<cr>
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
35 map <C-t><C-m> :NERDTreeMirror<cr>
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
36
430
5a347898e12f Always map _cs.
Edho Arief <edho@myconan.net>
parents: 424
diff changeset
37 nmap _cs :let @/ = ''<cr>
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
38 nmap _pa :set number! list!<cr>
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
39
467
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
40 " format JSON
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
41 map <leader>j <esc>:%!python -m json.tool<cr>
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
42
33
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
43 "autocmd VimEnter * NERDTree
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
44 "autocmd BufEnter * NERDTreeMirror
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
45
329
ea82caf6c059 Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
46 if has('syntax')
ea82caf6c059 Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
47 syntax on
431
be08a29208ab Added foldmethod setting.
Edho Arief <edho@myconan.net>
parents: 430
diff changeset
48 set foldmethod=syntax
432
087278fd11d8 Don't fold by default.
Edho Arief <edho@myconan.net>
parents: 431
diff changeset
49 set nofoldenable
446
3022c5d1f8ed Back to dark theme for compatibility with non-personal systems.
Edho Arief <edho@myconan.net>
parents: 432
diff changeset
50 set background=dark
503
e2b52663763b Replace solarized with base16.
edogawaconan <me@myconan.net>
parents: 496
diff changeset
51 set t_Co=256
e2b52663763b Replace solarized with base16.
edogawaconan <me@myconan.net>
parents: 496
diff changeset
52 colorscheme base16-default
329
ea82caf6c059 Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
53 endif
350
47fbc05cacce vim per file control.
Edho Arief <edho@myconan.net>
parents: 339
diff changeset
54
47fbc05cacce vim per file control.
Edho Arief <edho@myconan.net>
parents: 339
diff changeset
55 if has("autocmd")
467
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
56 augroup json_autocmd
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
57 autocmd!
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
58 autocmd FileType json set autoindent
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
59 autocmd FileType json set formatoptions=tcq2l
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
60 autocmd FileType json set textwidth=78 shiftwidth=2
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
61 autocmd FileType json set softtabstop=2 tabstop=8
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
62 autocmd FileType json set expandtab
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
63 autocmd FileType json set foldmethod=syntax
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
64 augroup END
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
65 au! BufRead,BufNewFile *.json set filetype=json
350
47fbc05cacce vim per file control.
Edho Arief <edho@myconan.net>
parents: 339
diff changeset
66 autocmd BufRead,BufNewFile supervisord.conf :set ft=dosini
353
dd0b17d4b57a Gemfile is ruby.
Edho Arief <edho@myconan.net>
parents: 350
diff changeset
67 autocmd BufRead,BufNewFile Gemfile :set ft=ruby
454
57b104afb2ac config.ru is ruby file.
Edho Arief <edho@myconan.net>
parents: 451
diff changeset
68 autocmd BufRead,BufNewFile config.ru :set ft=ruby
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
69 autocmd BufRead,BufNewFile crontab.* :set noet
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
70 autocmd BufRead,BufNewFile crontab :set noet
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
71 autocmd BufRead,BufNewFile fstab :set noet
496
6bdf99bfbe97 Newer git use different filename, I think.
edogawaconan <me@myconan.net>
parents: 494
diff changeset
72 autocmd BufRead,BufNewFile */.git/COMMIT_EDITMSG :set noet
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
73 autocmd BufRead,BufNewFile .git/COMMIT_EDITMSG :set noet
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
74 autocmd BufRead,BufNewFile .gitconfig :set noet
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
75 autocmd BufRead,BufNewFile .git/config :set noet
476
064970c9df7c Sort syntax list.
edogawaconan <me@myconan.net>
parents: 475
diff changeset
76 autocmd BufRead,BufNewFile *.coffee :set ft=coffee
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
77 autocmd BufRead,BufNewFile *.erb :set ft=eruby
393
0aabb2b34ef6 Added scss vim syntax support.
Edho Arief <edho@myconan.net>
parents: 390
diff changeset
78 autocmd BufRead,BufNewFile *.scss :set ft=scss
475
86873b811343 Add slim syntax to vim.
edogawaconan <me@myconan.net>
parents: 467
diff changeset
79 autocmd BufRead,BufNewFile *.slim :set ft=slim
350
47fbc05cacce vim per file control.
Edho Arief <edho@myconan.net>
parents: 339
diff changeset
80 endif
412
7ceec4404caf Add restore cursor position for vim.
Edho Arief <edho@myconan.net>
parents: 410
diff changeset
81
448
e0e8de4135bc Testing for function never returns true. Replaced with autocmd.
Edho Arief <edho@myconan.net>
parents: 446
diff changeset
82 if has('autocmd')
418
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
83 "Restore cursor position
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
84 set viminfo='10,\"100,:20,%,n~/.viminfo
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
85 function! ResCur()
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
86 if line("'\"") <= line("$")
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
87 normal! g`"
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
88 return 1
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
89 endif
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
90 endfunction
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
91 augroup resCur
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
92 autocmd!
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
93 autocmd BufWinEnter * call ResCur()
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
94 augroup END
496
6bdf99bfbe97 Newer git use different filename, I think.
edogawaconan <me@myconan.net>
parents: 494
diff changeset
95 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
96 autocmd BufWinEnter .git/COMMIT_EDITMSG exe "normal! gg"
418
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
97 endif
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
98
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
99 if has('statusline')
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
100 " Status line detail:
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
101 " %f file path
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
102 " %y file type between braces (if defined)
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
103 " %([%R%M]%) read-only, modified and modifiable flags between braces
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
104 " %{'!'[&ff=='default_file_format']}
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
105 " shows a '!' if the file format is not the platform
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
106 " default
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
107 " %{'$'[!&list]} shows a '*' if in list mode
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
108 " %{'~'[&pm=='']} shows a '~' if in patchmode
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
109 " (%{synIDattr(synID(line('.'),col('.'),0),'name')})
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
110 " only for debug : display the current syntax item name
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
111 " %= right-align following items
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
112 " #%n buffer number
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
113 " %l/%L,%c%V line number, total number of lines, and column number
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
114 function SetStatusLineStyle()
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
115 if &stl == '' || &stl =~ 'synID'
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
116 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}%{'~'[&pm=='']}%=#%n %l/%L,%c%V "
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
117 else
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
118 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]} (%{synIDattr(synID(line('.'),col('.'),0),'name')})%=#%n %l/%L,%c%V "
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
119 endif
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
120 endfunc
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
121 " Switch between the normal and vim-debug modes in the status line
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
122 nmap _ds :call SetStatusLineStyle()<CR>
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
123 call SetStatusLineStyle()
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
124 " Window title
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
125 if has('title')
493
1ad9091c464e Properly set window name for vim.
edogawaconan <me@myconan.net>
parents: 476
diff changeset
126 if &term == "screen"
1ad9091c464e Properly set window name for vim.
edogawaconan <me@myconan.net>
parents: 476
diff changeset
127 set t_ts=]0;
1ad9091c464e Properly set window name for vim.
edogawaconan <me@myconan.net>
parents: 476
diff changeset
128 set t_fs=
1ad9091c464e Properly set window name for vim.
edogawaconan <me@myconan.net>
parents: 476
diff changeset
129 endif
494
229acf12b960 Better vim titlestring.
edogawaconan <me@myconan.net>
parents: 493
diff changeset
130 set title
229acf12b960 Better vim titlestring.
edogawaconan <me@myconan.net>
parents: 493
diff changeset
131 let &titlestring = $user
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
132 endif
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
133 endif