├── LICENSE ├── README.md ├── coc-settings.json ├── coc.vimrc └── vimrc /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Fábio Berbert de Paula 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vimrc 2 | vimrc do vídeo do canal Cotidiano Hackeado 3 | 4 | Link para o vídeo: https://youtu.be/hdZMqMeruSQ 5 | 6 | Link para os plugins: 7 | 8 | https://github.com/mhinz/vim-startify
9 | https://github.com/rafi/awesome-vim-colorschemes
10 | https://github.com/tomasiser/vim-code-dark
11 | https://github.com/Yggdroot/indentLine
12 | https://github.com/preservim/nerdtree
13 | https://github.com/ryanoasis/vim-devicons
14 | https://github.com/vim-airline/vim-airline
15 | https://github.com/vim-airline/vim-airline-themes
16 | https://github.com/ctrlpvim/ctrlp.vim
17 | https://github.com/preservim/nerdcommenter
18 | https://github.com/mattn/emmet-vim
19 | https://github.com/dense-analysis/ale
20 | https://github.com/sheerun/vim-polyglot
21 | https://github.com/neoclide/coc.nvim 22 | 23 | 24 | Nerd Fonts: https://github.com/ryanoasis/nerd-fonts#patched-fonts 25 | 26 | Repositório com o .vimrc completo deste guia: https://github.com/fberbert/vimrc 27 | -------------------------------------------------------------------------------- /coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "jedi.enable": true, 3 | "jedi.startupMessage": true, 4 | "jedi.markupKindPreferred": "plaintext", 5 | "jedi.trace.server": true, 6 | "jedi.jediSettings.autoImportModules": [], 7 | "jedi.executable.command": "jedi-language-server", 8 | "jedi.executable.args": [], 9 | "jedi.completion.disableSnippets": false, 10 | "jedi.diagnostics.enable": true, 11 | "jedi.diagnostics.didOpen": true, 12 | "jedi.diagnostics.didChange": true, 13 | "jedi.diagnostics.didSave": true 14 | } 15 | -------------------------------------------------------------------------------- /coc.vimrc: -------------------------------------------------------------------------------- 1 | " TextEdit might fail if hidden is not set. 2 | set hidden 3 | 4 | " Some servers have issues with backup files, see #649. 5 | set nobackup 6 | set nowritebackup 7 | 8 | " Give more space for displaying messages. 9 | set cmdheight=2 10 | 11 | " Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable 12 | " delays and poor user experience. 13 | set updatetime=300 14 | 15 | " Don't pass messages to |ins-completion-menu|. 16 | set shortmess+=c 17 | 18 | " Always show the signcolumn, otherwise it would shift the text each time 19 | " diagnostics appear/become resolved. 20 | if has("patch-8.1.1564") 21 | " Recently vim can merge signcolumn and number column into one 22 | set signcolumn=number 23 | else 24 | set signcolumn=yes 25 | endif 26 | 27 | " Use tab for trigger completion with characters ahead and navigate. 28 | " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by 29 | " other plugin before putting this into your config. 30 | inoremap 31 | pumvisible() ? "" : 32 | check_back_space() ? "" : 33 | coc#refresh() 34 | inoremap pumvisible() ? "" : "" 35 | 36 | function! s:check_back_space() abort 37 | let col = col('.') - 1 38 | return !col || getline('.')[col - 1] =~# 's' 39 | endfunction 40 | 41 | " Use to trigger completion. 42 | if has('nvim') 43 | inoremap coc#refresh() 44 | else 45 | inoremap coc#refresh() 46 | endif 47 | 48 | " Use to confirm completion, `u` means break undo chain at current 49 | " position. Coc only does snippet and additional edit on confirm. 50 | " could be remapped by other vim plugin, try `:verbose imap `. 51 | if exists('*complete_info') 52 | inoremap complete_info()["selected"] != "-1" ? "" : "u" 53 | else 54 | inoremap pumvisible() ? "" : "u" 55 | endif 56 | 57 | " Use `[g` and `]g` to navigate diagnostics 58 | " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. 59 | nmap [g (coc-diagnostic-prev) 60 | nmap ]g (coc-diagnostic-next) 61 | 62 | " GoTo code navigation. 63 | nmap gd (coc-definition) 64 | nmap gy (coc-type-definition) 65 | nmap gi (coc-implementation) 66 | nmap gr (coc-references) 67 | nmap gt (coc-rename) 68 | 69 | " Use K to show documentation in preview window. 70 | nnoremap K :call show_documentation() 71 | 72 | function! s:show_documentation() 73 | if (index(['vim','help'], &filetype) >= 0) 74 | execute 'h '.expand('') 75 | else 76 | call CocAction('doHover') 77 | endif 78 | endfunction 79 | 80 | " Highlight the symbol and its references when holding the cursor. 81 | autocmd CursorHold * silent call CocActionAsync('highlight') 82 | 83 | " Symbol renaming. 84 | nmap rn (coc-rename) 85 | 86 | " Formatting selected code. 87 | xmap f (coc-format-selected) 88 | nmap f (coc-format-selected) 89 | 90 | augroup mygroup 91 | autocmd! 92 | " Setup formatexpr specified filetype(s). 93 | autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') 94 | " Update signature help on jump placeholder. 95 | autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') 96 | augroup end 97 | 98 | " Applying codeAction to the selected region. 99 | " Example: `aap` for current paragraph 100 | xmap a (coc-codeaction-selected) 101 | nmap a (coc-codeaction-selected) 102 | 103 | " Remap keys for applying codeAction to the current buffer. 104 | nmap ac (coc-codeaction) 105 | " Apply AutoFix to problem on the current line. 106 | nmap qf (coc-fix-current) 107 | 108 | " Map function and class text objects 109 | " NOTE: Requires 'textDocument.documentSymbol' support from the language server. 110 | xmap if (coc-funcobj-i) 111 | omap if (coc-funcobj-i) 112 | xmap af (coc-funcobj-a) 113 | omap af (coc-funcobj-a) 114 | xmap ic (coc-classobj-i) 115 | omap ic (coc-classobj-i) 116 | xmap ac (coc-classobj-a) 117 | omap ac (coc-classobj-a) 118 | 119 | " Use CTRL-S for selections ranges. 120 | " Requires 'textDocument/selectionRange' support of LS, ex: coc-tsserver 121 | nmap (coc-range-select) 122 | xmap (coc-range-select) 123 | 124 | " Add `:Format` command to format current buffer. 125 | command! -nargs=0 Format :call CocAction('format') 126 | 127 | " Add `:Fold` command to fold current buffer. 128 | command! -nargs=? Fold :call CocAction('fold', ) 129 | 130 | " Add `:OR` command for organize imports of the current buffer. 131 | command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') 132 | 133 | " Add (Neo)Vim's native statusline support. 134 | " NOTE: Please see `:h coc-status` for integrations with external plugins that 135 | " provide custom statusline: lightline.vim, vim-airline. 136 | set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} 137 | 138 | " Mappings for CoCList 139 | " Show all diagnostics. 140 | nnoremap a :CocList diagnostics 141 | " Manage extensions. 142 | nnoremap e :CocList extensions 143 | " Show commands. 144 | nnoremap c :CocList commands 145 | " Find symbol of current document. 146 | nnoremap o :CocList outline 147 | " Search workspace symbols. 148 | nnoremap s :CocList -I symbols 149 | " Do default action for next item. 150 | nnoremap j :CocNext 151 | " Do default action for previous item. 152 | nnoremap k :CocPrev 153 | " Resume latest coc list. 154 | nnoremap p :CocListResume 155 | 156 | let g:coc_disable_startup_warning = 1 157 | -------------------------------------------------------------------------------- /vimrc: -------------------------------------------------------------------------------- 1 | " ativar sintaxe colorida 2 | syntax on 3 | 4 | " ativar indentação automática 5 | set autoindent 6 | 7 | " ativa indentação inteligente, o Vim tentará adivinhar 8 | " qual é a melhor indentação para o código quando você 9 | " efetuar quebra de linha. Funciona bem para linguagem C 10 | set smartindent 11 | 12 | " por padrão o vim armazena os últimos 50 comandos que você 13 | " digitou em seu histórico. Eu sou exagerado, prefiro armazenar 14 | " os últimos 5000 15 | set history=5000 16 | 17 | " ativar numeração de linha 18 | set number 19 | 20 | " destaca a linha em que o cursor está posicionado 21 | " ótimo para quem não enxerga muito bem 22 | set cursorline 23 | 24 | " ativa o clique do mouse para navegação pelos documentos 25 | set mouse=a 26 | 27 | " ativa o compartilhamento de área de transferência entre o Vim 28 | " e a interface gráfica 29 | set clipboard=unnamedplus 30 | 31 | " converte o tab em espaços em branco 32 | " ao teclar tab o Vim irá substutuir por 2 espaços 33 | set tabstop=2 softtabstop=2 expandtab shiftwidth=2 34 | 35 | " ao teclar a barra de espaço no modo normal, o Vim 36 | " irá colapsar ou expandir o bloco de código do cursor 37 | " foldlevel é a partir de que nível de indentação o 38 | " código iniciará colapsado 39 | set foldmethod=syntax 40 | set foldlevel=99 41 | nnoremap za 42 | 43 | colo materialbox 44 | 45 | let g:indentLine_enabled = 1 46 | map i :IndentLinesToggle 47 | 48 | map :NERDTreeToggle 49 | set encoding=utf8 50 | set guifont=Anonymice\ Nerd\ Font\ Mono:h12 51 | 52 | set laststatus=2 53 | let g:airline#extensions#tabline#enabled = 1 54 | let g:airline_powerline_fonts = 1 55 | let g:airline_statusline_ontop=0 56 | let g:airline_theme='base16_twilight' 57 | 58 | let g:airline#extensions#tabline#formatter = 'default' 59 | " navegação entre os buffers 60 | nnoremap :bn 61 | nnoremap :bp 62 | nnoremap :bp\|bd # 63 | 64 | let g:ctrlp_custom_ignore = '\v[\/]\.(swp|zip)$' 65 | let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] 66 | let g:ctrlp_show_hidden = 1 67 | 68 | filetype plugin on 69 | let g:NERDSpaceDelims = 1 70 | let g:NERDDefaultAlign = 'left' 71 | map cc NERDCommenterInvert 72 | 73 | let g:ale_linters = {'python': ['flake8', 'pylint'], 'javascript': ['eslint']} 74 | let g:ale_completion_enabled = 0 75 | " let g:ale_fixers = { 76 | " 'python': ['yapf'], 77 | " } 78 | " nmap :ALEFix 79 | " let g:ale_fix_on_save = 1 80 | 81 | source ~/.vim/coc.nvimrc 82 | --------------------------------------------------------------------------------