Skip to content

Instantly share code, notes, and snippets.

@zdebra
Created February 20, 2022 18:25
Show Gist options
  • Save zdebra/ebde611f3a0c5daf04644404c4d34704 to your computer and use it in GitHub Desktop.
Save zdebra/ebde611f3a0c5daf04644404c4d34704 to your computer and use it in GitHub Desktop.
nvim setup
syntax on
set cursorline " Highlight the currently selected line
set hlsearch " highligh search results
set expandtab " expand <Tab>s with spaces; death to tabs!
set ruler " show current position at bottom
set number " Show line numbers
set ignorecase " Enable case insenstive search
set showmatch " show matching brackets
set autoindent " set the cursor at same indent as line above
set smartindent " try to be smart about indenting (C-style)
set shiftwidth=4 " spaces for each step of (auto)indent
set softtabstop=4 " set virtual tab stop (compat for 8-wide tabs)
set tabstop=4 " for proper display of files with tabs
set shiftround " always round indents to multiple of shiftwidth
set copyindent " use existing indents for new indents
set preserveindent " save as much indent structure as possible
set encoding=utf-8
set ls=2 " always show status line
set scrolloff=3 " keep 3 lines when scrolling
set showcmd " display incomplete commands
set path+=** " find recursively
"Set the list characters
set list
set listchars=nbsp:␣,eol:↲,tab:▸·
call plug#begin()
Plug 'morhetz/gruvbox'
Plug 'preservim/nerdtree'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'AndrewRadev/splitjoin.vim'
call plug#end()
" Start gruvbox theme
autocmd vimenter * ++nested colorscheme gruvbox
" Start NERDTree and put the cursor back in the other window.
autocmd VimEnter * NERDTree | wincmd p
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" vim-go specific
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_diagnostic_errors = 1
let g:go_highlight_diagnostic_warnings = 1
let g:go_fmt_command = "goimports"
" remap bindings for copy and paste
noremap <Leader>y "+y
noremap <Leader>p "+p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment