Skip to content

Instantly share code, notes, and snippets.

@archishou
Last active November 15, 2023 15:36
Show Gist options
  • Save archishou/180603d69e6c31e3d27ff1ea9a592cee to your computer and use it in GitHub Desktop.
Save archishou/180603d69e6c31e3d27ff1ea9a592cee to your computer and use it in GitHub Desktop.
Archi Vimrc
syntax on
set number
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
let mapleader = " "
set backspace=indent,eol,start
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
" Go commands for filetypes
autocmd filetype cpp nnoremap <leader>go :w <bar> exec '!printf "\33c\e[3J";g++ -std=c++20 -O3 '.shellescape('%').' -o '.shellescape('%:r-exe').' && ./'.shellescape('%:r-exe')<CR>
autocmd filetype rust nnoremap <leader>go :w <bar> exec '!printf "\33c\e[3J";rustc %; ./'.shellescape('%:r')<CR>
autocmd filetype python nnoremap <leader>go :w <bar> exec '!printf "\33c\e[3J";python3 %'<CR>
" Paste a lot of stuff
noremap <leader>p "*p
noremap <leader>P "*P
" Load competitive programming template
nnoremap <leader>cp <Cmd>r ~/.vim/templates/cp.cpp<CR>i<BS><Esc>
" Select all
noremap <leader>a ggVG
" Yank to system clipboard
noremap <leader>y "*y
" Select all and copy to system clipboard
noremap <leader>f ggvG"*y
" Switch buffers using <leader>w
nnoremap <leader>w <C-w>w
" Remaps for CtrlP
nnoremap <leader>sb :CtrlPBuffer<CR>
nnoremap <leader>sf :CtrlP<CR>
call plug#begin()
Plug 'ctrlpvim/ctrlp.vim'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
call plug#end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment