Просмотр исходного кода

~/.vimrc: textwidth only in comments plus a few other fixes.

 * set comments for Haskell & Ruby
 * highlight *.md files as Markdown
Lucas Stadler лет назад: 14
Родитель
Сommit
3153343414
1 измененных файлов с 36 добавлено и 3 удалено
  1. 36 3
      .vimrc

+ 36 - 3
.vimrc

3
3
4
" Incremental search is *awesome*
4
" Incremental search is *awesome*
5
set incsearch
5
set incsearch
6
set ignorecase " ignore case
7
set smartcase " unless pattern contains uppercase
8
9
" Some wildcard tweaking
10
set wildignore=*.hi,*.o
6
11
7
" Have tabs 3 chars long...
12
" Have tabs 3 chars long...
8
set tabstop=3
13
set tabstop=3
9
set shiftwidth=3
14
set shiftwidth=3
15
set smarttab
10
16
17
" Copy indent of the last line.
11
set copyindent
18
set copyindent
12
19
13
" Wrap lines automatically
14
set textwidth=72
20
" Show whitespace
21
set list listchars=tab:»·,trail:·
22
23
" Keep a longer history
24
set history=100
25
26
" Wrap lines in textfiles automatically.
27
" (Any way to enable in comments?)
28
au FileType text set textwidth=72
29
30
function! g:setTextWidthInComments()
31
	" Capture new position
32
	let g:curTextPosition = synIDattr(synIDtrans(synID(line("."), col("."), 0)), "name")
33
34
	if( g:curTextPosition == "Comment" )
35
		set textwidth=72
36
	else
37
		set textwidth=0
38
	endif
39
endfunction
40
41
autocmd CursorMoved * :call g:setTextWidthInComments()
42
43
au BufNewFile,BufRead *.{hs,lhs} set comments=:--,sr:{-,ex:-}
44
au BufNewFile,BufRead *.rb set comments=:#,s:=begin,e:=end
15
45
16
" Don't let me further than 1 line towards the end or the beginning.
46
" Don't let me further than 1 line towards the end or the beginning.
17
set scrolloff=1
47
set scrolloff=1
41
noremap <c-b> :make<CR>
71
noremap <c-b> :make<CR>
42
noremap <c-t> :CommandT<CR>
72
noremap <c-t> :CommandT<CR>
43
noremap <c-n> :tabnew<CR>:CommandT<CR>
73
noremap <c-n> :tabnew<CR>:CommandT<CR>
44
noremap <c-f> :!ack 
74
noremap <c-f> :!ack
75
nmap <c-a> :w<CR>
76
noremap <Leader>t :TagbarOpen<CR>
45
77
46
""" Filetype specific stuff comes now...
78
""" Filetype specific stuff comes now...
47
79
69
autocmd BufNewFile,BufRead *.{html,css,xml} runtime plugin/zencoding.vim
101
autocmd BufNewFile,BufRead *.{html,css,xml} runtime plugin/zencoding.vim
70
102
71
autocmd BufNewFile,BufRead *.arc set ft=lisp
103
autocmd BufNewFile,BufRead *.arc set ft=lisp
104
autocmd BufNewFile,BufRead *.md set ft=markdown
72
105
73
" Make folds a little more acceptable :)
106
" Make folds a little more acceptable :)
74
highlight Folded ctermbg=255
107
highlight Folded ctermbg=255