diff --git a/.config/clangd/config.yaml b/.config/clangd/config.yaml index 0fcee1e..56ef0d8 100644 --- a/.config/clangd/config.yaml +++ b/.config/clangd/config.yaml @@ -1,7 +1,7 @@ If: PathMatch: '.*\.(c|h)' CompileFlags: - Add: [ -std=c20 ] + Add: [ -std=c99 ] --- If: diff --git a/.config/ideavim/ideavimrc b/.config/ideavim/ideavimrc new file mode 100644 index 0000000..20c81dc --- /dev/null +++ b/.config/ideavim/ideavimrc @@ -0,0 +1,72 @@ +" --- Links to remember +" Plugins: https://jb.gg/ideavim-plugins +" IDE actions: https://jb.gg/abva4t +map +let mapleader = " " +set showmode +set showcmd +set scrolloff=0 + +" Line numbers +set number +set relativenumber + +" Navigation between lines +noremap j gj +noremap k gk + +" Search +set ignorecase +set smartcase +set incsearch +set hlsearch + +" Quickly play macros +nnoremap Q @q + +" Switch buffers +nnoremap :bp +nnoremap :bn + +" Switch panes +nnoremap h +nnoremap j +nnoremap k +nnoremap l + +" yank/paste with system clipboard +nnoremap y \"+y +nnoremap Y \"+Y +vnoremap y \"+y +vnoremap Y \"+Y +nnoremap p \"+p +nnoremap P \"+P +vnoremap p \"+p +vnoremap P \"+P + +" General mappings +map :nohls +map :q +map :NERDTreeToggle +nmap :m-2 +nmap :m+1 + +let g:NERDTreeMapQuit="" + +" IDE actions +nmap F (ReformatCode) +nmap i (ShowHoverInfo) +nmap of (RecentFiles) +nmap ? (FindInPath) +nmap sf (GotoFile) +nmap af (GotoFile) +nmap rn (RenameElement) +nmap ru (Run) + + +" Plugins +Plug 'machakann/vim-highlightedyank' +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-surround' +Plug 'preservim/nerdtree' +set peekaboo \ No newline at end of file diff --git a/.config/nvim/lua/config/mappings.lua b/.config/nvim/lua/config/mappings.lua index afab213..5fc4a31 100644 --- a/.config/nvim/lua/config/mappings.lua +++ b/.config/nvim/lua/config/mappings.lua @@ -23,6 +23,7 @@ map({ 'n', 'v' }, 'j', 'v:count == 0 ? "gj" : "j"', { expr = true, silent = true -- Copy and paste from clipboard map({ 'n', 'v' }, 'y', '"+y') +map({ 'n', 'v' }, 'Y', '"+Y') map({ 'n', 'v' }, 'p', '"+p') map({ 'n', 'v' }, 'P', '"+P') @@ -45,5 +46,6 @@ map('n', '', ':cp', { silent = true }) -- Remap to remove last word map('i', '', '') +-- Move lines quickly map('n', '', ':m-2', { silent = true }) map('n', '', ':m+1', { silent = true }) diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua index 21890e4..3311ae1 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/lsp/init.lua @@ -10,6 +10,7 @@ local servers = { pyright = {}, rust_analyzer = {}, ts_ls = {}, + ruby_lsp = {}, } vim.lsp.set_log_level("debug") diff --git a/.config/nvim/lua/lsp/jdtls.lua b/.config/nvim/lua/lsp/jdtls.lua new file mode 100644 index 0000000..a60981a --- /dev/null +++ b/.config/nvim/lua/lsp/jdtls.lua @@ -0,0 +1,3 @@ +return { + root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]), +} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua index c4b9cc3..d785b2e 100644 --- a/.config/nvim/lua/plugins/trouble.lua +++ b/.config/nvim/lua/plugins/trouble.lua @@ -7,5 +7,6 @@ return { { "ef", "Trouble diagnostics toggle filter.buf=0" }, { "cs", "Trouble symbols toggle focus=false" }, { "cl", "Trouble lsp toggle focus=false win.position=right" }, + { "el", "Trouble qflist toggle" }, }, } diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv index 662444c..b2b3d51 100644 --- a/.config/zsh/.zshenv +++ b/.config/zsh/.zshenv @@ -20,16 +20,26 @@ LC_PAPER="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_TIME="en_US.UTF-8" +# xdg dirs +XDG_DATA_HOME="${HOME}/.local/share" +XDG_CONFIG_HOME="${HOME}/.config" +XDG_STATE_HOME="${HOME}/.local/state" +XDG_CACHE_HOME="${HOME}/.cache" + # default configs ANDROID_HOME="${HOME}/.local/share/android" +BAT_THEME="TwoDark" EDITOR="/usr/bin/nvim" GNUPGHOME='~/.local/share/gnupg' GOPATH="${HOME}/.local/share/go" GPG_TTY="$(tty)" +JAVA_HOME="/usr/lib/jvm/java-23-openjdk" +LESS="--wheel-lines 3 --mouse" MANPAGER="sh -c 'col -bx | bat -l man -p'" MANROFFOPT="-c" MTR_OPTIONS="-t" SSH_ASKPASS="${HOME}/.local/bin/scripts/pinentry-askpass" SUDO_ASKPASS="${HOME}/.local/bin/scripts/dmenu-askpass" +GRADLE_USER_HOME="${HOME}/.local/share/gradle" set +a diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index c9d7631..acae179 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -54,7 +54,7 @@ alias ls="lsd --color=auto" alias l="ls -lh" alias la="ls -lah" alias ll="ls -lh" -alias lt="ls -lt" +alias lt="ls --color=always --icon=always -lt" # set bat as help pager alias -g -- --help='--help 2>&1 | bat --language=help --style=plain' @@ -91,12 +91,14 @@ alias wt="watch --color -d -cn 0.1 " alias cal="ncal -b" alias .e="source .env" alias vimu="vim -u /dev/null" +alias reswap="sudo swapoff /swapfile && sudo swapon /swapfile" # function aliases bl() { brightnessctl set "$1"% > /dev/null; } nosw() { alacritty --class 'noswallow' -e "$@"; }; compdef _command nosw t() { taskell "${1:-${HOME}/.taskell.md}"; } vims() { filepath="$(type "$1" | rev | cut -d ' ' -f 1 | rev)"; [ $? -eq 0 ] && vim "${filepath}"; }; compdef _command vims +tl() { tree -C "$@" | bat }; compdef _tree tl # compdef compdef -a '_git; _git-commit' gdc # todo @@ -104,25 +106,37 @@ compdef '_files -g "*.md"' md # git aliases gl() { git log --decorate "$@" | bat }; compdef '_git; _git-log' gl +gus() { git branch --set-upstream-to="${1:?}/${2:?}" "${2:?}"}; compdef '_git; _git-push' gus alias ga="git add" alias gb="git branch" alias gc="git commit" alias gca="git commit --amend --no-edit" alias gck="git checkout" alias gcl="git clone" +alias gcn="git clean" +alias gcp="git cherry-pick" alias gd="git diff" alias gds="gd --staged" alias gf="git fetch" alias gi="git init" +alias gla="gl --all" alias gm="git merge" alias gp="git push" +alias gpo="git push origin" alias gpu="git pull" alias gr="git restore" -alias grb="git rebase" +alias grj="git rebase" +alias grjc="git rebase --continue" +alias grjs="git rebase --cancel" +alias grm="git remote" alias grs="git restore --staged" alias grt="git reset" alias gs="git status" -alias gswc="git switch -c" +alias gsc="git switch -c" +alias gsh="git show" +alias gsp="git stash pop" +alias gsj="git stash" +alias gt="git tag" # docker aliases alias dc="docker compose" diff --git a/.gitconfig b/.gitconfig index 2ec6f6e..66a5929 100644 --- a/.gitconfig +++ b/.gitconfig @@ -1,5 +1,5 @@ [core] - pager = LESS="-Rz3" delta + pager = delta [user] email = me@wzray.com name = Arthur K. diff --git a/.local/bin/scripts/adbp b/.local/bin/scripts/adbp new file mode 100755 index 0000000..d9cc324 --- /dev/null +++ b/.local/bin/scripts/adbp @@ -0,0 +1,16 @@ +#!/bin/bash + +base_prefix="$(ip route | grep -o '10.16[[:digit:]]' | head -1)" + +if [ -n "$1" ]; then + phone_ip="$1" +elif [ -n "$base_prefix" ]; then + phone_ip="$base_prefix.8.3" +else + echo "Phone IP unknown!" + exit 1 +fi + +ssh -p 8022 u0_a343@"$phone_ip" 'su -c setprop service.adb.tcp.port 5555 && su -c stop adbd && su -c start adbd' +sleep 0.1 +adb connect "$phone_ip" diff --git a/.local/bin/scripts/gor b/.local/bin/scripts/gor new file mode 100755 index 0000000..9335992 --- /dev/null +++ b/.local/bin/scripts/gor @@ -0,0 +1,13 @@ +#!/bin/bash + +url="$(git remote get-url "${1:-origin}")" + +if [[ "$url" =~ ^https?:\/\/ ]]; then + echo "$url" +elif [[ "$url" =~ ^[a-zA-Z0-9_-]+@([a-zA-Z0-9_.-]+):(.*) ]]; then + url="https://${BASH_REMATCH[1]}/${BASH_REMATCH[2]}" + url="${url%.git}" + xdg-open "$url" +else + echo "TODO: $url" +fi