comparison rc/vimrc @ 424:b86827ee1aae

Various vimrc cleanup.
author Edho Arief <edho@myconan.net>
date Sat, 29 Dec 2012 21:41:52 +0700
parents f4a29755dd01
children 5a347898e12f
comparison
equal deleted inserted replaced
423:f4a29755dd01 424:b86827ee1aae
1 set showmode 1 set showmode " shows mode insert/replace/visual
2 set showcmd 2 set showcmd " shows last command on screen
3 set nomodeline 3 set nomodeline " disallow automatic vim command execution on arbitrary file
4 set autoindent 4 set autoindent
5 set lazyredraw 5 set lazyredraw
6 set vb t_vb= 6 set vb t_vb= " disables visual bell
7 set ruler 7 set ruler
8 set nohls
9 set nocompatible 8 set nocompatible
10 set backspace=2 9 set backspace=2 " make backspace work like most other apps
11 set esckeys 10 set esckeys
12 set noerrorbells 11 set noerrorbells
13 set ts=2 12 set ts=8
13 set sw=2
14 set expandtab 14 set expandtab
15 set title 15 set title
16 set list 16 set hlsearch
17 set ls=2 " always show status line
18 set list listchars=tab:>-,trail:.,extends:>
19 set number
20
21 if has('call')
22 call pathogen#infect()
23 endif
24 if has('filetype')
25 filetype plugin indent on
26 endif
17 27
18 map <C-t><up> :tabr<cr> 28 map <C-t><up> :tabr<cr>
19 map <C-t><down> :tabl<cr> 29 map <C-t><down> :tabl<cr>
20 map <C-t><left> :tabp<cr> 30 map <C-t><left> :tabp<cr>
21 map <C-t><right> :tabn<cr> 31 map <C-t><right> :tabn<cr>
22 map <C-t>p :tabp<cr> 32 map <C-t>p :tabp<cr>
23 map <C-t>n :tabn<cr> 33 map <C-t>n :tabn<cr>
24 map <C-t><C-t> :NERDTreeToggle<cr> 34 map <C-t><C-t> :NERDTreeToggle<cr>
25 map <C-t><C-m> :NERDTreeMirror<cr> 35 map <C-t><C-m> :NERDTreeMirror<cr>
36
37 if has('let')
38 nmap _cs :let @/ = ''<cr>
39 endif
40
41 nmap _pa :set number! list!<cr>
26 42
27 "autocmd VimEnter * NERDTree 43 "autocmd VimEnter * NERDTree
28 "autocmd BufEnter * NERDTreeMirror 44 "autocmd BufEnter * NERDTreeMirror
29 45
30 if has('syntax') 46 if has('syntax')
35 endif 51 endif
36 52
37 if has("autocmd") 53 if has("autocmd")
38 autocmd BufRead,BufNewFile supervisord.conf :set ft=dosini 54 autocmd BufRead,BufNewFile supervisord.conf :set ft=dosini
39 autocmd BufRead,BufNewFile Gemfile :set ft=ruby 55 autocmd BufRead,BufNewFile Gemfile :set ft=ruby
40 autocmd BufRead,BufNewFile crontab.* :set noet ts=8 nolist 56 autocmd BufRead,BufNewFile crontab.* :set noet
41 autocmd BufRead,BufNewFile crontab :set noet ts=8 nolist 57 autocmd BufRead,BufNewFile crontab :set noet
42 autocmd BufRead,BufNewFile fstab :set noet ts=8 nolist 58 autocmd BufRead,BufNewFile fstab :set noet
43 autocmd BufRead,BufNewFile .git/COMMIT_EDITMSG :set noet ts=8 nolist 59 autocmd BufRead,BufNewFile .git/COMMIT_EDITMSG :set noet
44 autocmd BufRead,BufNewFile .gitconfig :set noet ts=8 nolist 60 autocmd BufRead,BufNewFile .gitconfig :set noet
45 autocmd BufRead,BufNewFile .git/config :set noet ts=8 nolist 61 autocmd BufRead,BufNewFile .git/config :set noet
46 autocmd BufRead,BufNewFile *.erb :set ft=eruby ts=2 et list 62 autocmd BufRead,BufNewFile *.erb :set ft=eruby
47 autocmd BufRead,BufNewFile *.scss :set ft=scss 63 autocmd BufRead,BufNewFile *.scss :set ft=scss
48 autocmd BufRead,BufNewFile *.coffee :set ft=coffee 64 autocmd BufRead,BufNewFile *.coffee :set ft=coffee
49 endif 65 endif
50 66
51 if has('function!') 67 if has('function')
52 "Restore cursor position 68 "Restore cursor position
53 set viminfo='10,\"100,:20,%,n~/.viminfo 69 set viminfo='10,\"100,:20,%,n~/.viminfo
54 function! ResCur() 70 function! ResCur()
55 if line("'\"") <= line("$") 71 if line("'\"") <= line("$")
56 normal! g`" 72 normal! g`"
57 return 1 73 return 1
58 endif 74 endif
59 endfunction 75 endfunction
60
61 augroup resCur 76 augroup resCur
62 autocmd! 77 autocmd!
63 autocmd BufWinEnter * call ResCur() 78 autocmd BufWinEnter * call ResCur()
64 augroup END 79 augroup END
65 endif 80 endif
81
82 if has('statusline')
83 " Status line detail:
84 " %f file path
85 " %y file type between braces (if defined)
86 " %([%R%M]%) read-only, modified and modifiable flags between braces
87 " %{'!'[&ff=='default_file_format']}
88 " shows a '!' if the file format is not the platform
89 " default
90 " %{'$'[!&list]} shows a '*' if in list mode
91 " %{'~'[&pm=='']} shows a '~' if in patchmode
92 " (%{synIDattr(synID(line('.'),col('.'),0),'name')})
93 " only for debug : display the current syntax item name
94 " %= right-align following items
95 " #%n buffer number
96 " %l/%L,%c%V line number, total number of lines, and column number
97 function SetStatusLineStyle()
98 if &stl == '' || &stl =~ 'synID'
99 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}%{'~'[&pm=='']}%=#%n %l/%L,%c%V "
100 else
101 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]} (%{synIDattr(synID(line('.'),col('.'),0),'name')})%=#%n %l/%L,%c%V "
102 endif
103 endfunc
104 " Switch between the normal and vim-debug modes in the status line
105 nmap _ds :call SetStatusLineStyle()<CR>
106 call SetStatusLineStyle()
107 " Window title
108 if has('title')
109 set titlestring=%t%(\ [%R%M]%)
110 endif
111 endif