-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
76 lines (69 loc) · 1.62 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
" Seth Larson's vimrc
call pathogen#runtime_append_all_bundles()
set nocompatible
set hidden
set history=10000
set shell=bash
set ignorecase smartcase
set cursorline
set expandtab
set backspace=indent,eol,start
set tabstop=2
set softtabstop=2
set shiftwidth=2
set winwidth=79
set showtabline=2 "always display the tabline
set showcmd
set backup
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set wildmode=longest,list
set wildmenu
autocmd FileType make setlocal noexpandtab
syntax on
let mapleader=","
" Colors
:set t_Co=256
:set background=dark
""""""""""""""
" Key bindings
""""""""""""""
imap <c-l> <space>=><space>
imap <c-c> <esc>
:nnoremap <CR> :nohlsearch<cr>
cnoremap %% <C-R>=expand('%:h').'/'<cr>
map <leader>e :edit %%
map <leader>v :view %%
""""""""""""""""""""""
" Multipurpose Tab Key
""""""""""""""""""""""
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
inoremap <s-tab> <c-n>
"""""""""""""""""
" Training Wheels
"""""""""""""""""
map <Left> :echo "Surely you meant h"<cr>
map <Right> :echo "Surely you meant l"<cr>
map <Up> :echo "Surely you meant k"<cr>
map <Down> :echo "Surely you meant j"<cr>
"""""""""""""
" Rename File
"""""""""""""
function! RenameFile()
let old_name = expand('%')
let new_name = input('New name: ', expand('%'))
if new_name != '' && new_name != old_name
exec ':saveas ' . new_name
exec ':silent ~rm ' . old_name
redraw!
endif
endfunction
map <leader>n :call RenameFile()<cr>