-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
executable file
·101 lines (83 loc) · 3.57 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
" Configuration file for vim
" Startup pathogen for easy plugin setup
execute pathogen#infect()
" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=indent,eol,start " more powerful backspacing
" Now we set some defaults for the editor
set autoindent " always set autoindenting on
set tabstop=4 " 4 space tab stops
set shiftwidth=4 " 4 spaces for indentations
set expandtab " tabs really look like 4 spaces
set softtabstop=4 " BS 4 spaces like a tab
set textwidth=0 " Don't wrap words by default
set nobackup " Don't keep a backup file
set viminfo='20,\"50 " read/write a .viminfo file, don't store more than
" 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
" set textwidth=78 " Set right margin to 78 columns
" Suffixes that get lower priority when doing tab completion for filenames.
" These are files we are not likely to want to edit or read.
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
" We know xterm-debian is a color terminal
if &term =~ "xterm-debian" || &term =~ "xterm-xfree86"
set t_Co=16
set t_Sf=[3%dm
set t_Sb=[4%dm
endif
" Make p in Visual mode replace the selected text with the "" register.
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on
" Debian uses compressed helpfiles. We must inform vim that the main
" helpfiles is compressed. Other helpfiles are stated in the tags-file.
set helpfile=$VIMRUNTIME/doc/help.txt.gz
if has("autocmd")
" Enabled file type detection
" Use the default filetype settings. If you also want to load indent files
" to automatically do language-dependent indenting add 'indent' as well.
filetype plugin on
" Set yaml files to have indentation of 2
autocmd FileType yaml setlocal shiftwidth=2 tabstop=2 softtabstop=2
" Disable RedHat cursor position
augroup redhat
autocmd! BufReadPost *
augroup END
" Some Debian-specific things
augroup filetype
au BufRead reportbug.* set ft=mail
au BufRead reportbug-* set ft=mail
augroup END
endif " has ("autocmd")
" The following are commented out as they cause vim to behave a lot
" different from regular vi. They are highly recommended though.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
colorscheme elflord
" colorscheme evening
" Map key to toggle opt
function MapToggle(key, opt)
let cmd = ':set '.a:opt.'! \| set '.a:opt."?\<CR>"
exec 'nnoremap '.a:key.' '.cmd
exec 'inoremap '.a:key." \<C-O>".cmd
endfunction
command -nargs=+ MapToggle call MapToggle(<f-args>)
" Display-altering option toggles
"MapToggle <F1> hlsearch
"MapToggle <F2> wrap
"MapToggle <F3> list
" Behavior-altering option toggles
"MapToggle <F10> scrollbind
"MapToggle <F11> ignorecase
"MapToggle <F12> paste
set pastetoggle=<F12>
" display current file in two columns
noremap<silent> <F9> :<C-U>let @z=&so<CR>:set so=0<CR>maHmz:set noscb<CR>
\:vs<CR><C-W>wLzt:set scb<CR><C-W>p:set scb<CR>
\`zzt`a:let &so=@z<CR>