-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
94 lines (71 loc) · 2.43 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
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-endwise'
Plugin 'Raimondi/delimitMate'
Plugin 'scrooloose/nerdtree'
Plugin 'skalnik/vim-vroom'
Plugin 'kien/ctrlp.vim'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'fullybaked/toggle-numbers.vim'
Plugin 'Shougo/neocomplete.vim'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
call vundle#end() " required
" =========================== Settings ===========================
set nocompatible " be iMproved, required
filetype off " required
syntax on
set noswapfile
"No sounds
set visualbell
set shortmess+=I
set softtabstop=2
set tabstop=2 shiftwidth=2 expandtab
set expandtab " use spaces, not tabs (optional)
set rnu
let g:neocomplete#enable_at_startup = 1
" Detect file type for indentation below
:filetype indent on
" Use 2 space indentation on Ruby and YAML files
:autocmd FileType ruby,eruby,yaml,javascript,css,scss,html set ai sw=2 sts=2 et
" ================ Leader and other mappings =======================
let mapleader = "\<Space>"
"save with leader w
nnoremap <Leader>w :w<CR>
"save and quit with leader q
nnoremap <Leader>q :wq<CR>
"esc with j f, f j quickly
inoremap jf <esc>
inoremap fj <esc>
map <C-i> :NERDTreeToggle<CR>
"easy pasting
map <Leader>p :r !pbpaste<CR>
"shortcuts for Ruby debugging
map <Leader>bb orequire 'byebug'; byebug<esc>:w<cr>
map <Leader>yy orequire 'pry'; binding.pry<esc>:w<cr>
" ================ Delete whitespace function =======================
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
"associate the .es6 file extension with JavaScript
autocmd BufRead,BufNewFile *.es6 setfiletype javascript
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces() " strip trailing whitespace on save
" ================ Misc =======================
"autosave in tmux
let g:tmux_navigator_save_on_switch = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'