Skip to content

Instantly share code, notes, and snippets.

@devanshbatham
Created December 5, 2021 15:32
Show Gist options
  • Save devanshbatham/3638aea6173649af1eae9d5927f3853a to your computer and use it in GitHub Desktop.
Save devanshbatham/3638aea6173649af1eae9d5927f3853a to your computer and use it in GitHub Desktop.
Neovim Config
:set number
:set autoindent
:set tabstop=4
:set ts=4
:set shiftwidth=4
:set smarttab
:set softtabstop=4
:set mouse=a
:set encoding=UTF-8
:set autoindent
call plug#begin()
Plug 'https://github.com/rafi/awesome-vim-colorschemes' " Retro Scheme
Plug 'https://github.com/preservim/nerdtree' " NerdTree
Plug 'https://github.com/tpope/vim-commentary' " For Commenting gcc & gc
Plug 'https://github.com/vim-airline/vim-airline' " Status bar
Plug 'https://github.com/tc50cal/vim-terminal' " Vim Terminal
Plug 'https://github.com/preservim/tagbar' " Tagbar for code navigation
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'https://github.com/neoclide/coc.nvim' " Auto Completion
Plug 'airblade/vim-rooter'
Plug 'chrisbra/Colorizer'
Plug 'psliwka/vim-smoothie'
Plug 'thesis/vim-solidity'
Plug 'tzachar/cmp-tabnine', { 'do': './install.sh' }
call plug#end()
:colorscheme sonokai
nnoremap <C-f> :NERDTreeToggle<CR>
nnoremap <C-l> :call CocActionAsync('jumpDefinition')<CR>
let g:fzf_history_dir = '~/.local/share/fzf-history'
let g:fzf_tags_command = 'ctags -R'
" Border color
let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' } }
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" Bat theme for syntax coloring when viewing files in fzf
let $BAT_THEME='base16'
"Get Files
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0)
" Get text in files with Rg
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(<q-args>), 1,
\ fzf#vim#with_preview(), <bang>0)
" Exit Vim if NERDTree is the only window left.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
imap <F5> <Esc>:w<CR>:!clear;python3 %<CR>
" Trim Whitespaces
function! TrimWhitespace()
let l:save = winsaveview()
%s/\\\@<!\s\+$//e
call winrestview(l:save)
endfunction
" Markdown and Journal
autocmd FileType markdown setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType journal setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd BufEnter * silent! lcd %:p:h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment