Mercurial > ec-dotfiles
annotate rc/vimrc @ 475:86873b811343
Add slim syntax to vim.
author | edogawaconan <me@myconan.net> |
---|---|
date | Mon, 22 Jul 2013 12:40:24 +0900 |
parents | 8ef5ddb9b54b |
children | 064970c9df7c |
rev | line source |
---|---|
424 | 1 set showmode " shows mode insert/replace/visual |
2 set showcmd " shows last command on screen | |
3 set nomodeline " disallow automatic vim command execution on arbitrary file | |
3 | 4 set autoindent |
5 set lazyredraw | |
424 | 6 set vb t_vb= " disables visual bell |
3 | 7 set ruler |
8 set nocompatible | |
424 | 9 set backspace=2 " make backspace work like most other apps |
3 | 10 set esckeys |
11 set noerrorbells | |
424 | 12 set ts=8 |
13 set sw=2 | |
3 | 14 set expandtab |
32 | 15 set title |
424 | 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 | |
33 | 27 |
28 map <C-t><up> :tabr<cr> | |
29 map <C-t><down> :tabl<cr> | |
30 map <C-t><left> :tabp<cr> | |
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 | 34 map <C-t><C-t> :NERDTreeToggle<cr> |
35 map <C-t><C-m> :NERDTreeMirror<cr> | |
36 | |
430 | 37 nmap _cs :let @/ = ''<cr> |
424 | 38 nmap _pa :set number! list!<cr> |
39 | |
467 | 40 " format JSON |
41 map <leader>j <esc>:%!python -m json.tool<cr> | |
42 | |
33 | 43 "autocmd VimEnter * NERDTree |
44 "autocmd BufEnter * NERDTreeMirror | |
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 | 48 set foldmethod=syntax |
432 | 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 |
336
f0771672c559
[rc/vimrc] Forces transparent background for vim on gnome-terminal.
Edho Arief <edho@myconan.net>
parents:
329
diff
changeset
|
51 let g:solarized_termtrans=1 |
329
ea82caf6c059
Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
52 colorscheme solarized |
ea82caf6c059
Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
53 endif |
350 | 54 |
55 if has("autocmd") | |
467 | 56 augroup json_autocmd |
57 autocmd! | |
58 autocmd FileType json set autoindent | |
59 autocmd FileType json set formatoptions=tcq2l | |
60 autocmd FileType json set textwidth=78 shiftwidth=2 | |
61 autocmd FileType json set softtabstop=2 tabstop=8 | |
62 autocmd FileType json set expandtab | |
63 autocmd FileType json set foldmethod=syntax | |
64 augroup END | |
65 au! BufRead,BufNewFile *.json set filetype=json | |
350 | 66 autocmd BufRead,BufNewFile supervisord.conf :set ft=dosini |
353 | 67 autocmd BufRead,BufNewFile Gemfile :set ft=ruby |
454 | 68 autocmd BufRead,BufNewFile config.ru :set ft=ruby |
424 | 69 autocmd BufRead,BufNewFile crontab.* :set noet |
70 autocmd BufRead,BufNewFile crontab :set noet | |
71 autocmd BufRead,BufNewFile fstab :set noet | |
72 autocmd BufRead,BufNewFile .git/COMMIT_EDITMSG :set noet | |
73 autocmd BufRead,BufNewFile .gitconfig :set noet | |
74 autocmd BufRead,BufNewFile .git/config :set noet | |
75 autocmd BufRead,BufNewFile *.erb :set ft=eruby | |
393
0aabb2b34ef6
Added scss vim syntax support.
Edho Arief <edho@myconan.net>
parents:
390
diff
changeset
|
76 autocmd BufRead,BufNewFile *.scss :set ft=scss |
410
fd0a889066a6
Added syntax highlight for coffeescript.
Edho Arief <edho@myconan.net>
parents:
393
diff
changeset
|
77 autocmd BufRead,BufNewFile *.coffee :set ft=coffee |
475 | 78 autocmd BufRead,BufNewFile *.slim :set ft=slim |
350 | 79 endif |
412
7ceec4404caf
Add restore cursor position for vim.
Edho Arief <edho@myconan.net>
parents:
410
diff
changeset
|
80 |
448
e0e8de4135bc
Testing for function never returns true. Replaced with autocmd.
Edho Arief <edho@myconan.net>
parents:
446
diff
changeset
|
81 if has('autocmd') |
418
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
82 "Restore cursor position |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
83 set viminfo='10,\"100,:20,%,n~/.viminfo |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
84 function! ResCur() |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
85 if line("'\"") <= line("$") |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
86 normal! g`" |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
87 return 1 |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
88 endif |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
89 endfunction |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
90 augroup resCur |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
91 autocmd! |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
92 autocmd BufWinEnter * call ResCur() |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
93 augroup END |
451
abb434518e1f
Always start editing git commit message from line 1.
Edho Arief <edho@myconan.net>
parents:
448
diff
changeset
|
94 autocmd BufWinEnter .git/COMMIT_EDITMSG exe "normal! gg" |
418
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
95 endif |
424 | 96 |
97 if has('statusline') | |
98 " Status line detail: | |
99 " %f file path | |
100 " %y file type between braces (if defined) | |
101 " %([%R%M]%) read-only, modified and modifiable flags between braces | |
102 " %{'!'[&ff=='default_file_format']} | |
103 " shows a '!' if the file format is not the platform | |
104 " default | |
105 " %{'$'[!&list]} shows a '*' if in list mode | |
106 " %{'~'[&pm=='']} shows a '~' if in patchmode | |
107 " (%{synIDattr(synID(line('.'),col('.'),0),'name')}) | |
108 " only for debug : display the current syntax item name | |
109 " %= right-align following items | |
110 " #%n buffer number | |
111 " %l/%L,%c%V line number, total number of lines, and column number | |
112 function SetStatusLineStyle() | |
113 if &stl == '' || &stl =~ 'synID' | |
114 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}%{'~'[&pm=='']}%=#%n %l/%L,%c%V " | |
115 else | |
116 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]} (%{synIDattr(synID(line('.'),col('.'),0),'name')})%=#%n %l/%L,%c%V " | |
117 endif | |
118 endfunc | |
119 " Switch between the normal and vim-debug modes in the status line | |
120 nmap _ds :call SetStatusLineStyle()<CR> | |
121 call SetStatusLineStyle() | |
122 " Window title | |
123 if has('title') | |
124 set titlestring=%t%(\ [%R%M]%) | |
125 endif | |
126 endif |