This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/dotfiles/nvim.vim

597 lines
17 KiB
VimL
Raw Normal View History

2020-06-21 00:07:53 +02:00
" {{@@ header() @@}}
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
"
2020-09-30 23:17:09 +02:00
" Install plug if it isn't already {{{
2019-10-16 02:28:41 +02:00
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
2020-09-30 23:17:09 +02:00
"}}}
2019-10-16 02:28:41 +02:00
2020-09-30 23:17:09 +02:00
call plug#begin('~/.config/nvim/plugged')
2019-10-16 02:28:41 +02:00
2020-10-28 07:24:14 +01:00
Plug 'norcalli/nvim-colorizer.lua'
2020-09-30 23:17:09 +02:00
Plug 'tpope/vim-fugitive'
2020-09-21 04:36:40 +02:00
Plug 'airblade/vim-gitgutter'
let g:gitgutter_map_keys = 0
2019-10-16 02:28:41 +02:00
" Language server support
2020-04-17 06:54:35 +02:00
"
2020-10-10 05:14:55 +02:00
" {%@@ set lsp = "vim-lsp" @@%}
2020-06-25 08:00:04 +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-30 23:17:09 +02:00
Plug 'prabirshrestha/asyncomplete-file.vim'
Plug 'prabirshrestha/asyncomplete-emmet.vim'
Plug 'prabirshrestha/asyncomplete-neosnippet.vim'
Plug 'prabirshrestha/asyncomplete-buffer.vim'
2020-09-20 03:43:28 +02:00
2020-09-30 23:17:09 +02:00
set completeopt+=menu,longest,preview
" {%@@ elif lsp == "coc" @@%} "
2020-06-27 00:36:36 +02:00
Plug 'neoclide/coc.nvim', {'branch': 'release'}
2020-10-10 05:14:55 +02:00
" {%@@ endif @@%}
2020-06-27 00:36:36 +02:00
Plug 'sheerun/vim-polyglot'
2020-04-17 06:54:35 +02:00
2019-10-16 02:28:41 +02:00
" Fuzzy find
2020-10-21 04:42:50 +02:00
Plug 'junegunn/fzf', { 'do': {-> fzf#install() } }
2020-06-20 18:58:49 +02:00
Plug 'junegunn/fzf.vim'
2019-10-16 02:28:41 +02:00
" Completions
" 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-28 21:27:48 +02:00
Plug 'jiangmiao/auto-pairs'
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
2020-09-30 23:17:09 +02:00
Plug 'Shougo/neosnippet.vim'
Plug 'Shougo/neosnippet-snippets'
2020-09-28 21:27:48 +02:00
Plug 'tpope/vim-surround'
2020-10-20 20:46:50 +02:00
Plug 'tpope/vim-repeat'
2020-09-28 21:27:48 +02:00
" Select based on indentation
Plug 'lelgenio/vim-indent-object-colemak'
2019-10-16 02:28:41 +02:00
" Status bar
2020-10-26 17:36:12 +01:00
Plug 'vim-airline/vim-airline'
2020-10-26 19:53:08 +01:00
Plug 'vim-airline/vim-airline-themes'
2019-10-16 02:28:41 +02:00
" Color scheme
Plug 'dikiaap/minimalist'
2020-10-10 05:14:55 +02:00
Plug 'endel/vim-github-colorscheme'
2019-10-17 20:36:20 +02:00
" Latex
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
2019-12-13 03:58:26 +01:00
Plug 'vim-scripts/AnsiEsc.vim', { 'for': 'man' }
2020-09-25 22:16:24 +02:00
Plug 'rbgrouleff/bclose.vim'
Plug 'francoiscabrol/ranger.vim'
let g:ranger_replace_netrw = 1
2020-09-25 22:16:24 +02:00
let g:ranger_map_keys = 0
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
2020-09-30 23:17:09 +02:00
"}}}
" General{{{
"
" set foldmethod=marker " Friendship with marker ended, new indent is my best friend
set smartcase
set hidden
set autoread
" Better completion on command line
set wildmode=longest:full
2020-09-30 23:17:09 +02:00
" Show line numbers on the left
set number
set relativenumber
" Avoid shifting the text due to git or LSP
set signcolumn=yes
" Auto trimm end of line whitespace
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 forget to start vim using sudo.
cmap w!! w !sudo tee % >/dev/null
2019-11-23 02:17:36 +01:00
"}}}
" Syntax options{{{
2019-10-16 02:28:41 +02:00
"
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
2020-10-20 07:54:33 +02:00
set spelllang=en_us,pt_br
autocmd FileType tex set spell
" Allow moving the cursor anywhere
2020-06-20 18:58:49 +02:00
set virtualedit=all
" When to start scrolling the window
2020-07-01 07:07:41 +02:00
set scrolloff=8
set sidescrolloff=8
2020-06-20 18:58:49 +02:00
2020-09-30 23:17:09 +02:00
set linebreak
2019-10-16 02:28:41 +02:00
" Display whitespace
2019-10-16 02:28:41 +02:00
set listchars=space:_,eol:;,tab:>-,trail:~,extends:>,precedes:<
" {%@@ if color.type != "light" @@%} "
2019-12-09 19:25:42 +01:00
set list
" {%@@ endif @@%}
2019-10-16 02:28:41 +02:00
" Enable mouse
2019-10-16 02:28:41 +02:00
set mouse =a
set clipboard +=unnamedplus
" Rename the terminal
2019-10-16 02:28:41 +02:00
set title
2020-06-20 18:58:49 +02:00
2020-09-30 23:17:09 +02:00
let g:python_highlight_all = 1
2020-10-26 00:24:19 +01:00
autocmd FileType i3config hi Error none
2020-11-05 20:36:31 +01:00
autocmd FileType sql setlocal commentstring=--\ %s
2019-11-23 02:17:36 +01:00
"}}}
" Gay colors{{{
2019-10-16 02:28:41 +02:00
2020-11-05 06:46:54 +01:00
if (has('nvim'))
let $NVIM_TUI_ENABLE_TRUE_COLOR = 1
endif
if (has('termguicolors'))
set termguicolors
lua require'colorizer'.setup()
endif
" {%@@ if color.type == "light" @@%} "
colorscheme github
set background=light
let g:airline_theme="sol"
" {%@@ elif color.type == "dark" @@%} "
colorscheme minimalist
set background=dark
" {%@@ endif @@%}
2019-12-09 19:25:42 +01:00
2020-11-05 06:46:54 +01:00
"{%@@ set c = color @@%}"
"{%@@ set n = c.normal @@%}"
2020-11-05 06:46:54 +01:00
"background color is transparent
hi Normal guibg=None
hi EndOfBuffer guibg=None guifg={{@@ c.bg_light @@}}
hi SpecialKey guibg=None guifg={{@@ accent_color @@}}
hi Folded guibg=None
2020-06-20 18:58:49 +02:00
2020-11-05 06:46:54 +01:00
hi tabLine None
hi tabLineFill None
2020-06-20 18:58:49 +02:00
2020-11-05 06:46:54 +01:00
hi SignColumn guibg=None
hi GitGutterAdd guibg=None guifg={{@@ n.green @@}}
hi GitGutterChange guibg=None guifg={{@@ n.yellow @@}}
hi GitGutterDelete guibg=None guifg={{@@ n.red @@}}
2019-11-23 02:17:36 +01:00
2020-11-05 06:46:54 +01:00
"Line numers
hi LineNr guifg={{@@ c.bg_light @@}} guibg=None
2019-11-23 02:17:36 +01:00
2020-11-05 06:46:54 +01:00
" Comments
hi Comment guifg={{@@ c.bg_light @@}} guibg=None
2020-10-10 05:14:55 +02:00
2020-11-05 06:46:54 +01:00
"Make whitespace dark
hi NonText guifg={{@@ c.nontxt @@}} guibg=None
" highlight SpecialKey ctermfg=black guifg=#252525 guibg=None
2019-10-16 02:28:41 +02:00
2020-11-05 06:46:54 +01:00
"Current line
" {%@@ if c.type != "light" @@%} "
set cursorline
hi CursorLine gui=Bold guibg={{@@ c.bg_dark @@}}
hi CursorLineNr gui=Bold guibg={{@@ c.bg_dark @@}}
2020-11-05 06:46:54 +01:00
set cursorcolumn
hi CursorColumn gui=Bold guibg=none
2020-11-05 06:46:54 +01:00
set colorcolumn=80
hi ColorColumn gui=Bold guibg={{@@ c.bg @@}}
" {%@@ endif @@%} "
hi CursorLineNr guifg={{@@ c.nontxt @@}}
2020-06-20 18:58:49 +02:00
2020-11-05 06:46:54 +01:00
"Splits
hi VertSplit guibg=None guifg={{@@ c.bg_dark @@}}
" set fillchars=vert:/
2020-06-20 18:58:49 +02:00
2020-11-10 21:46:50 +01:00
hi Keyword guifg={{@@ accent_color @@}}
2020-11-05 06:46:54 +01:00
hi Identifier guifg={{@@ accent_color @@}}
2020-10-20 07:54:33 +02:00
2020-11-05 06:46:54 +01:00
hi MatchParen gui=bold guifg={{@@ n.yellow @@}}
2020-06-20 18:58:49 +02:00
2020-11-05 06:46:54 +01:00
hi SpellBad guisp={{@@ n.red @@}} guibg=none
hi SpellRare guisp={{@@ n.blue @@}} guibg=none
hi SpellCap guisp={{@@ n.cyan @@}} guibg=none
hi SpellLocal guisp={{@@ n.yellow @@}} guibg=none
2020-07-10 09:02:40 +02:00
2020-11-05 06:46:54 +01:00
"}}}
2019-11-23 02:17:36 +01:00
" Keys{{{
2020-05-18 00:40:41 +02:00
"
2020-09-30 23:17:09 +02:00
" The g is for moving between lines broken by wrap.
2020-11-10 05:27:30 +01:00
" {%@@ set keys = {
2020-09-30 23:17:09 +02:00
" h": key.left,
"gj": key.down,
"gk": key.up,
2020-11-10 05:27:30 +01:00
" l": key.right, } @@%}
2019-10-16 02:28:41 +02:00
2020-06-20 18:58:49 +02:00
" Basic motion
2020-11-07 03:54:12 +01:00
"{%@@ for old, new in keys.items() @@%}"
2020-11-07 19:56:04 +01:00
"{%@@ set OLD, NEW = old[-1].upper(), new.upper() @@%}"
noremap {{@@ new @@}} {{@@ old @@}}
noremap {{@@ NEW @@}} 10{{@@ old[-1] @@}}
noremap <silent> <C-w>{{@@ new @@}} :wincmd {{@@ old[-1] @@}}<CR>
noremap <silent> <C-w>{{@@ NEW @@}} :wincmd {{@@ OLD @@}}<CR>
2020-11-07 03:54:12 +01:00
"{%@@ endfor @@%}"
2020-06-17 10:25:10 +02:00
" Repeat search
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
" for/backward on tabs
2020-09-25 08:28:59 +02:00
nnoremap {{@@ key.tabL @@}} :tabprev<cr>
nnoremap {{@@ key.tabR @@}} :tabnext<cr>
" Enter insert mode
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
" Keyboard Layout specific
2020-10-22 17:09:42 +02:00
" {%@@ if key_layout == "colemak" @@%} "
2020-09-19 23:26:04 +02:00
" Insert on next line
2020-09-19 23:26:04 +02:00
noremap h o
noremap H O
2020-10-22 06:41:55 +02:00
" Jump to oposite side of selection
vnoremap m o
vnoremap M O
2020-09-19 23:26:04 +02:00
" To end of word
noremap t e
noremap T E
2020-10-29 18:44:29 +01:00
" Join line without space
2020-11-08 07:36:21 +01:00
nnoremap j :s/$\n\s*//<CR>
2020-10-29 18:44:29 +01:00
2020-11-07 03:54:12 +01:00
" Beginning/Ending of line
2020-10-03 07:33:35 +02:00
noremap , ^
2020-11-07 03:54:12 +01:00
noremap ; $
2020-10-03 07:33:35 +02:00
2020-09-28 23:41:04 +02:00
imap {{@@ key.insertQuit @@}} <ESC>
2020-09-25 19:41:04 +02:00
" FZF bindings
nmap <C-b> :Buffers<CR>
nmap <C-k> :Files <CR>
2020-10-16 07:13:47 +02:00
nmap <C-n> :GFiles <CR>
2020-09-25 19:41:04 +02:00
2020-09-30 23:17:09 +02:00
" Snippets
imap <C-e> <Plug>(neosnippet_expand_or_jump)
smap <C-e> <Plug>(neosnippet_expand_or_jump)
xmap <C-e> <Plug>(neosnippet_expand_target)
" Surround
let g:surround_no_mappings = 1
nmap dk <Plug>Dsurround
nmap ck <Plug>Csurround
nmap cK <Plug>CSurround
nmap yk <Plug>Ysurround
nmap yK <Plug>YSurround
nmap ykk <Plug>Yssurround
nmap yKk <Plug>YSsurround
nmap yKK <Plug>YSsurround
xmap K <Plug>VSurround
xmap gK <Plug>VgSurround
2020-10-22 17:09:42 +02:00
" {%@@ elif key_layout == "dvorak" @@%} "
2020-09-19 23:26:04 +02:00
" Added benefits
noremap - $
noremap _ ^
noremap N <C-w><C-w>
noremap T <C-w><C-r>
2020-09-25 19:41:04 +02:00
" FZF bindings
nmap <C-j> :GFiles <CR>
nmap <C-k> :Files <CR>
nmap <C-b> :Buffers<CR>
2020-10-22 17:09:42 +02:00
" {%@@ elif key_layout == "qwerty" @@%} "
2020-08-20 07:10:31 +02:00
" FZF bindings
nmap <C-b> :Buffers<CR>
nmap <C-n> :Files <CR>
nmap <C-m> :GFiles <CR>
" {%@@ endif @@%} "
2020-06-17 10:25:10 +02:00
2020-09-25 22:16:24 +02:00
" File Browser
nmap F :Ranger <CR>
" Open folds
2020-09-19 23:26:04 +02:00
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-10-03 08:21:33 +02:00
nmap <C-Q> :wqa<CR>
2020-06-17 10:25:10 +02:00
2020-10-28 07:24:14 +01:00
" Color yay! 💕 😍 💝
autocmd BufRead * lua require'colorizer'.attach_to_buffer(0)
nmap <silent> gC :ColorizerToggle<CR>
2019-10-16 02:28:41 +02:00
" Easy comment toggle
nmap <silent> gc :Commentary<CR>
xmap <silent> gc :Commentary<CR>
" EasyAlign
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
2020-10-27 21:11:08 +01:00
nmap <C-w>g :vertical Gdiffsplit<CR>
nmap ]d :GitGutterNextHunk<CR>
nmap [d :GitGutterPrevHunk<CR>
2020-10-22 17:09:42 +02:00
" Custom surrounds, should work fine on all layouts
" d
2020-10-28 07:24:35 +01:00
autocmd BufRead * let b:surround_100 = "{{@@ '{{@@ \\r @@}}' @@}}"
2020-10-22 17:09:42 +02:00
" s
2020-10-28 07:24:35 +01:00
autocmd BufRead * let b:surround_115 = "{{@@ '#{%@@ \\r @@%}#\\n#{%@@ @@%}#' @@}}"
2020-10-22 17:09:42 +02:00
2020-06-27 00:36:36 +02:00
"}}}
" Lanugage Server{{{
"
" {%@@ if lsp == "vim-lsp" @@%} "
2020-06-27 00:36:36 +02:00
" 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
2020-11-07 06:08:53 +01:00
let g:lsp_diagnostics_echo_cursor = 0
let g:lsp_virtual_text_enabled = 1
2020-07-21 20:39:15 +02:00
2020-06-27 00:36:36 +02:00
" Colors
2020-11-10 05:27:30 +01:00
" {%@@ set cols = {
"Error": n.red,
"Warning": n.yellow,
"Information": n.blue,
"Hint": n.cyan, } @@%}
2020-11-07 19:56:04 +01:00
"{%@@ for obj, col in cols.items() @@%}"
highlight Lsp{{@@ obj @@}}Highlight gui=undercurl guisp={{@@ col @@}}
highlight Lsp{{@@ obj @@}}Text gui=bold guifg={{@@ col @@}} guibg=none
highlight Lsp{{@@ obj @@}}Virtual gui=underline guifg={{@@ col @@}} guibg=none
"{%@@ endfor @@%}"
2020-07-01 07:07:41 +02:00
" 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-11-07 06:08:53 +01:00
" Pyls {{{
au User lsp_setup call lsp#register_server({
\ 'name': 'pyls',
\ 'cmd': {server_info->['pyls']},
\ 'whitelist': ['python'],
\ 'workspace_config': {'pyls': {'plugins': {
\ 'pyls_mypy': {'enabled': v:true},
\ } } } })
"}}}
2020-09-30 23:17:09 +02:00
" Complete File paths{{{
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({
\ 'name': 'file',
\ 'whitelist': ['*'],
\ 'priority': 10,
\ 'completor': function('asyncomplete#sources#file#completor')
\ }))
"}}}
" Emmet{{{
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#emmet#get_source_options({
\ 'name': 'emmet',
\ 'whitelist': ['html'],
\ 'completor': function('asyncomplete#sources#emmet#completor'),
\ }))
"}}}
" Snipets{{{
call asyncomplete#register_source(asyncomplete#sources#neosnippet#get_source_options({
\ 'name': 'neosnippet',
\ 'whitelist': ['*'],
\ 'completor': function('asyncomplete#sources#neosnippet#completor'),
\ }))
"}}}
"Buffer{{{
call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({
\ 'name': 'buffer',
\ 'allowlist': ['*'],
\ 'completor': function('asyncomplete#sources#buffer#completor'),
\ 'config': {
\ 'max_buffer_size': 5000000,
\ },
\ }))
"}}}
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)
"}}}
" {%@@ 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'
2020-10-12 05:28:30 +02:00
let g:python3_host_prog = '/usr/bin/python3'
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