Last active
November 12, 2025 08:07
-
-
Save sounishnath003/03bf14c98960ab74e7f8d043bda8a43f to your computer and use it in GitHub Desktop.
Sounish Nath - .vimrc setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "============================================================================= | |
| " General Settings | |
| "============================================================================= | |
| set nocompatible | |
| syntax on | |
| set number relativenumber | |
| set termguicolors | |
| set encoding=utf-8 | |
| set mouse=a | |
| set belloff=all | |
| set hidden | |
| set wrap | |
| set scrolloff=8 | |
| set showmatch | |
| set wildmenu | |
| set laststatus=2 | |
| set incsearch | |
| set hlsearch | |
| set ignorecase smartcase | |
| set completeopt=menu,menuone,noselect | |
| filetype plugin indent on | |
| " Indentation | |
| set tabstop=4 shiftwidth=4 expandtab autoindent | |
| "============================================================================= | |
| " Plugin Manager (Vim-Plug) | |
| "============================================================================= | |
| call plug#begin('~/.vim/plugged') | |
| " --- LSP & Completion --- | |
| Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
| " --- Python & Go Linting/Formatting --- | |
| Plug 'dense-analysis/ale' | |
| " --- Go Development --- | |
| Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } | |
| Plug 'buoto/gotests-vim' | |
| Plug 'sebdah/vim-delve' | |
| Plug 'mattn/vim-goimports' | |
| " --- Utilities --- | |
| Plug 'tpope/vim-surround' | |
| Plug 'tpope/vim-commentary' | |
| Plug 'preservim/nerdtree' | |
| Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
| Plug 'junegunn/fzf.vim' | |
| Plug 'tpope/vim-fugitive' | |
| Plug 'airblade/vim-gitgutter' | |
| Plug 'jiangmiao/auto-pairs' | |
| Plug 'sheerun/vim-polyglot' | |
| call plug#end() | |
| "============================================================================= | |
| " Python Development | |
| "============================================================================= | |
| autocmd FileType python setlocal tabstop=4 softtabstop=4 shiftwidth=4 expandtab | |
| nnoremap <F5> :!python3 %<CR> | |
| nnoremap <leader>r :!python3 %<CR> | |
| "============================================================================= | |
| " ALE Linting / Formatting | |
| "============================================================================= | |
| let g:ale_disable_lsp = 1 " let Coc handle LSP | |
| let g:ale_fix_on_save = 1 | |
| let g:ale_python_flake8_options = '--ignore=E501,W503' | |
| let g:ale_linters = { 'python': ['flake8'], 'go': ['golangci-lint'] } | |
| let g:ale_fixers = { 'python': ['black', 'isort'], 'go': ['goimports'] } | |
| " let g:ale_fixers = { 'python': ['autopep8'], 'go': ['goimports'] } | |
| "============================================================================= | |
| " Go Development | |
| "============================================================================= | |
| let g:go_fmt_command = "goimports" | |
| let g:go_def_mapping_enabled = 0 | |
| let g:go_doc_popup_window = 1 | |
| " Format Go on save using Coc | |
| autocmd BufWritePre *.go :silent! CocCommand editor.action.formatDocument | |
| "============================================================================= | |
| " Coc (LSP) Settings | |
| "============================================================================= | |
| " Tab completion | |
| inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" | |
| inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" | |
| " Useful Coc keymaps | |
| 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) | |
| nmap <silent> K :call CocActionAsync('doHover')<CR> | |
| " Auto save when leaving insert mode or switching buffers | |
| autocmd InsertLeave,TextChanged * silent! write | |
| " Show diagnostics | |
| nnoremap <silent> <leader>d :CocList diagnostics<CR> | |
| nnoremap <silent> <leader>a :CocAction<CR> | |
| " --- Completion Setup (VSCode-like) --- | |
| " Tab cycles through suggestions | |
| inoremap <silent><expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" | |
| inoremap <silent><expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" | |
| " Make <CR> (Enter) accept completion if menu is open, otherwise insert newline | |
| inoremap <silent><expr> <CR> pumvisible() ? coc#_select_confirm() : "\<CR>" | |
| "============================================================================= | |
| " Keymaps & Shortcuts | |
| "============================================================================= | |
| " File tree | |
| nnoremap <silent> <C-b> :NERDTreeToggle<CR> | |
| " Fuzzy find files | |
| nnoremap <silent> <C-p> :Files<CR> | |
| " Ripgrep search | |
| nnoremap <silent> <C-f> :Rg<CR> | |
| " Git status | |
| nnoremap <silent> <C-g> :G<CR> | |
| " Comment shortcut | |
| nmap <leader>c <Plug>CommentaryLine | |
| vmap <leader>c <Plug>Commentary |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The OG Primeagen 🔥 NVIM Setup

Compiled and modified for my requirements. I might create a repo based on my changes