├── .fdignore ├── bin ├── .gitignore ├── git-root ├── git-undo ├── palette ├── op ├── tovim ├── git-url ├── deadlink ├── battery ├── peco-tmux ├── diff-highlight └── wifi ├── .zsh ├── .gitignore ├── Completion │ ├── _httpstat │ ├── _gomi │ ├── _gist │ └── _jq ├── 90_misc.zsh ├── 50_setopts.zsh ├── 70_zstyles.zsh └── 30_aliases.zsh ├── .config ├── enhancd │ ├── .gitignore │ ├── my.fav │ └── config.ltsv ├── nvim.old │ ├── .gitignore │ ├── after │ │ └── ftplugin │ │ │ └── terraform.lua │ ├── lua │ │ ├── commands.lua │ │ ├── options.lua │ │ ├── autocmds.lua │ │ ├── filetypes.lua │ │ ├── keymaps.lua │ │ └── plugins │ │ │ ├── nvim-cmp.lua │ │ │ ├── neo-tree.lua │ │ │ └── telescope.lua │ ├── README.md │ ├── plugin │ │ ├── backup.vim │ │ └── rm.vim │ └── init.lua ├── .gitignore ├── zsh │ └── abbreviations ├── afx │ ├── github-p.yaml │ ├── local.yaml │ ├── gist.yaml │ ├── gh-extensions.yaml │ └── http.yaml ├── nvim │ ├── README.md │ ├── lua │ │ ├── config │ │ │ ├── commands.lua │ │ │ ├── lazy.lua │ │ │ ├── options.lua │ │ │ ├── filetypes.lua │ │ │ ├── autocmds.lua │ │ │ └── keymaps.lua │ │ └── plugins │ │ │ ├── markdown.lua │ │ │ ├── rm.lua │ │ │ ├── ftcolor.lua │ │ │ ├── which-key.lua │ │ │ ├── treesitter.lua │ │ │ ├── indent-blankline.lua │ │ │ ├── backup.lua │ │ │ ├── completion.lua │ │ │ ├── atone.lua │ │ │ ├── editing.lua │ │ │ ├── lualine.lua │ │ │ ├── wilder.lua │ │ │ ├── hlchunk.lua │ │ │ ├── lsp.lua │ │ │ ├── bufferline.lua │ │ │ ├── conform.lua │ │ │ ├── lspsaga.lua │ │ │ ├── golang.lua │ │ │ ├── colorschemes.lua │ │ │ ├── git.lua │ │ │ ├── oil.lua │ │ │ ├── barbar.lua │ │ │ ├── trouble.lua │ │ │ └── render-markdown.lua │ ├── init.lua │ └── lazy-lock.json ├── fish │ ├── completions │ │ └── vault.fish │ ├── fish_variables │ └── config.fish ├── blog │ └── config.yaml ├── ghostty │ └── config ├── gh-dash │ └── config.yml └── gomi │ └── config.yaml ├── .github └── FUNDING.yml ├── .vim ├── after │ ├── ftplugin │ │ ├── markdown.vim │ │ ├── yaml.vim │ │ ├── terraform.vim │ │ ├── javascript.vim │ │ ├── vim.vim │ │ └── go.vim │ └── syntax │ │ └── sh │ │ └── awkembed.vim ├── ftplugin │ └── go │ │ └── gocomplete.vim ├── _config │ ├── caw.vim │ ├── ftcolor.vim │ ├── anzu.vim │ ├── fzf.vim │ └── lightline.vim ├── .gitignore ├── plugin │ ├── jq.vim │ ├── restore_curpos.vim │ ├── cd_parent_dir.vim │ ├── backup.vim │ ├── rm.vim │ └── cursor-x.vim ├── syntax │ ├── vimgo.vim │ ├── gohtmltmpl.vim │ ├── godefstack.vim │ └── gotexttmpl.vim └── ftdetect │ └── go.vim ├── etc ├── scripts │ ├── tac.sh │ ├── rust.sh │ ├── mov2gif.sh │ ├── brew.sh │ ├── font.sh │ ├── tac.pl │ ├── which.py │ ├── tac.awk │ └── tree.py └── ss │ ├── neovim.png │ ├── 2025-11-09.png │ ├── neovim-2025-11-20.png │ └── 222952851-12e3765b-44c2-49c2-93e5-07eb16502994.png ├── .gitignore ├── .obsidian.vimrc ├── .curlrc ├── .gitmessage ├── .zshrc ├── Makefile ├── README.md ├── .bashrc ├── .zprofile ├── Brewfile ├── .zshenv ├── .tmux └── bin │ ├── README.md │ ├── kube │ └── path ├── .gitconfig └── .dir_colors /.fdignore: -------------------------------------------------------------------------------- 1 | .git 2 | -------------------------------------------------------------------------------- /bin/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /.zsh/.gitignore: -------------------------------------------------------------------------------- 1 | *secret*.zsh 2 | -------------------------------------------------------------------------------- /.config/enhancd/.gitignore: -------------------------------------------------------------------------------- 1 | secret.fav 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: 2 | - babarot 3 | -------------------------------------------------------------------------------- /.config/enhancd/my.fav: -------------------------------------------------------------------------------- 1 | ~/.config/nvim 2 | ~/.config/afx 3 | -------------------------------------------------------------------------------- /.vim/after/ftplugin/markdown.vim: -------------------------------------------------------------------------------- 1 | setlocal foldmethod=manual 2 | -------------------------------------------------------------------------------- /.vim/after/ftplugin/yaml.vim: -------------------------------------------------------------------------------- 1 | setlocal shiftwidth=2 tabstop=2 2 | -------------------------------------------------------------------------------- /.zsh/Completion/_httpstat: -------------------------------------------------------------------------------- 1 | #compdef httpstat 2 | 3 | _curl "$@" 4 | -------------------------------------------------------------------------------- /bin/git-root: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git rev-parse --show-toplevel 4 | -------------------------------------------------------------------------------- /.vim/after/ftplugin/terraform.vim: -------------------------------------------------------------------------------- 1 | setlocal shiftwidth=2 tabstop=2 2 | -------------------------------------------------------------------------------- /etc/scripts/tac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ex -s "$1" <(caw:i:toggle) 6 | -------------------------------------------------------------------------------- /.obsidian.vimrc: -------------------------------------------------------------------------------- 1 | imap jj 2 | nmap j gj 3 | nmap k gk 4 | nmap H ^ 5 | vmap v $h 6 | 7 | set clipboard=unnamed 8 | -------------------------------------------------------------------------------- /.config/zsh/abbreviations: -------------------------------------------------------------------------------- 1 | abbr "d c"="docker compose" 2 | abbr d="docker" 3 | abbr k="kubectl" 4 | abbr cf="conftest" 5 | abbr tf="terraform" 6 | -------------------------------------------------------------------------------- /etc/scripts/rust.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # https://doc.rust-lang.org/cargo/getting-started/installation.html 3 | 4 | curl https://sh.rustup.rs -sSf | sh 5 | -------------------------------------------------------------------------------- /bin/palette: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for c in {0..255} 4 | do 5 | printf "\e[48;5;%dm %3d \e[0m" $c $c 6 | [ $(($c % 16)) -eq 15 ] && echo 7 | done 8 | -------------------------------------------------------------------------------- /etc/ss/222952851-12e3765b-44c2-49c2-93e5-07eb16502994.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/babarot/dotfiles/HEAD/etc/ss/222952851-12e3765b-44c2-49c2-93e5-07eb16502994.png -------------------------------------------------------------------------------- /.vim/.gitignore: -------------------------------------------------------------------------------- 1 | plugged 2 | bundle 3 | swap 4 | undo 5 | view 6 | .netrwhist 7 | *~ 8 | **/*~ 9 | .DS_Store 10 | **/.DS_Store 11 | signs 12 | autoload/plug.vim 13 | -------------------------------------------------------------------------------- /.zsh/90_misc.zsh: -------------------------------------------------------------------------------- 1 | # need colors 2 | printf "\n${fg_bold[cyan]} ${SHELL} ${fg_bold[red]}${ZSH_VERSION}" 3 | printf "${fg_bold[cyan]} - DISPLAY on ${fg_bold[red]}${TMUX:+$(tmux -V)}${reset_color}\n\n" 4 | -------------------------------------------------------------------------------- /etc/scripts/mov2gif.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | from=${1:?mov file is required} 6 | to=${2:-outout.gif} 7 | 8 | ffmpeg -i ${from} -pix_fmt rgb8 -r 10 ${to} 9 | gifsicle -O3 ${to} -o ${to} 10 | -------------------------------------------------------------------------------- /.config/nvim.old/after/ftplugin/terraform.lua: -------------------------------------------------------------------------------- 1 | local colorscheme = "github_dark" 2 | local ok, _ = pcall(vim.api.nvim_command, "colorscheme " .. colorscheme) 3 | if not ok then 4 | print("error setting colorscheme") 5 | end 6 | -------------------------------------------------------------------------------- /.config/afx/github-p.yaml: -------------------------------------------------------------------------------- 1 | github: 2 | - name: babarot/claude-commands 3 | description: 4 | owner: babarot 5 | repo: claude-commands 6 | command: 7 | link: 8 | - from: . 9 | to: $HOME/.claude/commands 10 | -------------------------------------------------------------------------------- /.vim/plugin/jq.vim: -------------------------------------------------------------------------------- 1 | function! s:jq(...) 2 | if 0 == a:0 3 | let l:arg = "." 4 | else 5 | let l:arg = a:1 6 | endif 7 | execute "%! jq \"" . l:arg . "\"" 8 | endfunction 9 | command! -nargs=? JQ call s:jq() 10 | -------------------------------------------------------------------------------- /etc/scripts/brew.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if command -v brew &>/dev/null; then 4 | echo "${0}: brew is already installed" 5 | exit 0 6 | fi 7 | 8 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 9 | -------------------------------------------------------------------------------- /bin/op: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if ! type open &>/dev/null; then 4 | exit 1 5 | fi 6 | 7 | if [[ -p /dev/stdin ]]; then 8 | open "$(cat <&0)" "$@" 9 | else 10 | if [[ -z $1 ]]; then 11 | open . 12 | else 13 | open "$@" 14 | fi 15 | fi 16 | -------------------------------------------------------------------------------- /.config/nvim/README.md: -------------------------------------------------------------------------------- 1 | ![](../../etc/ss/neovim-2025-11-20.png) 2 | 3 | ## Version 4 | 5 | ``` 6 | NVIM v0.11.5 7 | Build type: Release 8 | LuaJIT 2.1.1762617240 9 | Run "nvim -V1 -v" for more info 10 | ``` 11 | 12 | ## Plugins 13 | 14 | [List](./lua/plugins/README.md) 15 | -------------------------------------------------------------------------------- /.config/afx/local.yaml: -------------------------------------------------------------------------------- 1 | local: 2 | - name: zsh 3 | description: My zsh scripts 4 | directory: ~/.zsh 5 | plugin: 6 | if: | 7 | [[ $SHELL == *zsh* ]] 8 | sources: 9 | - '[0-9]*.zsh' 10 | depends-on: 11 | - zdharma-continuum/history-search-multi-word 12 | -------------------------------------------------------------------------------- /.config/nvim.old/lua/commands.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_user_command('JQ', 2 | function(opts) 3 | local arg 4 | if #opts.args == 0 then 5 | arg = "." 6 | else 7 | arg = opts.args[0] 8 | end 9 | vim.fn.execute("%! jq " .. arg, true) 10 | end, {}) 11 | -------------------------------------------------------------------------------- /.vim/after/ftplugin/javascript.vim: -------------------------------------------------------------------------------- 1 | setlocal shiftwidth=2 tabstop=2 2 | 3 | " augroup jsautocmd 4 | " " https://github.com/millermedeiros/vim-esformatter 5 | " autocmd! 6 | " autocmd BufWritePre *.js :Esformatter 7 | " augroup END 8 | 9 | command! -range=% JSFmt :Esformatter 10 | -------------------------------------------------------------------------------- /.vim/after/ftplugin/vim.vim: -------------------------------------------------------------------------------- 1 | setlocal tabstop=2 shiftwidth=2 softtabstop=2 smarttab expandtab 2 | setlocal autoindent keywordprg=:help 3 | setlocal textwidth=78 formatoptions-=r formatoptions-=o nomodeline 4 | setlocal colorcolumn=+1 5 | if &modifiable 6 | setlocal fileformat=unix 7 | endif 8 | -------------------------------------------------------------------------------- /.config/fish/completions/vault.fish: -------------------------------------------------------------------------------- 1 | 2 | function __complete_vault 3 | set -lx COMP_LINE (string join ' ' (commandline -o)) 4 | test (commandline -ct) = "" 5 | and set COMP_LINE "$COMP_LINE " 6 | /usr/local/bin/vault 7 | end 8 | complete -c vault -a "(__complete_vault)" 9 | 10 | -------------------------------------------------------------------------------- /.vim/plugin/restore_curpos.vim: -------------------------------------------------------------------------------- 1 | function! s:restore_cursor_postion() 2 | if line("'\"") <= line("$") 3 | normal! g`" 4 | return 1 5 | endif 6 | endfunction 7 | 8 | augroup restore-cursor-position 9 | autocmd! 10 | autocmd BufWinEnter * call restore_cursor_postion() 11 | augroup END 12 | -------------------------------------------------------------------------------- /.vim/syntax/vimgo.vim: -------------------------------------------------------------------------------- 1 | if exists("b:current_syntax") 2 | finish 3 | endif 4 | 5 | let b:current_syntax = "vimgo" 6 | 7 | syn match goInterface /^\S*/ 8 | syn region goTitle start="\%1l" end=":" 9 | 10 | hi def link goInterface Type 11 | hi def link goTitle Label 12 | 13 | " vim: sw=2 ts=2 et 14 | -------------------------------------------------------------------------------- /.vim/syntax/gohtmltmpl.vim: -------------------------------------------------------------------------------- 1 | if exists("b:current_syntax") 2 | finish 3 | endif 4 | 5 | if !exists("main_syntax") 6 | let main_syntax = 'html' 7 | endif 8 | 9 | runtime! syntax/gotexttmpl.vim 10 | runtime! syntax/html.vim 11 | unlet b:current_syntax 12 | 13 | let b:current_syntax = "gohtmltmpl" 14 | 15 | " vim: sw=2 ts=2 et 16 | -------------------------------------------------------------------------------- /.vim/plugin/cd_parent_dir.vim: -------------------------------------------------------------------------------- 1 | function! s:cd_file_parentdir() 2 | let dir = expand("%:p:h") 3 | if !isdirectory(dir) 4 | return 5 | endif 6 | execute ":lcd " . expand("%:p:h") 7 | endfunction 8 | 9 | augroup cd-file-parentdir 10 | autocmd! 11 | autocmd BufRead,BufEnter * call cd_file_parentdir() 12 | augroup END 13 | -------------------------------------------------------------------------------- /etc/scripts/font.sh: -------------------------------------------------------------------------------- 1 | # NOTE: need to run brew bundle first 2 | # 3 | # https://zenn.dev/hisasann/articles/e8e6b17bf9faab 4 | # 5 | cd ~/Library/Fonts && curl -fLo \ 6 | "Droid Sans Mono for Powerline Nerd Font Complete.otf" \ 7 | https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete.otf 8 | -------------------------------------------------------------------------------- /.config/blog/config.yaml: -------------------------------------------------------------------------------- 1 | blog: 2 | name: tellme.tokyo 3 | url: https://tellme.tokyo 4 | dev_port: 1313 5 | draft: 6 | color: "#5FB458" 7 | suffix: "::Draft" 8 | 9 | hugo: 10 | command: hugo server --disableFastRender #--buildDrafts 11 | root_dir: $HOME/src/github.com/babarot/tellme.tokyo 12 | content_dir: content/post 13 | 14 | editor: nvim 15 | open_command: open -R 16 | -------------------------------------------------------------------------------- /.curlrc: -------------------------------------------------------------------------------- 1 | # Enable redirect 2 | -L 3 | 4 | # Permit unsafed SSL 5 | -k 6 | 7 | # Verbose 8 | -v 9 | 10 | # Disguise as IE 9 on Windows 7. 11 | user-agent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" 12 | 13 | # When following a redirect, automatically set the previous URL as referer. 14 | referer = ";auto" 15 | 16 | # Wait 60 seconds before timing out. 17 | connect-timeout = 60 18 | -------------------------------------------------------------------------------- /etc/scripts/tac.pl: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/perl 2 | # Oneliner: perl -e 'print reverse <>' 3 | use strict; 4 | use warnings; 5 | 6 | @ARGV or die "$0 [files...]"; 7 | 8 | for my $filename ( reverse @ARGV ) { 9 | open my $fh, '<', $filename or die "$filename:$!"; 10 | my @loc; 11 | push @loc, tell($fh) while (<$fh>); 12 | seek $fh, $_, 0 and print scalar <$fh> for ( reverse @loc ); 13 | close $fh; 14 | } 15 | -------------------------------------------------------------------------------- /.config/nvim.old/README.md: -------------------------------------------------------------------------------- 1 | [neovim]: https://img.shields.io/badge/neovim-v0.8.0-57A143.svg?style=popout&logo=neovim 2 | 3 | Neovim [![][neovim]](https://neovim.io/) 4 | ====== 5 | 6 | ![](https://user-images.githubusercontent.com/4442708/226423705-791907e5-7d4e-469e-9dda-e8f45411dbc2.png) 7 | 8 | ## Plugins 9 | 10 | Plugin manager: [folke/lazy.nvim](https://github.com/folke/lazy.nvim) 11 | 12 | ## Documents 13 | 14 | - [Neovim Docs](https://dzfrias.github.io/nvim-docsearch/) 15 | -------------------------------------------------------------------------------- /.vim/_config/ftcolor.vim: -------------------------------------------------------------------------------- 1 | if !g:pkg.installed('ftcolor.vim') 2 | finish 3 | endif 4 | 5 | let g:ftcolor_plugin_enabled = 1 6 | let g:ftcolor_redraw = 1 7 | let g:ftcolor_default_color_scheme = 'seoul256' 8 | let g:ftcolor_color_mappings = { 9 | \ 'vim': 'Tomorrow-Night', 10 | \ 'hcl': 'gruvbox', 11 | \ 'go': 'seoul256', 12 | \ 'yaml': 'seoul256', 13 | \ 'bash': 'despacio', 14 | \ 'zsh': 'despacio', 15 | \ 'sh': 'seoul256', 16 | \ } 17 | -------------------------------------------------------------------------------- /.vim/_config/anzu.vim: -------------------------------------------------------------------------------- 1 | if !g:pkg.installed('anzu.vim') 2 | finish 3 | endif 4 | 5 | nmap n (anzu-n) 6 | nmap N (anzu-N) 7 | nmap * (anzu-star) 8 | nmap # (anzu-sharp) 9 | nmap n (anzu-n-with-echo) 10 | nmap N (anzu-N-with-echo) 11 | nmap * (anzu-star-with-echo) 12 | nmap # (anzu-sharp-with-echo) 13 | 14 | augroup vim-anzu 15 | autocmd! 16 | autocmd CursorHold,CursorHoldI,WinLeave,TabLeave * call anzu#clear_search_status() 17 | augroup END 18 | -------------------------------------------------------------------------------- /.vim/plugin/backup.vim: -------------------------------------------------------------------------------- 1 | set backup 2 | 3 | augroup backup-files-automatically 4 | autocmd! 5 | autocmd BufWritePre * call s:backup_files() 6 | augroup END 7 | 8 | function! s:backup_files() 9 | let dir = strftime("~/.backup/vim/%Y/%m/%d", localtime()) 10 | if !isdirectory(dir) 11 | call system("mkdir -p " . dir) 12 | call system("chown goth:staff " . dir) 13 | endif 14 | execute "set backupdir=" . dir 15 | execute "set backupext=." . strftime("%H_%M_%S", localtime()) 16 | endfunction 17 | -------------------------------------------------------------------------------- /.config/nvim.old/plugin/backup.vim: -------------------------------------------------------------------------------- 1 | set backup 2 | 3 | augroup backup-files-automatically 4 | autocmd! 5 | autocmd BufWritePre * call s:backup_files() 6 | augroup END 7 | 8 | function! s:backup_files() 9 | let dir = strftime("~/.backup/vim/%Y/%m/%d", localtime()) 10 | if !isdirectory(dir) 11 | call system("mkdir -p " . dir) 12 | call system("chown goth:staff " . dir) 13 | endif 14 | execute "set backupdir=" . dir 15 | execute "set backupext=." . strftime("%H_%M_%S", localtime()) 16 | endfunction 17 | -------------------------------------------------------------------------------- /.config/enhancd/config.ltsv: -------------------------------------------------------------------------------- 1 | short:-G long:--ghq desc:Show ghq path func:ghq list --full-path condition:which ghq 2 | short:-g long:--git desc:Show dirs managed by Git func:git rev-parse --show-toplevel; fd --type directory --hidden --exclude .git --search-path $(git rev-parse --show-toplevel) --exec grealpath --relative-to=. {} | grep -v '^\.$' | sort condition:which fd && which grealpath && git rev-parse --is-inside-work-tree 3 | short:-x long: desc:Show favorite dirs func:cat ~/.config/enhancd/*.fav | sort | uniq | xargs -I% sh -c 'echo %' condition: 4 | -------------------------------------------------------------------------------- /.vim/after/syntax/sh/awkembed.vim: -------------------------------------------------------------------------------- 1 | " AWK Embedding: {{{1 2 | " ============== 3 | " Shamelessly ripped from aspperl.vim by Aaron Hope. 4 | if exists("b:current_syntax") 5 | unlet b:current_syntax 6 | endif 7 | syn include @AWKScript syntax/awk.vim 8 | syn region AWKScriptCode matchgroup=AWKCommand start=+[=\\]\@+ skip=+\\$+ end=+[=\\]\@[(optional scope)]: 5 | # 6 | # 72-character wrapped longer description. This should answer: 7 | # - Why was this change necessary? 8 | # - How does it address the problem? 9 | # - Are there any side effects? 10 | 11 | # type 12 | # fix, feat, docs, style, refactor, perf, test, build, ci, chore, revert, wip 13 | 14 | # optional scope 15 | # init, security, deps, config, i18n, ... 16 | 17 | # -------------------- 18 | # Conventional Commits 19 | # A specification for adding human and machine readable meaning to commit messages 20 | # Ref: https://www.conventionalcommits.org 21 | # -------------------- 22 | -------------------------------------------------------------------------------- /.config/nvim/lua/config/commands.lua: -------------------------------------------------------------------------------- 1 | -- Custom user commands 2 | 3 | -- Copy file path to clipboard 4 | vim.api.nvim_create_user_command('CP', function(opts) 5 | local path 6 | if opts.args == 'name' then 7 | path = vim.fn.expand('%:t') -- ファイル名のみ 8 | elseif opts.args == 'dir' then 9 | path = vim.fn.expand('%:p:h') -- ディレクトリのみ 10 | elseif opts.args == 'rel' then 11 | path = vim.fn.expand('%:.') -- 相対パス 12 | else 13 | path = vim.fn.expand('%:p') -- フルパス(デフォルト) 14 | end 15 | vim.fn.setreg('+', path) 16 | print('Copied: ' .. path) 17 | end, { 18 | nargs = '?', 19 | desc = 'Copy file path to clipboard (name/dir/rel or full path by default)' 20 | }) 21 | -------------------------------------------------------------------------------- /.config/afx/gist.yaml: -------------------------------------------------------------------------------- 1 | gist: 2 | - name: context-scripts 3 | description: Get current GCP/Kubernetes context which you are on. 4 | owner: babarot 5 | id: bb820b99fdba605ea4bd4fb29046ce58 6 | command: 7 | link: 8 | - from: gcp-context 9 | - from: kube-context 10 | - name: git-replace.sh 11 | description: n/a 12 | owner: babarot 13 | id: 135843910e2294781518587e9e90078e 14 | command: 15 | link: 16 | - from: git-replace.sh 17 | to: git-replace 18 | 19 | # - name: tmuxx 20 | # description: ~ 21 | # owner: babarot 22 | # id: bebec3a4b19764021dca4022e007e266 23 | # command: 24 | # link: 25 | # - from: tmuxx.sh 26 | # to: tmuxx 27 | # snippet: | 28 | # tmuxx 29 | -------------------------------------------------------------------------------- /.zsh/Completion/_gomi: -------------------------------------------------------------------------------- 1 | #compdef gomi 2 | 3 | # Copyright (c) 2015 babarot 4 | # License: MIT 5 | 6 | function _gomi() { 7 | local context curcontext=$curcontext state line 8 | typeset -A opt_args 9 | local ret=1 10 | 11 | _arguments -C \ 12 | '(-h --help)'{-h,--help}'[show this help and exit]' \ 13 | '(-r --restore -s --system)'{-r,--restore}'[restore files from gomi box]' \ 14 | '(-r --restore -s --system)'{-s,--system}'[use system-trashcan instead gomi-trashcan]' \ 15 | '(-)*:files:->file' \ 16 | && ret=0 17 | 18 | case $state in 19 | file) 20 | _files && ret=0 21 | ;; 22 | esac 23 | 24 | return ret 25 | } 26 | 27 | _gomi "$@" 28 | -------------------------------------------------------------------------------- /bin/tovim: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # tovim 3 | # got a hint from vim-jp.org 4 | # http://vim-jp.org/blog/2015/10/15/tovim-on-shell-command-pipes.html 5 | # 6 | # usage: ls -l | tovim | cut -d: -f1 7 | # 8 | 9 | set -e 10 | 11 | trap 'rm -f "$TOVIMTMP"' ERR 12 | 13 | if [ -p /dev/stdin ]; then 14 | in="$(cat <&0)" 15 | if [ -z "$in" ];then 16 | exit 0 17 | fi 18 | 19 | if [ -e "$in" ]; then 20 | vim "$in" /dev/tty 21 | else 22 | TOVIMTMP=~/.tovim_tmp_"$(date +%Y-%m-%d_%H-%M-%S.txt)" 23 | echo "$in" >"$TOVIMTMP" 24 | vim "$TOVIMTMP" /dev/tty 25 | cat "$TOVIMTMP" 26 | rm "$TOVIMTMP" 27 | fi 28 | else 29 | vim "$@" 30 | fi 31 | -------------------------------------------------------------------------------- /.zshrc: -------------------------------------------------------------------------------- 1 | # .zshrc 2 | # zshenv -> zprofile -> zshrc (current) 3 | # 4 | # | zshenv : always 5 | # | zprofile : if login shell 6 | # | zshrc : if interactive shell 7 | # | zlogin : if login shell, after zshrc 8 | # | zlogout : if login shell, after logout 9 | # 10 | # https://zsh.sourceforge.io/Doc/Release/Files.html#Files 11 | # 12 | 13 | # Return if zsh is called from Vim 14 | # if [[ -n $VIMRUNTIME ]]; then 15 | # return 0 16 | # fi 17 | 18 | autoload -Uz compinit 19 | compinit 20 | 21 | autoload -Uz colors 22 | colors 23 | 24 | source <(afx init) 25 | source <(afx completion zsh) 26 | 27 | export XDG_CONFIG_HOME="$HOME/.config" 28 | 29 | # word split: `-`, `_`, `.`, `=` 30 | export WORDCHARS='*?[]~&;!#$%^(){}<>' 31 | -------------------------------------------------------------------------------- /.vim/ftdetect/go.vim: -------------------------------------------------------------------------------- 1 | set completeopt-=preview 2 | 3 | augroup goautocmd 4 | autocmd! 5 | autocmd BufWritePre *.go :GoImports 6 | augroup END 7 | 8 | let g:go_highlight_array_whitespace_error = 1 9 | let g:go_highlight_chan_whitespace_error = 1 10 | let g:go_highlight_extra_types = 1 11 | let g:go_highlight_space_tab_error = 1 12 | let g:go_highlight_trailing_whitespace_error = 1 13 | let g:go_highlight_operators = 1 14 | let g:go_highlight_functions = 1 15 | let g:go_highlight_methods = 1 16 | let g:go_highlight_fields = 1 17 | let g:go_highlight_types = 1 18 | let g:go_highlight_build_constraints = 1 19 | let g:go_highlight_string_spellcheck = 1 20 | let g:go_highlight_format_strings = 1 21 | let g:go_highlight_generate_tags = 1 22 | -------------------------------------------------------------------------------- /etc/scripts/which.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | import glob 6 | 7 | def main(): 8 | """Script Main""" 9 | search_cmd = sys.argv[1:] 10 | search_path = os.environ['PATH'].split(':') 11 | for cmd in search_cmd: 12 | found_cmd = search_file(cmd, search_path) 13 | if found_cmd: 14 | print found_cmd 15 | else: 16 | print 'cannot find "%s" command' %(cmd) 17 | 18 | def search_file(file, search_path): 19 | for path in search_path: 20 | for match in glob.glob(os.path.join(path, file)): 21 | if os.access(match, os.X_OK): 22 | return match 23 | 24 | if __name__ == '__main__': 25 | main() 26 | -------------------------------------------------------------------------------- /.config/ghostty/config: -------------------------------------------------------------------------------- 1 | # Config generator https://ghostty.zerebos.com/ 2 | 3 | command = /opt/homebrew/bin/tmux 4 | clipboard-read = allow 5 | clipboard-write = allow 6 | copy-on-select = false 7 | window-height = 55 8 | window-width = 150 9 | window-padding-x = 10 10 | window-padding-y = 2 11 | window-padding-balance = true 12 | background-opacity = 0.95 13 | background-blur-radius = 20 14 | macos-titlebar-style = transparent 15 | 16 | ## Light 17 | # theme = Belafonte Day 18 | # theme = Apple Classic 19 | # theme = seoulbones_light 20 | ## Dark 21 | # theme = Solarized Dark Higher Contrast 22 | # theme = Builtin Solarized Dark 23 | # theme = Solarized Dark - Patched 24 | theme = TokyoNight Moon 25 | 26 | 27 | font-family = "Menlo" 28 | font-family = "Hiragino Kaku Gothic ProN" 29 | font-size = 18 30 | font-feature = -dlig 31 | 32 | shell-integration-features = cursor,title,sudo 33 | -------------------------------------------------------------------------------- /.config/nvim/init.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- Neovim Configuration 3 | -- ============================================================================ 4 | -- 5 | -- Structure: 6 | -- ~/.config/nvim/ 7 | -- ├── init.lua (this file) 8 | -- └── lua/ 9 | -- └── config/ 10 | -- ├── options.lua (vim options and settings) 11 | -- ├── keymaps.lua (key mappings) 12 | -- ├── autocmds.lua (autocommands) 13 | -- ├── filetypes.lua (filetype detection and settings) 14 | -- └── commands.lua (custom user commands) 15 | 16 | -- Load configuration modules 17 | require('config.options') 18 | require('config.lazy') 19 | require('config.keymaps') 20 | require('config.autocmds') 21 | require('config.filetypes') 22 | require('config.commands') 23 | -------------------------------------------------------------------------------- /etc/scripts/tac.awk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env awk -f 2 | # 3 | # @(#) tac ver.0.1 2014.10.2 4 | # 5 | # Usage: 6 | # tac.awk file... 7 | # 8 | # Description: 9 | # tac.awk - tac written in AWK 10 | # Same as 'tail -r' and 'tac'. 11 | # 12 | ###################################################################### 13 | # Oneliner: awk '{a[NR]=$0}END{for(i=NR;i>0;i--)print a[i]}' 14 | 15 | BEGIN { 16 | # In order to avoid conflicts, 17 | # use '\034' as the delimiter 18 | sort_exe = "sort -t \"\034\" -nr" 19 | } 20 | 21 | { 22 | # Passed to the child process 23 | printf("%d\034%s\n", NR, $0) |& sort_exe; 24 | } 25 | 26 | END { 27 | # Close the input pipe 28 | close(sort_exe, "to"); 29 | 30 | # Reads the output of the child process 31 | while ((sort_exe |& getline var) > 0) { 32 | split(var, arr, /\034/); 33 | 34 | print arr[2]; 35 | } 36 | close(sort_exe); 37 | } 38 | -------------------------------------------------------------------------------- /.config/nvim.old/init.lua: -------------------------------------------------------------------------------- 1 | local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' 2 | local uv = vim.uv or vim.loop 3 | if not uv.fs_stat(lazypath) then 4 | vim.fn.system({ 5 | 'git', 6 | 'clone', 7 | '--filter=blob:none', 8 | 'https://github.com/folke/lazy.nvim.git', 9 | '--branch=stable', 10 | lazypath, 11 | }) 12 | end 13 | vim.opt.rtp:prepend(lazypath) 14 | 15 | vim.g.mapleader = ',' 16 | vim.g.loaded_gzip = 1 17 | vim.g.loaded_man = 1 18 | vim.g.loaded_matchit = 1 19 | vim.g.loaded_matchparen = 1 20 | vim.g.loaded_shada_plugin = 1 21 | vim.g.loaded_tarPlugin = 1 22 | vim.g.loaded_tar = 1 23 | vim.g.loaded_zipPlugin = 1 24 | vim.g.loaded_zip = 1 25 | vim.g.loaded_netrwPlugin = 1 26 | 27 | require('autocmds') 28 | require('commands') 29 | require('filetypes') 30 | require('keymaps') 31 | require('options') 32 | require('plugins') 33 | -------------------------------------------------------------------------------- /.vim/plugin/rm.vim: -------------------------------------------------------------------------------- 1 | function! s:rm(bang) 2 | let file = fnamemodify(expand('%'), ':p') 3 | " https://github.com/babarot/gomi 4 | let cmd = "system(printf('%s %s', executable('gomi') ? 'gomi' : 'rm', shellescape(file)))" 5 | 6 | if !filereadable(file) 7 | echo printf("%s does not exist", file) 8 | return 9 | endif 10 | 11 | if empty(a:bang) 12 | redraw | echo printf("Delete '%s?' [y/N]: ", file) 13 | endif 14 | 15 | if !empty(a:bang) || nr2char(getchar()) ==? 'y' 16 | silent! update 17 | if eval(cmd == "" ? delete(file) : cmd) == 0 18 | let bufname = bufname(fnamemodify(file, ':p')) 19 | if bufexists(bufname) && buflisted(bufname) 20 | execute "bwipeout" bufname 21 | endif 22 | echo printf("Deleted '%s' successfully!", file) 23 | else 24 | echo printf("Failed to delete '%s'", file) 25 | endif 26 | endif 27 | endfunction 28 | 29 | command! -nargs=? -bang -complete=file Rm call s:rm() 30 | -------------------------------------------------------------------------------- /.vim/syntax/godefstack.vim: -------------------------------------------------------------------------------- 1 | if exists("b:current_syntax") 2 | finish 3 | endif 4 | 5 | syn match godefStackComment '^".*' 6 | syn match godefLinePrefix '^[>\s]\s' nextgroup=godefStackEntryNumber contains=godefStackCurrentPosition 7 | syn match godefStackEntryNumber '\d\+' nextgroup=godefStackFilename skipwhite 8 | syn match godefStackCurrentPosition '>' contained 9 | syn match godefStackFilename '[^|]\+' contained nextgroup=godefStackEntryLocation 10 | syn region godefStackEntryLocation oneline start='|' end='|' contained contains=godefStackEntryLocationNumber 11 | syn match godefStackEntryLocationNumber '\d\+' contained display 12 | 13 | let b:current_syntax = "godefstack" 14 | 15 | hi def link godefStackComment Comment 16 | hi def link godefStackCurrentPosition Special 17 | hi def link godefStackFilename Directory 18 | hi def link godefStackEntryLocationNumber LineNr 19 | 20 | " vim: sw=2 ts=2 et 21 | -------------------------------------------------------------------------------- /.config/nvim.old/plugin/rm.vim: -------------------------------------------------------------------------------- 1 | function! s:rm(bang) 2 | let file = fnamemodify(expand('%'), ':p') 3 | " https://github.com/babarot/gomi 4 | let cmd = "system(printf('%s %s', executable('gomi') ? 'gomi' : 'rm', shellescape(file)))" 5 | 6 | if !filereadable(file) 7 | echo printf("%s does not exist", file) 8 | return 9 | endif 10 | 11 | if empty(a:bang) 12 | redraw | echo printf("Delete '%s?' [y/N]: ", file) 13 | endif 14 | 15 | if !empty(a:bang) || nr2char(getchar()) ==? 'y' 16 | silent! update 17 | if eval(cmd == "" ? delete(file) : cmd) == 0 18 | let bufname = bufname(fnamemodify(file, ':p')) 19 | if bufexists(bufname) && buflisted(bufname) 20 | execute "bwipeout" bufname 21 | endif 22 | echo printf("Deleted '%s' successfully!", file) 23 | else 24 | echo printf("Failed to delete '%s'", file) 25 | endif 26 | endif 27 | endfunction 28 | 29 | command! -nargs=? -bang -complete=file Rm call s:rm() 30 | -------------------------------------------------------------------------------- /bin/git-url: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # git remote -v 4 | url="$(git remote -v | awk '$1=="origin"{print $2;exit}')" 5 | 6 | if [[ "${url}" =~ ^https?:// ]]; then 7 | # reconstruct url 8 | url="$(echo "${url}" | perl -pe 's#^https?://(github\.com)/([A-z0-9\._-]+)/([A-z0-9\._-]+)(\.git)?$#git\@$1:$2/$3#')" 9 | 10 | # to replace git protocol in remote URL with http protocol 11 | git remote set-url origin "${url}.git" 2>/dev/null 12 | if [[ $? != 0 ]]; then 13 | # failure case 14 | echo "Oops. Retry!" >&2 15 | exit 1 16 | fi 17 | 18 | # Show a remote URL 19 | git remote -v 20 | echo "Change origin url to '${url}' successfully" 21 | else 22 | # git remote -v returns empty 23 | if [[ -z "${url}" ]]; then 24 | echo "Remote URL is empty. Run this:" 25 | echo "-> git remote add origin https://github.com/{username}/{reponame}" 26 | exit 27 | fi 28 | 29 | git remote -v | perl -pe "s/git/\033[31mgit\033[m/" 30 | fi 31 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/markdown.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- Markdown Preview 3 | -- ============================================================================ 4 | -- 5 | -- Prerequisites: 6 | -- 1. GitHub CLI: https://cli.github.com/ 7 | -- 2. gh extension: gh extension install yusukebe/gh-markdown-preview 8 | 9 | return { 10 | { 11 | 'babarot/markdown-preview.nvim', 12 | ft = 'markdown', -- Lazy load on markdown files 13 | opts = { 14 | gh_cmd = 'md', -- Use 'md' as subcommand (gh md preview instead of gh markdown-preview) 15 | }, 16 | -- keys = { 17 | -- { 'mp', 'MarkdownPreview', desc = 'Markdown Preview', ft = 'markdown' }, 18 | -- { 'ms', 'MarkdownPreviewStop', desc = 'Markdown Preview Stop', ft = 'markdown' }, 19 | -- { 'mt', 'MarkdownPreviewToggle', desc = 'Markdown Preview Toggle', ft = 'markdown' }, 20 | -- }, 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/rm.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- rm.nvim - Safe File Deletion 3 | -- ============================================================================ 4 | -- 5 | -- Provides :Rm command to delete the current file with confirmation 6 | -- Uses 'gomi' command if available for trash-like deletion 7 | -- 8 | -- Commands: 9 | -- :Rm - Delete with confirmation prompt 10 | -- :Rm! - Delete without confirmation 11 | -- 12 | -- Repository: https://github.com/babarot/rm.nvim 13 | 14 | return { 15 | { 16 | 'babarot/rm.nvim', 17 | cmd = 'Rm', -- Load only when :Rm command is used 18 | opts = { 19 | -- Use gomi command if available, otherwise fall back to os.remove 20 | command = vim.fn.executable('gomi') == 1 and 'gomi' or nil, 21 | -- Show confirmation prompt by default 22 | confirm = true, 23 | -- Show notification after deletion 24 | notify = true, 25 | }, 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/ftcolor.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- ftcolor.nvim - File type based colorscheme switcher 3 | -- ============================================================================ 4 | 5 | return { 6 | { 7 | 'babarot/ftcolor.nvim', 8 | event = 'VeryLazy', 9 | config = function() 10 | require('ftcolor').setup({ 11 | enabled = true, 12 | default_colorscheme = 'tokyonight', 13 | redraw = true, 14 | mappings = { 15 | -- lua = 'leaf', -- Use leaf colorscheme for Lua files 16 | -- vim = 'leaf', 17 | -- go = 'seoul256', 18 | -- sh = 'material', 19 | -- bash = 'github_dark', 20 | -- zsh = 'github_dark', 21 | json = 'kanagawa', 22 | -- yaml = 'tokyonight', 23 | -- hcl = 'nord', 24 | -- terraform = 'seoul256', 25 | }, 26 | exclude_special_buffers = true, 27 | }) 28 | end, 29 | }, 30 | } 31 | -------------------------------------------------------------------------------- /.vim/_config/fzf.vim: -------------------------------------------------------------------------------- 1 | if !g:pkg.installed('fzf.vim') 2 | finish 3 | endif 4 | 5 | let g:fzf_preview_window = ['up,70%', 'ctrl-/'] 6 | 7 | " nnoremap j :History 8 | nnoremap k :Files 9 | nnoremap b :Buffers 10 | 11 | function! RipgrepFzf(query, fullscreen) 12 | let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true' 13 | let initial_command = printf(command_fmt, shellescape(a:query)) 14 | let reload_command = printf(command_fmt, '{q}') 15 | let spec = {'options': ['--disabled', '--query', a:query, '--bind', 'change:reload:'.reload_command]} 16 | let spec = fzf#vim#with_preview(spec, 'right', 'ctrl-/') 17 | call fzf#vim#grep(initial_command, 1, spec, a:fullscreen) 18 | endfunction 19 | 20 | command! -nargs=* -bang RG call RipgrepFzf(, 0) 21 | command! -bang -nargs=* GGrep 22 | \ call fzf#vim#grep( 23 | \ 'git grep --line-number -- '.shellescape(), 0, 24 | \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), 0) 25 | 26 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/which-key.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- which-key.nvim - Keybinding hints 3 | -- ============================================================================ 4 | 5 | return { 6 | { 7 | 'folke/which-key.nvim', 8 | event = 'VeryLazy', 9 | opts = { 10 | preset = 'modern', 11 | delay = 500, -- Time in ms to wait before showing which-key 12 | triggers = { 13 | { 'K', mode = { 'n', 'v' } }, -- Enable K as a which-key trigger 14 | { '', mode = { 'n', 'v' } }, -- Enable Space as a which-key trigger 15 | { '', mode = { 'n', 'v' } }, -- Enable Leader as a which-key trigger 16 | }, 17 | }, 18 | config = function(_, opts) 19 | local wk = require('which-key') 20 | wk.setup(opts) 21 | 22 | -- Register prefix groups 23 | wk.add({ 24 | { 'K', group = 'LSP' }, 25 | { '', group = 'Space Commands' }, 26 | { '', group = 'Leader Commands' }, 27 | }) 28 | end, 29 | }, 30 | } 31 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/treesitter.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- Treesitter - Syntax Highlighting & Parsing 3 | -- ============================================================================ 4 | 5 | return { 6 | { 7 | 'nvim-treesitter/nvim-treesitter', 8 | build = ':TSUpdate', 9 | event = { 'BufReadPost', 'BufNewFile' }, 10 | config = function() 11 | require('nvim-treesitter.configs').setup({ 12 | -- Enable auto_install for missing parsers 13 | auto_install = true, 14 | ensure_installed = { 15 | 'bash', 16 | 'go', 17 | 'gosum', 18 | 'gomod', 19 | 'hcl', 20 | 'lua', 21 | 'json', 22 | 'make', 23 | 'markdown', 24 | 'nginx', -- Nginx configuration files (built-in support) 25 | 'terraform', 26 | 'yaml', 27 | }, 28 | highlight = { 29 | enable = true, 30 | }, 31 | indent = { 32 | enable = true, 33 | }, 34 | }) 35 | end, 36 | }, 37 | } 38 | -------------------------------------------------------------------------------- /bin/deadlink: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # @(#) deadlink v0.1.0 4 | # 5 | # usage: 6 | # deadlink [dir(s)] 7 | # 8 | # description: 9 | # Remove the broken symlinks 10 | # 11 | ###################################################################### 12 | 13 | # Help message 14 | if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then 15 | echo "usage: deadlink [dir(s)]" 1>&2 16 | echo " Remove the broken symlinks within the directory given as arugment" 1>&2 17 | echo " If an argument is ommited, it defaults to the \$HOME(home directory)" 1>&2 18 | exit 19 | fi 20 | 21 | # You may pass multiple directory arguments. 22 | for arg in "${@:-$HOME}" 23 | do 24 | # Remove the hidden files and the regular files 25 | for f in "$arg"/.??* "$arg"/* 26 | do 27 | # -L: check for a symlink; -h is the same flag 28 | # -e: check for a validation of symlink; 29 | # -a flag is deprecated 30 | # ref to http://stackoverflow.com/questions/321348/bash-if-a-vs-e-option 31 | if [ -L "$f" ] && ! [ -e "$f" ]; then 32 | # verbose and interactive 33 | command rm -vi "$f" 34 | fi 35 | done 36 | done 37 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/indent-blankline.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- Indent Blankline - Indent Guide Display 3 | -- ============================================================================ 4 | 5 | return { 6 | { 7 | 'lukas-reineke/indent-blankline.nvim', 8 | main = 'ibl', 9 | event = { 'BufReadPost', 'BufNewFile' }, 10 | opts = { 11 | indent = { 12 | char = '│', 13 | tab_char = '│', 14 | }, 15 | scope = { 16 | enabled = true, 17 | show_start = true, 18 | show_end = false, 19 | injected_languages = true, 20 | highlight = { 'Function', 'Label' }, 21 | priority = 500, 22 | }, 23 | exclude = { 24 | filetypes = { 25 | 'help', 26 | 'dashboard', 27 | 'alpha', 28 | 'neo-tree', 29 | 'lazy', 30 | 'mason', 31 | 'lspinfo', 32 | 'toggleterm', 33 | 'TelescopePrompt', 34 | 'TelescopeResults', 35 | '', 36 | }, 37 | buftypes = { 38 | 'terminal', 39 | 'nofile', 40 | }, 41 | }, 42 | }, 43 | }, 44 | } 45 | -------------------------------------------------------------------------------- /.config/fish/fish_variables: -------------------------------------------------------------------------------- 1 | # This file contains fish universal variable definitions. 2 | # VERSION: 3.0 3 | SETUVAR LESS:\x2d\x2dLONG\x2dPROMPT\x20\x2d\x2dRAW\x2dCONTROL\x2dCHARS 4 | SETUVAR MACVIM_APP:/Applications/MacVim\x2eapp/Contents/MacOS/Vim 5 | SETUVAR PAGER:less 6 | SETUVAR __fish_initialized:3100 7 | SETUVAR fish_color_autosuggestion:555\x1ebrblack 8 | SETUVAR fish_color_cancel:\x2dr 9 | SETUVAR fish_color_cwd:green 10 | SETUVAR fish_color_cwd_root:red 11 | SETUVAR fish_color_history_current:\x2d\x2dbold 12 | SETUVAR fish_color_host:normal 13 | SETUVAR fish_color_host_remote:yellow 14 | SETUVAR fish_color_redirection:00afff 15 | SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack 16 | SETUVAR fish_color_status:red 17 | SETUVAR fish_color_user:brgreen 18 | SETUVAR fish_color_valid_path:\x2d\x2dunderline 19 | SETUVAR fish_key_bindings:fish_default_key_bindings 20 | SETUVAR fish_pager_color_completion:\x1d 21 | SETUVAR fish_pager_color_description:B3A06D\x1eyellow 22 | SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline 23 | SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan 24 | SETUVAR fish_user_paths:/Users/babarot/\x2eafx/github\x2ecom/junegunn/fzf/bin 25 | -------------------------------------------------------------------------------- /.config/nvim.old/lua/options.lua: -------------------------------------------------------------------------------- 1 | vim.opt.encoding = "UTF-8" 2 | vim.opt.cursorline = true 3 | vim.opt.cursorcolumn = false 4 | vim.opt.showmode = true 5 | vim.opt.hidden = true 6 | vim.opt.confirm = true 7 | vim.opt.splitright = true 8 | vim.opt.splitbelow = true 9 | vim.opt.incsearch = true 10 | vim.opt.hlsearch = true 11 | vim.opt.smartcase = true 12 | vim.opt.ignorecase = true 13 | vim.opt.autoindent = true 14 | vim.opt.autochdir = false 15 | vim.opt.smartindent = true 16 | vim.opt.showmatch = true 17 | vim.opt.laststatus = 3 18 | vim.opt.scrolloff = 8 19 | vim.opt.errorbells = false 20 | vim.opt.shiftwidth = 0 21 | vim.opt.softtabstop = 2 22 | vim.opt.tabstop = 2 23 | vim.opt.expandtab = true 24 | vim.opt.number = true 25 | vim.opt.relativenumber = true 26 | vim.opt.list = true 27 | vim.opt.listchars = { tab = ">·", trail = "·", precedes = "←", extends = "→", eol = "↲", nbsp = "␣" } 28 | vim.opt.termguicolors = true 29 | 30 | vim.opt.backup = false 31 | vim.opt.swapfile = false 32 | vim.opt.undofile = false 33 | 34 | if vim.fn.has('persistent_undo') then 35 | vim.opt.undofile = true 36 | vim.opt.undodir = vim.fn.stdpath('state') .. '/undo' 37 | end 38 | -------------------------------------------------------------------------------- /.config/afx/gh-extensions.yaml: -------------------------------------------------------------------------------- 1 | github: 2 | - name: dlvhdr/gh-dash 3 | description: A beautiful CLI dashboard for GitHub 4 | owner: dlvhdr 5 | repo: gh-dash 6 | as: 7 | gh-extension: 8 | name: gh-dash 9 | - name: mislav/gh-branch 10 | description: GitHub CLI extension for fuzzy finding, quickly switching between and deleting branches. 11 | owner: mislav 12 | repo: gh-branch 13 | as: 14 | gh-extension: 15 | name: gh-branch 16 | - name: seachicken/gh-poi 17 | description: Safely clean up your local branches 18 | owner: seachicken 19 | repo: gh-poi 20 | as: 21 | gh-extension: 22 | name: gh-poi 23 | tag: v0.9.0 24 | - name: yusukebe/gh-markdown-preview 25 | description: GitHub CLI extension to preview Markdown looks like GitHub. 26 | owner: yusukebe 27 | repo: gh-markdown-preview 28 | as: 29 | gh-extension: 30 | name: gh-markdown-preview 31 | tag: v1.10.1 32 | rename-to: gh-md 33 | - name: kawarimidoll/gh-q 34 | description: A gh extension to clone GitHub repositories using fzf and ghq. 35 | owner: kawarimidoll 36 | repo: gh-q 37 | as: 38 | gh-extension: 39 | name: gh-q 40 | - name: kranurag7/gh-fetch 41 | description: 42 | owner: kranurag7 43 | repo: gh-fetch 44 | as: 45 | gh-extension: 46 | name: gh-fetch 47 | -------------------------------------------------------------------------------- /.config/gh-dash/config.yml: -------------------------------------------------------------------------------- 1 | prSections: 2 | - title: My Pull Requests 3 | filters: is:open author:@me -org:zplug -org:mercari 4 | - title: Needs My Review 5 | filters: is:open review-requested:@me -org:zplug -org:mercari 6 | - title: Involved 7 | filters: is:open involves:@me -author:@me -org:zplug -org:mercari 8 | issuesSections: 9 | - title: My Issues 10 | filters: is:open author:@me -org:zplug -org:mercari 11 | - title: Assigned 12 | filters: is:open assignee:@me -org:zplug -org:mercari 13 | - title: Involved 14 | filters: is:open involves:@me -author:@me -org:zplug -org:mercari 15 | defaults: 16 | preview: 17 | open: true 18 | width: 50 19 | prsLimit: 20 20 | issuesLimit: 20 21 | view: prs 22 | layout: 23 | prs: 24 | updatedAt: 25 | width: 7 26 | repo: 27 | width: 15 28 | author: 29 | width: 15 30 | assignees: 31 | width: 20 32 | hidden: true 33 | base: 34 | width: 15 35 | hidden: true 36 | lines: 37 | width: 16 38 | issues: 39 | updatedAt: 40 | width: 7 41 | repo: 42 | width: 15 43 | creator: 44 | width: 10 45 | assignees: 46 | width: 20 47 | hidden: true 48 | refetchIntervalMinutes: 30 49 | keybindings: 50 | issues: [] 51 | prs: [] 52 | repoPaths: {} 53 | pager: 54 | diff: "" 55 | -------------------------------------------------------------------------------- /.vim/after/ftplugin/go.vim: -------------------------------------------------------------------------------- 1 | setlocal noexpandtab 2 | 3 | " automatically run gofmt 4 | " augroup custom-ftplugin-go 5 | " autocmd! * 6 | " if executable('gofmt') 7 | " autocmd BufWritePre call s:format() 8 | " endif 9 | " augroup END 10 | " 11 | " function! s:format() 12 | " let cursor = getpos('.') 13 | " silent! %!gofmt 14 | " if v:shell_error 15 | " let error = join(getline(1, '$'), "\n") 16 | " undo 17 | " endif 18 | " call setpos('.', cursor) 19 | " endfunction 20 | 21 | set completeopt-=preview 22 | 23 | augroup goautocmd 24 | autocmd! 25 | autocmd BufWritePre *.go :GoImports 26 | augroup END 27 | 28 | let g:go_fmt_command = "goimports" 29 | 30 | let g:go_gocode_unimported_packages = 1 31 | 32 | let g:go_highlight_array_whitespace_error = 1 33 | let g:go_highlight_chan_whitespace_error = 1 34 | let g:go_highlight_extra_types = 1 35 | let g:go_highlight_space_tab_error = 1 36 | let g:go_highlight_trailing_whitespace_error = 1 37 | let g:go_highlight_operators = 1 38 | let g:go_highlight_functions = 1 39 | let g:go_highlight_methods = 1 40 | let g:go_highlight_fields = 1 41 | let g:go_highlight_types = 1 42 | let g:go_highlight_build_constraints = 1 43 | let g:go_highlight_string_spellcheck = 1 44 | let g:go_highlight_format_strings = 1 45 | let g:go_highlight_generate_tags = 1 46 | 47 | set rtp+=$GOPATH/src/github.com/nsf/gocode/vim 48 | -------------------------------------------------------------------------------- /.vim/_config/lightline.vim: -------------------------------------------------------------------------------- 1 | if !g:pkg.installed('lightline.vim') 2 | finish 3 | endif 4 | 5 | let g:lightline = { 6 | \ 'colorscheme': 'wombat', 7 | \ 'active': { 8 | \ 'left': [ [ 'mode', 'paste' ], 9 | \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] 10 | \ }, 11 | \ 'component_function': { 12 | \ 'gitbranch': 'FugitiveHead' 13 | \ }, 14 | \ } 15 | 16 | let g:lightline = { 17 | \ 'colorscheme': 'wombat', 18 | \ 'active': { 19 | \ 'left': [ [ 'mode', 'paste' ], 20 | \ [ 'cocstatus', 'gitbranch', 'readonly', 'filename', 'modified' ] ], 21 | \ 'right': [ [ 'lineinfo' ], 22 | \ [ 'percent' ], 23 | \ [ 'filetype' ] ] 24 | \ }, 25 | \ 'component_function': { 26 | \ 'gitbranch': 'fugitive#head', 27 | \ 'filename': 'LightlineFilename', 28 | \ 'cocstatus': 'StatusDiagnostic' 29 | \ }, 30 | \ } 31 | 32 | function! StatusDiagnostic() abort 33 | let info = get(b:, 'coc_diagnostic_info', {}) 34 | if empty(info) | return '' | endif 35 | let msgs = [] 36 | if get(info, 'error', 0) 37 | call add(msgs, 'E' . info['error']) 38 | endif 39 | if get(info, 'warning', 0) 40 | call add(msgs, 'W' . info['warning']) 41 | endif 42 | return join(msgs, ' '). ' ' . get(g:, 'coc_status', '') 43 | endfunction 44 | -------------------------------------------------------------------------------- /.zsh/50_setopts.zsh: -------------------------------------------------------------------------------- 1 | #setopt ignore_eof 2 | #setopt xtrace 3 | setopt always_last_prompt 4 | setopt append_history 5 | setopt auto_cd 6 | setopt auto_menu 7 | setopt auto_param_keys 8 | setopt auto_param_slash 9 | setopt auto_pushd 10 | setopt auto_remove_slash 11 | setopt auto_resume 12 | setopt bang_hist 13 | setopt brace_ccl 14 | setopt complete_in_word 15 | setopt correct 16 | setopt correct_all 17 | setopt equals 18 | setopt extended_glob 19 | setopt extended_history 20 | setopt globdots 21 | setopt hist_expire_dups_first 22 | setopt hist_find_no_dups 23 | setopt hist_ignore_dups 24 | setopt hist_ignore_space 25 | setopt hist_no_functions 26 | setopt hist_no_store 27 | setopt hist_reduce_blanks 28 | setopt hist_save_nodups 29 | setopt hist_verify 30 | setopt inc_append_history 31 | setopt interactive_comments 32 | setopt list_types 33 | setopt long_list_jobs 34 | setopt magic_equal_subst 35 | setopt mail_warning 36 | setopt mark_dirs 37 | setopt multios 38 | setopt no_beep 39 | setopt no_case_glob 40 | setopt no_clobber 41 | setopt no_flow_control 42 | setopt no_global_rcs 43 | setopt no_hist_beep 44 | setopt no_list_beep 45 | setopt no_prompt_cr 46 | setopt notify 47 | setopt path_dirs 48 | setopt print_eight_bit 49 | setopt print_exit_value 50 | setopt pushd_ignore_dups 51 | setopt pushd_minus 52 | setopt pushd_to_home 53 | setopt rc_quotes 54 | setopt rm_star_wait 55 | setopt sh_word_split 56 | setopt share_history 57 | -------------------------------------------------------------------------------- /.config/afx/http.yaml: -------------------------------------------------------------------------------- 1 | http: 2 | - name: gcping 3 | description: Like gcping.com but a command line tool 4 | url: 'https://storage.googleapis.com/gcping-release/{{ .Name }}_{{ .OS }}_{{ .Arch }}_latest' 5 | command: 6 | link: 7 | - from: gcping_* 8 | to: gcping 9 | # - name: google-cloud-sdk 10 | # description: | 11 | # https://cloud.google.com/sdk/docs/install 12 | # https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl 13 | # url: 'https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-370.0.0-darwin-arm.tar.gz' 14 | # command: 15 | # build: 16 | # steps: 17 | # - google-cloud-sdk/bin/gcloud components install --quiet kubectl 18 | # - google-cloud-sdk/install.sh --quiet 19 | # link: 20 | # - from: google-cloud-sdk/bin/gcloud 21 | # to: gcloud 22 | # - from: google-cloud-sdk/bin/kubectl 23 | # to: kubectl 24 | # alias: 25 | # k: kubectl 26 | # plugin: 27 | # sources: 28 | # - 'google-cloud-sdk/*.zsh.inc' 29 | # snippet: | 30 | # gcp() { 31 | # type fzf &>/dev/null || { echo "fzf not found"; return 1; } 32 | # local project=$(gcloud projects list ${1+--filter ${1}} | grep -v sys- | fzf --height 50% --header-lines=1 --reverse --exit-0 | awk '{print $1}') 33 | # if [[ -z ${project} ]]; then 34 | # return 0 35 | # fi 36 | # gcloud config set project "${project}" 37 | # } 38 | -------------------------------------------------------------------------------- /etc/scripts/tree.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from __future__ import print_function 5 | import sys 6 | import os 7 | 8 | INDENT_WIDTH = 4 9 | EXCULUDE_LIST = ['.git'] 10 | 11 | def main(args): 12 | path_list = [] 13 | if len(args) == 0: 14 | path_list.append('.') 15 | else: 16 | for path in args: 17 | path = os.path.expanduser(path) 18 | if not os.path.isdir(path): 19 | print('Error: invalid path', path, file=sys.stderr) 20 | return 1 21 | path_list.append(path) 22 | 23 | tree(path_list) 24 | 25 | def tree(path_list, indent=0): 26 | for path in path_list: 27 | basename = os.path.basename(path) 28 | if basename in EXCULUDE_LIST: 29 | continue 30 | 31 | if os.path.islink(path): 32 | print(' ' * INDENT_WIDTH * indent + basename + '@') 33 | elif os.path.isdir(path): 34 | print(' ' * INDENT_WIDTH * indent + basename + '/') 35 | children = os.listdir(path) 36 | children = [os.path.join(path, x) for x in children] 37 | tree(children, indent + 1) 38 | else: 39 | print(' ' * INDENT_WIDTH * indent + basename) 40 | 41 | 42 | if __name__ == '__main__': 43 | sys.exit(main(sys.argv[1:])) 44 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DOTPATH := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) 2 | CANDIDATES := $(wildcard .??*) bin 3 | EXCLUSIONS := .DS_Store .git .gitmodules .travis.yml 4 | DOTFILES := $(filter-out $(EXCLUSIONS), $(CANDIDATES)) 5 | 6 | .DEFAULT_GOAL := help 7 | 8 | all: afx brew install 9 | 10 | afx: ## Install babarot/afx 11 | @curl -sL https://raw.githubusercontent.com/babarot/afx/HEAD/hack/install | sh 12 | @echo 'Done. Run "afx install" next.' 13 | 14 | brew: ## Install brew and run brew bundle 15 | @sh ./etc/scripts/brew.sh 16 | @brew bundle 17 | @echo 'Done. For saving your brew packages added newly, run "brew bundle dump".' 18 | 19 | list: ## Show dot files in this repo 20 | @$(foreach val, $(DOTFILES), /bin/ls -dF $(val);) 21 | 22 | install: ## Create symlink to home directory 23 | @echo 'Copyright (c) 2013-2015 BABAROT All Rights Reserved.' 24 | @echo '==> Start to link dotfiles to home directory.' 25 | @echo '' 26 | @$(foreach val, $(DOTFILES), ln -sfnv $(abspath $(val)) $(HOME)/$(val);) 27 | 28 | clean: ## Remove the dot files and this repo 29 | @echo 'Remove dot files in your home directory...' 30 | @-$(foreach val, $(DOTFILES), rm -vrf $(HOME)/$(val);) 31 | -rm -rf $(DOTPATH) 32 | 33 | new-shell: ## Run ghostty with zsh 34 | ghostty --command=/bin/zsh 35 | 36 | help: ## Self-documented Makefile 37 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ 38 | | sort \ 39 | | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' 40 | -------------------------------------------------------------------------------- /.config/nvim/lua/config/lazy.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- Lazy.nvim Plugin Manager 3 | -- ============================================================================ 4 | 5 | -- Bootstrap lazy.nvim 6 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 7 | if not (vim.uv or vim.loop).fs_stat(lazypath) then 8 | local lazyrepo = "https://github.com/folke/lazy.nvim.git" 9 | local out = vim.fn.system({ 10 | "git", 11 | "clone", 12 | "--filter=blob:none", 13 | "--branch=stable", 14 | lazyrepo, 15 | lazypath 16 | }) 17 | if vim.v.shell_error ~= 0 then 18 | vim.api.nvim_echo({ 19 | { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, 20 | { out, "WarningMsg" }, 21 | { "\nPress any key to exit..." }, 22 | }, true, {}) 23 | vim.fn.getchar() 24 | os.exit(1) 25 | end 26 | end 27 | vim.opt.rtp:prepend(lazypath) 28 | 29 | -- Setup lazy.nvim 30 | require("lazy").setup({ 31 | spec = { 32 | -- Import plugins from lua/plugins/ 33 | { import = "plugins" }, 34 | }, 35 | install = { 36 | colorscheme = { "tokyonight" }, 37 | }, 38 | checker = { 39 | enabled = false, 40 | }, 41 | performance = { 42 | rtp = { 43 | disabled_plugins = { 44 | "gzip", 45 | "matchit", 46 | "matchparen", 47 | "netrwPlugin", 48 | "tarPlugin", 49 | "tohtml", 50 | "tutor", 51 | "zipPlugin", 52 | }, 53 | }, 54 | }, 55 | }) 56 | -------------------------------------------------------------------------------- /.config/nvim.old/lua/autocmds.lua: -------------------------------------------------------------------------------- 1 | -- show cursor line only in active window 2 | vim.api.nvim_create_autocmd({ 'InsertLeave', 'WinEnter' }, { 3 | callback = function() 4 | local ok, cl = pcall(vim.api.nvim_win_get_var, 0, 'auto-cursorline') 5 | if ok and cl then 6 | vim.wo.cursorline = true 7 | vim.api.nvim_win_del_var(0, 'auto-cursorline') 8 | end 9 | end, 10 | }) 11 | vim.api.nvim_create_autocmd({ 'InsertEnter', 'WinLeave' }, { 12 | callback = function() 13 | local cl = vim.wo.cursorline 14 | if cl then 15 | vim.api.nvim_win_set_var(0, 'auto-cursorline', cl) 16 | vim.wo.cursorline = false 17 | end 18 | end, 19 | }) 20 | 21 | -- create directories when needed, when saving a file 22 | vim.api.nvim_create_autocmd({ 'BufWritePre' }, { 23 | group = vim.api.nvim_create_augroup('auto-create-dir', { clear = true }), 24 | callback = function(event) 25 | local file = vim.loop.fs_realpath(event.match) or event.match 26 | vim.fn.mkdir(vim.fn.fnamemodify(file, ':p:h'), 'p') 27 | local backup = vim.fn.fnamemodify(file, ':p:~:h') 28 | backup = backup:gsub("[/\\]", "%%") 29 | vim.go.backupext = backup 30 | end, 31 | }) 32 | 33 | -- vim.api.nvim_create_autocmd({ 'BufEnter', 'BufRead' }, { 34 | -- group = vim.api.nvim_create_augroup('cd-parent-dir', { clear = true }), 35 | -- callback = function() 36 | -- local dir = vim.fn.expand("%:p:h") 37 | -- if not vim.fn.isdirectory(dir) then 38 | -- return 39 | -- end 40 | -- vim.fn.execute(":lcd" .. dir) 41 | -- end 42 | -- }) 43 | -- 44 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/backup.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- backup.nvim - Automatic File Backup 3 | -- ============================================================================ 4 | 5 | return { 6 | { 7 | 'babarot/backup.nvim', 8 | event = { 'BufReadPost', 'BufNewFile' }, 9 | config = function() 10 | require('backup').setup({ 11 | -- Enable automatic backup on save 12 | enable = true, 13 | 14 | -- Base directory for backups (supports ~ expansion) 15 | backup_dir = '~/.backup/vim', 16 | 17 | -- Directory structure format using strftime patterns 18 | -- Default: YYYY/MM/DD (e.g., 2024/03/15) 19 | dir_structure = '%Y/%m/%d', 20 | 21 | -- Backup file extension format (timestamp) 22 | -- Default: .HH_MM_SS (e.g., .14_30_45) 23 | backup_ext = '.%H_%M_%S', 24 | 25 | -- File patterns to exclude from backup (lua patterns) 26 | exclude_patterns = { 27 | '%.git/', 28 | '/tmp/', 29 | '%.tmp', 30 | '%.swp', 31 | }, 32 | 33 | -- Maximum number of backups to keep per file (0 = unlimited) 34 | max_backups = 0, 35 | 36 | -- Automatically clean old backups on startup 37 | auto_clean = false, 38 | 39 | -- Number of days to keep backups (used with auto_clean) 40 | keep_days = 30, 41 | 42 | -- Show notification on backup 43 | notify_on_backup = false, 44 | }) 45 | end, 46 | }, 47 | } 48 | -------------------------------------------------------------------------------- /.config/fish/config.fish: -------------------------------------------------------------------------------- 1 | set fish_greeting "" 2 | 3 | set fish_color_normal normal 4 | set fish_color_command blue 5 | set fish_color_quote yellow 6 | set fish_color_end black 7 | set fish_color_error red 8 | set fish_color_param normal -bold 9 | set fish_color_comment black 10 | set fish_color_match green 11 | set fish_color_search_match yellow 12 | set fish_color_operator yellow 13 | set fish_color_escape brown 14 | 15 | #set -x PATH /opt/homebrew/bin $HOME/.rbenv/shims $HOME/.rbenv/bin $HOME/.plenv/shims $HOME/.plenv/bin /usr/bin /usr/sbin /bin /sbin 16 | set -x PATH $HOME/bin $PATH 17 | 18 | set -U PAGER less 19 | set -U LESS "--LONG-PROMPT --RAW-CONTROL-CHARS" 20 | set -U MACVIM_APP /Applications/MacVim.app/Contents/MacOS/Vim 21 | #set -U EDITOR "reatach-to-user-namespace -l $MACVIM_APP" 22 | 23 | function fish_prompt 24 | set -l last_status $status 25 | printf ' ' 26 | if test $last_status -eq 0 27 | set_color yellow 28 | printf '✘╹◡╹✘' 29 | else 30 | set_color red 31 | printf '✘>﹏<✘' 32 | end 33 | set_color normal 34 | printf " < \n" 35 | end 36 | 37 | set -g __fish_git_prompt_color_branch magenta 38 | set -g __fish_git_prompt_show_informative_status 1 39 | set -g __fish_git_prompt_color_dirtystate blue 40 | set -g __fish_git_prompt_color_stagedstate yellow 41 | set -g __fish_git_prompt_color_invalidstate red 42 | set -g __fish_git_prompt_color_cleanstate green 43 | 44 | function fish_right_prompt 45 | printf "%s " (__fish_git_prompt) 46 | set_color cyan 47 | prompt_pwd 48 | end 49 | 50 | alias l ls\ -AFG 51 | alias ll ls\ -AFGl 52 | -------------------------------------------------------------------------------- /.config/nvim.old/lua/filetypes.lua: -------------------------------------------------------------------------------- 1 | vim.filetype.add({ 2 | extension = { 3 | gotmpl = 'gotmpl', 4 | -- html = function(path, bufnr) 5 | -- -- https://tech.serhatteker.com/post/2022-06/nvim-syntax-highlight-hugo-html/ 6 | -- if string.find('{{', vim.api.nvim_buf_get_lines(bufnr, 0, 1, true)) then 7 | -- return 'gohtmltmpl' 8 | -- end 9 | -- end 10 | tape = 'vhs', 11 | tf = 'terraform', 12 | tfvars = 'terraform', 13 | }, 14 | pattern = { 15 | [".*/templates/.*%.tpl"] = "helm", 16 | [".*/templates/.*%.ya?ml"] = "helm", 17 | ["helmfile.*%.ya?ml"] = "helm", 18 | [".*/layouts/.*%.html"] = "gohtmltmpl", 19 | }, 20 | filename = { 21 | ["README$"] = function(path, bufnr) 22 | if string.find("#", vim.api.nvim_buf_get_lines(bufnr, 0, 1, true)) then 23 | return "markdown" 24 | end 25 | -- no return means the filetype won't be set and to try the next method 26 | end, 27 | }, 28 | literal = { 29 | Brewfile = 'brewfile', 30 | ['.tagpr'] = 'ini' 31 | }, 32 | function_extensions = { 33 | ['sh'] = function() 34 | vim.bo.filetype = 'sh' 35 | vim.bo.iskeyword = vim.bo.iskeyword .. ',:' 36 | end, 37 | ['zsh'] = function() 38 | vim.bo.filetype = 'zsh' 39 | vim.bo.iskeyword = vim.bo.iskeyword .. ',:' 40 | end, 41 | ['go'] = function() 42 | vim.bo.filetype = 'go' 43 | vim.bo.autoindent = true 44 | vim.bo.expandtab = false 45 | vim.bo.shiftwidth = 4 46 | vim.bo.softtabstop = 4 47 | vim.bo.tabstop = 4 48 | end, 49 | }, 50 | function_literal = {}, 51 | }) 52 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/completion.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- Completion - blink.cmp 3 | -- ============================================================================ 4 | 5 | return { 6 | { 7 | 'saghen/blink.cmp', 8 | version = '1.*', -- This downloads prebuilt binaries automatically 9 | event = 'InsertEnter', 10 | dependencies = { 11 | 'rafamadriz/friendly-snippets', 12 | 'moyiz/blink-emoji.nvim', 13 | }, 14 | opts_extend = { 'sources.default' }, 15 | opts = { 16 | keymap = { 17 | preset = 'default', 18 | [''] = { 'select_next', 'snippet_forward', 'fallback' }, 19 | [''] = { 'select_prev', 'snippet_backward', 'fallback' }, 20 | [''] = { 'accept', 'fallback' }, 21 | [''] = { 'show', 'show_documentation', 'hide_documentation' }, 22 | [''] = { 'hide', 'fallback' }, 23 | }, 24 | appearance = { 25 | use_nvim_cmp_as_default = true, 26 | nerd_font_variant = 'mono', 27 | }, 28 | sources = { 29 | default = { 'lsp', 'path', 'snippets', 'buffer', 'emoji' }, 30 | providers = { 31 | emoji = { 32 | module = 'blink-emoji', 33 | name = 'Emoji', 34 | score_offset = 15, 35 | }, 36 | }, 37 | }, 38 | completion = { 39 | menu = { 40 | auto_show = true, 41 | }, 42 | documentation = { 43 | auto_show = true, 44 | auto_show_delay_ms = 200, 45 | }, 46 | }, 47 | }, 48 | }, 49 | } 50 | -------------------------------------------------------------------------------- /.vim/plugin/cursor-x.vim: -------------------------------------------------------------------------------- 1 | " based on https://thinca.hatenablog.com/entry/20090530/1243615055 2 | " 3 | augroup auto-cursorcolumn-appear 4 | autocmd! 5 | autocmd CursorMoved,CursorMovedI * call s:auto_cursorcolumn('CursorMoved') 6 | autocmd CursorHold,CursorHoldI * call s:auto_cursorcolumn('CursorHold') 7 | autocmd BufEnter * call s:auto_cursorcolumn('WinEnter') 8 | autocmd BufLeave * call s:auto_cursorcolumn('WinLeave') 9 | 10 | let s:cursorcolumn_lock = 0 11 | function! s:auto_cursorcolumn(event) 12 | if a:event ==# 'WinEnter' 13 | setlocal cursorcolumn 14 | let s:cursorcolumn_lock = 2 15 | elseif a:event ==# 'WinLeave' 16 | setlocal nocursorcolumn 17 | elseif a:event ==# 'CursorMoved' 18 | setlocal nocursorcolumn 19 | if s:cursorcolumn_lock 20 | if 1 < s:cursorcolumn_lock 21 | let s:cursorcolumn_lock = 1 22 | else 23 | setlocal nocursorcolumn 24 | let s:cursorcolumn_lock = 0 25 | endif 26 | endif 27 | elseif a:event ==# 'CursorHold' 28 | setlocal cursorcolumn 29 | let s:cursorcolumn_lock = 1 30 | endif 31 | endfunction 32 | augroup END 33 | 34 | augroup multi-window-toggle-cursor 35 | autocmd! 36 | autocmd WinEnter * setlocal cursorline 37 | autocmd WinLeave * setlocal nocursorline nocursorcolumn 38 | augroup END 39 | 40 | augroup cursor-highlight-emphasis 41 | autocmd! 42 | autocmd CursorMoved,CursorMovedI,WinLeave * hi! link CursorLine CursorLine | hi! link CursorColumn CursorColumn 43 | autocmd CursorHold,CursorHoldI * hi! link CursorLine Visual | hi! link CursorColumn Visual 44 | augroup END 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dotfiles 2 | 3 | 6 | 7 | 8 | 9 | Setup guide is here: [setup-mac.md](./etc/docs/setup-mac.md) 10 | 11 | - Shell: zsh 12 | - Package manager: [afx](https://github.com/babarot/afx/) 13 | - Terminal: [Ghostty](https://ghostty.org/) 14 | - Editor: [Neovim](https://github.com/neovim/neovim) 15 | - Multiplexer: [tmux](https://github.com/tmux/tmux) 16 | - Plugin manager: [tpm](https://github.com/tmux-plugins/tpm) (Press `prefix` + I to install) 17 | - Font: [nerd-fonts](https://github.com/ryanoasis/nerd-fonts#font-installation) (DejaVuSansMono Nerd Font Mono) 18 | 19 | 34 | -------------------------------------------------------------------------------- /.zsh/70_zstyles.zsh: -------------------------------------------------------------------------------- 1 | # Important 2 | zstyle ':completion:*:default' menu select=2 3 | 4 | # Completing Groping 5 | zstyle ':completion:*:options' description 'yes' 6 | zstyle ':completion:*:descriptions' format '%F{yellow}Completing %B%d%b%f' 7 | zstyle ':completion:*' group-name '' 8 | 9 | # Completing misc 10 | zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 11 | zstyle ':completion:*' verbose yes 12 | zstyle ':completion:*' completer _expand _complete _match _prefix _approximate _list _history 13 | zstyle ':completion:*:*files' ignored-patterns '*?.o' '*?~' '*\#' 14 | zstyle ':completion:*' use-cache true 15 | zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters 16 | 17 | # Directory 18 | zstyle ':completion:*:cd:*' ignore-parents parent pwd 19 | zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} 20 | 21 | # default: -- 22 | zstyle ':completion:*' list-separator '-->' 23 | zstyle ':completion:*:manuals' separate-sections true 24 | 25 | # Menu select 26 | zmodload -i zsh/complist 27 | bindkey -M menuselect '^h' vi-backward-char 28 | bindkey -M menuselect '^j' vi-down-line-or-history 29 | bindkey -M menuselect '^k' vi-up-line-or-history 30 | bindkey -M menuselect '^l' vi-forward-char 31 | #bindkey -M menuselect '^k' accept-and-infer-next-history 32 | 33 | autoload -Uz cdr 34 | autoload -Uz history-search-end 35 | autoload -Uz modify-current-argument 36 | autoload -Uz smart-insert-last-word 37 | autoload -Uz terminfo 38 | autoload -Uz vcs_info 39 | autoload -Uz zcalc 40 | autoload -Uz zmv 41 | autoload -Uz run-help-git 42 | autoload -Uz run-help-svk 43 | autoload -Uz run-help-svn 44 | 45 | # Automaticall escape URL when copy and paste 46 | autoload -Uz url-quote-magic 47 | zle -N self-insert url-quote-magic 48 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/atone.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- atone.nvim - Modern Undo Tree Visualization 3 | -- ============================================================================ 4 | -- 5 | -- Features: 6 | -- - Graphical undo tree display 7 | -- - Live diff preview between undo states 8 | -- - Fast and modern UI 9 | -- - Auto-attach to buffers 10 | -- 11 | -- Commands: 12 | -- :Atone / :Atone open - Open undo tree 13 | -- :Atone toggle - Toggle undo tree 14 | -- :Atone close - Close undo tree 15 | -- :Atone focus - Focus undo tree window 16 | -- 17 | -- Default keymaps in atone window: 18 | -- j/k - Navigate nodes 19 | -- - Undo to selected node 20 | -- q/ - Quit 21 | -- ?/g? - Show help 22 | 23 | return { 24 | { 25 | 'XXiaoA/atone.nvim', 26 | cmd = 'Atone', 27 | keys = { 28 | { 'u', 'Atone toggle', desc = 'Toggle Undo Tree' }, 29 | }, 30 | opts = { 31 | -- Window layout 32 | layout = { 33 | position = 'left', -- 'left' or 'right' 34 | width = 30, -- Width of undo tree window 35 | }, 36 | 37 | -- Diff window 38 | diff = { 39 | height = 10, -- Height of diff window 40 | }, 41 | 42 | -- Auto attach to buffers 43 | auto_attach = true, 44 | 45 | -- Excluded filetypes 46 | exclude_filetypes = { 47 | 'help', 48 | 'qf', 49 | 'TelescopePrompt', 50 | }, 51 | 52 | -- UI borders 53 | border = 'rounded', -- 'none', 'single', 'double', 'rounded', 'solid', 'shadow' 54 | 55 | -- Graph style 56 | graph = { 57 | style = 'unicode', -- 'unicode' or 'ascii' 58 | }, 59 | }, 60 | }, 61 | } 62 | -------------------------------------------------------------------------------- /.bashrc: -------------------------------------------------------------------------------- 1 | # If not running interactively, don't do anything 2 | [[ -z "$PS1" ]] && return 3 | [[ -n "$VIMRUNTIME" ]] && return 4 | 5 | export PATH="$HOME/bin:/usr/local/bin:$PATH" 6 | export PAGER=less 7 | export LESS='-i -N -w -z-4 -g -e -M -X -F -R -P%t?f%f :stdin .?pb%pb\%:?lbLine %lb:?bbByte %bb:-...' 8 | export LESS='-f -N -X -i -P ?f%f:(stdin). ?lb%lb?L/%L.. [?eEOF:?pb%pb\%..]' 9 | export LESS='-f -X -i -P ?f%f:(stdin). ?lb%lb?L/%L.. [?eEOF:?pb%pb\%..]' 10 | export LESSCHARSET='utf-8' 11 | 12 | # LESS man page colors (makes Man pages more readable). 13 | export LESS_TERMCAP_mb=$'\E[01;31m' 14 | export LESS_TERMCAP_md=$'\E[01;31m' 15 | export LESS_TERMCAP_me=$'\E[0m' 16 | export LESS_TERMCAP_se=$'\E[0m' 17 | export LESS_TERMCAP_so=$'\E[01;44;33m' 18 | export LESS_TERMCAP_ue=$'\E[0m' 19 | export LESS_TERMCAP_us=$'\E[01;32m' 20 | 21 | export PROMPT_DIRTRIM=3 22 | export MYHISTFILE=~/.bash_myhistory 23 | export HISTCONTROL=ignoreboth:erasedups 24 | export HISTTIMEFORMAT="%Y/%m/%d %H:%M:%S: " 25 | export HISTSIZE=50000 26 | export HISTFILESIZE=50000 27 | export LANG=en_US.UTF-8 28 | 29 | show_exit() { 30 | if [[ "$1" -eq 0 ]]; then 31 | return 32 | fi 33 | echo -e "\007exit $1" 34 | } 35 | 36 | log_history() { 37 | echo "$(date '+%Y-%m-%d %H:%M:%S') $HOSTNAME:$$ $PWD ($1) $(history 1)" >> $MYHISTFILE 38 | } 39 | 40 | prompt_cmd() { 41 | local s=$? 42 | show_exit $s; 43 | log_history $s; 44 | } 45 | 46 | end_history() { 47 | log_history $?; 48 | echo "$(date '+%Y-%m-%d %H:%M:%S') $HOSTNAME:$$ $PWD (end)" >> $MYHISTFILE 49 | } 50 | PROMPT_COMMAND="prompt_cmd;$PROMPT_COMMAND" 51 | 52 | _exit() { 53 | end_history 54 | echo -e "Bye!" 55 | echo -en "\033[m" 56 | } 57 | trap _exit EXIT 58 | 59 | { 60 | shopt -s dotglob 61 | shopt -s extglob 62 | shopt -s cdspell 63 | shopt -s globstar 64 | shopt -s autocd 65 | shopt -s dirspell 66 | } &>/dev/null 67 | -------------------------------------------------------------------------------- /.config/gomi/config.yaml: -------------------------------------------------------------------------------- 1 | core: 2 | trash: 3 | strategy: auto 4 | home_fallback: true 5 | forbidden_paths: 6 | - $HOME/.local/share/Trash 7 | - $HOME/.trash 8 | - $XDG_DATA_HOME/Trash 9 | - /tmp/Trash 10 | - /var/tmp/Trash 11 | - $HOME/.gomi 12 | - / 13 | - /etc 14 | - /usr 15 | - /var 16 | - /bin 17 | - /sbin 18 | - /lib 19 | - /lib64 20 | 21 | restore: 22 | confirm: true 23 | verbose: true 24 | 25 | permanent_delete: 26 | enable: true 27 | 28 | ui: 29 | density: spacious # or compact 30 | preview: 31 | syntax_highlight: true 32 | colorscheme: nord # https://xyproto.github.io/splash/docs/index.html 33 | directory_command: exa -T -L 2 --color=always --icons 34 | style: 35 | deletion_dialog: "#FF007F" # "#F93769", "#FE7E39" 36 | list_view: 37 | cursor: "#AD58B4" # purple 38 | selected: "#5FB458" # green 39 | indent_on_select: false 40 | filter_match: "#5FB458" 41 | filter_prompt: "#5FB458" 42 | detail_view: 43 | border: "#F0F0F0" 44 | info_pane: 45 | deleted_from: 46 | fg: "#EEEEEE" 47 | bg: "#1C1C1C" 48 | deleted_at: 49 | fg: "#EEEEEE" 50 | bg: "#1C1C1C" 51 | preview_pane: 52 | border: "#3C3C3C" 53 | size: 54 | fg: "#EEEEDD" 55 | bg: "#3C3C3C" 56 | scroll: 57 | fg: "#EEEEDD" 58 | bg: "#3C3C3C" 59 | exit_message: bye! 60 | paginator_type: dots 61 | 62 | history: 63 | include: 64 | within_days: 100 65 | exclude: 66 | files: 67 | - .DS_Store 68 | - "oil:" # oil.nvim 69 | patterns: 70 | # - "^CH.*" 71 | globs: 72 | # - "*.go" 73 | size: 74 | min: 0KB 75 | max: 13GB 76 | 77 | logging: 78 | enabled: true 79 | level: debug 80 | rotation: 81 | max_size: 10MB 82 | max_files: 3 83 | -------------------------------------------------------------------------------- /.zprofile: -------------------------------------------------------------------------------- 1 | # autoload 2 | autoload -Uz run-help 3 | autoload -Uz add-zsh-hook 4 | autoload -Uz colors && colors 5 | autoload -Uz compinit && compinit -u 6 | autoload -Uz is-at-least 7 | 8 | # LANGUAGE must be set by en_US 9 | export LANGUAGE="en_US.UTF-8" 10 | export LANG="${LANGUAGE}" 11 | export LC_ALL="${LANGUAGE}" 12 | export LC_CTYPE="${LANGUAGE}" 13 | 14 | # Editor 15 | export EDITOR=vim 16 | export CVSEDITOR="${EDITOR}" 17 | export SVN_EDITOR="${EDITOR}" 18 | export GIT_EDITOR="${EDITOR}" 19 | 20 | # Pager 21 | export PAGER=less 22 | # Less status line 23 | export LESS='-R -f -X -i -P ?f%f:(stdin). ?lb%lb?L/%L.. [?eEOF:?pb%pb\%..]' 24 | export LESSCHARSET='utf-8' 25 | 26 | # LESS man page colors (makes Man pages more readable). 27 | export LESS_TERMCAP_mb=$'\E[01;31m' 28 | export LESS_TERMCAP_md=$'\E[01;31m' 29 | export LESS_TERMCAP_me=$'\E[0m' 30 | export LESS_TERMCAP_se=$'\E[0m' 31 | export LESS_TERMCAP_so=$'\E[00;44;37m' 32 | export LESS_TERMCAP_ue=$'\E[0m' 33 | export LESS_TERMCAP_us=$'\E[01;32m' 34 | 35 | # ls command colors 36 | export LSCOLORS=exfxcxdxbxegedabagacad 37 | export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30' 38 | 39 | export PATH=~/bin:/opt/homebrew/bin:$PATH 40 | 41 | # declare the environment variables 42 | export CORRECT_IGNORE='_*' 43 | export CORRECT_IGNORE_FILE='.*' 44 | 45 | #export WORDCHARS='*?[]~&;!#$%^(){}<>' 46 | #export WORDCHARS='*?.[]~&;!#$%^(){}<>' 47 | export WORDCHARS='*?_-.[]~=&;!#$%^(){}<>' 48 | 49 | # History file and its size 50 | export HISTFILE=~/.zsh_history 51 | export HISTSIZE=1000000 52 | export SAVEHIST=1000000 53 | # The size of asking history 54 | export LISTMAX=50 55 | # Do not add in root 56 | if [[ $UID == 0 ]]; then 57 | unset HISTFILE 58 | export SAVEHIST=0 59 | fi 60 | 61 | # fzf - command-line fuzzy finder (https://github.com/junegunn/fzf) 62 | export FZF_DEFAULT_OPTS="--extended --ansi --multi" 63 | 64 | # Cask 65 | #export HOMEBREW_CASK_OPTS="--appdir=/Applications" 66 | 67 | export GOPATH=$HOME 68 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/editing.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- Editing Enhancement 3 | -- ============================================================================ 4 | 5 | return { 6 | -- Auto pairs 7 | { 8 | 'windwp/nvim-autopairs', 9 | event = 'InsertEnter', 10 | config = function() 11 | require('nvim-autopairs').setup({ 12 | disable_filetype = { 'TelescopePrompt', 'vim' }, 13 | }) 14 | end, 15 | }, 16 | 17 | -- Comment 18 | { 19 | 'numToStr/Comment.nvim', 20 | event = { 'BufReadPost', 'BufNewFile' }, 21 | config = function() 22 | require('Comment').setup() 23 | -- Visual mode: K for comment toggle 24 | vim.keymap.set('v', 'K', 'gc', { silent = true, remap = true }) 25 | end, 26 | }, 27 | 28 | -- Surround 29 | { 30 | 'kylechui/nvim-surround', 31 | event = 'VeryLazy', -- Load earlier to avoid conflicts 32 | config = function() 33 | require('nvim-surround').setup({}) 34 | end, 35 | }, 36 | 37 | -- Split/Join code blocks (using Tree-sitter) 38 | { 39 | 'Wansmer/treesj', 40 | dependencies = { 'nvim-treesitter/nvim-treesitter' }, 41 | enable = false, 42 | keys = { 43 | { 'm', function() require('treesj').toggle() end, desc = 'Toggle Split/Join' }, 44 | -- { 'j', function() require('treesj').join() end, desc = 'Join Code Block' }, 45 | -- { 's', function() require('treesj').split() end, desc = 'Split Code Block' }, 46 | }, 47 | opts = { 48 | use_default_keymaps = false, -- Use custom keymaps defined above 49 | check_syntax_error = true, 50 | max_join_length = 120, 51 | cursor_behavior = 'hold', -- Keep cursor position after split/join 52 | notify = true, -- Show notification on split/join 53 | dot_repeat = true, -- Enable dot repeat 54 | }, 55 | }, 56 | 57 | -- Live preview for substitute and range commands 58 | { 59 | 'markonm/traces.vim', 60 | event = 'CmdlineEnter', 61 | }, 62 | } 63 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/lualine.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- lualine.nvim - Status line 3 | -- ============================================================================ 4 | 5 | return { 6 | { 7 | 'nvim-lualine/lualine.nvim', 8 | dependencies = { 'echasnovski/mini.icons' }, 9 | event = 'VeryLazy', 10 | opts = { 11 | options = { 12 | theme = 'tokyonight', 13 | component_separators = { left = '|', right = '|' }, 14 | section_separators = { left = '', right = '' }, 15 | globalstatus = true, -- Single statusline for all windows 16 | disabled_filetypes = { 17 | statusline = { 'dashboard', 'alpha' }, 18 | }, 19 | }, 20 | sections = { 21 | lualine_a = { 'mode' }, 22 | lualine_b = { 23 | 'branch', 24 | 'diff', 25 | { 26 | 'diagnostics', 27 | sources = { 'nvim_lsp' }, 28 | symbols = { error = ' ', warn = ' ', info = ' ', hint = ' ' }, 29 | }, 30 | }, 31 | lualine_c = { 32 | { 33 | 'filename', 34 | path = 1, -- 0 = just filename, 1 = relative path, 2 = absolute path 35 | symbols = { 36 | modified = '[+]', 37 | readonly = '[RO]', 38 | unnamed = '[No Name]', 39 | }, 40 | }, 41 | }, 42 | lualine_x = { 43 | 'encoding', 44 | { 45 | 'fileformat', 46 | symbols = { 47 | unix = 'LF', 48 | dos = 'CRLF', 49 | mac = 'CR', 50 | }, 51 | }, 52 | 'filetype', 53 | }, 54 | lualine_y = { 'progress' }, 55 | lualine_z = { 'location' }, 56 | }, 57 | inactive_sections = { 58 | lualine_a = {}, 59 | lualine_b = {}, 60 | lualine_c = { 'filename' }, 61 | lualine_x = { 'location' }, 62 | lualine_y = {}, 63 | lualine_z = {}, 64 | }, 65 | extensions = { 'lazy', 'mason' }, 66 | }, 67 | }, 68 | } 69 | -------------------------------------------------------------------------------- /.zsh/Completion/_gist: -------------------------------------------------------------------------------- 1 | #compdef gist 2 | # URL: https://github.com/babarot/gist 3 | # vim: ft=zsh 4 | 5 | _gist () { 6 | local -a _1st_arguments 7 | _1st_arguments=( 8 | 'open:Open user''s gist' 9 | 'edit:Edit the gist file and sync after' 10 | 'new:Create a new gist' 11 | 'delete:Delete gist files' 12 | 'config:Config the setting file' 13 | 'get:Manipulate gist with the command passed in the argument' 14 | 'run:Run the gist snippet as a script' 15 | 'help:Show help for any command' 16 | ) 17 | 18 | _arguments \ 19 | '(--help)--help[help message]' \ 20 | '(-v --version)'{-v,--version}'[show the version and exit]' \ 21 | '(-c --cache-clear)'{-c,--cache-clear}'[clear cache]' \ 22 | '*:: :->subcmds' \ 23 | && return 0 24 | 25 | if (( CURRENT == 1 )); then 26 | _describe -t commands "gist subcommand" _1st_arguments 27 | return 28 | fi 29 | 30 | case "$words[1]" in 31 | (open) 32 | _arguments \ 33 | '(- :)'{-h,--help}'[Show this help and exit]' \ 34 | '(--no-select)--no-select[Open only gist base URL without selecting]' \ 35 | '(--starred -s)'{--starred,-s}'[Open your starred gist]' \ 36 | && return 0 37 | ;; 38 | (run) 39 | _arguments \ 40 | '(- :)'{-h,--help}'[Show this help and exit]' \ 41 | '(--starred -s)'{--starred,-s}'[Open your starred gist]' \ 42 | && return 0 43 | ;; 44 | (new) 45 | _arguments \ 46 | '(- :)'{-h,--help}'[Show this help and exit]' \ 47 | '(-o --open)'{-o,--open}'[Open with the default browser]' \ 48 | '(-p --private)'{-p,--private}'[Create as private gist]' \ 49 | '(-)*: :_files' \ 50 | && return 0 51 | ;; 52 | (delete|config|get|edit) 53 | _arguments \ 54 | '(- :)'{-h,--help}'[Show this help and exit]' \ 55 | && return 0 56 | ;; 57 | (help) 58 | _values 'help message' ${_1st_arguments[@]%:*} && return 0 59 | ;; 60 | esac 61 | } 62 | 63 | _gist "$@" 64 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/wilder.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- Wilder.nvim - Enhanced Command-Line & Search 3 | -- ============================================================================ 4 | -- 5 | -- Features: 6 | -- - Fuzzy command-line completion 7 | -- - History filtering (e.g., `:xxx` shows only commands starting with xxx) 8 | -- - Enhanced search completion 9 | -- - Popup menu with preview 10 | 11 | return { 12 | { 13 | 'gelguy/wilder.nvim', 14 | event = 'CmdlineEnter', 15 | dependencies = { 16 | 'nvim-tree/nvim-web-devicons', -- Optional: for file icons 17 | }, 18 | config = function() 19 | local wilder = require('wilder') 20 | 21 | -- Setup wilder for command-line and search 22 | wilder.setup({ 23 | modes = { ':', '/', '?' }, 24 | next_key = '', 25 | previous_key = '', 26 | accept_key = '', 27 | reject_key = '', 28 | }) 29 | 30 | -- Map / to / using cnoremap 31 | -- This allows wilder to handle the key press properly 32 | vim.cmd([[ 33 | cnoremap wilder#in_context() ? "\" : "\" 34 | cnoremap wilder#in_context() ? "\" : "\" 35 | ]]) 36 | 37 | -- Set up command-line pipeline with fuzzy matching 38 | wilder.set_option('pipeline', { 39 | wilder.branch( 40 | -- For command-line 41 | wilder.cmdline_pipeline({ 42 | language = 'vim', 43 | fuzzy = 1, -- Enable fuzzy matching 44 | }), 45 | -- For search 46 | wilder.search_pipeline() 47 | ), 48 | }) 49 | 50 | -- Configure renderers 51 | wilder.set_option('renderer', wilder.renderer_mux({ 52 | [':'] = wilder.popupmenu_renderer({ 53 | highlighter = wilder.basic_highlighter(), 54 | left = { ' ', wilder.popupmenu_devicons() }, 55 | right = { ' ', wilder.popupmenu_scrollbar() }, 56 | pumblend = 20, -- Transparency (0-100) 57 | }), 58 | ['/'] = wilder.wildmenu_renderer({ 59 | highlighter = wilder.basic_highlighter(), 60 | }), 61 | })) 62 | end, 63 | }, 64 | } 65 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | tap "hashicorp/tap" 2 | tap "homebrew/bundle" 3 | 4 | # 5 | # Brew 6 | # https://formulae.brew.sh/ 7 | # 8 | brew "bash" 9 | brew "difftastic" 10 | brew "exiftool" 11 | brew "gawk" 12 | brew "gnu-sed" 13 | brew "go" 14 | brew "goreleaser" 15 | brew "grep" 16 | brew "hashicorp/tap/terraform-ls" 17 | brew "helmfile" 18 | brew "hugo" 19 | brew "kustomize" 20 | brew "libidn2" 21 | brew "litecli" 22 | brew "lua-language-server" 23 | brew "luarocks" # package manager for Lua 24 | brew "mas" if OS.mac? 25 | # brew "mysql" 26 | brew "rustup-init" 27 | brew "terraform" 28 | brew "tmux" 29 | brew "wget" 30 | brew "yarn" 31 | 32 | # it may take a little while 33 | brew "ffmpeg" 34 | brew "gifsicle" 35 | brew "ttyd" 36 | brew "gum" 37 | brew "vhs" # faressoft/terminalizer 38 | 39 | # 40 | # Cask 41 | # https://formulae.brew.sh/cask/ 42 | # 43 | cask "1password" 44 | cask "adobe-creative-cloud" 45 | cask "appcleaner" 46 | cask "cleanshot" 47 | cask "docker-desktop" 48 | cask "font-hack-nerd-font" 49 | cask "font-jetbrains-mono-nerd-font" 50 | cask "ghostty" 51 | cask "google-chrome" 52 | cask "google-japanese-ime" 53 | cask "hiddenbar" # alternative for "bartender" 54 | cask "inkdrop" 55 | cask "iterm2" 56 | cask "numi" 57 | #cask "obs" # no longer used 58 | cask "obsidian" 59 | cask "path-finder" 60 | cask "popclip" 61 | #cask "postman" 62 | cask "qlmarkdown" 63 | cask "rectangle" # alternative for "Magnet" 64 | cask "slack" 65 | cask "spotify" 66 | cask "tableplus" 67 | cask "the-unarchiver" 68 | cask "typora" 69 | cask "wezterm" 70 | cask "zoom" 71 | 72 | # 73 | # Mac App Store 74 | # https://github.com/mas-cli/mas 75 | # 76 | mas "1Password for Safari", id: 1569813296 77 | mas "Amphetamine", id: 937984704 78 | mas "DaisyDisk", id: 411643860 79 | mas "Day One", id: 1055511498 80 | mas "Fantastical", id: 975937182 81 | mas "LadioCast", id: 411213048 82 | mas "Magnet", id: 441258766 83 | mas "MeetingBar for Meet, Zoom & Co", id: 1532419400 84 | mas "MenubarX", id: 1575588022 85 | mas "Paste", id: 967805235 86 | mas "Spark", id: 1176895641 87 | mas "Tailscale", id: 1475387142 88 | mas "Things 3", id: 904280696 89 | # mas "Equinox - Create Wallpaper", id: 1591510203 90 | # mas "Translate Tab", id: 458887729 91 | mas "Yoink", id: 457622435 92 | # mas "Name Mangler 3", id: 603637384 93 | # mas "Rename X", id: 1438841416 94 | # mas "ToyViewer", id: 414298354 95 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/hlchunk.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- hlchunk.nvim - Code Chunk & Indent Highlighting 3 | -- ============================================================================ 4 | -- 5 | -- Features: 6 | -- - chunk: Highlight code block under cursor 7 | -- - indent: Indent guide lines (disabled - using indent-blankline instead) 8 | -- - line_num: Line number highlighting 9 | -- - blank: Blank line highlighting 10 | 11 | return { 12 | { 13 | 'shellRaining/hlchunk.nvim', 14 | enabled = false, -- Disabled: conflicts with indent-blankline.nvim 15 | event = { 'BufReadPost', 'BufNewFile' }, 16 | config = function() 17 | require('hlchunk').setup({ 18 | -- Chunk: Highlight the code block under cursor 19 | chunk = { 20 | enable = true, 21 | priority = 15, 22 | style = { 23 | { fg = '#806d9c' }, -- Chunk border color 24 | { fg = '#c21f30' }, -- Error chunk color 25 | }, 26 | use_treesitter = true, 27 | chars = { 28 | horizontal_line = '─', 29 | vertical_line = '│', 30 | left_top = '╭', 31 | left_bottom = '╰', 32 | right_arrow = '>', 33 | }, 34 | textobject = '', -- Disable textobject by default 35 | max_file_size = 1024 * 1024, -- 1MB 36 | error_sign = true, 37 | duration = 200, 38 | delay = 300, 39 | }, 40 | 41 | -- Indent: Disabled (using indent-blankline.nvim instead) 42 | indent = { 43 | enable = false, 44 | }, 45 | 46 | -- Line number: Highlight line numbers in chunk 47 | line_num = { 48 | enable = false, -- Disabled by default 49 | style = '#806d9c', 50 | priority = 10, 51 | }, 52 | 53 | -- Blank: Highlight blank lines 54 | blank = { 55 | enable = false, -- Disabled by default 56 | chars = { 57 | ' ', 58 | }, 59 | style = { 60 | { bg = '#434437' }, 61 | { bg = '#2f4440' }, 62 | { bg = '#433054' }, 63 | { bg = '#284251' }, 64 | }, 65 | priority = 9, 66 | }, 67 | }) 68 | end, 69 | }, 70 | } 71 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/lsp.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- LSP Configuration (Minimal) 3 | -- ============================================================================ 4 | 5 | return { 6 | -- Mason 7 | { 8 | 'williamboman/mason.nvim', 9 | config = function() 10 | require('mason').setup() 11 | end, 12 | }, 13 | 14 | -- LSPconfig (must be loaded before mason-lspconfig) 15 | { 16 | 'neovim/nvim-lspconfig', 17 | lazy = true, 18 | }, 19 | 20 | -- Mason-LSPconfig 21 | { 22 | 'williamboman/mason-lspconfig.nvim', 23 | dependencies = { 24 | 'williamboman/mason.nvim', 25 | 'neovim/nvim-lspconfig', 26 | 'saghen/blink.cmp', 27 | }, 28 | config = function() 29 | -- Capabilities for blink.cmp 30 | local capabilities = require('blink.cmp').get_lsp_capabilities() 31 | 32 | -- on_attach function for LSP servers 33 | local on_attach = function(client, bufnr) 34 | -- Attach nvim-navic for barbecue.nvim (breadcrumbs) 35 | if client.server_capabilities.documentSymbolProvider then 36 | local navic_ok, navic = pcall(require, 'nvim-navic') 37 | if navic_ok then 38 | navic.attach(client, bufnr) 39 | end 40 | end 41 | end 42 | 43 | -- Setup servers via mason-lspconfig (v2.0+ API) 44 | require('mason-lspconfig').setup({ 45 | ensure_installed = { 'gopls', 'lua_ls' }, 46 | automatic_installation = false, 47 | handlers = { 48 | -- Default handler for all servers 49 | function(server_name) 50 | require('lspconfig')[server_name].setup({ 51 | capabilities = capabilities, 52 | on_attach = on_attach, 53 | }) 54 | end, 55 | 56 | -- Custom handler for lua_ls 57 | ['lua_ls'] = function() 58 | require('lspconfig').lua_ls.setup({ 59 | capabilities = capabilities, 60 | on_attach = on_attach, 61 | settings = { 62 | Lua = { 63 | diagnostics = { 64 | globals = { 'vim' }, 65 | }, 66 | }, 67 | }, 68 | }) 69 | end, 70 | }, 71 | }) 72 | end, 73 | }, 74 | } 75 | -------------------------------------------------------------------------------- /.config/nvim/lua/config/options.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- Options 3 | -- ============================================================================ 4 | 5 | -- Leader keys (must be set before loading other configs) 6 | vim.g.mapleader = ',' 7 | vim.g.maplocalleader = '\\' 8 | 9 | -- Disable built-in plugins 10 | vim.g.loaded_gzip = 1 11 | vim.g.loaded_man = 1 12 | vim.g.loaded_matchit = 1 13 | vim.g.loaded_matchparen = 1 14 | vim.g.loaded_shada_plugin = 1 15 | vim.g.loaded_tarPlugin = 1 16 | vim.g.loaded_tar = 1 17 | vim.g.loaded_zipPlugin = 1 18 | vim.g.loaded_zip = 1 19 | vim.g.loaded_netrwPlugin = 1 20 | 21 | -- General 22 | vim.opt.encoding = "UTF-8" 23 | vim.opt.showmode = true 24 | vim.opt.hidden = true 25 | vim.opt.confirm = true 26 | vim.opt.mouse = "a" 27 | vim.opt.clipboard = "unnamedplus" -- Use system clipboard 28 | vim.opt.errorbells = false 29 | vim.opt.termguicolors = true 30 | 31 | -- UI 32 | vim.opt.number = true 33 | vim.opt.relativenumber = true 34 | vim.opt.cursorline = true 35 | vim.opt.cursorcolumn = false 36 | vim.opt.signcolumn = "yes" 37 | vim.opt.scrolloff = 8 38 | vim.opt.laststatus = 3 39 | vim.opt.showmatch = true 40 | 41 | -- Splits 42 | vim.opt.splitright = true 43 | vim.opt.splitbelow = true 44 | 45 | -- Search 46 | vim.opt.incsearch = true 47 | vim.opt.hlsearch = true 48 | vim.opt.smartcase = true 49 | vim.opt.ignorecase = true 50 | 51 | -- Indentation 52 | vim.opt.autoindent = true 53 | vim.opt.smartindent = true 54 | vim.opt.expandtab = true 55 | vim.opt.shiftwidth = 0 56 | vim.opt.softtabstop = 2 57 | vim.opt.tabstop = 2 58 | 59 | -- Whitespace display 60 | vim.opt.list = true 61 | vim.opt.listchars = { 62 | tab = ">·", 63 | trail = "·", 64 | precedes = "←", 65 | extends = "→", 66 | eol = "↲", 67 | nbsp = "␣", 68 | } 69 | 70 | -- Files 71 | vim.opt.backup = false 72 | vim.opt.swapfile = false 73 | vim.opt.undofile = false 74 | vim.opt.autochdir = false 75 | 76 | -- Persistent undo 77 | if vim.fn.has('persistent_undo') == 1 then 78 | vim.opt.undofile = true 79 | vim.opt.undodir = vim.fn.stdpath('state') .. '/undo' 80 | end 81 | -------------------------------------------------------------------------------- /.zsh/30_aliases.zsh: -------------------------------------------------------------------------------- 1 | autoload -Uz zmv 2 | alias zmv='noglob zmv -W' 3 | 4 | alias cp="${ZSH_VERSION:+nocorrect} cp -i" 5 | alias mv="${ZSH_VERSION:+nocorrect} mv -i" 6 | alias mkdir="${ZSH_VERSION:+nocorrect} mkdir" 7 | 8 | alias du='du -h' 9 | alias job='jobs -l' 10 | alias grep='grep --color=auto' 11 | alias fgrep='fgrep --color=auto' 12 | alias egrep='egrep --color=auto' 13 | 14 | # Use plain vim. 15 | alias suvim='vim -N -u NONE -i NONE' 16 | 17 | if (( $+commands[kubectl] )); then 18 | alias k=kubectl 19 | fi 20 | 21 | if (( $+commands[nvim] )); then 22 | alias vim=nvim 23 | fi 24 | 25 | # Global aliases 26 | alias -g L='| less' 27 | alias -g G='| grep' 28 | alias -g X='| xargs' 29 | alias -g N=" >/dev/null 2>&1" 30 | alias -g N1=" >/dev/null" 31 | alias -g N2=" 2>/dev/null" 32 | alias -g VI='| xargs -o vim' 33 | alias -g CSV="| sed 's/,,/, ,/g;s/,,/, ,/g' | column -s, -t" 34 | alias -g H='| head' 35 | alias -g T='| tail' 36 | alias -g W='| wc -l' 37 | 38 | alias -g CP='| pbcopy' 39 | alias -g CC='| tee /dev/tty | pbcopy' 40 | alias -g F='$(fzf)' 41 | 42 | awk_alias2() { 43 | local -a options fields words 44 | while (( $#argv > 0 )) 45 | do 46 | case "$1" in 47 | -*) 48 | options+=("$1") 49 | ;; 50 | <->) 51 | fields+=("$1") 52 | ;; 53 | *) 54 | words+=("$1") 55 | ;; 56 | esac 57 | shift 58 | done 59 | if (( $#fields > 0 )) && (( $#words > 0 )); then 60 | awk '$'$fields[1]' ~ '${(qqq)words[1]}'' 61 | elif (( $#fields > 0 )) && (( $#words == 0 )); then 62 | awk '{print $'$fields[1]'}' 63 | fi 64 | } 65 | alias -g A="| awk_alias2" 66 | 67 | # list galias 68 | alias galias="alias | command grep -E '^[A-Z]'" 69 | alias yy="fc -ln -1 | tr -d '\n' | pbcopy" 70 | 71 | gchange() { 72 | if ! type gcloud &>/dev/null; then 73 | echo "gcloud not found" >&2 74 | return 1 75 | fi 76 | gcloud config configurations activate $(gcloud config configurations list | fzf-tmux --reverse --header-lines=1 | awk '{print $1}') 77 | } 78 | 79 | alias -g Q="| gawk 'match(\$0, /\"(.*?)\"/, a) {print a[1]}'" 80 | alias -g QQ="| gawk 'match(\$0, /(\".*?\")/, a) {print a[1]}'" 81 | alias -g ESC='| sed -r "s/\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"' 82 | alias -g ANSI='| sed -r "s/\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"' 83 | 84 | pskill() { 85 | ps -ef | fzf \ 86 | --bind 'ctrl-r:reload(ps -ef),enter:execute(kill {2})+reload(ps -ef)' \ 87 | --header 'Press CTRL-R to reload' \ 88 | --header-lines=1 \ 89 | --height=50 90 | } 91 | -------------------------------------------------------------------------------- /.zshenv: -------------------------------------------------------------------------------- 1 | # Prevent /etc/zprofile from messing up PATH order 2 | setopt no_global_rcs 3 | 4 | XDG_CONFIG_HOME=$HOME/.config 5 | 6 | typeset -gx -U path 7 | path=( \ 8 | ~/bin(N-/) \ 9 | ~/.local/bin(N-/) \ 10 | /usr/local/bin(N-/) \ 11 | /usr/local/go/bin \ 12 | /opt/homebrew/bin \ 13 | ~/.cargo/bin(N-/) \ 14 | ~/.zplug/bin(N-/) \ 15 | ~/.tmux/bin(N-/) \ 16 | "$path[@]" \ 17 | ) 18 | 19 | # set fpath before compinit 20 | typeset -gx -U fpath 21 | fpath=( \ 22 | ~/.zsh/Completion(N-/) \ 23 | ~/.zsh/functions(N-/) \ 24 | ~/.zsh/plugins/zsh-completions(N-/) \ 25 | /usr/local/share/zsh/site-functions(N-/) \ 26 | $fpath \ 27 | ) 28 | 29 | # 30 | # autoload 31 | autoload -Uz run-help 32 | autoload -Uz add-zsh-hook 33 | autoload -Uz colors && colors 34 | autoload -Uz compinit && compinit -u 35 | autoload -Uz is-at-least 36 | 37 | # LANGUAGE must be set by en_US 38 | export LANGUAGE="en_US.UTF-8" 39 | export LANG="${LANGUAGE}" 40 | export LC_ALL="${LANGUAGE}" 41 | export LC_CTYPE="${LANGUAGE}" 42 | 43 | # Editor 44 | export EDITOR=vim 45 | export CVSEDITOR="${EDITOR}" 46 | export SVN_EDITOR="${EDITOR}" 47 | export GIT_EDITOR="${EDITOR}" 48 | 49 | # Pager 50 | export PAGER=less 51 | # Less status line 52 | export LESS='-R -f -X -i -P ?f%f:(stdin). ?lb%lb?L/%L.. [?eEOF:?pb%pb\%..]' 53 | export LESSCHARSET='utf-8' 54 | 55 | # LESS man page colors (makes Man pages more readable). 56 | export LESS_TERMCAP_mb=$'\E[01;31m' 57 | export LESS_TERMCAP_md=$'\E[01;31m' 58 | export LESS_TERMCAP_me=$'\E[0m' 59 | export LESS_TERMCAP_se=$'\E[0m' 60 | export LESS_TERMCAP_so=$'\E[00;44;37m' 61 | export LESS_TERMCAP_ue=$'\E[0m' 62 | export LESS_TERMCAP_us=$'\E[01;32m' 63 | 64 | # ls command colors 65 | export LSCOLORS=exfxcxdxbxegedabagacad 66 | export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30' 67 | 68 | # declare the environment variables 69 | export CORRECT_IGNORE='_*' 70 | export CORRECT_IGNORE_FILE='.*' 71 | 72 | #export WORDCHARS='*?[]~&;!#$%^(){}<>' 73 | #export WORDCHARS='*?.[]~&;!#$%^(){}<>' 74 | export WORDCHARS='*?_-.[]~=&;!#$%^(){}<>' 75 | 76 | # History file and its size 77 | export HISTFILE=~/.zsh_history 78 | export HISTSIZE=1000000 79 | export SAVEHIST=1000000 80 | # The size of asking history 81 | export LISTMAX=50 82 | # Do not add in root 83 | if [[ $UID == 0 ]]; then 84 | unset HISTFILE 85 | export SAVEHIST=0 86 | fi 87 | 88 | # fzf - command-line fuzzy finder (https://github.com/junegunn/fzf) 89 | export FZF_DEFAULT_OPTS="--extended --ansi --multi" 90 | 91 | # Cask 92 | #export HOMEBREW_CASK_OPTS="--appdir=/Applications" 93 | 94 | export GOPATH=$HOME 95 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/bufferline.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- Bufferline - Buffer Line 3 | -- ============================================================================ 4 | 5 | return { 6 | { 7 | 'akinsho/bufferline.nvim', 8 | enabled = false, -- Disabled: using barbar.nvim instead 9 | version = '*', 10 | dependencies = { 11 | 'nvim-tree/nvim-web-devicons', 12 | }, 13 | event = { 'BufReadPost', 'BufAdd', 'BufNewFile' }, 14 | config = function() 15 | require('bufferline').setup({ 16 | options = { 17 | mode = 'buffers', -- set to "tabs" to only show tabpages instead 18 | 19 | -- Style 20 | style_preset = require('bufferline').style_preset.default, 21 | themable = true, 22 | numbers = 'none', 23 | 24 | -- Mouse support 25 | close_command = 'bdelete! %d', 26 | right_mouse_command = 'bdelete! %d', 27 | left_mouse_command = 'buffer %d', 28 | middle_mouse_command = nil, 29 | 30 | -- Buffer management 31 | indicator = { 32 | icon = '▎', 33 | style = 'icon', 34 | }, 35 | buffer_close_icon = '×', 36 | modified_icon = '●', 37 | close_icon = '', 38 | left_trunc_marker = '', 39 | right_trunc_marker = '', 40 | 41 | -- Tabs 42 | max_name_length = 30, 43 | max_prefix_length = 15, 44 | truncate_names = true, 45 | tab_size = 21, 46 | 47 | -- Diagnostics (LSP integration) 48 | diagnostics = 'nvim_lsp', 49 | diagnostics_update_in_insert = false, 50 | diagnostics_indicator = function(count, level, diagnostics_dict, context) 51 | local icon = level:match('error') and ' ' or ' ' 52 | return ' ' .. icon .. count 53 | end, 54 | 55 | -- Offsets (for sidebars like nvim-tree) 56 | offsets = { 57 | { 58 | filetype = 'NvimTree', 59 | text = 'File Explorer', 60 | text_align = 'left', 61 | separator = true, 62 | }, 63 | }, 64 | 65 | -- Color 66 | color_icons = true, 67 | show_buffer_icons = true, 68 | show_buffer_close_icons = true, 69 | show_close_icon = true, 70 | show_tab_indicators = true, 71 | show_duplicate_prefix = true, 72 | persist_buffer_sort = true, 73 | 74 | -- Separator 75 | separator_style = 'thin', -- "slant" | "slope" | "thick" | "thin" | { 'any', 'any' } 76 | enforce_regular_tabs = false, 77 | always_show_bufferline = true, 78 | 79 | -- Sorting 80 | sort_by = 'insert_after_current', 81 | }, 82 | }) 83 | end, 84 | }, 85 | } 86 | -------------------------------------------------------------------------------- /.config/nvim/lua/plugins/conform.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- conform.nvim - Lightweight Code Formatter 3 | -- ============================================================================ 4 | -- 5 | -- Features: 6 | -- - Minimal diff formatting (preserves folds, marks, cursor position) 7 | -- - Range formatting support for all formatters 8 | -- - Multiple formatters chaining 9 | -- - 200+ formatters support 10 | -- 11 | -- Commands: 12 | -- :ConformInfo - Show available formatters 13 | -- 14 | -- Keymaps: 15 | -- fm - Format buffer (normal/visual mode) 16 | 17 | return { 18 | { 19 | 'stevearc/conform.nvim', 20 | event = { 'BufWritePre' }, 21 | cmd = { 'ConformInfo' }, 22 | keys = { 23 | { 24 | 'fm', 25 | function() 26 | require('conform').format({ async = true, lsp_format = 'fallback' }) 27 | end, 28 | mode = { 'n', 'v' }, 29 | desc = 'Format buffer', 30 | }, 31 | }, 32 | opts = { 33 | -- Formatters by filetype 34 | formatters_by_ft = { 35 | -- Lua 36 | lua = { 'stylua' }, 37 | 38 | -- Go 39 | go = { 'gofmt', 'goimports' }, 40 | 41 | -- Python 42 | python = { 'isort', 'black' }, 43 | 44 | -- JavaScript/TypeScript 45 | javascript = { 'prettier' }, 46 | typescript = { 'prettier' }, 47 | javascriptreact = { 'prettier' }, 48 | typescriptreact = { 'prettier' }, 49 | 50 | -- Web 51 | html = { 'prettier' }, 52 | css = { 'prettier' }, 53 | scss = { 'prettier' }, 54 | 55 | -- JSON/YAML 56 | json = { 'jq' }, 57 | -- yaml = { 'yamlfmt' }, -- Disabled 58 | 59 | -- Markdown 60 | markdown = { 'prettier' }, 61 | 62 | -- Shell 63 | sh = { 'shfmt' }, 64 | bash = { 'shfmt' }, 65 | zsh = { 'shfmt' }, 66 | 67 | -- Rust 68 | rust = { 'rustfmt' }, 69 | 70 | -- Terraform/HCL 71 | terraform = { 'terraform_fmt' }, 72 | tf = { 'terraform_fmt' }, 73 | hcl = { 'terraform_fmt' }, 74 | }, 75 | 76 | -- Format on save 77 | format_on_save = function(bufnr) 78 | -- Disable format on save for YAML files 79 | if vim.bo[bufnr].filetype == 'yaml' then 80 | return 81 | end 82 | return { 83 | timeout_ms = 500, 84 | lsp_format = 'fallback', 85 | } 86 | end, 87 | 88 | -- Customize formatters 89 | formatters = { 90 | shfmt = { 91 | prepend_args = { '-i', '2' }, -- 2 spaces indent 92 | }, 93 | }, 94 | 95 | -- Notification on format 96 | notify_on_error = true, 97 | }, 98 | }, 99 | } 100 | -------------------------------------------------------------------------------- /.config/nvim/lua/config/filetypes.lua: -------------------------------------------------------------------------------- 1 | -- ============================================================================ 2 | -- Filetype Settings 3 | -- ============================================================================ 4 | 5 | -- ---------------------------------------------------------------------------- 6 | -- Filetype detection 7 | -- ---------------------------------------------------------------------------- 8 | vim.filetype.add({ 9 | extension = { 10 | gotmpl = 'gotmpl', 11 | tape = 'vhs', 12 | tf = 'terraform', 13 | tfvars = 'terraform', 14 | }, 15 | pattern = { 16 | [".*/templates/.*%.tpl"] = "helm", 17 | [".*/templates/.*%.ya?ml"] = "helm", 18 | ["helmfile.*%.ya?ml"] = "helm", 19 | [".*/layouts/.*%.html"] = "gohtmltmpl", 20 | [".*/nginx/.*%.conf"] = "nginx", -- Nginx config files in nginx directories 21 | ["nginx%.conf"] = "nginx", -- nginx.conf specifically 22 | }, 23 | filename = { 24 | ["README$"] = function(path, bufnr) 25 | local first_line = vim.api.nvim_buf_get_lines(bufnr, 0, 1, true)[1] 26 | if first_line and string.find(first_line, "#") then 27 | return "markdown" 28 | end 29 | end, 30 | }, 31 | literal = { 32 | Brewfile = 'brewfile', 33 | ['.tagpr'] = 'ini', 34 | }, 35 | }) 36 | 37 | -- ---------------------------------------------------------------------------- 38 | -- Filetype-specific settings 39 | -- ---------------------------------------------------------------------------- 40 | 41 | -- Shell scripts: add ':' to keyword characters 42 | vim.api.nvim_create_autocmd("FileType", { 43 | group = vim.api.nvim_create_augroup('ft-shell', { clear = true }), 44 | pattern = { "sh", "zsh" }, 45 | callback = function() 46 | vim.bo.iskeyword = vim.bo.iskeyword .. ',:' 47 | end, 48 | }) 49 | 50 | -- Go: use tabs and 4-space width 51 | vim.api.nvim_create_autocmd("FileType", { 52 | group = vim.api.nvim_create_augroup('ft-go', { clear = true }), 53 | pattern = "go", 54 | callback = function() 55 | vim.bo.autoindent = true 56 | vim.bo.expandtab = false 57 | vim.bo.shiftwidth = 4 58 | vim.bo.softtabstop = 4 59 | vim.bo.tabstop = 4 60 | end, 61 | }) 62 | 63 | -- Nginx: register treesitter parser 64 | vim.api.nvim_create_autocmd("FileType", { 65 | group = vim.api.nvim_create_augroup('ft-nginx', { clear = true }), 66 | pattern = "nginx", 67 | callback = function() 68 | vim.treesitter.language.register("nginx", "nginx") 69 | end, 70 | }) 71 | 72 | -- ---------------------------------------------------------------------------- 73 | -- User commands 74 | -- ---------------------------------------------------------------------------- 75 | 76 | -- Format JSON with jq 77 | vim.api.nvim_create_user_command('JQ', function(opts) 78 | local arg = opts.args == "" and "." or opts.args 79 | vim.cmd("%! jq " .. arg) 80 | end, { nargs = '?' }) 81 | -------------------------------------------------------------------------------- /.config/nvim.old/lua/keymaps.lua: -------------------------------------------------------------------------------- 1 | local opt = { noremap = true, silent = true } 2 | 3 | vim.keymap.set('i', 'jj', '', opt) 4 | vim.keymap.set('i', '', '', opt) 5 | vim.keymap.set('i', '', '', opt) 6 | vim.keymap.set('v', 'v', '$h', opt) 7 | 8 | vim.keymap.set('c', 'jj', '', opt) 9 | vim.keymap.set('c', '', '', opt) 10 | vim.keymap.set('c', '', '', opt) 11 | vim.keymap.set('c', '', '', opt) 12 | vim.keymap.set('c', '', '', opt) 13 | vim.keymap.set('c', '', '', opt) 14 | vim.keymap.set('c', '', '', opt) 15 | vim.keymap.set('c', '', '', opt) 16 | vim.keymap.set('c', '', '', opt) 17 | -- vim.keymap.set('c', '', '', opt) 18 | -- vim.keymap.set('c', '', '', opt) 19 | 20 | vim.keymap.set({ 'n', 'v' }, 'j', 'gj', opt) 21 | vim.keymap.set({ 'n', 'v' }, 'k', 'gk', opt) 22 | vim.keymap.set({ 'n', 'v' }, 'gj', 'j', opt) 23 | vim.keymap.set({ 'n', 'v' }, 'gk', 'k', opt) 24 | vim.keymap.set({ 'n', 'v' }, 'H', '^', opt) 25 | vim.keymap.set({ 'n', 'v' }, 'L', '$', opt) 26 | vim.keymap.set({ 'n', 'v' }, ';', ':', {}) 27 | 28 | vim.keymap.set('n', '', ':w', opt) 29 | -- vim.keymap.set('n', 'q', ':bdelete', { noremap = false, silent = true }) 30 | vim.keymap.set('n', 'q', '', opt) 31 | vim.keymap.set('n', 'tt', ':tabnew', opt) 32 | vim.keymap.set('n', 'tc', ':tabclose', opt) 33 | vim.keymap.set('n', '', ':bprev', opt) 34 | vim.keymap.set('n', '', ':bnext', opt) 35 | vim.keymap.set('n', '', ':bdelete', opt) 36 | vim.keymap.set('n', '', ':nohl', opt) 37 | 38 | vim.keymap.set('n', 'n', 'nzz', opt) 39 | vim.keymap.set('n', 'N', 'Nzz', opt) 40 | vim.keymap.set('n', 'S', '*zz', opt) 41 | vim.keymap.set('n', '*', '*zz', opt) 42 | vim.keymap.set('n', '#', '#zz', opt) 43 | vim.keymap.set('n', 'g*', 'g*zz', opt) 44 | vim.keymap.set('n', 'g#', 'g#zz', opt) 45 | vim.keymap.set('n', 'ZZ', '', opt) 46 | vim.keymap.set('n', 'ZQ', '', opt) 47 | vim.keymap.set('n', 'zz', 48 | function() 49 | if vim.fn.winline() == (vim.fn.winheight(0) + 1) / 2 then 50 | return 'zt' -- top 51 | else 52 | local scrolloff = vim.opt.scrolloff:get() 53 | return vim.fn.winline() == scrolloff + 1 and 'zb' or 'zz' -- bottom or middle 54 | end 55 | end, 56 | { expr = true, noremap = true, silent = true }) 57 | -- Jump a next blank line 58 | vim.keymap.set('n', 'W', ':keepjumps normal! }', opt) 59 | vim.keymap.set('n', 'B', ':keepjumps normal! {', opt) 60 | -- Set tabs and windows 61 | vim.keymap.set('n', 'sp', ':split', opt) 62 | vim.keymap.set('n', 'vs', ':split', opt) 63 | vim.keymap.set('n', 'ss', 64 | function() 65 | if vim.fn.winnr('$') == 1 then 66 | return ':vsplit' 67 | else 68 | return ':wincmd w' 69 | end 70 | end, 71 | { expr = true, noremap = true, silent = true }) 72 | -------------------------------------------------------------------------------- /.config/nvim.old/lua/plugins/nvim-cmp.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local has_words_before = function() 3 | if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end 4 | local line, col = unpack(vim.api.nvim_win_get_cursor(0)) 5 | return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil 6 | end 7 | 8 | local cmp = require('cmp') 9 | local lspkind = require('lspkind') 10 | 11 | cmp.setup({ 12 | snippet = { 13 | expand = function(args) 14 | vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. 15 | end, 16 | }, 17 | mapping = { 18 | [''] = cmp.mapping.abort(), 19 | [''] = cmp.mapping.scroll_docs(-4), 20 | [''] = cmp.mapping.scroll_docs(4), 21 | [''] = cmp.mapping.complete(), 22 | [''] = cmp.mapping.select_next_item(), 23 | [''] = cmp.mapping.select_prev_item(), 24 | [''] = cmp.mapping.select_next_item(), 25 | [''] = cmp.mapping.select_prev_item(), 26 | [''] = cmp.mapping.confirm({ select = true }), 27 | [''] = vim.schedule_wrap(function(fallback) 28 | if cmp.visible() and has_words_before() then 29 | cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) 30 | else 31 | fallback() 32 | end 33 | end), 34 | [''] = cmp.mapping(function(fallback) 35 | vim.api.nvim_feedkeys(vim.fn['copilot#Accept'](vim.api.nvim_replace_termcodes('', true, true, true)), 'n', 36 | true) 37 | end) 38 | }, 39 | sources = cmp.config.sources({ 40 | { name = 'nvim_lsp' }, 41 | { name = 'vsnip' }, 42 | { name = 'path' }, 43 | { name = 'buffer' }, 44 | { name = 'nvim_lsp_signature_help' }, 45 | { name = 'emoji' }, 46 | -- https://github.com/hrsh7th/nvim-cmp/issues/1310 47 | -- { name = 'cmdline' }, 48 | { name = 'copilot' }, 49 | }), 50 | formatting = { 51 | format = lspkind.cmp_format({ 52 | mode = 'symbol_text', 53 | maxwidth = 50, 54 | ellipsis_char = '...', 55 | }), 56 | }, 57 | experimental = { 58 | ghost_text = false -- this feature conflict to the copilot.vim's preview. 59 | } 60 | }) 61 | 62 | -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). 63 | cmp.setup.cmdline({ '/', '?' }, { 64 | mapping = cmp.mapping.preset.cmdline(), 65 | sources = { 66 | { name = 'buffer' } 67 | } 68 | }) 69 | 70 | -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). 71 | cmp.setup.cmdline(':', { 72 | -- mapping = cmp.mapping.preset.cmdline(), 73 | mapping = cmp.mapping.preset.cmdline({ 74 | [''] = cmp.mapping.select_next_item(), 75 | [''] = cmp.mapping.select_prev_item(), 76 | }), 77 | sources = cmp.config.sources({ 78 | { name = 'path' } 79 | }, { 80 | { name = 'cmdline' } 81 | }) 82 | }) 83 | end 84 | -------------------------------------------------------------------------------- /.tmux/bin/README.md: -------------------------------------------------------------------------------- 1 | # tmux-bin 2 | 3 | Utility commands for tmux status bar. 4 | Can be used as external plugins for [tmux-powerkit](https://github.com/fabioluciano/tmux-powerkit). 5 | 6 | ## Commands 7 | 8 | ### path 9 | 10 | Display the current directory in various styles. 11 | 12 | ```bash 13 | path --dir --style