-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.vimrc
More file actions
107 lines (99 loc) · 3.02 KB
/
.vimrc
File metadata and controls
107 lines (99 loc) · 3.02 KB
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
102
103
104
105
106
107
set encoding=utf-8
"""""""""""""""""""""""""
" KEYBINDINGS
"""""""""""""""""""""""""
let mapleader=","
let localmapleader=","
map <Leader>s :w<CR>
map <Leader>q :wqa<CR>
map <Leader>[ :tabprevious<cr>
map <Leader>] :tabnext<cr>
nnoremap <F9> :!%:p
nnoremap <leader>r :!ruby %:p
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
" window
nmap <leader>sw<left> :topleft vnew<CR>
nmap <leader>sw<right> :botright vnew<CR>
nmap <leader>sw<up> :topleft new<CR>
command! Q q " Bind :Q to :q
command! Qall qall
"""""""""""""""""""""""""
" Basic features
"""""""""""""""""""""""""
" Display options
syntax on
set pastetoggle=<F12>
set number
set list! " Display unprintable characters
set listchars=tab:▸\ ,trail:•,extends:»,precedes:«
if $TERM =~ '256color'
set t_Co=256
elseif $TERM =~ '^xterm$'
set t_Co=256
endif
" Misc
filetype plugin indent on " Do filetype detection and load custom file plugins and indent files
" Always edit file, even when swap file is found
set shortmess+=A
set hidden " Don't abandon buffers moved to the background
set wildmenu " Enhanced completion hints in command line
set backspace=eol,start,indent " Allow backspacing over indent, eol, & start
set complete=.,w,b,u,U,t,i,d " Do lots of scanning on tab completion
set directory=~/.vim/swap " Directory to use for the swap file
set diffopt=filler,iwhite " In diff mode, ignore whitespace changes and align unchanged lines
set nowrap
set visualbell
set mouse=a
" Indentation and tabbing
set autoindent smartindent
set smarttab " Make <tab> and <backspace> smarter
set tabstop=2
set shiftwidth=2
set expandtab
set incsearch
set magic
" viminfo: remember certain things when we exit
" (http://vimdoc.sourceforge.net/htmldoc/usr_21.html)
" % : saves and restores the buffer list
" '100 : marks will be remembered for up to 30 previously edited files
" /100 : save 100 lines from search history
" h : disable hlsearch on start
" "500 : save up to 500 lines for each register
" :100 : up to 100 lines of command-line history will be remembered
" n... : where to save the viminfo files
set viminfo=%100,'100,/100,h,\"500,:100,n~/.vim/viminfo
" Undo
set undolevels=10000
if has("persistent_undo")
set undodir=~/.vim/undo " Allow undoes to persist even after a file is closed
set undofile
endif
" Search settings
set ignorecase
set smartcase
set hlsearch
set incsearch
set showmatch
" to_html settings
let html_number_lines = 1
let html_ignore_folding = 1
let html_use_css = 1
"let html_no_pre = 0
"let use_xhtml = 1
let xml_use_xhtml = 1
"""""""""""""""""""""""""
" Custom functions
"""""""""""""""""""""""""
" When opening a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif |
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction