-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
134 lines (105 loc) · 3.27 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
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
" backwards compatibility is dumb
set nocompatible
" load vundle
if filereadable(expand("~/.vim/vundle.vim"))
source ~/.vim/vundle.vim
endif
" needed to make vim load zshrc
set shell=zsh
" always use utf-8 for everything
set encoding=utf-8 " encoding used to represent/display characters
set fileencoding=utf-8 " encoding used when reading/writing files
" why are these not the defaults
set number " line numbers
set cursorline " highlight the current line
set backspace=indent,eol,start " make the delete key act sane
set visualbell " don't beep
set autoread " reload files when changed
" status line
set showcmd " show incomplete commands
set showmode " show the current mode
set laststatus=2 " always show the status line
set ruler " show the position of the cursor
" command completion
set wildmenu " enable command completion
set wildmode=list:longest,full " show longest matching string first
" ignore file patterns
set wildignore+=*.pyc
" set the terminal's title
set title
" This makes vim act like all other editors, buffers can
" exist in the background without being in a window.
" http://items.sjbach.com/319/configuring-vim-right
set hidden
" syntax colouring
syntax on
set background=dark
colorscheme Tomorrow-Night-Bright
" make comma the leader key
let mapleader=","
" turn off swapfiles
set noswapfile
set nobackup
set nowb
" make indentation not suck
set autoindent
set smartindent
set smarttab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
" line wrapping
set wrap " soft-wrap lines automatically
set linebreak " don't wrap in the middle of words
set colorcolumn=81 " display a guide at the 80th column
" search
set incsearch " incremental search (search as you type)
set hlsearch " highlight search results
set ignorecase " default to case-insensitive search
set smartcase " searching for capital letters switches to case-sensitive
""""""""""""""""""""""""""""""""""""""""
" KEYBINDINGS
""""""""""""""""""""""""""""""""""""""""
" reload vimrc
nnoremap <leader>rc :source $MYVIMRC<return>
" reload gvimrc
nnoremap <leader>rg :source $MYGVIMRC<return>
" open and switch to a new split
nnoremap <leader>sv <C-w>v<C-w>l
nnoremap <leader>s <C-w>s<C-w>j
" kill trailing whitespace
nnoremap <leader>w :%s/\s\+$//<cr>:let @/=''<CR>
" toggle search highlights
nnoremap <C-f> :set hlsearch!<CR>
" use tab to jump between do/end etc.
nnoremap <tab> %
vnoremap <tab> %
""""""""""""""""""""""""""""""""""""""""
" PLUGIN CONFIGURATION
""""""""""""""""""""""""""""""""""""""""
" ack.vim
nnoremap <leader>a :Ack<space> " Use ',a' to run an Ack search.
" ctrl-p
" keybindings
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" search in the root directory of the current project
" 'r' == nearest ancestor path with version control
" 'a' == directory of current file, unless shell CWD isn't direct ancestor
let g:ctrlp_working_path_mode = 'ra'
" open files created with ctrl-y in the current panel
let g:ctrlp_open_new_file = 'r'
" load extensions
let g:ctrlp_extensions = ['funky']
" powerline
if has('python')
python << endpython
try:
from powerline.vim import setup as powerline_setup
powerline_setup()
del powerline_setup
except ImportError:
print("To enable Powerline, run:\npip install powerline-status")
endpython
endif