Skip to content

Instantly share code, notes, and snippets.

@afa7789
Last active July 3, 2025 20:15
Show Gist options
  • Save afa7789/952781e8c46b2d8ca29d390d32303141 to your computer and use it in GitHub Desktop.
Save afa7789/952781e8c46b2d8ca29d390d32303141 to your computer and use it in GitHub Desktop.
neovim config ( para não esquecer )
Your Neovim (`v0.11.2`) uses **Vim-Plug** with plugins in `~/.vim/plugged`: `coc.nvim` (LSP), `papercolor-theme` (theme), `fzf` (fuzzy finder), `tagbar` (code tags), `vim-go` (Go support, causing `noshellslash` error), `nerdtree` (file explorer), `vim-multiple-cursors` (multi-cursor editing), and `vim-solidity` (Solidity syntax). Config is in `~/.config/nvim/init.vim`, with settings for syntax, indentation, search, and `coc.nvim` mappings. No `~/.vimrc` or `init.lua`.
**To reset and reinstall** (avoiding `vim-go`):
```bash
cp -r ~/.config/nvim ~/.config/nvim.bak
rm -rf ~/.vim/plugged ~/.local/share/nvim ~/.cache/nvim ~/.config/nvim
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
mkdir -p ~/.config/nvim && nvim ~/.config/nvim/init.vim
# Paste: call plug#begin('~/.vim/plugged') | Plug 'preservim/nerdtree' | Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | Plug 'junegunn/fzf.vim' | Plug 'vim-airline/vim-airline' | Plug 'neoclide/coc.nvim', { 'branch': 'release' } | Plug 'NLKNguyen/papercolor-theme' | Plug 'tpope/vim-commentary' | Plug 'jiangmiao/auto-pairs' | Plug 'tomlion/vim-solidity' | call plug#end() | set nocompatible | filetype plugin indent on | syntax on | set number | set tabstop=4 | set shiftwidth=4 | set expandtab | set autoindent | set cursorline | set showmatch | set incsearch | set hlsearch | set ignorecase | set smartcase | set mouse=a | set hidden | set cmdheight=2 | set updatetime=300 | set shortmess+=c | set signcolumn=yes | if has('nvim') | set shellslash | endif | nnoremap <C-t> :NERDTreeToggle<CR> | let g:NERDTreeShowHidden=1 | nnoremap <C-p> :Files<CR> | nnoremap <C-f> :Rg<CR> | let g:airline#extensions#tabline#enabled=1 | let g:coc_global_extensions=['coc-go', 'coc-json', 'coc-solidity'] | nnoremap <silent> gd <Plug>(coc-definition) | nnoremap <silent> gr <Plug>(coc-references) | nnoremap <silent> <leader>f <Plug>(coc-format-selected) | inoremap <silent><expr> <TAB> pumvisible() ? "\<C-n>" : <SID>check_back_space() ? "\<TAB>" : coc#refresh() | inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | function! s:check_back_space() abort | let col=col('.')-1 | return !col || getline('.')[col-1]=~#'\s' | endfunction | set background=dark | colorscheme PaperColor
nvim && :PlugInstall && :CocInstall coc-go coc-json coc-solidity
brew install fzf && ~/.vim/plugged/fzf/install --all && brew install ripgrep && go install golang.org/x/tools/gopls@latest
nvim ~/.zshrc
# Replace Go section: export GOPATH="$HOME/go" | export PATH="$GOPATH/bin:/opt/homebrew/bin:$PATH" | alias ggovm="$GOPATH/bin/g"
source ~/.zshrc
brew upgrade neovim
```
**Shortcuts**:
- `Ctrl+t`: Toggle NERDTree
- `Ctrl+p`: Fuzzy file search
- `Ctrl+f`: Search content (replaces `Ctrl+g`)
- `gd`: Go to definition
- `<leader>f` (e.g., `\f`): Format code
- `gcc`: Comment line
- `U`: Show documentation (coc.nvim)
Test: `nvim example.go` and try shortcuts. Check `:messages` or `:CocInfo` for errors.
//#" nvim ~/.config/nvim/init.vim
call plug#begin('~/.vim/plugged')
Plug 'preservim/nerdtree' " File explorer
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim' " Fuzzy finder
Plug 'vim-airline/vim-airline' " Status line
Plug 'neoclide/coc.nvim', { 'branch': 'release' } " LSP for Go
Plug 'NLKNguyen/papercolor-theme' " Theme
Plug 'tpope/vim-commentary' " Comment code
Plug 'jiangmiao/auto-pairs' " Auto-close brackets
Plug 'tomlion/vim-solidity' " Solidity support
call plug#end()
set nocompatible
filetype plugin indent on
syntax on
set number
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
set cursorline
set showmatch
set incsearch
set hlsearch
set ignorecase
set smartcase
set mouse=a
set hidden
set cmdheight=2
set updatetime=300
set shortmess+=c
set signcolumn=yes
if has('nvim')
set shellslash
endif
nnoremap <C-t> :NERDTreeToggle<CR>
let g:NERDTreeShowHidden=1
nnoremap <C-p> :Files<CR>
nnoremap <C-g> :Rg<CR>
let g:airline#extensions#tabline#enabled=1
let g:coc_global_extensions=['coc-go', 'coc-json', 'coc-solidity']
nnoremap <silent> gd <Plug>(coc-definition)
nnoremap <silent> gr <Plug>(coc-references)
nnoremap <silent> <leader>f <Plug>(coc-format-selected)
inoremap <silent><expr> <TAB> pumvisible() ? "\<C-n>" : <SID>check_back_space() ? "\<TAB>" : coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col=col('.')-1
return !col || getline('.')[col-1]=~#'\s'
endfunction
set background=dark
colorscheme PaperColor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment