Skip to content

Instantly share code, notes, and snippets.

@itsgg
Last active September 21, 2025 12:09
Show Gist options
  • Select an option

  • Save itsgg/c96d82424771905d065ed35ec5b5f46e to your computer and use it in GitHub Desktop.

Select an option

Save itsgg/c96d82424771905d065ed35ec5b5f46e to your computer and use it in GitHub Desktop.
vim
" Basic Settings
set nocompatible " Use Vim settings rather than Vi settings
filetype plugin indent on " Enable file type detection and plugin/indent loading
syntax enable " Enable syntax highlighting
set encoding=UTF-8 " Set encoding to UTF-8
set termencoding=utf-8 " Set terminal encoding to UTF-8
set number " Show line numbers
set cursorline " Highlight current line
set showmatch " Show matching brackets
set incsearch " Incremental search
set nohlsearch " Don't highlight search results
set ignorecase " Case insensitive search
set smartcase " Case sensitive if search contains uppercase
set hidden " Allow switching buffers without saving
set mouse=a " Enable mouse support
set clipboard=unnamed " Use system clipboard
set backspace=indent,eol,start " Make backspace work as expected
set history=1000 " Keep more command history
set undolevels=1000 " More undo history
set wildmenu " Command completion
set wildmode=list:longest " Complete longest common string
set scrolloff=8 " Keep 8 lines above/below cursor
set sidescrolloff=8 " Keep 8 columns left/right of cursor
set splitbelow " Open split below
set splitright " Open split right
set termwinsize=10x0 " Set terminal height
set noswapfile " No swapfile
set nobackup " No backup
set nowritebackup " No write backup
" Indentation settings
set autoindent " Copy indent from current line when starting a new line
set smartindent " Smart auto-indenting
set expandtab " Use spaces instead of tabs
set tabstop=4 " Number of spaces for a tab
set shiftwidth=4 " Number of spaces for autoindent
set softtabstop=4 " Number of spaces for a tab in insert mode
set signcolumn=yes " Always show sign column
" GUI Settings
if has('gui_running')
" Set GUI font to JetBrains Mono with ligatures
set guifont=JetBrains\ Mono:h13
set transparency=2
" Remove GUI elements for a cleaner look
set guioptions-=T " Remove toolbar
set guioptions-=r " Remove right scrollbar
set guioptions-=L " Remove left scrollbar
set guioptions-=m " Remove menu bar
" Enable ligatures (if supported by your MacVim version)
set macligatures
endif
" Theme settings
set termguicolors " Enable true color support
set background=dark " Use dark background
" Install vim-plug if not installed
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Plugins
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-commentary'
Plug 'nanotech/jellybeans.vim'
Plug 'voldikss/vim-floaterm'
Plug 'preservim/nerdtree'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'tpope/vim-fugitive'
Plug 'junegunn/fzf.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'mattn/vim-lsp-settings'
Plug 'christoomey/vim-tmux-navigator'
" Plug 'github/copilot.vim'
Plug 'dracula/vim', { 'as': 'dracula' }
call plug#end()
" Disable automatic comment insertion
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Apply theme
colorscheme jellybeans
" Make jellybeans background transparent
hi Normal guibg=NONE ctermbg=NONE
hi NonText guibg=NONE ctermbg=NONE
hi LineNr guibg=NONE ctermbg=NONE
hi SignColumn guibg=NONE ctermbg=NONE
hi EndOfBuffer guibg=NONE ctermbg=NONE
hi StatusLine guibg=NONE guifg=#ffffff ctermbg=NONE ctermfg=15
hi StatusLineNC guibg=NONE guifg=#ffffff ctermbg=NONE ctermfg=15
" Status line settings
set laststatus=2
" Customize floaterm title
let g:floaterm_title = "Terminal"
" Performance settings
set lazyredraw " Don't redraw while executing macros
set ttyfast " Faster redrawing
set updatetime=300 " Faster update time
" Shortcuts
let mapleader = ","
" inoremap <expr> <Tab> copilot#Accept("\<CR>")
" Remove search highlights
nnoremap <silent> <leader><Space> :nohlsearch<CR>
" Toggle FloatTerm
function! ToggleFloatermKill()
if floaterm#terminal#get_bufnr(0) != -1 && floaterm#window#find() != -1
" If Floaterm is open, kill it
execute 'FloatermKill'
else
" If Floaterm is not open, open it
execute 'FloatermNew'
endif
endfunction
nnoremap <silent> <leader>t :call ToggleFloatermKill()<CR>
tnoremap <silent> <leader>t <C-\><C-n>:call ToggleFloatermKill()<CR>
" Toggle NerdTree
nnoremap <leader>e :NERDTreeToggle<CR>
" Format Document
nnoremap <leader>f :LspDocumentFormat<CR>
" Telescope Shortcuts
nnoremap <leader>ff :Files<cr>
nnoremap <leader>fg :GFiles<cr>
nnoremap <leader>fb :Buffers<cr>
nnoremap <leader>fr :Rg<cr>
" Easier Window Navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Comment
noremap <leader>c :Commentary<CR>
" Scrollmode
tnoremap <C-s> <C-\><C-n>
" Tabs
noremap <D-1> :tabn 1<CR>
noremap <D-2> :tabn 2<CR>
noremap <D-3> :tabn 3<CR>
noremap <D-4> :tabn 4<CR>
noremap <D-5> :tabn 5<CR>
noremap <D-6> :tabn 6<CR>
noremap <D-7> :tabn 7<CR>
noremap <D-8> :tabn 8<CR>
noremap <D-9> :tabn 9<CR>
" Run
autocmd FileType python map <buffer> <leader>r :w<CR>:exec '!python' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <leader>r <esc>:w<CR>:exec '!python' shellescape(@%, 1)<CR>
" LSP
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'typescript',
\ 'cmd': {server_info->['typescript-language-server', '--stdio']},
\ 'whitelist': ['javascript', 'javascriptreact', 'typescript', 'typescriptreact'],
\ })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment