dot rc

Sign in or create your account | Project List | Help

dot rc Git Source Tree

Root/rc/vimrc

Source at commit fd4cee4d3f5fb2f73b2fd4a509ba72368ad445a2 created 3 years 4 months ago.
By Luciano M. F. Rocha, vim: break hardlinks on copy
1" vim:et:sw=2:ts=2
2" Use Vim settings, rather than Vi settings, must be the first option
3" for its side effects.
4set nocompatible
5
6" check for Byte-Order-Mark, then utf8, and finally assume latin1
7set fileencodings=ucs-bom,utf-8,latin1
8" force encoding when reading/writing with:
9" :e|w ++enc=encoding file
10
11" allow backspacing over everything in insert mode
12set backspace=indent,eol,start
13
14set nobackup " do not keep a backup file
15set backupcopy=auto,breakhardlink " break hardlinks on write
16set history=50 " keep 50 lines of command line history
17set ruler " show the cursor position all the time
18set showcmd " display incomplete commands
19set incsearch " do incremental searching
20set nohlsearch " don't highlight search matches
21set showmatch " jump to matching bracket when inserting one
22set wildmenu " tab completion shows options above command line
23"
24"disabled: let filetype define it
25"set smartindent " do smart autoindenting when starting a new line
26
27syntax on " switch syntax highlighting on
28
29" Q, by default, switches to Ex mode; make it reformat the current paragraph
30" instead (more useful)
31map Q gqap
32
33" Map F1 to the ESC key in insert mode, and Help otherwise
34" together)
35imap <esc>[11~ <esc>
36map <esc>[11~ :h
37
38" F7 macro for toggling between syntax on and off
39map <F7> :if exists("syntax_on") <Bar>
40    \ syntax off <Bar>
41    \ else <Bar>
42    \ syntax enable <Bar>
43    \ endif <CR>
44
45" make grep also work well with a single file
46set grepprg=grep\ -nH\ $*
47
48" syntax highlighting inside C comment strings
49let c_comment_strings=1
50
51" assume sh is bash
52let g:is_bash=1
53
54" for zenburn, assume running in a bright environment
55"let g:zenburn_high_Contrast = 1
56
57" In many terminal emulators the mouse works just fine, thus enable it.
58" conflicts with c&p, disabled
59"set mouse=a
60
61" Convenient command to see the difference between the current buffer and the
62" file it was loaded from, thus the changes you made.
63command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
64                \ | wincmd p | diffthis
65
66" use cscope if available
67if has("cscope") && filereadable("/usr/bin/cscope")
68   set csprg=/usr/bin/cscope
69   set csto=0
70   set cst
71   set nocsverb
72   " add any database in current directory
73   if filereadable("cscope.out")
74      cs add cscope.out
75   " else add database pointed to by environment
76   elseif $CSCOPE_DB != ""
77      cs add $CSCOPE_DB
78   endif
79   set csverb
80endif
81
82" Only do this part when compiled with support for autocommands.
83if has("autocmd")
84
85  " Enable file type detection.
86  " Use the default filetype settings, so that mail gets 'tw' set to 72,
87  " 'cindent' is on in C files, etc.
88  " Also load indent files, to automatically do language-dependent indenting.
89  filetype plugin indent on
90
91  " prevent duplication of autocommands
92  if !exists("autocommands_loaded")
93    let autocommands_loaded = 1
94
95    " For all text files set 'textwidth' to 78 characters.
96    autocmd FileType text setlocal textwidth=78
97
98    " When editing a file, always jump to the last known cursor position.
99    " Don't do it when the position is invalid or when inside an event handler
100    " (happens when dropping a file on gvim).
101    autocmd BufReadPost *
102      \ if line("'\"") > 0 && line("'\"") <= line("$") |
103      \ exe "normal g`\"" |
104      \ endif
105
106    " indent style used by subversion authors
107    au BufNewFile,BufRead ~/work/subversion/**/*.[ch]
108      \ setlocal cinoptions={.5s,:.5s,+.5s,t0,g0,^-2,e-2,n-2,p2s,(0,=.5s
109      \ formatoptions=croql cindent shiftwidth=4 tabstop=8
110
111    " use git styles for git commit message
112    au BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit
113
114    " load personal commands for all files
115    au BufEnter * runtime! my/*.vim
116
117  endif
118else " no autocmd
119
120  set autoindent "always set autoindenting on
121
122endif " autocmd
123

Archive Download this file

Branches:
master