-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
158 lines (132 loc) · 3.77 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
" Go away VI!
set nocompatible
set shell=/bin/sh
" <Vundle stuff>
filetype off
set rtp+=~/.config/nvim/bundle/Vundle.vim
call vundle#begin('~/.config/nvim/bundle')
" </Vundle stuff>
" Plugins
Plugin 'majutsushi/tagbar'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'tpope/vim-sleuth'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
"Plugin 'fatih/vim-go'
Plugin 'airblade/vim-gitgutter'
"Plugin 'w0rp/ale'
Plugin 'tomasr/molokai'
"Plugin 'qpkoor/vim-bufkill'
Plugin 'editorconfig/editorconfig-vim'
" <Vundle stuff>
call vundle#end()
filetype plugin indent on
" </Vundle stuff>
" Colorscheme
set bg=dark
set t_Co=256
let g:molokai_original = 1
let g:rehash256 = 1
colorscheme molokai
" Plugin config
let g:airline_theme = 'powerlineish'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let NERDTreeIgnore = ['\.o$', '\.pyc$']
" Line-wrap, tabs, bracket matching
set wrap
set linebreak
set noexpandtab
set shiftwidth=8
set tabstop=8
set autoindent
set copyindent
set showmatch
" Show evil characters
set list
set listchars=tab:\ \ ,trail:.,nbsp:.
" Default encoding
set encoding=utf8 nobomb
set fileencoding=utf8
" Search
set hlsearch " Highlight search
set incsearch " Incremental search
set ignorecase " Ignore case normally
set smartcase " Become case sensitive if you type upper-case letters
set smarttab
" Visual stuff
syntax on
set cursorline " Highlights line with cursor
set number ruler " Shows line numbers
set modeline " Shows modeline (the thing on the second last line
set showtabline=2 " Tabline (Thing on the top
set laststatus=2 " Always show status bar
set mouse=a " Enable mouse in all modes
set fillchars+=vert:│ " Make the vertical split continuous
" Fix mouse
if has('mouse_sgr')
set ttymouse=sgr
endif
" Vim stuff
set backupdir=~/.cache/nvim/backup " Backup store
"set directory=~/.cache/nvim/swap " Swap store
set noswapfile
set noundofile
set backspace=indent,eol,start " Change backspace behaviour to be more sensible
set whichwrap+=<,>,[,] " Allow left/right cursor at SOL/EOL to do as expected
set shortmess=atI " Slighty change dialogues, suppress intro
set wildmenu " Enhance command line completion
set clipboard=unnamed " Use OS clipboard by default
set hidden " Allow hidden buffers
if !empty($DISPLAY)
set clipboard=unnamedplus
endif
" Helper functions
function! LineHome()
let x = col('.')
execute "normal ^"
if x == col('.')
execute "normal 0"
endif
return ""
endfunction
command! CloseHiddenBuffers call s:CloseHiddenBuffers()
function! s:CloseHiddenBuffers()
let open_buffers = []
for i in range(tabpagenr('$'))
call extend(open_buffers, tabpagebuflist(i + 1))
endfor
for num in range(1, bufnr("$") + 1)
if buflisted(num) && index(open_buffers, num) == -1 && getbufvar(num, '&mod') == 0
exec "bdelete ".num
endif
endfor
endfunction
"
" Mappings
"
" Visual-line navigation
noremap <silent> k gk
noremap <silent> j gj
noremap <silent> <Up> gk
noremap <silent> <Down> gj
" C-a/C-e home/end handling
map <silent> <C-e> <End>
imap <silent> <C-e> <End>
map <silent> <C-a> <Home>
nmap <silent> <C-a> :call LineHome()<CR>
imap <silent> <C-a> <C-R>=LineHome()<CR>
" C-z as undo - Disables ability to suspend VIM
"map <C-z> :normal u<CR>
"imap <C-z> <C-o>u
" Command-z/Command-Shift-z undo/redo
map <D-z> :normal u<CR>
imap <D-z> <C-o>u
map <D-S-z> <C-r>
imap <D-S-z> <C-o><C-r>
nmap <C-t> :FZF ~/src<CR>
if has('nvim')
tmap <C-g><C-c> <C-\><C-n>
endif