" {{@@ header() @@}} " LEL " _ " _ ____ _(_)_ __ ___ " | '_ \ \ / / | '_ ` _ \ " | | | \ V /| | | | | | | " |_| |_|\_/ |_|_| |_| |_| " Plugins{{{ " " 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') Plug 'arrufat/vala.vim' Plug 'NLKNguyen/c-syntax.vim' Plug 'vim-python/python-syntax' Plug 'jaxbot/semantic-highlight.vim' Plug 'stephpy/vim-yaml' Plug 'airblade/vim-gitgutter' Plug 'chrisbra/Colorizer' Plug 'junegunn/vim-easy-align' " Language server support " " Plug 'sheerun/vim-polyglot' " Plug 'dense-analysis/ale' Plug 'neoclide/coc.nvim', {'branch': 'release'} " Plug 'davidhalter/jedi-vim' " Plug 'autozimu/LanguageClient-neovim', { " \ 'branch': 'next', " \ 'do': 'bash install.sh', " \} " Debugger " Plug 'vim-vdebug/vdebug' " Fuzzy find Plug 'junegunn/fzf' Plug 'junegunn/fzf.vim' " Completions " Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " Pais Plug 'jiangmiao/auto-pairs' Plug 'tpope/vim-surround' " Comments Plug 'tpope/vim-commentary' " Status bar " Plug 'vim-airline/vim-airline' " Plug 'vim-airline/vim-airline-themes' " let g:airline#extensions#ale#enabled = 1 " Bufferlist (integrates with airline) "Plug 'bling/vim-bufferline' " Color scheme Plug 'dikiaap/minimalist' " Simplify movement Plug 'easymotion/vim-easymotion' " Simplify file management Plug 'scrooloose/nerdtree' Plug 'ryanoasis/vim-devicons' Plug 'Xuyuanp/nerdtree-git-plugin' " Format using prettier " Plug 'prettier/vim-prettier', { 'do': 'yarn install' } " Make markdown fun again "Plug 'junegunn/limelight.vim' " Better buffer management "Plug 'qpkorr/vim-bufkill' " Utilities "Plug 'xolox/vim-misc' " Notes "Plug 'xolox/vim-notes' " Latex Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' } Plug 'vim-latex/vim-latex', { 'for': 'tex' } Plug 'vim-scripts/AnsiEsc.vim', { 'for': 'man' } " Plug 'powerman/vim-plugin-AnsiEsc' Plug 'mboughaba/i3config.vim' Plug 'dag/vim-fish' call plug#end() "}}} " Syntax options{{{ " " Enable syntax and set color scheme syntax on set tabstop=4 set shiftwidth=4 set expandtab set smarttab set virtualedit=all set scrolloff=10 set sidescrolloff=10 set nowrap "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:< set list "ativa o mouse set mouse =a set clipboard +=unnamedplus set title let g:python_highlight_all = 1 "}}} " Gay colors{{{ " if (empty($TMUX)) if (has('nvim')) let $NVIM_TUI_ENABLE_TRUE_COLOR = 1 endif if (has('termguicolors')) set termguicolors endif " endif colorscheme minimalist set background=dark "background color is transparent highlight Normal guibg=None 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 "Line numers highlight LineNr term=bold ctermfg=9 guifg={{@@ color.bg_light @@}} guibg=None "Make whitespace dark highlight NonText ctermfg=darkgray guifg={{@@ color.nontxt @@}} guibg=None " highlight SpecialKey ctermfg=black guifg=#252525 guibg=None "Current line 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 @@}} "}}} " Keys{{{ " " Basic motion noremap {{@@ key.left @@}} noremap {{@@ key.down @@}} noremap {{@@ key.up @@}} noremap {{@@ key.right @@}} noremap {{@@ key.left @@}} :wincmd h noremap {{@@ key.down @@}} :wincmd j noremap {{@@ key.up @@}} :wincmd k noremap {{@@ key.right @@}} :wincmd l noremap {{@@ key.next @@}} n noremap {{@@ key.next.upper() @@}} N " Added benefits noremap - $ noremap _ ^ " noremap N " noremap T noremap H 8 noremap T 8 " noremap D " Single charater traversal imap imap "I deserve the death sentence nmap :wa "open and close folds nmap {{@@ key.right @@}} noremap :silent! foldopen " Easy comment toggle nmap gc :Commentary xmap gc :Commentary " Toggle file manager map :NERDTreeToggle %:p:h " EasyAlign xmap ga (EasyAlign) nmap ga (EasyAlign) "EasyMotion map e (easymotion-prefix) set ignorecase map :GFiles "" coc {{{ "allow json comments autocmd FileType json syntax match Comment +\/\/.\+$+ " 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 " Use `[g` and `]g` to navigate diagnostics " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. nmap [g (coc-diagnostic-prev) nmap ]g (coc-diagnostic-next) " GoTo code navigation. nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) " Use gd to show documentation in preview window. nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') 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 (coc-rename) " use 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 \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" " Formatting selected code. xmap gf (coc-format-selected) nmap gf (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 (coc-funcobj-i) omap if (coc-funcobj-i) xmap af (coc-funcobj-a) omap af (coc-funcobj-a) xmap ic (coc-classobj-i) omap ic (coc-classobj-i) xmap ac (coc-classobj-a) omap ac (coc-classobj-a) "}}} "}}} " Lanugage Server{{{ " set foldmethod=marker set hidden set autoread function! 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 autocmd BufWritePre * :call StripTrailingWhitespaces() " Auto deploy dotfiles autocmd BufWritePost /**/dotdrop/{config.yaml,dotfiles/**} silent !dotdrop install -f "python env{{{ let g:python_host_prog = '/usr/bin/python2' let g:python3_host_prog = '/usr/bin/python' " 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 "}}} " Latex{{{ let g:livepreview_previewer = 'zathura' autocmd FileType tex LLPStartPreview "}}} "groff{{{ augroup filetrype_groff autocmd VimEnter *.ms set ft=groff autocmd VimEnter *.ms silent !zathura (string replace --regex .ms\$ .pdf "%" ) & jobs -lp > /tmp/groff-preview autocmd VimLeave *.ms silent !kill (cat /tmp/groff-preview ) autocmd BufWritePost *.ms silent !compile % " autocmd FileType groff setlocal commentstring=\\\"\ %s augroup END "}}} "}}} "Hide statusbar{{{ let s:hidden_all = 0 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 " nnoremap :call ToggleHiddenAll() call ToggleHiddenAll() "}}} " vim:foldmethod=marker