Skip to content

Instantly share code, notes, and snippets.

@AkashDhiman
Created October 31, 2023 21:26
Show Gist options
  • Save AkashDhiman/f5f02c10c4879a54f829aefa505ea0c8 to your computer and use it in GitHub Desktop.
Save AkashDhiman/f5f02c10c4879a54f829aefa505ea0c8 to your computer and use it in GitHub Desktop.
my vim configuration
syntax enable
set encoding=utf8
set expandtab
set smarttab
set shiftwidth=4
set tabstop=4
set number
set belloff=all
set mouse=a
set autoindent
set clipboard=unnamed
" execute the files using Ctrl + t
autocmd filetype cpp nnoremap <C-t> :w <bar> !g++-12 -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG % -o %:r && ./%:r && rm ./%:r <CR>
autocmd filetype java nnoremap <C-t> :w <bar> !javac % && java -enableassertions %:r && rm ./%:r.class <CR>
autocmd filetype python nnoremap <C-t> :w <bar> !python3 % <CR>
" competitive programming templates
" cp0: basic
" TODO: make templates for dsu, bfs, dfs, grid & adjList, and more...
autocmd BufNewFile *.cf.cpp 0r ~/.vim/templates/cpp/cf.cpp
autocmd BufNewFile *.kickstart.cpp 0r ~/.vim/templates/cpp/kickstart.cpp
autocmd vimenter * ++nested colorscheme gruvbox
set background=dark
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-e> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment