Skip to content

Instantly share code, notes, and snippets.

@Aadv1k
Created March 24, 2022 15:43
Show Gist options
  • Save Aadv1k/58886d5914be8461fd4a25e257a833dd to your computer and use it in GitHub Desktop.
Save Aadv1k/58886d5914be8461fd4a25e257a833dd to your computer and use it in GitHub Desktop.
gvimrc
set guifont=consolas:h12
set termguicolors
set guioptions-=m " menu bar
set guioptions-=T " tool bar
set guioptions-=r " scroll bar
syntax on
set noerrorbells
set belloff=all
set nu
set guicursor=
set smartindent autoindent
set expandtab
set tabstop=4 softtabstop=4
set shiftwidth=4
set hidden
set noerrorbells
set nowrap
set backspace=2
set incsearch
set nohlsearch
set smartcase
set ignorecase
set noswapfile
set nobackup
set textwidth=79
set scrolloff=8
set splitright
"" https://github.com/microsoft/terminal/issues/6865
set cursorline
set formatoptions-=cro
set encoding=utf-8
let g:netrw_liststyle=3
let g:netrw_banner=0
let g:netrw_browse_split=2
let g:netrw_winsize=80
let g:gruvbox_material_background = 'medium'
color gruvbox-material
augroup htmlMode
autocmd!
autocmd BufRead,BufReadPost *.js,*.jsx,*.md,*.css,*.html,*.scss,*.json nmap <silent> <Leader>fmt :silent exec '!prettier --write %'<CR>:e<CR>
autocmd BufRead,BufReadPost *.js,*.jsx,*.css,*.html,*.scss,*.json call SetTwoIndent()
autocmd FileType sass set filetype=scss
function! SetTwoIndent()
set tabstop=2 softtabstop=2 shiftwidth=2
endfunction
autocmd FileType html nmap <CR> <c-y>,
autocmd FileType javascript nnoremap <Leader>js :!node %<CR>
autocmd FileType typescript nnoremap <Leader>js :execute '!tsc % && node ' . expand('%:r') . '.js'<CR>
augroup END
augroup pyMode
autocmd!
autocmd FileType python nnoremap <silent> <Leader>fmt :silent exec ':!python3 -m autopep8 --in-place --aggressive %'<CR>:e<CR>
autocmd FileType python nnoremap <Leader>js :!python3 %<cr>
augroup END
augroup cppMode
autocmd!
autocmd FileType c nmap <silent> <Leader>js :execute '!gcc % -o ' . expand('%:r') . ' && ./' . expand('%:r') <CR>
autocmd FileType cpp nmap <silent> <Leader>js :execute '!g++ % -o' . expand('%:r') . ' && ./' . expand('%:r') <CR>
augroup END
augroup luaMode
autocmd!
autocmd FileType lua nnoremap <Leader>js :!lua %<cr>
augroup END
"""""""""""""""""""""""
"""""""""""""""""""""""
""""""""Keymaps""""""""
"""""""""""""""""""""""
"""""""""""""""""""""""
let mapleader=" "
tmap <Esc> <C-\><C-n>
" Simple but awesome
imap <c-space> <c-p>
" Force of habit :/
imap <c-o>cw <c-o>cb
nmap <silent> <S-l> :tabn<CR>
nmap <silent> <S-h> :tabp<CR>
inoremap , ,<c-g>u
inoremap . .<c-g>u
inoremap ( (<c-g>u
nmap <C-Right> :vertical res +2 <CR>
nmap <C-Left> :vertical res -2 <CR>
nmap <C-Up> :res +2 <CR>
nmap <C-Down> :res -2 <CR>
nnoremap J mzJ`z
nnoremap n nzzzv
nnoremap N Nzzzv
nnoremap Y y$
vnoremap > >gv
vnoremap < <gv
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
cnoreabbrev W w
cnoreabbrev Wq wq
cnoreabbrev WQ wq
cnoreabbrev Q q
cnoreabbrev so so %
cnoreabbrev Wqa wqa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment