" ~/.config/nvim/init.vim " This config is for neovim " The plugin manager used is VimPlug call plug#begin() Plug 'scrooloose/nerdtree' Plug 'tpope/vim-commentary' Plug 'ctrlpvim/ctrlp.vim' " Plug 'christoomey/vim-tmux-navigator' Plug 'morhetz/gruvbox' call plug#end() " General filetype plugin indent on " turns on detection, plugin, indent syntax on " enable syntax highlighting set number " line numbers set nocp " tuns off compatibility with old vi set autoread " watch for file changes set showmode " show INSERT, VISUAL, etc set ruler " cursor position set wildmenu " enhanced command line completion set mouse-=a " disabled VISUAL mode set showmatch " matching parens set scrolloff=5 " keeps a margin of lines above/below line set clipboard=unnamedplus " use system clipboard " Theme colorscheme gruvbox set t_Co=256 " set background=dark " set t_ut= " disable Background Color Erase " Code folding set foldmethod=manual "Tabs and spacing set autoindent " copy indentation from prev line set cindent set tabstop=4 set expandtab set shiftwidth=4 set smarttab " Other set noerrorbells set visualbell set mouse=n " enables mouse " Search set hlsearch " highlight search items set incsearch " incremental searching set ignorecase " case insensitive search set smartcase set diffopt+=iwhite " ctrlp let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] " NERDTree setup " Check if NERDTree is open or active function! IsNERDTreeOpen() return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1) endfunction function! CheckIfCurrentBufferIsFile() return strlen(expand('%')) > 0 endfunction " Call NERDTreeFind iff NERDTree is active, current window contains a modifiable " file, and we're not in vimdiff function! SyncTree() if &modifiable && IsNERDTreeOpen() && CheckIfCurrentBufferIsFile() && !&diff NERDTreeFind wincmd p endif endfunction " Highlight currently open buffer in NERDTree autocmd BufRead * call SyncTree() function! ToggleTree() if CheckIfCurrentBufferIsFile() if IsNERDTreeOpen() NERDTreeClose else NERDTreeFind endif else NERDTree endif endfunction " NERDTree setup done " WSL2 system clipboard support using win32yank.exe " Enable if you want this and make sure win32yank.exe is installed "let g:clipboard = { " \ 'name': 'win32yank-wsl', " \ 'copy': { " \ '+': 'win32yank.exe -i --crlf', " \ '*': 'win32yank.exe -i --crlf', " \ }, " \ 'paste': { " \ '+': 'win32yank.exe -o --lf', " \ '*': 'win32yank.exe -o --lf', " \ }, " \ 'cache_enabled': 0, " \ } " remapped keys inoremap { {}O inoremap {{ { inoremap {} {} nnoremap q " shortcuts nmap :call ToggleTree() " close vim if only thing open is NERDTree " autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif