-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
172 lines (137 loc) · 3.92 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
"vim needs a posix compliant shell
if &shell =~# 'fish$'
set shell=/bin/bash
endif
"if has('python3')
command! -nargs=1 Py py3 <args>
set pythonthreedll=/usr/local/Frameworks/Python.framework/Versions/Current/Python
"endif
"pathogen init
runtime macros/matchit.vim
runtime bundle/vim-pathogen/autoload/pathogen.vim
execute pathogen#infect()
filetype plugin indent on
"prevents some security exploits having to do with modelines
set modelines=3
"tab settings
set tabstop=2
set expandtab
set shiftwidth=2
set softtabstop=2
" Add line numbers
set number
set ruler
"relative ruler
"set relativenumber
" disable swp files \o/
set noswapfile
set nobackup
"scroll when the cursor is three lines from the bottom/top
set scrolloff=3
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" Set encoding
set encoding=utf-8
"color stuff
syntax on
set t_Co=256
set background=dark
let g:molokai_original = 0
colorscheme molokai
set linespace=2
let g:solarized_termcolors=256
"colorscheme solarized
"colorscheme smyck
"search related stuff
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set hlsearch
nnoremap <leader><space> :noh<cr>
nnoremap <tab> %
vnoremap <tab> %
"wrapping
set wrap
set showbreak=…
set linebreak
"disable arrow keys for training
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
"nnoremap j gj
"nnoremap k gk
"Use the arrows to something usefull
map <left> :BB<CR>
map <right> :BF<CR>
map <down> :BD<CR>
" use double j as ESC
inoremap jj <ESC>
let mapleader=" "
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" Shortcut to edit/reload vimrc
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
"NERDTree stuff
nmap <Leader>n :NERDTreeToggle<CR>
let NERDTreeIgnore=['^tmp$', '^.git$']
let NERDTreeShowHidden=1
"autocmd vimenter * if !argc() | NERDTree | endif
"autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" make uses real tabs
autocmd FileType make set noexpandtab
" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
"autocmd BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
if has("win32")
command! -bar Fullscreen :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
endif
" vim-rhubarb
let g:github_enterprise_urls = ['https://github.wdf.sap.corp']
"go specific stuff
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <Leader>gb <Plug>(go-doc-browser)
"Enable goimports to automatically insert import paths instead of gofm
let g:go_fmt_command = "goimports"
let g:go_highlight_functions = 1
let g:go_highlight_function_parameters = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_format_strings = 1
let g:go_auto_type_info = 1
let g:go_updatetime = 400
let g:go_auto_sameids = 1
let g:go_def_mode='gopls'
let g:go_info_mode='gopls'
let g:go_metalinter_command = 'golangci-lint'
let g:go_metalinter_enabled = []
let g:SuperTabDefaultCompletionType = "context"
set completeopt-=preview
"dash search mapping
:nmap <silent> <leader>d <Plug>DashSearch
"spell checking
set spelllang=en
set spellfile=$HOME/dotfiles/vim/spell/en.utf-8.add
au BufNewFile,BufRead,BufEnter *.md setlocal spell
au BufNewFile,BufRead,BufEnter *.slide setlocal spell
nmap <F12> :TagbarToggle<CR>
set exrc
set secure