diff options
-rw-r--r-- | .vimrc | 33 | ||||
-rw-r--r-- | .zshrc | 140 | ||||
-rw-r--r-- | kitty/kitty.conf | 2 | ||||
-rw-r--r-- | nvim/init.vim | 1 | ||||
-rwxr-xr-x | sync.sh | 2 |
5 files changed, 100 insertions, 78 deletions
@@ -21,7 +21,9 @@ Plugin 'nvim-lua/plenary.nvim' Plugin 'nvim-telescope/telescope.nvim' Plugin 'tpope/vim-surround' Plugin 'puremourning/vimspector' +Plugin 'ilyachur/cmake4vim' " File types +Plugin 'rust-lang/rust.vim' Plugin 'neovimhaskell/haskell-vim' Plugin 'peterhoeg/vim-qml' Plugin 'lervag/vimtex' @@ -72,11 +74,19 @@ autocmd FileType python set ts=4 sw=4 sts=4 expandtab autocmd FileType markdown set ts=4 sw=4 sts=4 expandtab autocmd FileType tex set ts=4 sw=4 sts=4 expandtab autocmd FileType haskell set ts=4 sw=4 sts=4 expandtab +autocmd FileType rust set ts=4 sw=4 sts=4 expandtab autocmd FileType qml set ts=4 sw=4 sts=4 expandtab autocmd FileType c,cpp,asm set ts=8 sw=8 sts=8 noexpandtab +autocmd FileType javascript set ts=8 sw=8 sts=8 noexpandtab set autoindent smartindent +" Force 2 spaces, 4 spaces or 1 tab +nnoremap <leader>2 :set ts=2 sw=2 sts=2 expandtab<CR> +nnoremap <leader>4 :set ts=4 sw=4 sts=4 expandtab<CR> +nnoremap <leader>8 :set ts=8 sw=8 sts=8 noexpandtab<CR> + set background=dark +colorscheme vim let g:airline_theme='onedark' " Popup menu colors @@ -87,8 +97,11 @@ highlight PmenuSel guibg=#61AFEF " Generic shortcuts inoremap <C-s> <esc>:w<CR>a nnoremap <leader>\ :noh<CR> + +" Autoformat autocmd FileType python nnoremap <leader>b :!black %<CR>:e<CR> autocmd FileType c,cpp nnoremap <leader>b :pyf /usr/share/clang/clang-format.py<CR> +autocmd FileType rust nnoremap <leader>b :!rustfmt %<CR>:e<CR> " ale nnoremap <leader>a :ALEToggle<CR> @@ -116,6 +129,22 @@ let g:NERDCommentEmptyLines = 1 let g:NERDTrimTrailingWhitespace = 1 let g:NERDToggleCheckAllLines = 1 +" Vimspector +nmap <F2> <Plug>VimspectorToggleBreakpoint +nmap <F3> <Plug>VimspectorStop +nmap <F4> <Plug>VimspectorRestart +nmap <F5> <Plug>VimspectorContinue +nmap <F6> <Plug>VimspectorPause +nmap <F7> <Plug>VimspectorUpFrame +nmap <F8> <Plug>VimspectorDownFrame +nmap <F10> <Plug>VimspectorStepOver +nmap <F11> <Plug>VimspectorStepInto +nmap <F12> <Plug>VimspectorStepOut +nmap <leader>di <Plug>VimspectorBalloonEval +xmap <leader>di <Plug>VimspectorBalloonEval +nmap <leader>B <Plug>VimspectorBreakpoints +nmap <leader>D <Plug>VimspectorDisassemble + " vimtex let g:vimtex_view_general_viewer = 'okular' let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex' @@ -135,8 +164,8 @@ let g:pencil#map#suspend_af = 'K' let g:pencil#textwidth = 74 augroup pencil autocmd! - " autocmd FileType markdown,mkd call pencil#init() - autocmd FileType text call pencil#init() + autocmd FileType markdown,mkd call pencil#init() + " autocmd FileType text call pencil#init() augroup END " vim-workspace @@ -1,4 +1,4 @@ -export ZSH="/usr/share/oh-my-zsh" +export ZSH="/home/fkfd/.oh-my-zsh" ZSH_THEME="fkfd" @@ -15,46 +15,38 @@ source $ZSH/oh-my-zsh.sh export EDITOR=/usr/bin/nvim export BROWSER=/usr/bin/firefox export PROJECT_PATHS=(~/Projects/ ~/Projects/_cloned/ ~/Projects/_archive/) -export GOPROXY=https://proxy.golang.com.cn,direct -export PATH="$HOME/.local/bin:$PATH" +export PATH="$HOME/.local/bin:$HOME/.local/texlive/2024/bin/x86_64-linux:$PATH" # utilities mc () { - mkdir $1 && cd $1 + mkdir $1 && cd $1 } -share () { - src=$1 - if [[ $2 == '' ]]; then - dst=$(basename $1) - else - dst=$2 - fi - scp -r $src www@fkfd.me:www/static/$dst - echo "https://fkfd.me/static/$(urlencode $dst)" -} - -bright () { - if [[ $1 == 10 ]]; then - xrandr --output HDMI-A-0 --brightness 1 - return 0 - fi - xrandr --output HDMI-A-0 --brightness "0.$1" +# look at anything +k () { + if [[ -d $1 ]]; then + ls $1 + elif [[ -f $1 ]]; then + $EDITOR $1 + fi } -mnt-cryfs () { - cryfs "/data/Vaults/$1.enc" "$HOME/Vaults/$1" -} - -umnt-cryfs () { - cryfs-unmount "$HOME/Vaults/$1" +share () { + src=$1 + if [[ $2 == '' ]]; then + dst=$(basename $1) + else + dst=$2 + fi + scp -r $src www@fkfd.me:www/static/$dst + echo "https://fkfd.me/static/$(urlencode $dst)" } # make aliases accessible in sudo alias sudo="sudo " alias incognito="unset HISTFILE" -alias proxy="export SOCKS5_PROXY=localhost:1080; export HTTP_PROXY=http://localhost:1081; export HTTPS_PROXY=http://localhost:1081" +alias proxy="export SOCKS5_PROXY=127.0.0.1:1080; export HTTP_PROXY=http://127.0.0.1:1081; export HTTPS_PROXY=http://127.0.0.1:1081" # SSH alias mrf="mosh root@fkfd.me" @@ -66,27 +58,31 @@ alias gimme="sudo chown -R $USER ./ && sudo chmod -R +rw ./*" alias lemme="sudo chmod +x" # embedded -alias ard="arduino-cli" +alias espenv="source ~/p/esp/esp-idf/export.sh" +alias mmu="make && make upload" # python alias py="python" alias venv="source ./venv/bin/activate" # tools -alias ytdl="youtube-dl --proxy socks5://localhost:1080/" alias ytdlp="yt-dlp --proxy socks5://localhost:1080/" alias v="nvim" alias c="cat" alias ls="eza" -alias dormshare="sudo python -m http.server -b 192.168.8.2 80" -alias scanto="scanimage -d 'hpaio:/usb/HP_LaserJet_Professional_M1219nf_MFP?serial=000000000QJA9XJFPR1a' --source Flatbed --format=jpeg --mode=Gray --resolution=200 -x 210 -y 297 -o " - -alias tlmgr="/usr/share/texmf-dist/scripts/texlive/tlmgr.pl --usermode" +PRINTER="hpaio:/usb/HP_LaserJet_Professional_M1219nf_MFP?serial=000000000QJA9XJFPR1a" +alias scan="scanimage -d '$PRINTER' --source Flatbed --format=jpeg" +alias scanto="scanimage -d '$PRINTER' --source Flatbed --format=jpeg --mode=Gray --resolution=200 -x 210 -y 297 -o " alias catpic="montage -tile 1x -geometry +0+0" +alias prc="perf record -F 1000 --call-graph=dwarf -e cycles:u" +alias prp="perf report" + # fun -alias rickroll="vlc -f '/data/Videos/Rick Astley - Never Gonna Give You Up (Official Music Video).mkv'" +alias rickroll="vlc -f '~/Videos/Rick Astley - Never Gonna Give You Up (Official Music Video).mkv'" + +alias neofetch="if [[ $TERM == 'xterm-kitty' ]]; then neofetch --kitty ~/Pictures/branding/logos/arch.png --size 420px; else neofetch; fi" # disable beep in x11 set -B 0 @@ -99,52 +95,52 @@ alias accel="killall kglobalaccel5 && kglobalaccel5&" # TA work alias gccc="gcc -pedantic -std=c11 -Wall -Wextra -Werror -Wno-unused-result -Wconversion -Wvla" -# auto-generated by kdesrc-build initial setup: do not remove! -# Add the kdesrc-build directory to the path -# export PATH="$HOME/kde/src/kdesrc-build:$PATH" -# Create alias for running software built with kdesrc-build -kdesrc-run () -{ - source "$HOME/kde/build/$1/prefix.sh" && "$HOME/kde/usr/bin/$1" +# SJTU VPN +vpn () { + if ! systemctl is-active --quiet strongswan; then + sudo systemctl start strongswan + fi + if [[ $1 == "on" ]]; then + sudo swanctl -i --child vpn-student + elif [[ $1 == "off" ]]; then + sudo swanctl -t --ike vpn-student + else + echo "Usage: $0 [on|off]" + fi } - # kdesrc-build ################################################################# ## Add kdesrc-build to PATH -export PATH="$HOME/kde/src/kdesrc-build:$PATH" +export PATH="/home/fkfd/kde/src/kdesrc-build:$PATH" ## Autocomplete for kdesrc-run -function _comp-kdesrc-run -{ - local cur - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - - # Complete only the first argument - if [[ $COMP_CWORD != 1 ]]; then - return 0 - fi - - # Retrieve build modules through kdesrc-run - # If the exit status indicates failure, set the wordlist empty to avoid - # unrelated messages. - local modules - if ! modules=$(kdesrc-run --list-installed); - then - modules="" - fi - - # Return completions that match the current word - COMPREPLY=( $(compgen -W "${modules}" -- "$cur") ) - - return 0 +function _comp_kdesrc_run { + local cur + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + + # Complete only the first argument + if [[ $COMP_CWORD != 1 ]]; then + return 0 + fi + + # Retrieve build modules through kdesrc-run + # If the exit status indicates failure, set the wordlist empty to avoid + # unrelated messages. + local modules + if ! modules=$(kdesrc-run --list-installed); + then + modules="" + fi + + # Return completions that match the current word + COMPREPLY=( $(compgen -W "${modules}" -- "$cur") ) + + return 0 } ## Register autocomplete function -# complete -o nospace -F _comp-kdesrc-run kdesrc-run - +complete -o nospace -F _comp_kdesrc_run kdesrc-run ################################################################################ -# opam configuration -[[ ! -r /home/fkfd/.opam/opam-init/init.zsh ]] || source /home/fkfd/.opam/opam-init/init.zsh > /dev/null 2> /dev/null diff --git a/kitty/kitty.conf b/kitty/kitty.conf index e1aabf6..0e3f718 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -1,5 +1,5 @@ font_family Fira Code -font_size 12 +font_size 13 cursor_blink_interval 0 diff --git a/nvim/init.vim b/nvim/init.vim index cddc0aa..aa408a7 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -39,7 +39,6 @@ require('nvim-tree').setup({ }, view = { width = 30, - hide_root_folder = false, side = 'left', number = false, relativenumber = false, @@ -3,7 +3,5 @@ # cp ~/.gitconfig ./ cp ~/.vimrc ./ cp ~/.zshrc ./ -cp -r ~/.config/sway/ ./ -cp -r ~/.config/i3status/ ./ cp -r ~/.config/kitty/ ./ cp -r ~/.config/nvim/ ./ |