Przeglądaj źródła

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

 * set comments for Haskell & Ruby
 * highlight *.md files as Markdown
Lucas Stadler 14 lat temu
rodzic
commit
3153343414
1 zmienionych plików z 36 dodań i 3 usunięć
  1. 36 3
      .vimrc

+ 36 - 3
.vimrc

@ -3,15 +3,45 @@ set autoindent
3 3
4 4
" Incremental search is *awesome*
5 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 12
" Have tabs 3 chars long...
8 13
set tabstop=3
9 14
set shiftwidth=3
15
set smarttab
10 16
17
" Copy indent of the last line.
11 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 46
" Don't let me further than 1 line towards the end or the beginning.
17 47
set scrolloff=1
@ -41,7 +71,9 @@ noremap <Space> :NERDTree<CR>
41 71
noremap <c-b> :make<CR>
42 72
noremap <c-t> :CommandT<CR>
43 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 78
""" Filetype specific stuff comes now...
47 79
@ -69,6 +101,7 @@ au BufNewFile,BufRead *.{hs,lhs,chs} set ts=4 sw=4 expandtab
69 101
autocmd BufNewFile,BufRead *.{html,css,xml} runtime plugin/zencoding.vim
70 102
71 103
autocmd BufNewFile,BufRead *.arc set ft=lisp
104
autocmd BufNewFile,BufRead *.md set ft=markdown
72 105
73 106
" Make folds a little more acceptable :)
74 107
highlight Folded ctermbg=255