Skip to content

Instantly share code, notes, and snippets.

@parthokr
Created March 24, 2024 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parthokr/20cfbd24aaf6e87d29459481df53cb97 to your computer and use it in GitHub Desktop.
Save parthokr/20cfbd24aaf6e87d29459481df53cb97 to your computer and use it in GitHub Desktop.
Neovim configuration
autocmd filetype cpp nnoremap <F5> :w <bar> !g++ -Wall -Wno-unused-result -std=c++17 -O2 % -o %:r.out && ./%:r.out <CR>
let mapleader = "\<Space>"
:set number
:set relativenumber
:set autoindent
:set tabstop=4
:set shiftwidth=4
:set smarttab
:set softtabstop=4
:set mouse=a
:set encoding=UTF-8
:set clipboard=unnamedplus
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
call plug#begin()
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'https://github.com/preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'https://github.com/terryma/vim-multiple-cursors'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'sbdchd/neoformat'
Plug 'NLKNguyen/papercolor-theme'
Plug 'ryanoasis/vim-devicons'
Plug 'numToStr/Comment.nvim'
Plug 'folke/tokyonight.nvim', { 'branch': 'main' }
Plug 'morhetz/gruvbox'
Plug 'vhda/verilog_systemverilog.vim'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'nvim-lua/plenary.nvim'
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-treesitter/nvim-treesitter'
Plug 'catppuccin/nvim', { 'as': 'catppuccin' }
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
call plug#end()
lua require('Comment').setup()
lua require('telescope').setup{defaults = { file_ignore_patterns = {"node_modules"} } }
let g:gruvbox_contrast_dark = 'hard'
":colorscheme jellybeans
":colorscheme onedark
" set background=dark
" colorscheme PaperColor
" colorscheme tokyonight-moon
" colorscheme tokyonight-night
" colorscheme tokyonight-day
colorscheme gruvbox
" colorscheme catppuccin-mocha
let g:airline_theme='simple'
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#tabline#enabled = 1
let g:NERDTreeGitStatusIndicatorMapCustom = {
\ 'Modified' :'✹',
\ 'Staged' :'✚',
\ 'Untracked' :'✭',
\ 'Renamed' :'➜',
\ 'Unmerged' :'═',
\ 'Deleted' :'✖',
\ 'Dirty' :'✗',
\ 'Ignored' :'☒',
\ 'Clean' :'✔︎',
\ 'Unknown' :'?',
\ }
nnoremap <C-p> :GFiles<CR>
" nnoremap <leader>f :FZF<CR>
" nnoremap <leader>n :NERDTreeFocus<CR>
" nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
" nnoremap <C-f> :NERDTreeFind<CR>
" open telescope
nnoremap <leader>f :Telescope find_files<CR>
" open live grep
nnoremap <leader>l :Telescope live_grep<CR>
map <leader>n :bnext<CR>
map <leader>N :bprev<CR>
" open terminal below with ctrl t
map <leader>t :belowright split <bar> terminal<CR>
" close current buffer
map <leader>w :bd<CR>
" split window to right
map <leader>v :vsplit<CR>
" augroup fmt
" autocmd!
" autocmd BufWritePre * undojoin | Neoformat
" augroup END
" autosave on focus lost
" autocmd CursorHold,CursorHoldI * update
"
" if ! exists("g:CheckUpdateStarted")
" let g:CheckUpdateStarted=1
" call timer_start(1,'CheckUpdate')
" endif
" function! CheckUpdate(timer)
" silent! checktime
" call timer_start(1000,'CheckUpdate')
" endfunction
"
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ CheckBackSpace() ? "\<TAB>" :
\ coc#refresh()
function! CheckBackSpace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
inoremap ii <Esc>
inoremap <M-S> :update<cr>
nnoremap <M-S> <Esc>:update<cr>gi
noremap <silent> <C-s> :w<CR>
inoremap <silent> <C-s> <ESC>:w<CR>
" GoTo code navigation
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment