2020-06-21 00:07:53 +02:00
|
|
|
" {{@@ header() @@}}
|
2019-11-23 02:17:36 +01:00
|
|
|
" LEL
|
2019-12-09 19:25:42 +01:00
|
|
|
" _
|
|
|
|
" _ ____ _(_)_ __ ___
|
|
|
|
" | '_ \ \ / / | '_ ` _ \
|
2019-12-01 17:36:00 +01:00
|
|
|
" | | | \ V /| | | | | | |
|
|
|
|
" |_| |_|\_/ |_|_| |_| |_|
|
2019-12-09 19:25:42 +01:00
|
|
|
|
2019-11-23 02:17:36 +01:00
|
|
|
" Plugins{{{
|
2019-10-16 02:28:41 +02:00
|
|
|
"
|
|
|
|
" Install plug if it isn't already
|
|
|
|
if empty(glob('~/.config/nvim/autoload/plug.vim'))
|
|
|
|
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
|
|
|
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
|
|
augroup PLUG
|
|
|
|
au!
|
|
|
|
autocmd VimEnter * PlugInstall
|
|
|
|
augroup END
|
|
|
|
endif
|
|
|
|
|
|
|
|
call plug#begin('~/.config/nvim/plugged')
|
|
|
|
|
2020-06-20 18:58:49 +02:00
|
|
|
|
2019-10-16 02:28:41 +02:00
|
|
|
Plug 'airblade/vim-gitgutter'
|
|
|
|
Plug 'chrisbra/Colorizer'
|
|
|
|
|
|
|
|
|
|
|
|
" Language server support
|
2020-04-17 06:54:35 +02:00
|
|
|
"
|
2020-06-27 00:36:36 +02:00
|
|
|
{%@@ set lsp = "vim-lsp" @@%}
|
2020-06-25 08:00:04 +02:00
|
|
|
|
2020-06-27 00:36:36 +02:00
|
|
|
{%@@ if lsp == "vim-lsp" @@%}
|
2020-06-25 08:00:04 +02:00
|
|
|
Plug 'prabirshrestha/vim-lsp'
|
|
|
|
Plug 'mattn/vim-lsp-settings'
|
|
|
|
|
|
|
|
Plug 'prabirshrestha/asyncomplete.vim'
|
|
|
|
Plug 'prabirshrestha/asyncomplete-lsp.vim'
|
2020-09-20 18:17:25 +02:00
|
|
|
" Plug 'prabigshrestha/asyncomplete-file.vim'
|
2020-09-20 03:43:28 +02:00
|
|
|
|
|
|
|
Plug 'SirVer/ultisnips'
|
|
|
|
Plug 'prabirshrestha/async.vim'
|
|
|
|
Plug 'thomasfaingnaert/vim-lsp-snippets'
|
|
|
|
Plug 'thomasfaingnaert/vim-lsp-ultisnips'
|
|
|
|
|
|
|
|
let g:UltiSnipsExpandTrigger="<tab>"
|
|
|
|
let g:UltiSnipsJumpForwardTrigger="<tab>"
|
|
|
|
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
|
|
|
|
|
|
|
|
set completeopt+=menuone
|
|
|
|
set cot+=preview
|
2020-06-27 00:36:36 +02:00
|
|
|
{%@@ elif lsp == "coc" @@%}
|
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
|
|
{%@@ endif @@%}
|
|
|
|
|
|
|
|
Plug 'sheerun/vim-polyglot'
|
2020-04-17 06:54:35 +02:00
|
|
|
|
|
|
|
" Plug 'autozimu/LanguageClient-neovim', {
|
|
|
|
" \ 'branch': 'next',
|
|
|
|
" \ 'do': 'bash install.sh',
|
|
|
|
" \}
|
2019-10-16 02:28:41 +02:00
|
|
|
|
2020-03-13 03:13:31 +01:00
|
|
|
" Debugger
|
2020-08-20 07:10:31 +02:00
|
|
|
let g:vimspector_install_gadgets = [ 'debugpy', 'vscode-cpptools', 'CodeLLDB' ]
|
|
|
|
let g:vimspector_enable_mappings = 'HUMAN'
|
|
|
|
Plug 'puremourning/vimspector'
|
2020-03-13 03:13:31 +01:00
|
|
|
|
2019-10-16 02:28:41 +02:00
|
|
|
" Fuzzy find
|
2020-06-20 18:58:49 +02:00
|
|
|
Plug 'junegunn/fzf'
|
|
|
|
Plug 'junegunn/fzf.vim'
|
2019-10-16 02:28:41 +02:00
|
|
|
|
|
|
|
" Completions
|
2020-09-20 03:43:28 +02:00
|
|
|
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
2020-04-17 06:54:35 +02:00
|
|
|
|
2020-06-27 00:36:36 +02:00
|
|
|
" HTML shortcuts
|
|
|
|
Plug 'mattn/emmet-vim'
|
|
|
|
|
2020-09-19 23:26:04 +02:00
|
|
|
Plug 'jiangmiao/auto-pairs'
|
2020-04-17 06:54:35 +02:00
|
|
|
Plug 'tpope/vim-surround'
|
2020-06-27 00:36:36 +02:00
|
|
|
Plug 'junegunn/vim-easy-align'
|
2019-10-16 02:28:41 +02:00
|
|
|
Plug 'tpope/vim-commentary'
|
2019-12-09 19:25:42 +01:00
|
|
|
|
2019-10-16 02:28:41 +02:00
|
|
|
" Status bar
|
2020-06-24 06:08:16 +02:00
|
|
|
Plug 'vim-airline/vim-airline'
|
2019-12-09 19:25:42 +01:00
|
|
|
" Plug 'vim-airline/vim-airline-themes'
|
2020-06-27 00:36:36 +02:00
|
|
|
{%@@ if lsp == "ale" @@%}
|
|
|
|
let g:airline#extensions#ale#enabled = 1
|
|
|
|
{%@@ endif @@%}
|
2019-10-16 02:28:41 +02:00
|
|
|
|
|
|
|
" Bufferlist (integrates with airline)
|
2020-06-24 06:08:16 +02:00
|
|
|
" Plug 'bling/vim-bufferline'
|
2019-10-16 02:28:41 +02:00
|
|
|
|
|
|
|
" Color scheme
|
|
|
|
Plug 'dikiaap/minimalist'
|
2020-06-27 00:36:36 +02:00
|
|
|
" Plug 'morhetz/gruvbox' " Not that good
|
2019-10-16 02:28:41 +02:00
|
|
|
|
|
|
|
" Utilities
|
|
|
|
"Plug 'xolox/vim-misc'
|
|
|
|
|
|
|
|
" Notes
|
|
|
|
"Plug 'xolox/vim-notes'
|
2019-10-17 20:36:20 +02:00
|
|
|
|
|
|
|
" Latex
|
|
|
|
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
|
2019-10-18 15:48:39 +02:00
|
|
|
Plug 'vim-latex/vim-latex', { 'for': 'tex' }
|
2019-12-13 03:58:26 +01:00
|
|
|
Plug 'vim-scripts/AnsiEsc.vim', { 'for': 'man' }
|
2019-12-09 19:25:42 +01:00
|
|
|
" Plug 'powerman/vim-plugin-AnsiEsc'
|
2020-06-24 06:08:16 +02:00
|
|
|
|
|
|
|
" Language sytax highlight improvements
|
2020-06-27 00:36:36 +02:00
|
|
|
" Plug 'mboughaba/i3config.vim'
|
|
|
|
" Plug 'dag/vim-fish'
|
|
|
|
" Plug 'arrufat/vala.vim'
|
|
|
|
" Plug 'NLKNguyen/c-syntax.vim'
|
|
|
|
" Plug 'vim-python/python-syntax'
|
|
|
|
" Plug 'stephpy/vim-yaml'
|
2020-06-24 06:08:16 +02:00
|
|
|
|
2019-10-16 02:28:41 +02:00
|
|
|
call plug#end()
|
2019-12-09 19:25:42 +01:00
|
|
|
|
2019-11-23 02:17:36 +01:00
|
|
|
"}}}
|
|
|
|
" Syntax options{{{
|
2019-10-16 02:28:41 +02:00
|
|
|
"
|
|
|
|
|
|
|
|
" Enable syntax and set color scheme
|
|
|
|
syntax on
|
|
|
|
|
2020-07-12 08:02:43 +02:00
|
|
|
set tabstop=4
|
|
|
|
set shiftwidth=4
|
2019-10-16 02:28:41 +02:00
|
|
|
set expandtab
|
|
|
|
set smarttab
|
2020-06-20 18:58:49 +02:00
|
|
|
|
|
|
|
set virtualedit=all
|
|
|
|
|
2020-07-01 07:07:41 +02:00
|
|
|
set scrolloff=8
|
|
|
|
set sidescrolloff=8
|
2020-06-20 18:58:49 +02:00
|
|
|
|
|
|
|
set nowrap
|
2019-10-16 02:28:41 +02:00
|
|
|
|
|
|
|
"destaque no númer de linhas
|
|
|
|
set number
|
|
|
|
set relativenumber
|
|
|
|
|
|
|
|
"display whitespace
|
|
|
|
set listchars=tab:>-,trail:~,extends:>,precedes:<
|
|
|
|
set listchars=space:_,eol:;,tab:>-,trail:~,extends:>,precedes:<
|
2019-12-09 19:25:42 +01:00
|
|
|
set list
|
2019-10-16 02:28:41 +02:00
|
|
|
|
|
|
|
"ativa o mouse
|
|
|
|
set mouse =a
|
|
|
|
set clipboard +=unnamedplus
|
|
|
|
set title
|
2020-06-20 18:58:49 +02:00
|
|
|
|
|
|
|
let g:python_highlight_all = 1
|
2019-11-23 02:17:36 +01:00
|
|
|
"}}}
|
|
|
|
" Gay colors{{{
|
2019-10-16 02:28:41 +02:00
|
|
|
|
2020-04-19 21:17:46 +02:00
|
|
|
" if (empty($TMUX))
|
2019-10-16 02:28:41 +02:00
|
|
|
if (has('nvim'))
|
|
|
|
let $NVIM_TUI_ENABLE_TRUE_COLOR = 1
|
|
|
|
endif
|
|
|
|
if (has('termguicolors'))
|
|
|
|
set termguicolors
|
|
|
|
endif
|
2020-04-19 21:17:46 +02:00
|
|
|
" endif
|
2019-10-16 02:28:41 +02:00
|
|
|
|
|
|
|
colorscheme minimalist
|
|
|
|
|
2019-12-13 03:58:26 +01:00
|
|
|
set background=dark
|
2019-12-09 19:25:42 +01:00
|
|
|
|
2019-10-16 02:28:41 +02:00
|
|
|
"background color is transparent
|
2019-12-13 03:25:15 +01:00
|
|
|
highlight Normal guibg=None
|
2020-06-20 18:58:49 +02:00
|
|
|
highlight EndOfBuffer guibg=None guifg={{@@ color.bg_light @@}}
|
|
|
|
highlight SpecialKey guibg=None guifg={{@@ color.accent @@}}
|
|
|
|
|
|
|
|
|
|
|
|
highlight SignColumn guibg=None
|
|
|
|
highlight GitGutterAdd guifg=lightgreen
|
|
|
|
highlight GitGutterChange guifg=yellow
|
|
|
|
highlight GitGutterDelete guifg=lightred
|
2019-11-23 02:17:36 +01:00
|
|
|
|
2019-10-16 02:28:41 +02:00
|
|
|
"Line numers
|
2020-06-20 18:58:49 +02:00
|
|
|
highlight LineNr term=bold ctermfg=9 guifg={{@@ color.bg_light @@}} guibg=None
|
2019-11-23 02:17:36 +01:00
|
|
|
|
|
|
|
"Make whitespace dark
|
2020-06-20 18:58:49 +02:00
|
|
|
highlight NonText ctermfg=darkgray guifg={{@@ color.nontxt @@}} guibg=None
|
2019-12-09 19:25:42 +01:00
|
|
|
" highlight SpecialKey ctermfg=black guifg=#252525 guibg=None
|
2019-10-16 02:28:41 +02:00
|
|
|
|
|
|
|
"Current line
|
2020-06-20 18:58:49 +02:00
|
|
|
set cursorline
|
|
|
|
highlight CursorLine term=bold cterm=bold gui=Bold guibg={{@@ color.bg_dark @@}}
|
|
|
|
highlight CursorLineNr term=bold cterm=bold gui=Bold guibg={{@@ color.bg_dark @@}} guifg=white
|
|
|
|
|
|
|
|
"Splits
|
|
|
|
highlight VertSplit guibg=None guifg={{@@ color.bg_dark @@}}
|
|
|
|
" set fillchars=vert:/
|
|
|
|
|
|
|
|
highlight Identifier guifg={{@@ color.accent @@}}
|
|
|
|
|
2020-07-10 09:02:40 +02:00
|
|
|
highlight MatchParen gui=bold guifg=yellow
|
|
|
|
|
2020-06-20 18:58:49 +02:00
|
|
|
"}}}
|
2019-11-23 02:17:36 +01:00
|
|
|
" Keys{{{
|
2020-05-18 00:40:41 +02:00
|
|
|
"
|
2019-10-16 02:28:41 +02:00
|
|
|
|
2020-06-20 18:58:49 +02:00
|
|
|
" Basic motion
|
2020-09-19 23:26:04 +02:00
|
|
|
map {{@@ key.left @@}} <left>
|
|
|
|
map {{@@ key.down @@}} <down>
|
|
|
|
map {{@@ key.up @@}} <up>
|
|
|
|
map {{@@ key.right @@}} <right>
|
2020-06-17 10:25:10 +02:00
|
|
|
|
2020-07-20 00:32:18 +02:00
|
|
|
noremap <silent> <C-w>{{@@ key.left @@}} :wincmd h<CR>
|
|
|
|
noremap <silent> <C-w>{{@@ key.down @@}} :wincmd j<CR>
|
|
|
|
noremap <silent> <C-w>{{@@ key.up @@}} :wincmd k<CR>
|
|
|
|
noremap <silent> <C-w>{{@@ key.right @@}} :wincmd l<CR>
|
2020-06-24 05:36:42 +02:00
|
|
|
|
2020-06-20 18:58:49 +02:00
|
|
|
noremap {{@@ key.next @@}} n
|
|
|
|
noremap {{@@ key.next.upper() @@}} N
|
2020-08-20 07:10:31 +02:00
|
|
|
|
2020-09-19 23:26:04 +02:00
|
|
|
noremap {{@@ key.insertMode @@}} i
|
|
|
|
noremap {{@@ key.insertMode.upper() @@}} I
|
2020-08-20 07:10:31 +02:00
|
|
|
|
2020-09-19 23:26:04 +02:00
|
|
|
{%@@ if key.layout == "colemak" @@%}
|
|
|
|
|
|
|
|
" insert on next line
|
|
|
|
noremap h o
|
|
|
|
noremap H O
|
|
|
|
|
|
|
|
" To end of word
|
|
|
|
noremap t e
|
|
|
|
noremap T E
|
|
|
|
|
|
|
|
" inneR object (like vip)
|
|
|
|
onoremap r i
|
|
|
|
{%@@ for move in "p{([w" @@%}
|
|
|
|
nnoremap vr{{@@ move @@}} vi{{@@ move @@}}
|
|
|
|
{%@@ endfor @@%}
|
|
|
|
|
|
|
|
{%@@ endif @@%}
|
|
|
|
|
|
|
|
{%@@ if key.layout == "dvorak" @@%}
|
|
|
|
|
|
|
|
" Added benefits
|
|
|
|
noremap - $
|
|
|
|
noremap _ ^
|
|
|
|
noremap N <C-w><C-w>
|
|
|
|
noremap T <C-w><C-r>
|
|
|
|
|
|
|
|
{%@@ endif @@%}
|
2020-08-20 07:10:31 +02:00
|
|
|
|
|
|
|
noremap {{@@ key.down.upper() @@}} 8<Down>
|
|
|
|
noremap {{@@ key.up.upper() @@}} 8<Up>
|
2020-09-19 23:26:04 +02:00
|
|
|
noremap D <C-w><C-r>
|
2020-06-17 10:25:10 +02:00
|
|
|
|
2020-09-19 23:26:04 +02:00
|
|
|
"open folds
|
|
|
|
nmap <silent> {{@@ key.right @@}} <right>
|
|
|
|
nmap <silent> <right> <right>:silent! foldopen<CR>
|
2020-06-17 10:25:10 +02:00
|
|
|
|
|
|
|
"I deserve the death sentence
|
2020-06-21 00:07:53 +02:00
|
|
|
nmap <C-s> :wa<CR>
|
2020-06-17 10:25:10 +02:00
|
|
|
|
2019-10-16 02:28:41 +02:00
|
|
|
" Easy comment toggle
|
|
|
|
nmap <silent> gc :Commentary<CR>
|
|
|
|
xmap <silent> gc :Commentary<CR>
|
|
|
|
|
|
|
|
" Toggle file manager
|
2020-06-25 18:38:40 +02:00
|
|
|
" map <silent> <C-n> :NERDTreeToggle %:p:h<CR>
|
2019-10-16 02:28:41 +02:00
|
|
|
|
|
|
|
" EasyAlign
|
|
|
|
xmap ga <Plug>(EasyAlign)
|
|
|
|
nmap ga <Plug>(EasyAlign)
|
|
|
|
|
2020-06-27 00:36:36 +02:00
|
|
|
map <C-j> :GFiles<CR>
|
2020-08-20 07:10:31 +02:00
|
|
|
" map <C-q> :Files<CR>
|
2020-06-27 00:36:36 +02:00
|
|
|
|
|
|
|
"}}}
|
|
|
|
" Lanugage Server{{{
|
|
|
|
"
|
|
|
|
set foldmethod=marker
|
2020-09-19 23:26:04 +02:00
|
|
|
set ignorecase
|
2020-06-27 00:36:36 +02:00
|
|
|
set hidden
|
|
|
|
set autoread
|
|
|
|
|
|
|
|
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
|
|
|
|
function! <SID>StripTrailingWhitespaces()
|
|
|
|
let l = line(".")
|
|
|
|
let c = col(".")
|
|
|
|
%s/\s\+$//e
|
|
|
|
call cursor(l, c)
|
|
|
|
endfun
|
|
|
|
|
|
|
|
" Allow saving of files as sudo when I forgot to start vim using sudo.
|
|
|
|
cmap w!! w !sudo tee % >/dev/null
|
|
|
|
|
|
|
|
" Auto deploy dotfiles
|
2020-07-12 08:02:43 +02:00
|
|
|
autocmd BufWritePost {{@@ parent_dir( _dotdrop_dotpath ) @@}}/{config.yaml,dotfiles/**} silent !dotdrop install -f
|
2020-06-27 00:36:36 +02:00
|
|
|
|
|
|
|
{%@@ if lsp == "vim-lsp" @@%}
|
|
|
|
" vim-lsp{{{
|
|
|
|
|
|
|
|
"allow json comments
|
|
|
|
autocmd FileType json syntax match Comment +\/\/.\+$+
|
|
|
|
|
2020-06-29 04:23:15 +02:00
|
|
|
" Workaround for bug
|
2020-09-20 03:43:28 +02:00
|
|
|
" let g:lsp_documentation_float = 0
|
2020-06-30 09:09:45 +02:00
|
|
|
|
2020-06-27 00:36:36 +02:00
|
|
|
" Complete
|
2020-09-20 03:43:28 +02:00
|
|
|
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
|
|
|
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
|
|
|
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"
|
|
|
|
imap <c-space> <Plug>(asyncomplete_force_refresh)
|
2020-06-27 00:36:36 +02:00
|
|
|
|
|
|
|
" Fix
|
2020-06-30 09:09:45 +02:00
|
|
|
nmap gf <Plug>(lsp-document-format)
|
|
|
|
vmap gf <Plug>(lsp-document-range-format)
|
|
|
|
nmap gr <plug>(lsp-rename)
|
|
|
|
nmap gl <plug>(lsp-code-action)
|
2020-07-01 07:07:41 +02:00
|
|
|
nmap gs <plug>(lsp-references)
|
2020-06-27 00:36:36 +02:00
|
|
|
|
|
|
|
" Move around
|
|
|
|
nmap <silent> [g <Plug>(lsp-previous-diagnostic)
|
|
|
|
nmap <silent> ]g <Plug>(lsp-next-diagnostic)
|
|
|
|
|
|
|
|
nmap <silent> gd :LspDefinition<cr>
|
|
|
|
nmap <silent> K :LspHover<cr>
|
|
|
|
|
2020-07-21 20:39:15 +02:00
|
|
|
" Lint
|
|
|
|
let g:lsp_diagnostics_echo_cursor = 1
|
|
|
|
let g:lsp_virtual_text_enabled = 0
|
|
|
|
|
2020-06-27 00:36:36 +02:00
|
|
|
" Colors
|
2020-06-30 09:09:45 +02:00
|
|
|
highlight LspErrorHighlight gui=undercurl guisp={{@@ color.normal.red @@}}
|
|
|
|
highlight LspErrorText gui=bold guifg={{@@ color.normal.red @@}} guibg=none
|
2020-07-01 07:07:41 +02:00
|
|
|
highlight LspErrorVirtual gui=underline guifg={{@@ color.normal.red @@}} guibg=none
|
2020-06-27 00:36:36 +02:00
|
|
|
|
2020-06-30 09:09:45 +02:00
|
|
|
highlight LspWarningHighlight gui=undercurl guisp={{@@ color.normal.yellow @@}}
|
|
|
|
highlight LspWarningText gui=bold guifg={{@@ color.normal.yellow @@}} guibg=none
|
2020-07-01 07:07:41 +02:00
|
|
|
highlight LspWarningVirtual gui=underline guifg={{@@ color.normal.yellow @@}} guibg=none
|
|
|
|
|
|
|
|
" Highlight all references, looks pretty *-*
|
|
|
|
let g:lsp_highlight_references_enabled = 1
|
|
|
|
highlight LspReference gui=bold guifg={{@@ color.normal.yellow @@}}
|
2020-06-21 00:07:53 +02:00
|
|
|
|
2020-06-27 00:36:36 +02:00
|
|
|
"}}}
|
|
|
|
{%@@ elif lsp == "coc" @@%}
|
2020-06-20 18:58:49 +02:00
|
|
|
"" coc {{{
|
2020-06-27 00:36:36 +02:00
|
|
|
|
2020-06-20 18:58:49 +02:00
|
|
|
"allow json comments
|
2020-06-21 00:07:53 +02:00
|
|
|
autocmd FileType json syntax match Comment +\/\/.\+$+
|
|
|
|
|
2020-06-20 18:58:49 +02:00
|
|
|
" Don't pass messages to |ins-completion-menu|.
|
|
|
|
set shortmess+=c
|
|
|
|
|
|
|
|
" Always show the signcolumn, otherwise it would shift the text each time
|
|
|
|
" diagnostics appear/become resolved.
|
|
|
|
if has("patch-8.1.1564")
|
|
|
|
" Recently vim can merge signcolumn and number column into one
|
|
|
|
set signcolumn=number
|
|
|
|
else
|
|
|
|
set signcolumn=yes
|
|
|
|
endif
|
2019-12-13 03:25:15 +01:00
|
|
|
|
2020-06-23 19:19:51 +02:00
|
|
|
" Use `[g` and `]g` to navigate diagnostics
|
|
|
|
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
|
|
|
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
|
|
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
|
|
|
|
2020-06-20 18:58:49 +02:00
|
|
|
" GoTo code navigation.
|
|
|
|
nmap <silent> gd <Plug>(coc-definition)
|
|
|
|
nmap <silent> gy <Plug>(coc-type-definition)
|
|
|
|
nmap <silent> gi <Plug>(coc-implementation)
|
|
|
|
nmap <silent> gr <Plug>(coc-references)
|
|
|
|
|
|
|
|
" Use gd to show documentation in preview window.
|
|
|
|
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
|
|
|
function! s:show_documentation()
|
|
|
|
if (index(['vim','help'], &filetype) >= 0)
|
|
|
|
execute 'h '.expand('<cword>')
|
|
|
|
else
|
|
|
|
call CocAction('doHover')
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Highlight the symbol and its references when holding the cursor.
|
|
|
|
autocmd CursorHold * silent call CocActionAsync('highlight')
|
|
|
|
|
|
|
|
" Symbol renaming.
|
|
|
|
nmap gr <Plug>(coc-rename)
|
|
|
|
|
|
|
|
" use <tab> for trigger completion and navigate to the next complete item
|
|
|
|
function! s:check_back_space() abort
|
|
|
|
let col = col('.') - 1
|
|
|
|
return !col || getline('.')[col - 1] =~ '\s'
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
inoremap <silent><expr> <Tab>
|
|
|
|
\ pumvisible() ? "\<C-n>" :
|
|
|
|
\ <SID>check_back_space() ? "\<Tab>" :
|
|
|
|
\ coc#refresh()
|
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
|
|
|
|
|
|
|
" Formatting selected code.
|
|
|
|
xmap gf <Plug>(coc-format-selected)
|
|
|
|
nmap gf <Plug>(coc-format-selected)
|
|
|
|
|
|
|
|
" Add `:Format` command to format current buffer.
|
|
|
|
command! -nargs=0 Format :call CocAction('format')
|
|
|
|
|
|
|
|
" Map function and class text objects
|
|
|
|
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
|
|
|
|
xmap if <Plug>(coc-funcobj-i)
|
|
|
|
omap if <Plug>(coc-funcobj-i)
|
|
|
|
xmap af <Plug>(coc-funcobj-a)
|
|
|
|
omap af <Plug>(coc-funcobj-a)
|
|
|
|
xmap ic <Plug>(coc-classobj-i)
|
|
|
|
omap ic <Plug>(coc-classobj-i)
|
|
|
|
xmap ac <Plug>(coc-classobj-a)
|
|
|
|
omap ac <Plug>(coc-classobj-a)
|
|
|
|
|
|
|
|
"}}}
|
2020-06-27 00:36:36 +02:00
|
|
|
{%@@ elif lsp == "ale" @@%}
|
2020-06-25 08:00:04 +02:00
|
|
|
" ale{{{
|
|
|
|
|
|
|
|
" Lint
|
|
|
|
let g:ale_echo_msg_error_str = 'E'
|
|
|
|
let g:ale_echo_msg_warning_str = 'W'
|
|
|
|
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' "
|
|
|
|
|
|
|
|
|
|
|
|
let g:ale_python_pyls_executable = '/usr/bin/pyls'
|
|
|
|
let g:ale_use_global_executables = 1
|
|
|
|
let g:ale_python_mypy_options = '--ignore-missing-imports'
|
|
|
|
let g:ale_linters = {
|
|
|
|
\ 'python': ['pyls'],
|
|
|
|
\ }
|
|
|
|
|
|
|
|
" Fix
|
|
|
|
"
|
|
|
|
let g:ale_fixers = {
|
|
|
|
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
|
|
|
|
\ 'python': ['autopep8'],
|
|
|
|
\}
|
|
|
|
let g:ale_fix_on_save = 1
|
|
|
|
|
|
|
|
" Complete
|
|
|
|
"
|
|
|
|
" Use deoplete.
|
|
|
|
let g:deoplete#enable_at_startup = 1
|
|
|
|
call deoplete#custom#option('sources', {
|
|
|
|
\ '_': ['ale'],
|
|
|
|
\})
|
|
|
|
|
|
|
|
" let g:ale_completion_symbols = {
|
|
|
|
" \ 'text': '',
|
|
|
|
" \ 'method': '',
|
|
|
|
" \ 'function': '',
|
|
|
|
" \ 'constructor': '',
|
|
|
|
" \ 'field': '',
|
|
|
|
" \ 'variable': '',
|
|
|
|
" \ 'class': '',
|
|
|
|
" \ 'interface': '',
|
|
|
|
" \ 'module': '',
|
|
|
|
" \ 'property': '',
|
|
|
|
" \ 'unit': 'unit',
|
|
|
|
" \ 'value': 'val',
|
|
|
|
" \ 'enum': '',
|
|
|
|
" \ 'keyword': 'keyword',
|
|
|
|
" \ 'snippet': '',
|
|
|
|
" \ 'color': 'color',
|
|
|
|
" \ 'file': '',
|
|
|
|
" \ 'reference': 'ref',
|
|
|
|
" \ 'folder': '',
|
|
|
|
" \ 'enum member': '',
|
|
|
|
" \ 'constant': '',
|
|
|
|
" \ 'struct': '',
|
|
|
|
" \ 'event': 'event',
|
|
|
|
" \ 'operator': '',
|
|
|
|
" \ 'type_parameter': 'type param',
|
|
|
|
" \ '<default>': 'v'
|
|
|
|
" \ }
|
|
|
|
|
|
|
|
" Move
|
|
|
|
"
|
|
|
|
" move around
|
|
|
|
nmap <silent> [g <Plug>(ale_previous_wrap)
|
|
|
|
nmap <silent> ]g <Plug>(ale_next_wrap)
|
|
|
|
|
|
|
|
" Colors
|
|
|
|
highlight ALEError gui=undercurl guisp=red
|
|
|
|
highlight ALEErrorSign guifg=red
|
|
|
|
|
|
|
|
highlight ALEWarning gui=undercurl guisp=yellow
|
|
|
|
highlight ALEWarningSign guifg=yellow
|
|
|
|
|
|
|
|
"}}}
|
2020-06-27 00:36:36 +02:00
|
|
|
{%@@ endif @@%}
|
2019-12-09 19:25:42 +01:00
|
|
|
|
2019-11-23 02:17:36 +01:00
|
|
|
"python env{{{
|
2020-06-23 19:19:51 +02:00
|
|
|
let g:python_host_prog = '/usr/bin/python2'
|
|
|
|
let g:python3_host_prog = '/usr/bin/python'
|
2019-10-16 02:28:41 +02:00
|
|
|
" MUST NOT BE INDENTED!
|
|
|
|
py3 << EOF
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
if 'VIRTUAL_ENV' in os.environ:
|
|
|
|
project_base_dir = os.environ['VIRTUAL_ENV']
|
|
|
|
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
|
|
|
|
execfile(activate_this, dict(__file__=activate_this))
|
|
|
|
EOF
|
2019-11-23 02:17:36 +01:00
|
|
|
"}}}
|
|
|
|
" Latex{{{
|
2019-10-17 20:36:20 +02:00
|
|
|
let g:livepreview_previewer = 'zathura'
|
2019-10-18 15:48:39 +02:00
|
|
|
autocmd FileType tex LLPStartPreview
|
2019-11-23 02:17:36 +01:00
|
|
|
"}}}
|
2020-04-17 06:54:35 +02:00
|
|
|
"groff{{{
|
2020-04-19 21:17:46 +02:00
|
|
|
augroup filetrype_groff
|
|
|
|
autocmd VimEnter *.ms set ft=groff
|
|
|
|
|
2020-06-20 18:58:49 +02:00
|
|
|
autocmd VimEnter *.ms silent !zathura (string replace --regex .ms\$ .pdf "%" ) & jobs -lp > /tmp/groff-preview
|
2020-04-19 21:17:46 +02:00
|
|
|
autocmd VimLeave *.ms silent !kill (cat /tmp/groff-preview )
|
|
|
|
|
|
|
|
autocmd BufWritePost *.ms silent !compile %
|
|
|
|
|
|
|
|
" autocmd FileType groff setlocal commentstring=\\\"\ %s
|
|
|
|
augroup END
|
2020-04-17 06:54:35 +02:00
|
|
|
"}}}
|
2019-11-23 02:17:36 +01:00
|
|
|
"}}}
|
|
|
|
"Hide statusbar{{{
|
2019-10-18 18:24:58 +02:00
|
|
|
let s:hidden_all = 0
|
2019-10-17 20:36:20 +02:00
|
|
|
function! ToggleHiddenAll()
|
|
|
|
if s:hidden_all == 0
|
|
|
|
let s:hidden_all = 1
|
|
|
|
set noshowmode
|
|
|
|
set noruler
|
|
|
|
set laststatus=0
|
|
|
|
set noshowcmd
|
|
|
|
else
|
|
|
|
let s:hidden_all = 0
|
|
|
|
set showmode
|
|
|
|
set ruler
|
|
|
|
set laststatus=2
|
|
|
|
set showcmd
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
2020-06-17 10:25:10 +02:00
|
|
|
" nnoremap <S-h> :call ToggleHiddenAll()<CR>
|
2019-10-18 18:24:58 +02:00
|
|
|
call ToggleHiddenAll()
|
2019-11-23 02:17:36 +01:00
|
|
|
"}}}
|
2019-12-09 19:25:42 +01:00
|
|
|
" vim:foldmethod=marker
|