forked from doon/dotfiles_old
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
133 lines (110 loc) · 3.45 KB
/
vimrc
File metadata and controls
133 lines (110 loc) · 3.45 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
" Use Vim settings, rather then Vi settings (much better!).
set nocompatible
" default to utf-8
set encoding=utf-8
" load pathogen
call pathogen#infect()
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
let mapleader = "\<Space>"
" Store temporary files in a central spot
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set backup
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set ignorecase " ignore case when searching
set smartcase " unless we have at least 1 cap
set title " set our title when running in term
set showmatch
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
set hlsearch
" Press Space to turn off highlighting and clear any message already
" displayed.
:nnoremap <leader> <leader> :nohlsearch<Bar>:echo<CR>
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" treat json as javascript
au BufNewFile,BufRead *.json set ft=javascript
" go to last edit in file unless it is a git commit message
au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g`\"" | endif
autocmd BufReadPost fugitive://* set bufhidden=delete
augroup END
augroup myfiletypes
"clear old autocmds in group
autocmd!
"for ruby, autoindent with two spaces, always expand tabs
autocmd FileType ruby,haml,eruby,yaml,html,javascript,sass set ai sw=2 sts=2 et
autocmd FileType python set sw=4 sts=4 et
augroup END
endif
" Softtabs, 2 spaces
set tabstop=2 shiftwidth=2
set smarttab
set expandtab
set list listchars=tab:»·,trail:·
if has("statusline") && !&cp
" Always display the status line
set laststatus=2
set statusline=%t[%{strlen(&fenc)?&fenc:'none'},%{&ff}]%h%m%r%y\ Buf:#%n
set statusline+=%=%c,%l/%L\ %P\
set statusline+=%{fugitive#statusline()}\ \ \
endif
" No Help, please
nmap <F1> <Esc>
" Color scheme
set t_Co=256
let g:hybrid_use_iTerm_colors = 1
set background=dark
colorscheme hybrid
" Numbers
set numberwidth=4
if exists("&relativenumber")
set relativenumber
else
set number
endif
" allow background buffers w/o saving
set hidden
" Tab completion options
" (only complete to the longest unambiguous match, and show a menu)
set completeopt=longest,menu
set wildmode=list:longest,list:full
set complete=.,t
" set the command height
set cmdheight=2
" include gem tags
set tags+=gems.tags
" Yank text to the OS X clipboard
noremap <leader>y "*y
noremap <leader>yy "*Y
noremap <leader>d "*d
noremap <leader>p :set paste<CR>:put *<CR>:set nopaste<CR>
let g:rustfmt_autosave = 1
let g:rustfmt_command = '~/.cargo/bin/rustfmt'
" cleanup whitespace
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
" avoid escape
inoremap jk <Esc>
inoremap kj <Esc>
if has('nvim')
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
tnoremap <Esc> <C-\><C-n>
endif
"Local config
if filereadable(".vimrc.local")
source .vimrc.local
endif