-
Notifications
You must be signed in to change notification settings - Fork 4
/
vimrc
176 lines (150 loc) · 6.09 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
173
174
175
set nocompatible " Enables Vim specific features
filetype off " Reset filetype detection
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" This is the Vundle package, which can be found on GitHub.
" For GitHub repos, you specify plugins using the
" 'user/repository' format
Plugin 'VundleVim/Vundle.vim'
Plugin 'fatih/vim-go'
let g:go_fmt_command = "goimports"
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_types = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_structs = 1
let g:go_highlight_interfaces = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_generate_tags = 1
let g:go_auto_sameids = 0 " FIXME: breaks visual selections
let g:go_fold_enable = ['block', 'import', 'varconst', 'package_comment']
let g:go_gopls_enabled = 1
nnoremap gp :GoDefPop<CR>
"let g:go_gopls_options = ["-rpc.trace", "-logfile=/tmp/gopls.log", "-debug=localhost:8099"]
"let g:go_debug=['lsp', 'shell-commands']
Plugin 'Valloric/YouCompleteMe'
let g:ycm_gopls_binary_path = 'gopls' " use $PATH
call vundle#end()
filetype plugin indent on " Re-enable filetype detection
set bg=dark " I like dark backgrounds
set ttyfast " Indicate fast terminal conn for faster redraw
set laststatus=1 " Show status line iff 2+ windows
set modeline " Allow file-embedded modelines
set hlsearch " Highlight search terms
set showcmd " Show last command
set completeopt=menuone " Show insertion menu for completions
set list " Show listchars
set listchars=tab:>-,trail:_ " Render tabs and trailing spaces
set tabstop=4 " Tab width
set shiftwidth=4 " How much to shoft text
set ai " Auto-indent
syn on " Syntax highlighting
set textwidth=78 " Default text width
set formatoptions+=t " Textwidth formatting
set backspace=indent,eol,start " Makes backspace key more powerful
set autowrite " Automatically save before :next, :make etc.
set cursorline " Highlight the current line
set formatoptions+=j " Elide comment-leader when joining comment lines
set maxmempattern=10000 " Let plugins use more memory for things like syntax
set foldmethod=indent " FIXME: "syntax" is better but suuuuuuper slow
set nofoldenable
set foldlevel=50
set timeoutlen=1000 ttimeoutlen=0 " kill some flicker
set signcolumn=number " show errors in the line-num column
" Center search results
nnoremap n nzz
nnoremap N Nzz
" diff colors
hi diffAdded ctermfg=green
hi diffRemoved ctermfg=red
" Popup menu colors
highlight Pmenu ctermfg=15 ctermbg=0 guifg=#ffffff guibg=#000000
highlight PmenuSel ctermfg=15 ctermbg=4 guifg=#ffffff guibg=#000000
" Go error messages
highlight SpellBad term=standout cterm=bold ctermfg=7 ctermbg=1 guifg=White guibg=Red
" Keyboard shortcuts
nnoremap % :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR>
" Jump to next window
nnoremap ww :wincmd w<CR>
" Jump to next/prev file
nnoremap <Tab> :bnext<CR>
nnoremap <S-Tab> :bprevious<CR>
" Go to begin/end
nnoremap gb [{
nnoremap ge ]}
nnoremap gt :GoDefType<CR>
" gd is already mapped to :GoDef
if has("autocmd")
" When editing a file, always jump to the last cursor position
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" markdown
au BufRead,BufNewFile *.md set filetype=markdown
" go
au FileType go setl tabstop=4
au FileType go setl shiftwidth=4
au FileType go setl formatoptions-=t " No textwidth formatting
au FileType go setl number
au FileType go setl nolist
" yaml
au FileType yaml setl indentkeys-=<:>
au FileType yaml setl tabstop=2
au FileType yaml setl shiftwidth=2
au FileType yaml setl expandtab
au FileType yaml setl number
" sh
au FileType sh setl expandtab
au FileType sh setl tabstop=4
au FileType sh setl shiftwidth=4
au FileType sh setl list
"""-au FileType python setlocal errorformat=%+P[%f],%t:\ %#%l:%m
"""-au FileType python setlocal makeprg=/home/build/static/projects/gpylint/gpylint.par\ %
"""-
"""-" make tw=0 when lines in the file are already longer than 80.
"""-" see :help fo-table
"""-au BufEnter * setlocal formatoptions+=l
"""-
"""-augroup cprog
"""- " Remove all cprog autocommands
"""- au!
"""-
"""- " When starting to edit a file:
"""- " For *.c and *.h files set formatting of comments and set C-indenting on.
"""- " For other files switch it off.
"""- " Don't change the order, it's important that the line with * comes first.
"""-
"""- " i dont like cindent autoindent is fine with me.
"""- " autocmd BufRead * set formatoptions=tcql nocindent comments&
"""- " autocmd BufRead *.c,*.h set formatoptions=croql nocindent ai comments=sr:/*,mb:*,el:*/,://
"""- "autocmd BufRead *.c,*.h,*.C,*.cc set formatoptions=croql cindent cinoptions={4 shiftwidth=4 comments=sr:/*,mb:*,el:*/,://
"""- "autocmd BufRead *.c,*.h,*.C,*.cc syn region myFold start="{" end="}" transparent fold
"""-" autocmd BufRead *.c,*.h,*.C,*.cc syn region myFold start="/\*" skip="/\*" end="\*/" transparent fold
"""- "autocmd BufRead *.c,*.h,*.C,*.cc syn region myComment start=.^/\*. skip=./\*. end=.\*/. fold
"""- "autocmd BufRead *.c,*.h,*.C,*.cc hi def link myComment Comment
"""-
"""- "autocmd BufRead *.c,*.h,*.C,*.cc syn sync fromstart
"""- "autocmd BufRead *.c,*.h,*.C,*.cc set foldmethod=syntax
"""-augroup END
"""-
function! Marks()
marks
echo('Mark: ')
" getchar() - prompts user for a single character and returns the chars
" ascii representation
" nr2char() - converts ASCII `NUMBER TO CHAR'
let s:mark = nr2char(getchar())
" remove the `press any key prompt'
redraw
" build a string which uses the `normal' command plus the var holding the
" mark - then eval it.
execute "normal! '" . s:mark
endfunction
nnoremap ' :call Marks()<CR>
source ~/.exrc
"""-:set textwidth=78
"""-:set expandtab
"""-:set fileformats=unix,dos
"""-:set viminfo='50,<200,/100
"""-:set history=50