-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
83 lines (68 loc) · 1.93 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
set nocompatible
filetype off
set expandtab
set softtabstop=2
set shiftwidth=2
set tabstop=2
set tw=102
set backupdir=~/.vim/temp
set directory=~/.vim/temp
let mapleader=","
colorscheme koehler
set ai
set ruler
set showcmd
set hlsearch
filetype plugin indent on
syntax on
au BufRead,BufNewFile {Capfile,Gemfile,Vagrantfile,Rakefile,Thorfile,config.ru,.caprc,.irbrc,irb_tempfile*} set ft=ruby
au BufRead,BufNewFile {*.jbuilder,*.rabl,*.rubyxl,*.etl} setf ruby
au BufRead,BufNewFile *.go set filetype=go
au BufNewFile,BufRead *.jst set syntax=jst
au BufRead,BufNewFile *.md set filetype=markdown
au BufRead,BufNewFile *.port set filetype=python
set relativenumber
function! NumberToggle()
if(&relativenumber == 1)
set number
set norelativenumber
else
if(&number == 1)
set nonumber
set norelativenumber
else
set nonumber
set relativenumber
endif
endif
endfunc
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
nmap <F1> :echo<CR>
imap <F1> <C-o>:echo<CR>
map <F1> :r! reattach-to-user-namespace pbpaste
nnoremap <F2> :call NumberToggle()<cr>
nmap <F4> :vsplit<bar>wincmd l<bar>exe "norm! Ljz<c-v><cr>"<cr>:set scb<cr>:wincmd h<cr>:set scb<cr>
map <F7> :set spell!
map <F9> :noh
map <down> <nop>
map <left> <nop>
map <right> <nop>
map <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
imap <up> <nop>
nnoremap <Space> :
nmap <silent> <C-N> :silent noh<CR>
nmap <S-Enter> O<Esc>
nmap <CR> o<Esc>
autocmd BufReadPost,FileReadPost,BufNewFile * call system("tmux rename-window " . expand("%:t"))
autocmd VimLeave * call system("tmux rename-window bash")
autocmd FileType c,cpp,java,php,ruby,python autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
autocmd BufWritePre *.coffee,*.scss,*.js,*.css,*.erb,*.yml :call <SID>StripTrailingWhitespaces()
autocmd Filetype python setl expandtab tabstop=2 shiftwidth=2