Last active
March 23, 2025 13:51
-
-
Save shikaan/f3e269bad0cfefee3a47e30777a0c045 to your computer and use it in GitHub Desktop.
.vimrc (with tmux and alacritty)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g mouse on | |
set -g status-style "bg=default" | |
set -g window-status-current-style "bg=default,reverse" | |
set -g window-status-separator '|' | |
set -g window-status-format " #W#{?window_flags,#F, } (M-#I) " | |
set -g window-status-current-format " #W#{?window_flags,#F, } (M-#I) " | |
set -g base-index 1 | |
set-window-option -g pane-base-index 1 | |
set -g status-position top | |
# Don't slowdown mode change in vim | |
set -sg escape-time 0 | |
set -g xterm-keys on | |
bind -n M-t new-window | |
bind -n M-1 selectw -t 1 | |
bind -n M-2 selectw -t 2 | |
bind -n M-3 selectw -t 3 | |
bind -n M-4 selectw -t 4 | |
bind -n M-5 selectw -t 5 | |
bind -n M-6 selectw -t 6 | |
bind -n M-7 selectw -t 7 | |
bind -n M-8 selectw -t 8 | |
bind -n M-9 selectw -t 9 | |
bind -n M-0 selectw -t 0 | |
bind r source-file ~/.tmux.conf \; display ".tmux.conf reloaded!" | |
set -g default-terminal tmux-256color |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:vimspector_enable_mappings = 'HUMAN' | |
call plug#begin('~/.vim/plugins') | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'yegappan/lsp' | |
Plug 'tpope/vim-commentary' | |
Plug 'puremourning/vimspector' | |
call plug#end() | |
set number | |
set encoding=UTF-8 | |
set signcolumn=yes | |
colorscheme habamax | |
set cursorline | |
" Wrap cursor at the beginning and end of the line | |
set whichwrap+=>,l | |
set whichwrap+=<,h | |
" Use system clipboard | |
set clipboard^=unnamed,unnamedplus | |
" Highlight serach result | |
set hlsearch | |
" Fold based on syntax | |
set foldmethod=syntax | |
set foldlevel=20 | |
" Intendation | |
set expandtab | |
set tabstop=2 | |
set softtabstop=2 | |
set shiftwidth=2 | |
set smartindent | |
set ignorecase | |
set smartcase | |
set incsearch | |
set hidden | |
set nobackup | |
set nowritebackup | |
set noswapfile | |
set mouse=a | |
set ttimeoutlen=0 | |
let mapleader=" " | |
"" Color Preferences | |
highlight link Function Boolean " Distinguish functions from identifiers | |
"" junegunn/fzf | |
nnoremap <leader><leader>f :call fzf#run(fzf#wrap({'sink': 'e', 'source': 'git ls-files -c -d -m -o --exclude-standard --deduplicate', 'options': '--reverse --preview="cat {}"'}))<CR> | |
nnoremap <leader><leader>b :call fzf#run(fzf#wrap({'sink': 'b', 'source': map(filter(getbufinfo(), 'v:val.listed'), 'bufname(v:val.bufnr)'), 'options': '--reverse --preview="cat {}"'}))<CR> | |
""yegappan/lsp | |
nnoremap <leader>a :LspCodeAction<CR> | |
nnoremap <leader>rn :LspRename<CR> | |
nnoremap <leader>f :LspFormat<CR> | |
nnoremap <silent><F2> :LspDiag nextWrap<CR> | |
nnoremap <silent><S-F2> :LspDiag prevWrap<CR> | |
nnoremap <silent>K :LspHover<CR> | |
nnoremap <leader>d :LspGotoDefinition<CR> | |
nnoremap <leader>b :LspShowReferences<CR> | |
nnoremap <leader>i :LspGotoImpl<CR> | |
nnoremap <leader>s :LspSymbolSearch<CR> | |
let lspOpts = #{ | |
\ autoHighlightDiags: v:true, | |
\ semanticHighlight: v:true, | |
\ diagSignErrorText: ' !', | |
\ diagSignWarningText: ' >', | |
\ } | |
autocmd User LspSetup call LspOptionsSet(lspOpts) | |
let lspServers = [#{ | |
\ name: 'clang', | |
\ filetype: ['c', 'cpp', 'h'], | |
\ path: '/opt/homebrew/opt/llvm/bin/clangd', | |
\ args: ['--clang-tidy', '--suggest-missing-includes', '--background-index', '--header-insertion=iwyu'], | |
\ }] | |
autocmd User LspSetup call LspAddServer(lspServers) | |
highlight LspDiagSignErrorText ctermfg=red | |
highlight LspDiagSignWarnText ctermfg=yellow | |
"" tpope/vim-commentary | |
xmap <leader>c <Plug>Commentary | |
omap <leader>c <Plug>Commentary | |
nmap <leader>c <Plug>CommentaryLine | |
"" Cursor | |
let &t_SI = "\e[6 q" | |
let &t_EI = "\e[2 q" | |
"" Custom keybindings | |
nnoremap <A-Down> :m .+1<CR>== | |
nnoremap <A-Up> :m .-2<CR>== | |
vnoremap <A-Down> :m '>+1<CR>gv=gv | |
vnoremap <A-Up> :m '<-2<CR>gv=gv | |
"" Snippets | |
function! InsertSnippet() | |
let filetype = &filetype | |
let s:snippets_dir = expand('~/.vim/snippets/' . filetype) | |
if !isdirectory(s:snippets_dir) | |
echo "No snippets available for file type: " . filetype | |
return | |
endif | |
let snippets = split(globpath(s:snippets_dir, '*'), '\n') | |
if empty(snippets) | |
echo "No snippets available in " . s:snippets_dir | |
return | |
endif | |
" add selection to yank register, but backup first | |
let s:old_yank_register = @" | |
normal! gvy | |
let s:selection = @" | |
let snippet_names = map(snippets, {_, v -> fnamemodify(v, ':t') }) | |
call fzf#run({'source': snippet_names, 'sink': function('InsertSelectedSnippet'), 'window': {'relative': v:true, 'width': 64, 'height': 16}, 'options': '--reverse --preview="cat ' . s:snippets_dir . '/{}"'}) | |
endfunction | |
function! InsertSelectedSnippet(selected) | |
let snippet_content = readfile(s:snippets_dir . '/' . a:selected) | |
let snippet_lines = snippet_content | |
" Replace $$SELECTION$$ if needed | |
if empty('s:selection') | |
else | |
let snippet_lines = map(snippet_lines, {_, val -> substitute(val, '\$\$SELECTION\$\$', escape(s:selection, '\'), 'g')}) | |
let @" = s:old_yank_register | |
endif | |
let l:line = line('.') | |
let l:indent = indent(l:line) | |
let l:indented_snippet = map(snippet_lines, {_, val -> repeat(" ", l:indent) . val}) | |
call append(l:line, l:indented_snippet) | |
" Find and place cursor at $$CURSOR$$ if it exists | |
let l:cursor = getpos(".") | |
if search('\$\$CURSOR\$\$', 'W') | |
execute "normal! v9lc" | |
else | |
call setpos('.', l:cursor) | |
endif | |
endfunction | |
nnoremap <leader>sn :call InsertSnippet()<CR> | |
xnoremap . :call InsertSnippet()<CR> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schemes: | |
light: &light | |
primary: | |
background: '0xf8f8f8' | |
foreground: '0x2a2b33' | |
normal: | |
black: '0x000000' | |
red: '0xde3d35' | |
green: '0x3e953a' | |
yellow: '0xd2b67b' | |
blue: '0x2f5af3' | |
magenta: '0xa00095' | |
cyan: '0x3e953a' | |
white: '0xbbbbbb' | |
bright: | |
black: '0x000000' | |
red: '0xde3d35' | |
green: '0x3e953a' | |
yellow: '0xd2b67b' | |
blue: '0x2f5af3' | |
magenta: '0xa00095' | |
cyan: '0x3e953a' | |
white: '0xffffff' | |
dark: &dark | |
primary: | |
background: '0x1e2127' | |
foreground: '0xabb2bf' | |
normal: | |
black: '0x1e2127' | |
red: '0xe06c75' | |
green: '0x98c379' | |
yellow: '0xd19a66' | |
blue: '0x61afef' | |
magenta: '0xc678dd' | |
cyan: '0x56b6c2' | |
white: '0xabb2bf' | |
bright: | |
black: '0x5c6370' | |
red: '0xe06c75' | |
green: '0x98c379' | |
yellow: '0xd19a66' | |
blue: '0x61afef' | |
magenta: '0xc678dd' | |
cyan: '0x56b6c2' | |
white: '0xffffff' | |
scrolling: | |
history: 1000 | |
font: | |
size: 12 | |
normal: | |
family: "Inconsolata" | |
selection: | |
save_to_clipboard: false | |
cursor: | |
style: Underline | |
draw_bold_text_with_bright_colors: false | |
shell: | |
program: tmux | |
colors: *dark |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment