diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..104cfe2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# private scripts +./scripts/open diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml new file mode 100644 index 0000000..5408f4d --- /dev/null +++ b/alacritty/alacritty.yml @@ -0,0 +1,149 @@ +# Example: https://github.com/alacritty/alacritty/blob/master/alacritty.yml +# +# ---------------------- +# TERM env customization. +# ---------------------- +env: + # If this property is not set, alacritty will set it to xterm-256color. + # + # Note that some xterm terminfo databases don't declare support for italics. + # You can verify this by checking for the presence of `smso` and `sitm` in + # `infocmp xterm-256color`. + TERM: xterm-256color + +# ---------------------- +# Font configuration +# ---------------------- +font: + # Font Size + size: 11 + offset: + x: 0 + y: 1 + + normal: + family: JetBrains Mono + style: Regular + bold: + family: JetBrains Mono + style: Bold + italic: + family: JetBrains Mono + style: Italic + bold_italic: + family: JetBrains Mono + style: Bold Italic +# ---------------------- +# Window Padding +# ---------------------- +# +window: + padding: + x: 8 + y: 8 + opacity: 0.8 + +# ---------------------- +# Others +# ---------------------- + +# Display tabs using this many cells (changes require restart) +# tabspaces: 8 + +# When true, bold text is drawn using the bright variant of colors. +draw_bold_text_with_bright_colors: true + +# Disable bell +visual_bell: + animation: EaseOutExpo + duration: 0 + +hide_cursor_when_typing: true + + +# ---------------------- +# THEME: Gruvbox +# ---------------------- +# +# Source: https://github.com/alacritty/alacritty/wiki/Color-schemes + +colors: + primary: + # hard contrast background - '#1d2021' + background: &gruvbox_dark_bg '#282828' + # soft contrast background - '#32302f' + foreground: '#ebdbb2' + bright_foreground: '#fbf1c7' + dim_foreground: '#a89984' + cursor: + text: CellBackground + cursor: CellForeground + vi_mode_cursor: + text: CellBackground + cursor: CellForeground + # search: + # matches: + # foreground: '#000000' + # background: '#ffffff' + # focused_match: + # foreground: CellBackground + # background: CellForeground + # bar: + # background: '' + # foreground: '' + # line_indicator: + # foreground: None + # background: None + selection: + text: CellBackground + background: CellForeground + bright: + black: '#928374' + red: '#fb4934' + green: '#b8bb26' + yellow: '#fabd2f' + blue: '#83a598' + magenta: '#d3869b' + cyan: '#8ec07c' + white: '#ebdbb2' + normal: + black: *gruvbox_dark_bg + red: '#cc241d' + green: '#98971a' + yellow: '#d79921' + blue: '#458588' + magenta: '#b16286' + cyan: '#689d6a' + white: '#a89984' + dim: + black: '#32302f' + red: '#9d0006' + green: '#79740e' + yellow: '#b57614' + blue: '#076678' + magenta: '#8f3f71' + cyan: '#427b58' + white: '#928374' + # indexed_colors: [] + +# ---------------------- +# Keybindings +# ---------------------- +key_bindings: +- { key: T, mods: Control, command: { program: "alacritty" } } +# copy-paste +- { key: V, mods: Control, action: Paste } +- { key: C, mods: Control, action: Copy } +# control + shift + c -> interrupt +- { key: C, mods: Control|Shift, chars: "\x03" } + +- { key: Paste, action: Paste } +- { key: Copy, action: Copy } +- { key: L, mods: Control, action: ClearLogNotice } +- { key: L, mods: Control, chars: "\x0c" } +- { key: PageUp, mods: Shift, action: ScrollPageUp, mode: ~Alt } +- { key: PageDown, mods: Shift, action: ScrollPageDown, mode: ~Alt } +- { key: Home, mods: Shift, action: ScrollToTop, mode: ~Alt } +- { key: End, mods: Shift, action: ScrollToBottom, mode: ~Alt } + +- { key: F11, action: ToggleFullscreen } diff --git a/bash/aliases.sh b/bash/aliases.sh index b99d322..627d376 100644 --- a/bash/aliases.sh +++ b/bash/aliases.sh @@ -1,35 +1,31 @@ #!/usr/bin/env bash -# Vi -alias vimdiff="nvim -d" - -# ngrok aliases -alias ng-pg="ngrok tcp --region=eu --remote-addr=3.tcp.eu.ngrok.io:22146 5432" - -# Shortcuts -alias fonts="open ~/.local/share/fonts" -alias horario="open ~/zet/assets/horario.png" -alias kitty="nvim ~/.config/kitty/kitty.conf" - -alias lazydocker="TERM=xterm-kitty lazydocker" - # Utils alias ..="cd .." alias ls="ls --format=single-column --classify --color --group-directories-first" alias la="ls -la" alias sb="source ~/.bashrc" -if [[ $OSTYPE == "darwin"* ]]; then - alias ls="/usr/local/bin/gls --format=single-column --classify --color --group-directories-first" - alias la="/usr/local/bin/gls --format=single-column --classify --color --group-directories-first -la" - alias find="/usr/local/bin/gfind" -fi +alias hosts="sudoedit /etc/hosts" # you can't cd on the current shell process by "cd-ing" on a shell script # https://stackoverflow.com/questions/255414/why-cant-i-change-directories-using-cd-in-a-script jump() { - [ -h "$MARKPATH/$1" ] && cd "$(readlink "${MARKPATH}/${1}")" || exit 1 + [ -h "$MARKPATH/$1" ] && cd "$(readlink "${MARKPATH}/${1}")" || echo "mark not found :(" +} + +# cd into repos where you'll want to work on +repos() { + local GITHUB_PATH="$HOME/github.com" + + repo=$( + find "$GITHUB_PATH" -mindepth 2 -maxdepth 2 -type d | + fzf-tmux -p 40% --multi --prompt="Your repositories > " + ) + + cd "$repo" || return } -# Use nvr to avoid nesting nvim in Terminal buffers. -alias nvim="nvim-nvr" +# check ~/dot/scripts/nvimr +# +alias nvim="nvimr" diff --git a/bash/bash b/bash/bash index 9b64c2b..8adb255 120000 --- a/bash/bash +++ b/bash/bash @@ -1 +1 @@ -/Users/odas0r/dot/bash \ No newline at end of file +/home/odas0r/dot/bash \ No newline at end of file diff --git a/bash/editor.sh b/bash/editor.sh index c63762e..babd60e 100644 --- a/bash/editor.sh +++ b/bash/editor.sh @@ -10,21 +10,5 @@ fi export HRULEWIDTH=73 # Define the editor -if [[ ! -x "$(command -v nvim-nvr)" ]]; then - export VISUAL=/usr/bin/vim - export EDITOR="$VISUAL" -else - if [[ $OSTYPE == "darwin"* ]]; then - VISUAL=/usr/local/bin/nvim - EDITOR="$VISUAL" - - export VISUAL - export EDITOR - else - VISUAL=/usr/bin/nvim - EDITOR="$VISUAL" - - export VISUAL - export EDITOR - fi -fi +export VISUAL=/usr/bin/nvim +export EDITOR="$VISUAL" diff --git a/bash/fzf.sh b/bash/fzf.sh index 274c833..2298c33 100644 --- a/bash/fzf.sh +++ b/bash/fzf.sh @@ -8,19 +8,16 @@ FD_OPTIONS="--follow --exclude .git --exclude node_modules" FZF_BINDS="--bind 'f2:toggle-preview,ctrl-d:half-page-down,ctrl-u:half-page-up,ctrl-/:toggle-all'" FZF_STYLES="--height=90% --layout=reverse --preview-window right:60%" -FZF_TOKYO_THEME=' - --color=fg:#c0caf5,bg:#1a1b26,hl:#bb9af7 - --color=fg+:#c0caf5,bg+:#1a1b26,hl+:#7dcfff - --color=info:#7aa2f7,prompt:#7dcfff,pointer:#7dcfff - --color=marker:#9ece6a,spinner:#9ece6a,header:#9ece6a' +# --color=fg:#c0caf5,bg:#1a1b26,hl:#bb9af7 -export FZF_DEFAULT_OPTS="--no-mouse ${FZF_STYLES} ${FZF_BINDS} ${FZF_TOKYO_THEME}" +# FZF_TOKYO_THEME=' +# --color=fg:#c0caf5,hl:#bb9af7 +# --color=fg+:#c0caf5,bg+:#1a1b26,hl+:#7dcfff +# --color=info:#7aa2f7,prompt:#7dcfff,pointer:#7dcfff +# --color=marker:#9ece6a,spinner:#9ece6a,header:#9ece6a' + +export FZF_DEFAULT_OPTS="--no-mouse ${FZF_STYLES} ${FZF_BINDS}" export FZF_DEFAULT_COMMAND="fd --hidden --type f --type l ${FD_OPTIONS}" export FZF_CTRL_T_COMMAND="fd ${FD_OPTIONS}" export FZF_ALT_C_COMMAND="fd --type d ${FD_OPTIONS}" - -# To install fd -# sudo apt install fd-find -# ln -s $(which fdfind) ~/.local/bin/fd -# Make sure that $HOME/.local/bin is in your $PATH. diff --git a/bash/git-ssh.sh b/bash/git-ssh.sh new file mode 100644 index 0000000..b90f915 --- /dev/null +++ b/bash/git-ssh.sh @@ -0,0 +1,23 @@ +# Reference: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases + +env=~/.ssh/agent.env + +agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; } + +agent_start () { + (umask 077; ssh-agent >| "$env") + . "$env" >| /dev/null ; } + +agent_load_env + +# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2=agent not running +agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?) + +if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then + agent_start + ssh-add +elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then + ssh-add +fi + +unset env diff --git a/bash/path.sh b/bash/path.sh index 11f5a20..7019f46 100644 --- a/bash/path.sh +++ b/bash/path.sh @@ -12,9 +12,9 @@ export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm # Java -export JAVA_HOME=$(/usr/libexec/java_home -v 16) -export JUNIT_HOME="$HOME/java" -export CLASSPATH="$CLASSPATH:$JUNIT_HOME/junit-4.13.2.jar:$JUNIT_HOME/hamcrest-core-1.3.jar" +# export JAVA_HOME=$(/usr/libexec/java_home -v 17) +# export JUNIT_HOME="$HOME/java" +# export CLASSPATH="$CLASSPATH:$JUNIT_HOME/junit-4.13.2.jar:$JUNIT_HOME/hamcrest-core-1.3.jar" # Go export GOROOT="/usr/local/go" @@ -24,34 +24,22 @@ export GOPATH="$HOME/go" export CARGOPATH="/home/odas0r/.cargo" # Tools -export LUA_LSP="$TOOLS/lua-language-server/bin/Linux" +export LUA_LANGUAGE_SERVER="$TOOLS/lua-language-server/bin" -# WSL Shit -if [ -n "$WSL_DISTRO_NAME" ]; then - # Desktop Global Variable - export DESKTOP="/mnt/c/Users/guilh/Desktop" - - # Browser on WSL - export BROWSER="/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe" - - # Perl - export PERLPATH="/home/odas0r/perl5" - export PERL5LIB="/home/odas0r/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}" - export PERL_LOCAL_LIB_ROOT="/home/odas0r/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}" - export PERL_MB_OPT='--install_base "/home/odas0r/perl5"' - export PERL_MM_OPT="INSTALL_BASE=/home/odas0r/perl5" -fi - -# MacOS Shit -if [[ $OSTYPE == "darwin"* ]]; then - # CoreUtils for macos - # brew install coreutils - export GNU_UTILS="/usr/local/opt/coreutils/libexec/gnubin" - - # Tools - export LUA_LSP="$TOOLS/lua-language-server/bin/macOS" - -fi +# Perl +export PERLPATH="/hom/odas0r/perl5" +export PERL5LIB="/home/odas0r/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}" +export PERL_LOCAL_LIB_ROOT="/home/odas0r/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}" +export PERL_MB_OPT='--install_base "/home/odas0r/perl5"' +export PERL_MM_OPT="INSTALL_BASE=/home/odas0r/perl5" # Global Path -export PATH="$PATH:/bin:/usr/local/bin:$GOROOT/bin:$GOPATH/bin:$CARGOPATH/bin:$PERLPATH/bin:$LOCAL_BIN:$LOCAL_SCRIPTS:$LUA_LSP:$GNU_UTILS" +PATH="$PATH:/bin:/usr/local/bin:" +PATH+="$GOROOT/bin:$GOPATH/bin:" +PATH+="$CARGOPATH/bin:" +PATH+="$PERLPATH/bin:" +PATH+="$LOCAL_BIN:$LOCAL_SCRIPTS:" +PATH+="$LUA_LANGUAGE_SERVER:" +PATH+="$GNU_UTILS" + +export PATH diff --git a/bash/ps1.sh b/bash/ps1.sh index 90b8e21..6b4ba60 100644 --- a/bash/ps1.sh +++ b/bash/ps1.sh @@ -14,9 +14,9 @@ parse_git_branch() { # ret=$? # PS1=$(if [[ ${ret} = 0 ]]; then echo "👋 "; else echo "🐞 "; fi) -PS1="👋 " +PS1="=> " PS1+="$cyan/\W$reset" PS1+=" $magenta\$(parse_git_branch)$reset" PS1+="$ " -PS2="📝keep typing...> " +PS2="Keep typing...> " diff --git a/bashrc b/bashrc index 2d4d769..6e8b9a4 100644 --- a/bashrc +++ b/bashrc @@ -1,8 +1,3 @@ - -#### FIG ENV VARIABLES #### -# Please make sure this block is at the start of this file. -[ -s ~/.fig/shell/pre.sh ] && source ~/.fig/shell/pre.sh -#### END FIG ENV VARIABLES #### #!/usr/bin/env bash if [ -e /etc/bashrc ]; then @@ -18,7 +13,4 @@ for file in $HOME/.bash/autocomplete/*.sh; do . $file done -#### FIG ENV VARIABLES #### -# Please make sure this block is at the end of this file. -[ -s ~/.fig/fig.sh ] && source ~/.fig/fig.sh -#### END FIG ENV VARIABLES #### +alias luamake=/home/odas0r/tools/lua-language-server/3rd/luamake/luamake diff --git a/fonts/setup b/fonts/setup deleted file mode 100755 index cd90b0e..0000000 --- a/fonts/setup +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -set -e - -fontPath="$HOME/.local/share/fonts" - -# create the folder for fonts -mkdir -p "$fontPath" - -readarray -d '' fonts < <( - find "$HOME/dot/fonts" -mindepth 1 -type f -name '*.ttf' -) - -# install fonts -for font in $fonts; do - cp "$font" "$fontPath" -done - -# clear the cache and regenerate the fonts -fc-cache -f -v diff --git a/gh/config.darwin.yml b/gh/config.darwin.yml index 89c6df1..86d4bd5 100644 --- a/gh/config.darwin.yml +++ b/gh/config.darwin.yml @@ -1,5 +1,5 @@ git_protocol: ssh -editor: nvim +editor: nvimr prompt: enabled pager: less aliases: diff --git a/gh/config.yml b/gh/config.yml index 8545d42..8fcaa9a 100644 --- a/gh/config.yml +++ b/gh/config.yml @@ -4,4 +4,4 @@ prompt: enabled pager: less aliases: co: pr checkout -browser: "'/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe'" +browser: "open" diff --git a/git/gitconfig b/git/gitconfig index 03ecdfa..75e302c 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -6,13 +6,16 @@ default = current [core] editor = nvim + autocrlf = false [init] defaultBranch = main -[credential "https://github.com"] - helper = ! auth git-credential +[diff] + tool = nvimr +[difftool "nvimr"] + cmd = nvimr -d $LOCAL $REMOTE [merge] - tool = "nvim -d" - conflictstyle = diff3 -[mergetool] - prompt = false - keepBackup = false + tool = nvimr +[mergetool "nvimr"] + cmd = nvimr -d $LOCAL $BASE $REMOTE $MERGED -c 'wincmd J | wincmd =' + prompt = false + keepBackup = false diff --git a/git/setup b/git/setup index 11395a8..3249b40 100755 --- a/git/setup +++ b/git/setup @@ -5,24 +5,11 @@ set -euo pipefail declare DISTRO declare -r GIT_PATH="$HOME/dot/git" -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - DISTRO=$(awk -F= '/^NAME/{print ${2}}' /etc/os-release) - - if [[ ${DISTRO} = "Ubuntu"* ]]; then - if uname -a | grep -q '^Linux.*Microsoft'; then - # ubuntu via WSL Windows Subsystem for Linux - ln -sf "$GIT_PATH/gitconfig" "$HOME/.gitconfig" - else - # native ubuntu - ln -sf "$GIT_PATH/gitconfig" "$HOME/.gitconfig" - fi - elif [[ ${DISTRO} = "Debian"* ]]; then - # debian - ln -sf "$GIT_PATH/gitconfig" "$HOME/.gitconfig" - fi -elif [[ "$OSTYPE" == "darwin"* ]]; then +if [[ "$OSTYPE" == "darwin"* ]]; then # macOS OSX ln -sf "$GIT_PATH/gitconfig_darwin" "$HOME/.gitconfig" +else + ln -sf "$GIT_PATH/gitconfig" "$HOME/.gitconfig" fi printf "Git setup done! 🌟\n" diff --git a/install/bat b/install/bat new file mode 100755 index 0000000..af04903 --- /dev/null +++ b/install/bat @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -e + +VERSION=0.18.2 + +mkdir /tmp/bat-install && cd /tmp/bat-install + +curl -OL https:/github.com/sharkdp/bat/releases/download/v${VERSION}/bat_${VERSION}_amd64.deb + +sudo dpkg -i bat_0.18.2_amd64.deb diff --git a/install/fd b/install/fd new file mode 100755 index 0000000..8522be3 --- /dev/null +++ b/install/fd @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -e + +sudo apt install fd-find + +ln -s $(which fdfind) ~/.local/bin/fd diff --git a/install/fzf b/install/fzf index aeee69f..7b4e0d9 100755 --- a/install/fzf +++ b/install/fzf @@ -8,8 +8,6 @@ if [[ $OSTYPE == "darwin"* ]]; then $(brew --prefix)/opt/fzf/install else # install with github - mkdir -p /tmp/fzf - cd /tmp/fzf - git clone --depth 1 https://github.com/junegunn/fzf.git . - ~/.fzf/install + git clone --depth 1 https://github.com/junegunn/fzf.git $HOME/.fzf + $HOME/.fzf/install fi diff --git a/install/go-air b/install/go-air deleted file mode 100755 index 1d92b6d..0000000 --- a/install/go-air +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if [[ ! -x "$(command -v go)" ]]; then - echo "you need to instal golang!" - echo "check dot/install/golang" - exit 1 -fi - -curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(go env GOPATH)/bin diff --git a/install/go-migrate b/install/go-migrate new file mode 100755 index 0000000..14b81e1 --- /dev/null +++ b/install/go-migrate @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -e + +version="v4.15.1" +platform="linux" + +mkdir -p /tmp/migrate +cd /tmp/migrate + +# download the migrate binary +curl -L https://github.com/golang-migrate/migrate/releases/download/$version/migrate.$platform-amd64.tar.gz | tar xvz + +# install the migrate binary +sudo install migrate /usr/local/bin diff --git a/install/golang b/install/golang index f56bd64..0bb88ce 100755 --- a/install/golang +++ b/install/golang @@ -2,14 +2,16 @@ set -e -version=$(curl https://golang.org/VERSION?m=text) +version=$(curl https://go.dev/VERSION?m=text) +echo "VERSION: $version" + os="linux" arch="amd64" tarFile="${version}.${os}-${arch}.tar.gz" url="https://golang.org/dl/${tarFile}" # Download the latest golang -wget --quiet --continue --show-progress "${url}" +wget --continue --show-progress "${url}" printf "Downloaded Golang!\n" # Remove the old golang diff --git a/install/kitty b/install/kitty deleted file mode 100755 index 9f3537a..0000000 --- a/install/kitty +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -e - -curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin diff --git a/install/lua-language-server b/install/lua-language-server index ff5cea3..d772298 100755 --- a/install/lua-language-server +++ b/install/lua-language-server @@ -4,9 +4,13 @@ set -e # Docs: https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone) +if [[ -d "$HOME/tools/lua-language-server" ]]; then + rm -rf "$HOME/tools/lua-language-server" +fi + mkdir -p $HOME/tools/ cd $HOME/tools -git clone --depth=1 https://hub.fastgit.org/sumneko/lua-language-server +git clone --depth=1 https://github.com/sumneko/lua-language-server cd lua-language-server git submodule update --init --recursive diff --git a/install/neovim b/install/neovim index 2d11b3d..33491d7 100755 --- a/install/neovim +++ b/install/neovim @@ -17,3 +17,8 @@ mv nvim.appimage nvim chmod u+x ./nvim sudo mv ./nvim /usr/bin + +# install nvr + +sudo apt install python3-pip +pip3 install neovim-remote diff --git a/install/nvm b/install/nvm new file mode 100755 index 0000000..e8b8c3c --- /dev/null +++ b/install/nvm @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +VERSION=0.38.0 + +curl-o- "https://raw.githubusercontent.com/nvm-sh/nvm/v${VERSION}/install.sh" | bash + +nvm install node diff --git a/install/pgFormatter b/install/pgFormatter index 63d40ca..93b61da 100755 --- a/install/pgFormatter +++ b/install/pgFormatter @@ -2,24 +2,4 @@ set -e -# install Perl CGI module -sudo apt-get install libcgi-pm-perl -y - -# make tmp dir for installation -mkdir -p /tmp/pgFormatter -cd /tmp/pgFormatter - -owner="darold" -repo="pgFormatter" - -version="$(curl -s "https://api.github.com/repos/${owner}/${repo}/releases/latest" | jq -r '.tag_name')" -downloadFile="${version}.tar.gz" - -# download the latest release -wget "https://github.com/${owner}/${repo}/archive/refs/tags/${downloadFile}" - -# tar the file -tar -xzf "$downloadFile" -cd "pgFormatter-${version//v/}" -perl Makefile.PL -make && sudo make install +echo "type pg_format to see the installer command" diff --git a/install/rg b/install/rg new file mode 100755 index 0000000..a54516d --- /dev/null +++ b/install/rg @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +sudo apt-get install ripgrep diff --git a/install/stylua b/install/stylua new file mode 100755 index 0000000..7336ba2 --- /dev/null +++ b/install/stylua @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# create installer dir +mkdir -p /tmp/stylua-installer +cd /tmp/stylua-installer + +# download and install binary +VERSION=v0.13.0 +wget "https://github.com/JohnnyMorganz/StyLua/releases/download/$VERSION/stylua-linux.zip" +unzip stylua-linux.zip +sudo install stylua /usr/local/bin + +# cleanup +cd - && rm -rf /tmp/stylua-installer diff --git a/lazygit/config.yml b/lazygit/config.yml index 710e3d0..1409120 100644 --- a/lazygit/config.yml +++ b/lazygit/config.yml @@ -52,7 +52,7 @@ git: # one of always, never, when-maximised # this determines whether the git graph is rendered in the commits panel showGraph: 'when-maximised' - skipHookPrefix: WIP + skipHookPrefix: 'WIP' autoFetch: true branchLogCmd: 'git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --' allBranchesLogCmd: 'git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium' diff --git a/lazygit/setup b/lazygit/setup index 4eb45a5..124958a 100755 --- a/lazygit/setup +++ b/lazygit/setup @@ -5,24 +5,10 @@ if [[ ! -x "$(command -v lazygit)" ]]; then exit 1 fi -declare DISTRO -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - DISTRO=$(awk -F= '/^NAME/{print ${2}}' /etc/os-release) - - if [[ ${DISTRO} = "Ubuntu"* ]]; then - if uname -a | grep -q '^Linux.*Microsoft'; then - # ubuntu via WSL Windows Subsystem for Linux - echo "SETUP NOT IMPLEMENTED: lazygit" - else - # native ubuntu - echo "SETUP NOT IMPLEMENTED: lazygit" - fi - elif [[ ${DISTRO} = "Debian"* ]]; then - # debian - echo "SETUP NOT IMPLEMENTED: lazygit" - fi -elif [[ "$OSTYPE" == "darwin"* ]]; then +if [[ "$OSTYPE" == "darwin"* ]]; then # macOS OSX ln -sf "$HOME/dot/lazygit/config.yml" "$HOME/Library/Application Support/lazygit/config.yml" +else + ln -sf "$HOME/dot/lazygit/config.yml" "$HOME/.config/lazygit/config.yml" fi diff --git a/nvim/init.vim b/nvim/init.vim index 6e235d8..1b73f0b 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,4 +1,4 @@ -set tw=72 fo=cq wm=0 " no automatic wrapping, rewrapping will wrap to 72 +set tw=79 fo=cq wm=0 " no automatic wrapping, rewrapping will wrap to 79 set tabstop=2 set softtabstop=-1 @@ -9,18 +9,21 @@ set autoindent set autoread set autowriteall -set relativenumber +set number set ruler set showmode set showcmd +" experimentation for performance +set lazyredraw +set ttyfast + set numberwidth=2 set laststatus=2 set nofixendofline set foldmethod=manual set noshowmatch -match ErrorMsg '\s\+$' set shortmess=aoOtTI set hidden @@ -31,7 +34,7 @@ set updatetime=100 set hlsearch set incsearch set linebreak -set nowrap " wrap is for psychopaths +set nowrap " more risky, but cleaner set nobackup @@ -49,12 +52,6 @@ set foldmethod=manual set spelllang+=pt_pt set encoding=utf-8 -" on yank copy to clipboard -set clipboard+=unnamedplus - -" set the cursor fat on insert -set guicursor=i:block - " Return to last edit position when opening files au BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | @@ -84,7 +81,6 @@ set wildignore+=**/.supabase/* " augroup custom_settings au! - au FileType markdown setl conceallevel=2 spell norelativenumber tw=72 foldlevel=99 au FileType text setl conceallevel=2 spell norelativenumber tw=72 au BufRead *.env* setl ft=config augroup end @@ -109,11 +105,12 @@ nnoremap :nohl call plug#begin() -" treesitter shit -Plug 'folke/tokyonight.nvim', { 'branch': 'main' } +" theme +Plug 'ellisonleao/gruvbox.nvim' + +" treesitter Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} -Plug 'windwp/nvim-ts-autotag' -Plug 'nvim-treesitter/nvim-treesitter-refactor' +Plug 'nvim-treesitter/playground' " status line Plug 'nvim-lualine/lualine.nvim' @@ -123,14 +120,19 @@ Plug 'nvim-lua/lsp-status.nvim' Plug 'nvim-lua/plenary.nvim' Plug 'nvim-telescope/telescope.nvim' Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } -Plug 'numToStr/Comment.nvim' -Plug 'JoosepAlviste/nvim-ts-context-commentstring' +Plug 'windwp/nvim-ts-autotag' Plug 'ThePrimeagen/harpoon' -Plug 'caenrique/nvim-toggle-terminal' +Plug 's1n7ax/nvim-terminal' Plug 'mhinz/vim-signify' + +" comments, utilities for documentation +Plug 'numToStr/Comment.nvim' +Plug 'JoosepAlviste/nvim-ts-context-commentstring' + " newtr replacement because newtr sucks Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' } +Plug 'kristijanhusak/defx-git' " database " fork of https://github.com/tpope/vim-dadbod (I believe this is faster) @@ -140,7 +142,9 @@ Plug 'kristijanhusak/vim-dadbod-completion' " lsp, Completion Engine Plug 'neovim/nvim-lspconfig' Plug 'onsails/lspkind-nvim' -Plug 'jose-elias-alvarez/nvim-lsp-ts-utils' + +" yank over OSC +Plug 'ojroques/vim-oscyank', {'branch': 'main'} " completion Plug 'hrsh7th/nvim-cmp' @@ -149,20 +153,14 @@ Plug 'hrsh7th/cmp-nvim-lua' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-buffer' Plug 'quangnguyen30192/cmp-nvim-ultisnips' +Plug 'tzachar/cmp-tabnine', { 'do': './install.sh' } " formatter -" Plug 'lukas-reineke/format.nvim' Plug 'mhartington/formatter.nvim' " snippet Engine Plug 'sirver/UltiSnips' -" documentation -Plug 'heavenshell/vim-jsdoc', { - \ 'for': ['javascript', 'javascriptreact','typescript', 'typescriptreact'], - \ 'do': 'make install' -\} - " writing Plug 'preservim/vim-markdown' @@ -176,10 +174,6 @@ au FileType * hi SpellBad ctermbg=NONE ctermfg=Red cterm=underline au FileType * hi Error ctermbg=NONE ctermfg=Red au FileType * hi ErrorMsg ctermbg=NONE ctermfg=Red -highlight htmlTitle gui=bold guifg=#e0af68 ctermfg=Yellow -highlight htmlBold gui=bold guifg=#e0af68 ctermfg=214 -highlight htmlItalic gui=italic guifg=#bb9af7 ctermfg=214 - hi MatchParen guibg=lightgray " @@ -202,17 +196,8 @@ let g:db="postgres://postgres:postgres@localhost:5432/postgres" let g:vim_dadbod_completion_mark = 'SQL' let g:completion_matching_ignore_case = 1 -" -" Folding -" -let g:markdown_folding = 1 -" -augroup remember_folds - autocmd! - autocmd BufWinLeave *.md mkview - autocmd BufWinEnter *.md silent! loadview -augroup END - lua << EOF -require("plenary.reload").reload_module("odas0r", true) + -- import all configs + require("odas0r") + require("plenary.reload").reload_module("odas0r", true) EOF diff --git a/nvim/lua/odas0r/cmp.lua b/nvim/lua/odas0r/cmp.lua index 1e7e350..96fcf54 100644 --- a/nvim/lua/odas0r/cmp.lua +++ b/nvim/lua/odas0r/cmp.lua @@ -23,7 +23,21 @@ end local cmp = require("cmp") cmp.setup({ + completion = { + autocomplete = false, + }, + snippet = { + expand = function(args) + vim.fn["UltiSnips#Anon"](args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, mapping = { + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.confirm({ @@ -59,12 +73,8 @@ cmp.setup({ "s", }), }, - sources = cmp.config.sources({ - { name = "gh_issues" }, - { name = "nvim_lua" }, - { name = "nvim_lsp" }, { name = "path" }, { @@ -74,17 +84,9 @@ cmp.setup({ }, }, { name = "vim-dadbod-completion" }, - - -- { name = "cmp_tabnine" }, { name = "ultisnips" }, + { name = "cmp_tabnine" }, }), - - snippet = { - expand = function(args) - vim.fn["UltiSnips#Anon"](args.body) - end, - }, - formatting = { format = lspkind.cmp_format({ with_text = true, @@ -93,10 +95,24 @@ cmp.setup({ nvim_lsp = "[Lsp]", path = "[Path]", ["vim-dadbod-completion"] = "[Sql]", - gh_issues = "[Issue]", ultisnips = "[Snip]", buffer = "[Buffer]", + cmp_tabnine = "[TN]", }, }), }, }) + +local t = require("telescope.state") + +local callback = function() + -- if telescope is open don't execute `cmp` + if #t.get_existing_prompts() ~= 2 then + return require("odas0r.debounce").debounce() + end +end + +vim.api.nvim_create_autocmd({ "TextChangedI" }, { + pattern = { "*" }, + callback = callback, +}) diff --git a/nvim/lua/odas0r/cmp_gh.lua b/nvim/lua/odas0r/cmp_gh.lua deleted file mode 100644 index e63a424..0000000 --- a/nvim/lua/odas0r/cmp_gh.lua +++ /dev/null @@ -1,69 +0,0 @@ -local Job = require("plenary.job") - -local source = {} - -source.new = function() - local self = setmetatable({ cache = {} }, { __index = source }) - - return self -end - -source.complete = function(self, _, callback) - local bufnr = vim.api.nvim_get_current_buf() - - -- This just makes sure that we only hit the GH API once per session. - -- - -- You could remove this if you wanted, but this just makes it so we're - -- good programming citizens. - if not self.cache[bufnr] then - Job - :new({ - -- Uses `gh` executable to request the issues from the remote repository. - "gh", - "issue", - "list", - "--limit", - "1000", - "--json", - "title,number,body", - - on_exit = function(job) - local result = job:result() - local ok, parsed = pcall(vim.json.decode, table.concat(result, "")) - if not ok then - vim.notify("Failed to parse gh result") - return - end - - local items = {} - for _, gh_item in ipairs(parsed) do - gh_item.body = string.gsub(gh_item.body or "", "\r", "") - - table.insert(items, { - label = string.format("#%s", gh_item.number), - documentation = { - kind = "markdown", - value = string.format("# %s\n\n%s", gh_item.title, gh_item.body), - }, - }) - end - - callback({ items = items, isIncomplete = false }) - self.cache[bufnr] = items - end, - }) - :start() - else - callback({ items = self.cache[bufnr], isIncomplete = false }) - end -end - -source.get_trigger_characters = function() - return { "#" } -end - -source.is_available = function() - return vim.bo.filetype == "gitcommit" -end - -require("cmp").register_source("gh_issues", source.new()) diff --git a/nvim/lua/odas0r/debounce.lua b/nvim/lua/odas0r/debounce.lua new file mode 100644 index 0000000..b5172fc --- /dev/null +++ b/nvim/lua/odas0r/debounce.lua @@ -0,0 +1,19 @@ +local M = {} + +local cmp = require("cmp") +local timer = vim.loop.new_timer() + +local DEBOUNCE_DELAY = 250 + +function M.debounce() + timer:stop() + timer:start( + DEBOUNCE_DELAY, + 0, + vim.schedule_wrap(function() + cmp.complete({ reason = cmp.ContextReason.Auto }) + end) + ) +end + +return M diff --git a/nvim/lua/odas0r/efm.lua b/nvim/lua/odas0r/efm.lua index 54b7ec6..829d43a 100644 --- a/nvim/lua/odas0r/efm.lua +++ b/nvim/lua/odas0r/efm.lua @@ -1,3 +1,5 @@ +-- go install github.com/mattn/efm-langserver@latest + local on_attach = function(_, bufnr) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) @@ -17,15 +19,6 @@ local on_attach = function(_, bufnr) buf_set_keymap("n", "J", "lua vim.diagnostic.goto_next()", opts) end --- Eslint Setup with efm --- https://github.com/neovim/nvim-lspconfig/wiki/User-contributed-tips#eslint_d -local eslint = { - lintCommand = "eslint_d -f unix --stdin --stdin-filename ${INPUT}", - lintStdin = true, - lintFormats = { "%f:%l:%c: %m" }, - lintIgnoreExitCode = true, -} - local shellcheck = { lintCommand = "shellcheck -f gcc -x", lintSource = "shellcheck", @@ -46,18 +39,14 @@ require("lspconfig").efm.setup({ debounce_text_changes, }, init_options = { documentFormatting = false }, - filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "sh" }, + filetypes = { "sh" }, root_dir = function(fname) - return util.root_pattern("tsconfig.json")(fname) or util.root_pattern(".eslintrc.js", ".git")(fname) or "" + return util.root_pattern(".git")(fname) or "" end, settings = { - rootMarkers = { ".eslintrc.js", ".git/" }, + rootMarkers = { ".git/" }, languages = { sh = { shellcheck }, - javascript = { eslint }, - javascriptreact = { eslint }, - typescript = { eslint }, - typescriptreact = { eslint }, }, }, }) diff --git a/nvim/lua/odas0r/formatter.lua b/nvim/lua/odas0r/formatter.lua index 4875581..bc768d9 100644 --- a/nvim/lua/odas0r/formatter.lua +++ b/nvim/lua/odas0r/formatter.lua @@ -4,7 +4,12 @@ local formatter = require("formatter") local prettierConfig = function() return { exe = "prettier", - args = { "--stdin-filepath", vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), "--double-quote" }, + args = { + "--stdin-filepath", + vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), + "--double-quote", + "--prose-wrap always", + }, stdin = true, } end @@ -14,7 +19,12 @@ local formatterConfig = { function() return { exe = "stylua", - args = { "--indent-type", "Spaces", "--indent-width", 2 }, + args = { + "--indent-type", + "Spaces", + "--indent-width", + 2, + }, stdin = false, } end, @@ -83,15 +93,15 @@ local commonFT = { "scss", "html", "java", - "javascript", - "javascriptreact", - "typescript", - "typescriptreact", "markdown", "markdown.mdx", "yaml", "xml", "svg", + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", } for _, ft in ipairs(commonFT) do formatterConfig[ft] = { prettierConfig } diff --git a/nvim/lua/odas0r/init.lua b/nvim/lua/odas0r/init.lua index 1c800b7..6539173 100644 --- a/nvim/lua/odas0r/init.lua +++ b/nvim/lua/odas0r/init.lua @@ -2,10 +2,11 @@ require("odas0r.checkbox") require("odas0r.lsp") require("odas0r.efm") require("odas0r.cmp") -require("odas0r.status") +require("odas0r.lualine") require("odas0r.formatter") -require("odas0r.cmp_gh") require("odas0r.comment") +require("odas0r.debounce") require("odas0r.treesitter") require("odas0r.telescope") require("odas0r.harpoon") +require("odas0r.nvim-terminal") diff --git a/nvim/lua/odas0r/lsp.lua b/nvim/lua/odas0r/lsp.lua index 1ecba3e..029ac93 100644 --- a/nvim/lua/odas0r/lsp.lua +++ b/nvim/lua/odas0r/lsp.lua @@ -24,82 +24,26 @@ end local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) +local util = require("lspconfig").util + local debounce_text_changes = 150 -- npm install -g typescript typescript-language-server require("lspconfig").tsserver.setup({ - -- Needed for inlayHints. Merge this table with your settings or copy - -- it from the source if you want to add your own init_options. - init_options = require("nvim-lsp-ts-utils").init_options, - root_dir = require("lspconfig").util.root_pattern("package.json"), - on_attach = function(client, bufnr) - local ts_utils = require("nvim-lsp-ts-utils") - ts_utils.setup({ - debug = false, - disable_commands = false, - enable_import_on_completion = true, - - -- import all - import_all_timeout = 5000, -- ms - -- lower numbers = higher priority - import_all_priorities = { - same_file = 1, -- add to existing import statement - local_files = 2, -- git files or files with relative path markers - buffer_content = 3, -- loaded buffer content - buffers = 4, -- loaded buffer names - }, - import_all_scan_buffers = 100, - import_all_select_source = false, - -- if false will avoid organizing imports - always_organize_imports = true, - - -- filter diagnostics - filter_out_diagnostics_by_severity = {}, - filter_out_diagnostics_by_code = {}, - - -- inlay hints - auto_inlay_hints = true, - inlay_hints_highlight = "Comment", - inlay_hints_priority = 200, -- priority of the hint extmarks - inlay_hints_throttle = 150, -- throttle the inlay hint request - inlay_hints_format = { -- format options for individual hint kind - Type = {}, - Parameter = {}, - Enum = {}, - }, - - -- update imports on file move - update_imports_on_move = true, - require_confirmation_on_move = false, - watch_dir = nil, - }) - - -- required to fix code action ranges and filter diagnostics - ts_utils.setup_client(client) - - -- set default keymaps - lsp_keymaps(client, bufnr) - - -- set custom keymaps to typescript development - local opts = { noremap = true, silent = true } - vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", ":TSLspOrganize", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "f", ":TSLspRenameFile", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", ":TSLspImportAll", opts) - end, - + on_attach = lsp_keymaps, capabilities = capabilities, flags = { debounce_text_changes, }, }) -vim.g.markdown_fenced_languages = { - "ts=typescript", -} +-- npm i -g vscode-langservers-extracted +require("lspconfig").eslint.setup({}) require("lspconfig").denols.setup({ on_attach = lsp_keymaps, - root_dir = require("lspconfig").util.root_pattern("deno.json"), + capabilities = capabilities, + root_dir = util.root_pattern("deno.json"), init_options = { lint = true, }, @@ -107,19 +51,19 @@ require("lspconfig").denols.setup({ -- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#java_language_server -- https://github.com/georgewfraser/java-language-server -local home = os.getenv("HOME") -require("lspconfig").java_language_server.setup({ - on_attach = lsp_keymaps, - capabilities = capabilities, - flags = { - debounce_text_changes, - }, - cmd = { home .. "/tools/javalsp/dist/lang_server_mac.sh" }, - root_dir = function(fname) - return require("lspconfig").util.root_pattern("pom.xml", "gradle.build", ".classpath", ".git")(fname) - or vim.fn.getcwd() - end, -}) +-- local home = os.getenv("HOME") +-- require("lspconfig").java_language_server.setup({ +-- on_attach = lsp_keymaps, +-- capabilities = capabilities, +-- flags = { +-- debounce_text_changes, +-- }, +-- cmd = { home .. "/tools/javalsp/dist/lang_server_mac.sh" }, +-- root_dir = function(fname) +-- return require("lspconfig").util.root_pattern("pom.xml", "gradle.build", ".classpath", ".git")(fname) +-- or vim.fn.getcwd() +-- end, +-- }) -- require("lspconfig").jdtls.setup({ -- on_attach = on_attach, @@ -145,6 +89,11 @@ require("lspconfig").yamlls.setup({ flags = { debounce_text_changes, }, + settings = { + schemas = { + ["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*", + }, + }, }) -- npm i -g bash-language-server @@ -157,13 +106,13 @@ require("lspconfig").bashls.setup({ }) -- npm install -g @tailwindcss/language-server -require("lspconfig").tailwindcss.setup({ - on_attach = lsp_keymaps, - capabilities = capabilities, - flags = { - debounce_text_changes, - }, -}) +-- require("lspconfig").tailwindcss.setup({ +-- on_attach = lsp_keymaps, +-- capabilities = capabilities, +-- flags = { +-- debounce_text_changes, +-- }, +-- }) -- pip install 'python-lsp-server[all]' require("lspconfig").pylsp.setup({ @@ -174,11 +123,12 @@ require("lspconfig").pylsp.setup({ }, }) --- ./dot/installs/golang +-- go install golang.org/x/tools/gopls@latest +-- go install golang.org/x/tools/cmd/goimports@latest require("lspconfig").gopls.setup({ cmd = { "gopls", "serve" }, filetypes = { "go", "gomod" }, - root_dir = require("lspconfig").util.root_pattern("go.work", "go.mod", ".git"), + root_dir = util.root_pattern("go.work", "go.mod", ".git"), settings = { gopls = { analyses = { @@ -219,7 +169,7 @@ require("lspconfig").sumneko_lua.setup({ flags = { debounce_text_changes, }, - cmd = { sumneko_binary_path, "-E", sumneko_root_path .. "/main.lua" }, + cmd = { sumneko_binary_path, "-E", sumneko_root_path .. "/lua-language-server/main.lua" }, settings = { Lua = { runtime = { diff --git a/nvim/lua/odas0r/status.lua b/nvim/lua/odas0r/lualine.lua similarity index 89% rename from nvim/lua/odas0r/status.lua rename to nvim/lua/odas0r/lualine.lua index 9a72a50..af38c7d 100644 --- a/nvim/lua/odas0r/status.lua +++ b/nvim/lua/odas0r/lualine.lua @@ -11,7 +11,7 @@ lsp_status.config({ }) require("lualine").setup({ - options = { theme = "tokyonight", section_separators = "", component_separators = "" }, + options = { theme = "gruvbox_dark", section_separators = "", component_separators = "" }, section_separators = {}, sections = { lualine_a = { "mode" }, diff --git a/nvim/lua/odas0r/nvim-terminal.lua b/nvim/lua/odas0r/nvim-terminal.lua new file mode 100644 index 0000000..620136f --- /dev/null +++ b/nvim/lua/odas0r/nvim-terminal.lua @@ -0,0 +1,11 @@ +local Terminal = require('nvim-terminal.terminal') +local Window = require('nvim-terminal.window') + +local window = Window:new({ + position = 'botright', + split = 'sp', + width = 100, + height = 35 +}) + +terminal = Terminal:new(window) diff --git a/nvim/lua/odas0r/telescope.lua b/nvim/lua/odas0r/telescope.lua index 61a97a6..b2e7284 100644 --- a/nvim/lua/odas0r/telescope.lua +++ b/nvim/lua/odas0r/telescope.lua @@ -14,11 +14,15 @@ require("telescope").setup({ sorting_strategy = "ascending", mappings = { i = { - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - - [""] = actions.toggle_all, + [""] = actions.toggle_all, + [""] = actions.send_selected_to_qflist + actions.open_qflist }, + n = { + [""] = actions.toggle_all, + ["l"] = actions.toggle_selection, + ["h"] = actions.remove_selection, + [""] = actions.send_selected_to_qflist + actions.open_qflist + } }, prompt_prefix = " > ", selection_caret = " ", @@ -33,7 +37,8 @@ require("telescope").setup({ }, extensions = { fzf = { - case_mode = "smart_case", + fuzzy = true, + -- case_mode = "smart_case", }, }, }) @@ -48,18 +53,98 @@ M.search_dotfiles = function() }) end -M.search_zet_fleet = function() - require("telescope.builtin").live_grep({ - prompt_title = "Searching Zettelkasten...", - cwd = "~/github.com/zet/fleet", +M.search_zet = function(tags) + if #tags == 0 then + require("telescope.builtin").live_grep({ + prompt_title = "[All]", + cwd = "~/github.com/odas0r/zet", + hidden = true, + }) + end + + local search = "" + + for index, tag in ipairs(tags) do + if index < #tags then + search = search .. tag .. "|" + else + search = search .. tag + end + end + + -- create the regex expression + search = "(" .. search .. ")" + + -- Search on zettel + require("telescope.builtin").grep_string({ + search = search, + prompt_title = "[All]: " .. search, + cwd = "~/github.com/odas0r/zet", + use_regex = true, + hidden = true, + }) +end + +M.search_zet_fleet = function(tags) + if #tags == 0 then + require("telescope.builtin").live_grep({ + prompt_title = "[Fleet]", + cwd = "~/github.com/odas0r/zet/fleet", + hidden = true, + }) + end + + local search = "" + + for index, tag in ipairs(tags) do + if index < #tags then + search = search .. tag .. "|" + else + search = search .. tag + end + end + + -- create the regex expression + search = "(" .. search .. ")" + + -- Search on zettel + require("telescope.builtin").grep_string({ + search = search, + prompt_title = "[Fleet]: " .. search, + cwd = "~/github.com/odas0r/zet/fleet", + use_regex = true, hidden = true, }) end -M.search_zet_permanent = function() - require("telescope.builtin").live_grep({ - prompt_title = "Searching Zettelkasten...", - cwd = "~/github.com/zet/permanent", +M.search_zet_permanent = function(tags) + if #tags == 0 then + require("telescope.builtin").live_grep({ + prompt_title = "[Permanent]", + cwd = "~/github.com/odas0r/zet/permanent", + hidden = true, + }) + end + + local search = "" + + for index, tag in ipairs(tags) do + if index < #tags then + search = search .. tag .. "|" + else + search = search .. tag + end + end + + -- create the regex expression + search = "(" .. search .. ")" + + -- Search on zettel + require("telescope.builtin").grep_string({ + search = search, + prompt_title = "[Permanent]: " .. search, + cwd = "~/github.com/odas0r/zet/permanent", + use_regex = true, hidden = true, }) end diff --git a/nvim/lua/odas0r/treesitter.lua b/nvim/lua/odas0r/treesitter.lua index d5eaca2..78e56eb 100644 --- a/nvim/lua/odas0r/treesitter.lua +++ b/nvim/lua/odas0r/treesitter.lua @@ -1,18 +1,10 @@ require("nvim-treesitter.configs").setup({ - ensure_installed = "maintained", + ensure_installed = "all", indent = { enable = true }, highlight = { enable = true, - - disable = { "vim", "html" }, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = { "markdown" }, }, -- Plugins diff --git a/nvim/plugin/checkbox.vim b/nvim/plugin/checkbox.vim index 060d46d..d9c4d23 100644 --- a/nvim/plugin/checkbox.vim +++ b/nvim/plugin/checkbox.vim @@ -1,4 +1,2 @@ -lua require("odas0r") - nnoremap x :lua require("odas0r/checkbox").toggle() vnoremap x :lua require("odas0r/checkbox").toggle_many() diff --git a/nvim/plugin/clipboard.vim b/nvim/plugin/clipboard.vim new file mode 100644 index 0000000..6add21d --- /dev/null +++ b/nvim/plugin/clipboard.vim @@ -0,0 +1,21 @@ +" Docs: https://github.com/ojroques/vim-oscyank#copying-from-a-register + +" > For the impatient one, copy this line to your config. Content will be +" > copied to clipboard after any yank operation: + +" on yank copy to clipboard +set clipboard+=unnamedplus + +let g:oscyank_max_length = 1000000 + +let g:oscyank_term = 'default' + +let g:clipboard = { + \ 'name': 'osc53', + \ 'copy': { + \ '+': {lines, regtype -> OSCYankString(join(lines, "\n"))}, + \ }, + \ 'paste': { + \ '+': {-> [split(getreg(''), '\n'), getregtype('')]} + \ }, + \ } diff --git a/nvim/plugin/colorscheme.vim b/nvim/plugin/colorscheme.vim deleted file mode 100644 index 2f37d3e..0000000 --- a/nvim/plugin/colorscheme.vim +++ /dev/null @@ -1,12 +0,0 @@ -" Documentation: tokyonight -" -" Press "K" on when cursor on top of defx - -let g:tokyonight_style = "night" -let g:tokyonight_italic_functions = 1 -colorscheme tokyonight - - -" change themes -nnoremap 8 :let g:tokyonight_style = "night":colorscheme default:colorscheme tokyonight -nnoremap 9 :let g:tokyonight_style = "day":colorscheme default:colorscheme tokyonight diff --git a/nvim/plugin/defx.vim b/nvim/plugin/defx.vim index 431805f..8db6497 100644 --- a/nvim/plugin/defx.vim +++ b/nvim/plugin/defx.vim @@ -2,10 +2,13 @@ " " Press "K" on when cursor on top of defx -lua require("odas0r") -nnoremap \ :Defx -search=`expand('%:p')` `expand('%:p:h')` +nnoremap \ Defx -columns=mark:indent:icon:indent:filename:space:git -search=`expand('%:p')` `expand('%:p:h')` + function! DefxMappings() + " local options + setlocal cursorline + " open a file with left mouse click nnoremap <2-LeftMouse> defx#do_action('open_tree', 'toggle') nnoremap c @@ -43,7 +46,7 @@ function! DefxMappings() \ defx#do_action('cd', ['..']) nnoremap q \ defx#do_action('quit') - nnoremap + nnoremap \ defx#do_action('toggle_select') . 'j' nnoremap \ defx#do_action('toggle_select_all') @@ -71,3 +74,13 @@ function! s:browse_check(path) abort augroup END execute 'Defx' a:path endfunction + +" Defx *git* indicators +call defx#custom#column('git', 'raw_mode', 1) + +call defx#custom#column('git', 'column_length', 1) +call defx#custom#column('git', 'max_indicator_width', 0) + +" I want to update defx status automatically when changing file. +autocmd BufWritePost * call defx#redraw() + diff --git a/nvim/plugin/formatter.vim b/nvim/plugin/formatter.vim index 6670462..1723c2a 100644 --- a/nvim/plugin/formatter.vim +++ b/nvim/plugin/formatter.vim @@ -4,5 +4,11 @@ autocmd FocusGained * checktime augroup FormatAutogroup autocmd! + + " Formatter nnoremap gp FormatWrite + + " ESLint + autocmd BufWritePre *.tsx,*.ts,*.jsx,*.js EslintFixAll + augroup END diff --git a/nvim/plugin/gruvbox.vim b/nvim/plugin/gruvbox.vim new file mode 100644 index 0000000..43247e1 --- /dev/null +++ b/nvim/plugin/gruvbox.vim @@ -0,0 +1,10 @@ +set background=dark " or light if you want light mode +colorscheme gruvbox + +let g:gruvbox_bold = 1 +let g:gruvbox_italic = 1 +let g:gruvbox_underline = 1 +let g:gruvbox_undercurl = 1 + +" soft, medium, hard +let g:gruvbox_contrast_dark = "medium" diff --git a/nvim/plugin/harpoon.vim b/nvim/plugin/harpoon.vim index b993e9e..dc20c89 100644 --- a/nvim/plugin/harpoon.vim +++ b/nvim/plugin/harpoon.vim @@ -1,7 +1,5 @@ " Documentation: https://github.com/ThePrimeagen/harpoon -lua require("odas0r") - nnoremap a :lua require("harpoon.mark").add_file() nnoremap :lua require("harpoon.ui").toggle_quick_menu() diff --git a/nvim/plugin/indentation.vim b/nvim/plugin/indentation.vim new file mode 100644 index 0000000..1bdca77 --- /dev/null +++ b/nvim/plugin/indentation.vim @@ -0,0 +1,11 @@ +" Indentation fixes, settings + +function! IndentWithI() + if len(getline('.')) == 0 + return "\"_cc" + else + return "i" + endif +endfunction + +nnoremap i IndentWithI() diff --git a/nvim/plugin/markdown.vim b/nvim/plugin/markdown.vim index d86b5e6..a035392 100644 --- a/nvim/plugin/markdown.vim +++ b/nvim/plugin/markdown.vim @@ -2,11 +2,47 @@ " " Press "K" on when cursor on top of vim-markdown -set conceallevel=2 +let g:netrw_browsex_viewer = "open" let g:vim_markdown_folding_disabled = 1 let g:vim_markdown_conceal_code_blocks = 1 let g:vim_markdown_new_list_item_indent = 2 + let g:vim_markdown_no_extensions_in_markdown = 0 + let g:vim_markdown_autowrite = 1 let g:vim_markdown_edit_url_in = 'current' + +" Experiments +let g:vim_markdown_conceal = 2 + +" Treesitter uses a differnt highlight group regarding markdown, etc: +" +" TSTitle, TSLiteral, TSEmphasis, TSStrong, TSURI, TSTextReference, +" TSPunctSpecial and TSStringEscape. +" +highlight TSStrong guifg=#fabd2f gui=bold +highlight TSEmphasis guifg=#d3869b gui=italic + +" +" Markdown Custom Settings +" +augroup markdown_custom_settings + autocmd! + autocmd FileType markdown setlocal + \ conceallevel=2 + \ spell nonumber norelativenumber + \ tw=80 foldlevel=99 + \ wrap linebreak +augroup END + +" +" Remmember Folding +" +let g:markdown_folding = 1 + +augroup remember_folds + autocmd! + autocmd BufWinLeave *.md mkview + autocmd BufWinEnter *.md silent! loadview +augroup END diff --git a/nvim/plugin/playground.vim b/nvim/plugin/playground.vim index 35e38e6..81d652a 100644 --- a/nvim/plugin/playground.vim +++ b/nvim/plugin/playground.vim @@ -1,10 +1,10 @@ augroup Playground au! " bash - au FileType sh xnoremap r yPgv:!bash - au FileType sh nnoremap rp vapyPgv:!bash + au FileType sh xnoremap r yPgv:!bash + au FileType sh nnoremap rp vapyPgv:!bash " sql - au FileType sql xnoremap r :DB - au FileType sql nnoremap rp vap:DB + au FileType sql xnoremap r :DB + au FileType sql nnoremap rp vap:DB augroup end diff --git a/nvim/plugin/telescope.vim b/nvim/plugin/telescope.vim index ba28641..fe3b989 100644 --- a/nvim/plugin/telescope.vim +++ b/nvim/plugin/telescope.vim @@ -2,10 +2,10 @@ " " Press "K" on when cursor on top of telescope -lua require("odas0r") - nnoremap Telescope git_files +nnoremap Telescope grep_string nnoremap Telescope live_grep +nnoremap Telescope man_pages nnoremap b Telescope buffers " custom telescope built-ins diff --git a/nvim/plugin/terminal.vim b/nvim/plugin/terminal.vim index 4210c0d..673d8fb 100644 --- a/nvim/plugin/terminal.vim +++ b/nvim/plugin/terminal.vim @@ -2,8 +2,8 @@ " " Press "K" on when cursor on top of telescope -nnoremap t :ToggleTerminal -tnoremap t :ToggleTerminal +nnoremap t lua terminal:toggle() +tnoremap t lua terminal:toggle() tnoremap (&filetype == "fzf") ? "" : "" tnoremap @@ -11,7 +11,10 @@ tnoremap augroup terminal_settings autocmd! - autocmd TermOpen * startinsert + autocmd BufReadPre * execute ":lua terminal:close()" + autocmd BufWinEnter * execute ":lua terminal:close()" + + autocmd TermOpen * startinsert | setlocal nonumber norelativenumber autocmd TermLeave * stopinsert " Ignore various filetypes as those will close terminal automatically diff --git a/nvim/plugin/transparent.vim b/nvim/plugin/transparent.vim new file mode 100644 index 0000000..acb2298 --- /dev/null +++ b/nvim/plugin/transparent.vim @@ -0,0 +1,14 @@ +augroup Transparent + au! + + au VimEnter * highlight Normal guibg=NONE ctermbg=NONE + au VimEnter * highlight CursorColumn cterm=NONE ctermbg=NONE ctermfg=NONE + au VimEnter * highlight CursorLine cterm=NONE ctermbg=NONE ctermfg=NONE + au VimEnter * highlight CursorLineNr cterm=NONE ctermbg=NONE ctermfg=NONE + au VimEnter * highlight SignColumn ctermbg=NONE guibg=NONE + + " Signify Transparent Color + au VimEnter * highlight SignifySignAdd ctermfg=green guifg=#00ff00 guibg=NONE ctermbg=NONE cterm=NONE gui=NONE + au VimEnter * highlight SignifySignDelete ctermfg=red guifg=#ff0000 guibg=NONE ctermbg=NONE cterm=NONE gui=NONE + au VimEnter * highlight SignifySignChange ctermfg=yellow guifg=#ffff00 guibg=NONE ctermbg=NONE cterm=NONE gui=NONE +augroup end diff --git a/nvim/plugin/zet.vim b/nvim/plugin/zet.vim index 14e2149..85d300c 100644 --- a/nvim/plugin/zet.vim +++ b/nvim/plugin/zet.vim @@ -1,11 +1,11 @@ -nnoremap zf lua require("odas0r.telescope").search_zet_fleet() -nnoremap zp lua require("odas0r.telescope").search_zet_permanent() +nnoremap zq lua require("odas0r.telescope").search_zet({}) +nnoremap zf !zet fix % " add files to the history of zettelkasten augroup zettelkasten_history au! + " add to history - au BufWinEnter ~/github.com/zet-cmd/.zet/**/*.md silent !zet history.insert % - au BufWinEnter ~/github.com/zet/fleet/*.md silent !zet history.insert % - au BufWinEnter ~/github.com/zet/permanent/*.md silent !zet history.insert % + au BufWinEnter ~/github.com/odas0r/zet/fleet/*.md silent !zet history.insert % + au BufWinEnter ~/github.com/odas0r/zet/permanent/*.md silent !zet history.insert % augroup end diff --git a/nvim/setup b/nvim/setup index 491d2b5..2b17d1c 100755 --- a/nvim/setup +++ b/nvim/setup @@ -20,9 +20,9 @@ ln -sf "$HOME/dot/nvim/spell" "$NVIM/spell" mkdir -p "$HOME/snippets" ln -sf "$HOME/dot/nvim/ultisnips" "$HOME/snippets/ultisnips" -# setup lua -mkdir -p "$NVIM/lua" -ln -sf "$HOME/dot/nvim/lua" "$NVIM/lua" +# setup lua and plugins +ln -sf "$HOME/dot/nvim/lua" "$NVIM" +ln -sf "$HOME/dot/nvim/plugin" "$NVIM" # installing plug if [[ ! -f "$NVIM/autoload/plug.vim" ]]; then @@ -32,4 +32,4 @@ fi printf "To install all vim plugins :PlugInstall!\n" -echo "Vim setup done! 🌟" +echo "Neovim setup done! 🌟" diff --git a/nvim/spell/en.utf-8.add b/nvim/spell/en.utf-8.add index b9f9d78..4fcdbee 100644 --- a/nvim/spell/en.utf-8.add +++ b/nvim/spell/en.utf-8.add @@ -1,6 +1,6 @@ STDOUT zettels -zettelkasten +#ettelkasten reddit fzf Backend @@ -306,6 +306,7 @@ Canelhas Redbul Pracetamol LGTM +nvimr nvr searchbar afetar @@ -401,3 +402,44 @@ data-layer vendor-lockin editor-specific RLS +webdev +vite +ssr +alpinejs +twitch.tv +vm +livestreaming +starter-kit +ens33 +mobiledata +postgresql +PostgreSQL +cli +Alacritty +alacritty +xstate +sign-up +cssnano +Esc +F6 +F5 +webapp +#ash +mvp +full-text-search +fuzzy-finding +#ettelkasten +zettelkasten +tcp +ufw +testing-ui +gx +Kepubify +Freewind.scss +testing-apis +tdd +delete-later +Svelte-Kit +integration-testing +unit-testing +API's diff --git a/nvim/spell/en.utf-8.add.spl b/nvim/spell/en.utf-8.add.spl index 3b5903f..f57e188 100644 Binary files a/nvim/spell/en.utf-8.add.spl and b/nvim/spell/en.utf-8.add.spl differ diff --git a/nvim/spell/spell b/nvim/spell/spell index 3742135..b5dce9f 120000 --- a/nvim/spell/spell +++ b/nvim/spell/spell @@ -1 +1 @@ -/Users/odas0r/dot/nvim/spell \ No newline at end of file +/home/odas0r/dot/nvim/spell \ No newline at end of file diff --git a/nvim/ultisnips/css.snippets b/nvim/ultisnips/css.snippets index 606a0fa..a3815e4 100644 --- a/nvim/ultisnips/css.snippets +++ b/nvim/ultisnips/css.snippets @@ -1,38 +1,9 @@ priority -50 -snippet rgb "color rgb" -rgb(${1:255}, ${2:255}, ${3:255})$0 -endsnippet - -snippet rgba "color rgba" -rgba(${1:255}, ${2:255}, ${3:255}, ${4:0.5})$0 -endsnippet - -snippet hsl "color hsl" -hsl(${1:360}, ${2:100}%, ${3:100}%)$0 -endsnippet - -snippet hsla "color hsla" -hsla(${1:360}, ${2:100}%, ${3:100}%, ${4:0.5})$0 -endsnippet - -snippet scrollbar "scrollbar" -scrollbar-base-color: ${1:#CCCCCC};${2: -scrollbar-arrow-color: ${3:#000000}; -scrollbar-track-color: ${4:#999999}; -scrollbar-3dlight-color: ${5:#EEEEEE}; -scrollbar-highlight-color: ${6:#FFFFFF}; -scrollbar-face-color: ${7:#CCCCCC}; -scrollbar-shadow-color: ${9:#999999}; -scrollbar-darkshadow-color: ${8:#666666};} -endsnippet - -snippet selection "selection" -$1::-moz-selection, -$1::selection { - color: ${2:inherit}; - background: ${3:inherit}; -} +snippet /* "comment block" b +/* + * $0 + */ endsnippet # vim:ft=snippets: diff --git a/nvim/ultisnips/go.snippets b/nvim/ultisnips/go.snippets index 8deb103..f32094a 100644 --- a/nvim/ultisnips/go.snippets +++ b/nvim/ultisnips/go.snippets @@ -1,119 +1,578 @@ +# SOURCE: https://github.com/fatih/vim-go/blob/master/gosnippets/UltiSnips/go.snippets +# +# ========================================== # Snippets for Go +# ========================================== -priority -50 +priority -0 -snippet /** "Description" A -/** - * $0 - */ +# shorthand variable declaration +snippet : "v := value" +${1} := ${0} endsnippet -# when to abbriviate and when not? -# b doesn't work here, because it ignores whitespace -# optional local name? -snippet /^import/ "Import declaration" r -import ( - "${1:package}" -) +# anonymous function +snippet anon "fn := func() { ... }" +${1:fn} := func() { + ${2:${VISUAL}} +} +${0} endsnippet -snippet /^package/ "Package declaration" r -// Package $1 provides ... -package ${1:main} +# append +snippet ap "append(slice, value)" +append(${1:slice}, ${0:value}) +endsnippet + +# append assignment +snippet ap= "a = append(a, value)" +${1:slice} = append($1, ${0:value}) endsnippet -# Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle -snippet /^cons/ "Constants declaration" r +# break +snippet br "break" +break +endsnippet + +# channel +snippet ch "chan Type" +chan ${0:int} +endsnippet + + +# case +snippet case "case ...:" +case ${1:value}: + ${0:${VISUAL}} +endsnippet + +# constant +snippet con "const XXX Type = ..." +const ${1:NAME} ${2:Type} = ${0:0} +endsnippet + +# constants +snippet cons "const ( ... )" +const ( + + ${1:NAME} ${2:Type} = ${3:value} + ${0} +) +endsnippet + +# constants with iota +snippet iota "const ( ... = iota )" const ( - ${1:constant}${2/(.+)/ /}${2:type} = ${0:value} + ${1:NAME} ${2:Type} = iota + ${0} ) endsnippet -snippet /^con/ "Constant declaration" r -const ${1:name}${2/(.+)/ /}${2:type} = ${0:value} +# continue +snippet cn "continue" +continue endsnippet -snippet iota "Iota constant generator" b -const ( - ${1:constant}${2/(.+)/ /}${2:type} = iota +# default case +snippet default "default: ..." +default: + ${0:${VISUAL}} +endsnippet + +# defer + +snippet df "defer someFunction()" +defer ${1:func}(${2}) +${0} +endsnippet + +snippet def "defer func() { ... }" +defer func() { + ${0:${VISUAL}} +}() +endsnippet + +# defer recover +snippet defr +defer func() { + if err := recover(); err != nil { + ${0:${VISUAL}} + } +}() +endsnippet + +# gpl +snippet gpl +/* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by + +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see . +* +* Copyright (C) ${1:Author}, `!v strftime("%Y")` +*/ +${0} + +endsnippet + +# import +snippet import "import ( ... )" +import ( + "${1:package}" ) endsnippet -snippet struct "Struct declaration" b -type ${1:Struct} struct { +# full interface snippet +snippet interface "interface I { ... }" +type ${1:Interface} interface { + ${2:/* TODO: add methods */} +} +endsnippet + +# if condition +snippet if "if ... { ... }" +if ${1:condition} { ${0:${VISUAL}} } endsnippet -snippet interface "Interface declaration" b -type ${1:Interface} interface { + +# else snippet +snippet else +else { + ${0:${VISUAL}} +} +endsnippet + +# if inline error +snippet ife "If with inline error" +if err := ${1:condition}; err != nil { + ${0:${VISUAL}} +} +endsnippet + +snippet ew "errors.Wrap" +errors.Wrap(${1:err}, "${2:message}") +endsnippet + +snippet ewf "errors.Wrapf" +errors.Wrapf(${1:err}, "${2:message %v}", ${3:args...}) +endsnippet + +# error snippet +snippet errn "Error return" !b +if err != nil { + return err +} +${0} +endsnippet + +snippet errnw "Error return wrap" !b +if err != nil { + return errors.Wrap(err, "${1:message}") +} +${0} +endsnippet + +snippet errnwf "Error return wrapf" !b +if err != nil { + return errors.Wrapf(err, "${1:message %v}", ${2:args...}) +} +${0} +endsnippet + +# error log snippet +snippet errl "Error with log.Fatal(err)" !b +if err != nil { + log.Fatal(err) +} +${0} +endsnippet + +# error multiple return +snippet errn, "Error return with two return values" !b +if err != nil { + return ${1:nil}, ${2:err} +} +${0} +endsnippet + +snippet errn,w "Error return wrap with two return values" !b +if err != nil { + return nil, errors.Wrap(err, "${1:message}") +} +${0} +endsnippet + +snippet errn,wf "Error return wrapf with two return values" !b +if err != nil { + return nil, errors.Wrapf(err, "${1:message %v}", ${2:args...}) +} +${0} +endsnippet + +# error panic +snippet errp "Error panic" !b +if err != nil { + panic(${1}) +} +${0} +endsnippet + +# error test +snippet errt "Error test fatal " !b +if err != nil { + t.Fatal(err) +} +${0} +endsnippet + + +# error handle +snippet errh "Error handle and return" !b +if err != nil { + ${1} + return +} +${0} +endsnippet + +# json field tag +snippet json "\`json:key\`" +\`json:"${1:`!v go#util#snippetcase(matchstr(getline("."), '\w\+'))`}"\` +endsnippet + +# yaml field tag +snippet yaml "\`yaml:key\`" +\`yaml:"${1:`!v go#util#snippetcase(matchstr(getline("."), '\w\+'))`}"\` +endsnippet + +# fallthrough +snippet ft "fallthrough" +fallthrough +endsnippet + +# for loop +snippet for "for ... { ... }" +for ${1} { ${0:${VISUAL}} } endsnippet -snippet if "If statement" b -if ${1:condition}${1/(.+)/ /}{ +# for integer loop +snippet fori "for 0..N-1 { ... }" +for ${1:i} := 0; $1 < ${2:N}; $1++ { ${0:${VISUAL}} + } endsnippet -snippet switch "Switch statement" b -switch ${1:expression}${1/(.+)/ /}{ -case$0 +# for range loop +snippet forr "for k, v := range items { ... }" + +for ${2:k}, ${3:v} := range ${1} { + ${0:${VISUAL}} +} +endsnippet + +snippet forsel "for select" +for { + select { + case ${2:${1:result} := }<- ${3:channel}: + ${0} + } +} +endsnippet + +snippet selc "select case" !b +case ${1:${2:var} := }<-${3:channel}: + ${0} + +endsnippet + +# function +snippet func "func Function(...) [error] { ... }" +func ${1:name}(${2:params})${3/(.+)/ /}`!p opening_par(snip, 3)`$3`!p closing_par(snip, 3)` { + ${0:${VISUAL}} +} +endsnippet + +# Fmt Printf debug +snippet ff "fmt.Printf(...)" +fmt.Printf("$1 = %+v\n", ${1:${VISUAL}}) +endsnippet + +# Fmt Printf debug with hash +snippet ffh "fmt.Printf(#...) hash" +fmt.Printf("$1 = %#v\n", ${1:${VISUAL}}) +endsnippet + +# Fmt Println debug +snippet fn "fmt.Println(...)" +fmt.Println("${1:${VISUAL}}") +endsnippet + +# Fmt Errorf debug +snippet fe "fmt.Errorf(...)" +fmt.Errorf("${1:${VISUAL}}") +endsnippet + +# Fmt Errorf wrap +snippet few "fmt.Errorf(%w, err)" +fmt.Errorf("${1:message}: %w", ${2:${VISUAL:err}}) +endsnippet + +# Fmt Errorf wrap and return +snippet errnfw "Error return fmt.Errorf(%w, err)" !b +if ${1:${VISUAL:err}} != nil { + return fmt.Errorf("${2:message}: %w", $1) } endsnippet -# functions -snippet /^main/ "Main function" r +# log printf +snippet lf "log.Printf(...)" +log.Printf("${1:${VISUAL}} = %+v\n", $1) +endsnippet + +# log println +snippet ln "log.Println(...)" +log.Println("${1:${VISUAL}}") +endsnippet + +# make +snippet make "make(Type, size)" +make(${1:[]string}, ${2:0})${0} +endsnippet + +# map +snippet map "map[Type]Type" +map[${1:string}]${0:int} +endsnippet + +# main() +snippet main "func main() { ... }" func main() { ${0:${VISUAL}} } endsnippet -snippet /^meth/ "Method" r -func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} { +# method +snippet meth "func (self Type) Method(...) [error] { ... }" +func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}`!p opening_par(snip, 5)`$5`!p closing_par(snip, 5)` { ${0:${VISUAL}} } endsnippet -snippet func "Function" b -func ${1:name}(${2:params})${3/(.+)/ /}${3:type} { +# ok +snippet ok "if !ok { ... }" +if !ok { ${0:${VISUAL}} } endsnippet -snippet funch "HTTP handler" b -func ${1:handler}(${2:w} http.ResponseWriter, ${3:r} *http.Request) { +# package +snippet package "package ..." +// Package $1 provides ${2:...} +package ${1:main} +${0} +endsnippet + +# panic +snippet pn "panic()" +panic("${0:msg}") +endsnippet + +# return +snippet rt "return" +return ${0:${VISUAL}} +endsnippet + +# select +snippet select "select { case a := <-chan: ... }" +select { +case ${1:v1} := <-${2:chan1}: + ${0} +} +endsnippet + +# struct +snippet st "type T struct { ... }" +type ${1:Type} struct { + ${0} +} +endsnippet + + +# switch +snippet switch "switch x { ... }" +switch ${1:var} { + +case ${2:value1}: + ${0} +} +endsnippet + +snippet tswitch "type switch x { ... }" +switch ${2:$1 := }${1:v}.(type) { + ${0} +} +endsnippet + +# sprintf +snippet sp "fmt.Sprintf(...)" +fmt.Sprintf("%${1:s}", ${2:var}) +endsnippet + +# goroutine named function +snippet go "go someFunc(...)" +go ${1:funcName}(${0}) +endsnippet + +# goroutine anonymous function +snippet gof "go func() { ... }()" +go func() { + ${1:${VISUAL}} +}() +${0} +endsnippet + +# test function +snippet test "func TestXYZ(t *testing.T) { ... }" +func Test${1:Function}(t *testing.T) { ${0:${VISUAL}} } endsnippet -# types and variables -snippet map "Map type" b -map[${1:keytype}]${2:valtype} +# test t.Run +snippet tr "t.Run(XYZ, func(t *testing.T){ ... })" +t.Run("${0}", func(t *testing.T){ + +}) endsnippet -snippet : "Variable declaration :=" b -${1:name} := ${0:value} +# test table snippet +snippet tt +var tests = []struct { + name string + expected string + given string +}{ + {"${1}", "${2}", "${3}",}, +} +for _, tt := range tests { + tt := tt + t.Run(tt.name, func(t *testing.T){ + actual := ${0:${VISUAL}}(tt.given) + if actual != tt.expected { + t.Errorf("$0(%s): expected %s, actual %s", tt.given, tt.expected, actual) + } + + }) +} endsnippet -snippet var "Variable declaration" b -var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}} + +snippet hf "http.HandlerFunc" +func ${1:handler}(w http.ResponseWriter, r *http.Request) { + ${0:fmt.Fprintf(w, "hello world")} +} endsnippet -snippet vars "Variables declaration" b -var ( - ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} } -) + +snippet hhf "mux.HandleFunc" !b +${1:http}.HandleFunc("${2:/}", func(w http.ResponseWriter, r *http.Request) { + ${0:fmt.Fprintf(w, "hello world")} +}) endsnippet -snippet json "JSON field" -\`json:"${1:displayName}"\` +# quick test server +snippet tsrv "httptest.NewServer" +ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Fprintln(w, ${1:`response`}) +})) +defer ts.Close() + +${0:someUrl} = ts.URL endsnippet -# error handling -snippet err "Basic error handling" b +# test error handling +snippet ter "if err != nil { t.Errorf(...) }" if err != nil { - log.${1:Fatal}(err) + t.Errorf("${0:message}") } endsnippet + +# test fatal error +snippet terf "if err != nil { t.Fatalf(...) }" +if err != nil { + t.Fatalf("${0:message}") +} +endsnippet + +snippet example "func ExampleXYZ() { ... }" +func Example${1:Method}() { + ${0:${VISUAL}} + // Output: +} +endsnippet + +snippet benchmark "func BenchmarkXYZ(b *testing.B) { ... }" +func Benchmark${1:Method}(b *testing.B) { + for i := 0; i < b.N; i++ { + ${0:${VISUAL}} + } +} + +endsnippet + +# variable declaration +snippet var "var x Type [= ...]" +var ${1:x} ${2:Type}${3: = ${0:value}} +endsnippet + +# variables declaration +snippet vars "var ( ... )" +var ( + ${1:x} ${2:Type}${3: = ${0:value}} +) + +endsnippet + +# equals fails the test if exp is not equal to act. +snippet eq "equals: test two identifiers with DeepEqual" +if !reflect.DeepEqual(${1:expected}, ${2:actual}) { + _, file, line, _ := runtime.Caller(0) + fmt.Printf("%s:%d:\n\n\texp: %#v\n\n\tgot: %#v\n\n", filepath.Base(file), line, $1, $2) + t.FailNow() +} +endsnippet + +global !p +import re +# Automatically wrap return types with parentheses +def return_values(s): + # remove everything wrapped in parentheses + s = re.sub("\(.*?\)|\([^)]*$", "", s) + return len(s.split(",")) +def opening_par(snip, pos): + if return_values(t[pos]) > 1 and not t[pos].startswith("("): + snip.rv = "(" + else: + snip.rv = "" +def closing_par(snip, pos): + if return_values(t[pos]) > 1: + snip.rv = ")" + else: + snip.rv = "" +endglobal + +# vim:ft=snippets:1 diff --git a/nvim/ultisnips/javascript.snippets b/nvim/ultisnips/javascript.snippets index b70e68e..a31eb59 100644 --- a/nvim/ultisnips/javascript.snippets +++ b/nvim/ultisnips/javascript.snippets @@ -40,6 +40,14 @@ if (${1:true}) { } endsnippet +snippet try "try-catch" b +try { + $0 +} catch(error) { + +} +endsnippet + snippet switch switch (${VISUAL}${1:expression}) { case '${VISUAL}${2:case}': diff --git a/nvim/ultisnips/markdown.snippets b/nvim/ultisnips/markdown.snippets index e0601be..eaeaeb4 100644 --- a/nvim/ultisnips/markdown.snippets +++ b/nvim/ultisnips/markdown.snippets @@ -4,20 +4,20 @@ priority -50 # Text # -snippet * "italics" -*${1:${VISUAL}}*$0 +snippet _ "italics" +_${1:${VISUAL}}_ $0 endsnippet -snippet ** "bold" -**${1:${VISUAL}}**$0 +snippet * "bold" +**${1:${VISUAL}}** $0 endsnippet -snippet *** "bold italics" -***${1:${VISUAL}}***$0 +snippet _* "bold italics" +_**${1:${VISUAL}}**_ $0 endsnippet -snippet /* "Comment" -$0 +snippet /* "Comment" + $0 endsnippet # diff --git a/nvim/ultisnips/scss.snippets b/nvim/ultisnips/scss.snippets new file mode 100644 index 0000000..e5cc7e3 --- /dev/null +++ b/nvim/ultisnips/scss.snippets @@ -0,0 +1,5 @@ +priority -50 + +extends css + +# vim:ft=snippets: diff --git a/nvim/ultisnips/sh.snippets b/nvim/ultisnips/sh.snippets index 740231b..b50ff6b 100644 --- a/nvim/ultisnips/sh.snippets +++ b/nvim/ultisnips/sh.snippets @@ -60,26 +60,12 @@ fi endsnippet snippet os "check if command exists" b -declare DISTRO - -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - DISTRO=$(awk -F= '/^NAME/{print \${2}}' /etc/os-release) - - if [[ ${DISTRO} = "Ubuntu"* ]]; then - if uname -a | grep -q '^Linux.*Microsoft'; then - # ubuntu via WSL Windows Subsystem for Linux - echo "NOT IMPLEMENTED" - else - # native ubuntu - echo "NOT IMPLEMENTED" - fi - elif [[ ${DISTRO} = "Debian"* ]]; then - # debian - echo "NOT IMPLEMENTED" - fi -elif [[ "$OSTYPE" == "darwin"* ]]; then +if [[ "$OSTYPE" == "darwin"* ]]; then # macOS OSX echo "NOT IMPLEMENTED" +else + # debian + echo "NOT IMPLEMENTED" fi endsnippet diff --git a/nvim/ultisnips/sql.snippets b/nvim/ultisnips/sql.snippets index c746b0a..d5db5ea 100644 --- a/nvim/ultisnips/sql.snippets +++ b/nvim/ultisnips/sql.snippets @@ -65,7 +65,7 @@ alter table $2 alter table $2 validate constraint $1; endsnippet -snippet ctf "postgresql constraint foreign key" b +snippet ct:fk "postgresql constraint foreign key" b /* * Add foreign key constraint ${1:${VISUAL:fkey}} to table * ${2:${VISUAL:table_referencing}} (${3:${VISUAL:fkey_ref}}) referencing ${4:${VISUAL:table_to_reference}} diff --git a/nvim/ultisnips/typescript.snippets b/nvim/ultisnips/typescript.snippets index 2f442c0..4da9091 100644 --- a/nvim/ultisnips/typescript.snippets +++ b/nvim/ultisnips/typescript.snippets @@ -4,31 +4,28 @@ extends javascript extends html extends javascript-jsdoc -snippet int "interface" +snippet interface "interface" interface ${1} { + $0 }; endsnippet -snippet eint "interface" -export interface ${1} { -}; -endsnippet - -snippet ty "new type" +snippet type "new type" type $1 = $2; endsnippet -snippet ety "new type" -export type $1 = $2; +snippet export:interface "interface" +export interface ${1} { + $0 +}; endsnippet -snippet nspc "namespace" -namespace ${1} { -}; +snippet export:type "new type" +export type $1 = $2; endsnippet -snippet ex "export" -export $1 from "$2"; +snippet import "import a module" +import $2 from "$1"; endsnippet priority -49 @@ -37,3 +34,19 @@ function ${1:function_name} (${2:argument}: ${3:argument_type}) { ${VISUAL}$0 } endsnippet + +# Jest Snippets + +snippet describe "Jest suite test case" b +describe("$1", () => { + test("$2", () => { + $0 + }) +}) +endsnippet + +snippet test "Jest suite test case" b +test("$1", () => { + $0 +}) +endsnippet diff --git a/nvim/ultisnips/ultisnips b/nvim/ultisnips/ultisnips index e0afce7..f9e1186 120000 --- a/nvim/ultisnips/ultisnips +++ b/nvim/ultisnips/ultisnips @@ -1 +1 @@ -/Users/odas0r/dot/nvim/ultisnips \ No newline at end of file +/home/odas0r/dot/nvim/ultisnips \ No newline at end of file diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index b19d3da..0000000 --- a/package-lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "dot", - "lockfileVersion": 2, - "requires": true, - "packages": {} -} diff --git a/package.json b/package.json deleted file mode 100644 index 0967ef4..0000000 --- a/package.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/.psqlrc b/psqlrc similarity index 100% rename from .psqlrc rename to psqlrc diff --git a/scripts/cmd b/scripts/cmd index bdc8712..de25e9d 100755 --- a/scripts/cmd +++ b/scripts/cmd @@ -4,5 +4,5 @@ set -e cmd="$(command -v "$1")" if [ -n "$cmd" ]; then - popup nvim "$cmd" + popup nvimr "$cmd" fi diff --git a/scripts/docker-fix b/scripts/docker-fix new file mode 100755 index 0000000..e737e6f --- /dev/null +++ b/scripts/docker-fix @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +sudo systemctl restart docker.socket docker.service diff --git a/scripts/dot b/scripts/dot index b726f1d..25b0b70 100755 --- a/scripts/dot +++ b/scripts/dot @@ -4,12 +4,16 @@ set -e if [[ -n $1 ]]; then # find the files by regex & open them w/ vim - find "$HOME/dot" -type f -name "*$1*" -exec nvim-nvr '{}' + + find "$HOME/dot" -type f -name "*$1*" -exec nvimr '{}' + exit 0 fi -cd "$HOME/dot" -file="$(fzf-tmux -p 95% --preview 'bat --theme=ansi --style=numbers --color=always {}')" +cd "$HOME/dot" +file=$( + fzf-tmux -p 95% --multi \ + --prompt="Search through your dotfiles > " \ + --preview 'bat --theme=gruvbox-dark --style=numbers --color=always {}' +) if [[ -f $file ]]; then if [[ ${file: -4} =~ (.png|jpeg|gif) ]]; then @@ -17,6 +21,6 @@ if [[ -f $file ]]; then open "$(basename "$file")" exit 0 else - nvim-nvr "$file" + nvimr "$file" fi fi diff --git a/scripts/exe b/scripts/exe new file mode 100755 index 0000000..3d5165a --- /dev/null +++ b/scripts/exe @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +chmod +x "$@" diff --git a/scripts/gitsync b/scripts/gitsync index a361b8d..e96925b 100755 --- a/scripts/gitsync +++ b/scripts/gitsync @@ -18,7 +18,7 @@ _sync() { # Check if there are uncommitted changes if [ -n "$(git status --porcelain)" ]; then git add . - git commit -m "automated/scripted commit and push " -q + git commit -m "Gitsync: $(date +%Y-%m-%d)" -q git pull -q git push -q fi diff --git a/scripts/lg b/scripts/lzd similarity index 51% rename from scripts/lg rename to scripts/lzd index 19a35c0..e89866e 100755 --- a/scripts/lg +++ b/scripts/lzd @@ -2,9 +2,9 @@ set -e -if [[ ! -x "$(command -v lazygit)" ]]; then +if [[ ! -x "$(command -v lazydocker)" ]]; then echo "You need to install lazygit" exit 1 fi -popup lazygit -p "$(pwd)" "$@" +popup lazydocker "$@" diff --git a/scripts/lzg b/scripts/lzg new file mode 100755 index 0000000..ff92dff --- /dev/null +++ b/scripts/lzg @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +is_in_git_repo() { + git rev-parse HEAD -- >/dev/null 2>&1 +} + +if [[ ! -x "$(command -v lazygit)" ]]; then + echo "You need to install lazygit" + exit 1 +fi + +if [[ -d "$1" ]]; then + cd "$1" + is_in_git_repo || (echo "You're not in a git repo" && exit 1) + root=$(git rev-parse --show-toplevel) + popup lazygit -p "$root" "${@:1}" + +else + is_in_git_repo || (echo "You're not in a git repo" && exit 1) + root=$(git rev-parse --show-toplevel) + popup lazygit -p "$root" "$@" +fi diff --git a/scripts/newx b/scripts/newx index fa386a5..d8d1118 100755 --- a/scripts/newx +++ b/scripts/newx @@ -7,7 +7,7 @@ path="$HOME/.local/bin/scripts/${1}" if [[ -e $path ]]; then read -r -p "${1} already exists. Edit?" yes case "$yes" in - y | yes | ok | okay) exec nvim-nvr "$path" ;; + y | yes | ok | okay) exec nvimr "$path" ;; esac exit 0 fi @@ -20,4 +20,4 @@ set -euxo pipefail EOF chmod +x "$path" -nvim-nvr +2 "$path" +nvimr +2 "$path" diff --git a/scripts/nextday b/scripts/nextday index af9d446..e415cdd 100755 --- a/scripts/nextday +++ b/scripts/nextday @@ -21,7 +21,7 @@ if [[ ! -f "$file" ]]; then export title="# Journal Entry, ${nextdayDate}" tmpl "$DAILY_TEMPLATE" >"$file" - popup nvim "$file" + popup nvimr "$file" else - popup nvim "$file" + popup nvimr "$file" fi diff --git a/scripts/nr b/scripts/nr index 2af263c..43d4f45 120000 --- a/scripts/nr +++ b/scripts/nr @@ -1 +1 @@ -/Users/odas0r/github.com/nr-cmd/nr \ No newline at end of file +/home/odas0r/github.com/odas0r/nr-cmd/nr \ No newline at end of file diff --git a/scripts/nvim-nvr b/scripts/nvim-nvr deleted file mode 100755 index 5defd4a..0000000 --- a/scripts/nvim-nvr +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -e - -NVIM=$(which nvim) -if [[ -z "$NVIM_LISTEN_ADDRESS" ]]; then - $NVIM "$@" -else - if [[ -z "$*" ]]; then - nvr -l -c new - else - nvr -l "$@" - fi -fi diff --git a/scripts/nvimr b/scripts/nvimr new file mode 100755 index 0000000..7e629e9 --- /dev/null +++ b/scripts/nvimr @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -e + +# TODO: Refactor this into using the builtin, check remote.txt + +declare NVIM_LISTEN_ADDRESS + +# Create a server per tmux session +NVIM_LISTEN_ADDRESS="/tmp/nvim_$(tmux display-message -p '#S')" +export NVIM_LISTEN_ADDRESS + +if [[ -z "$*" ]]; then + nvr -s -l -c enew +else + nvr -s -l "$@" +fi diff --git a/scripts/open b/scripts/open new file mode 100755 index 0000000..836efa3 --- /dev/null +++ b/scripts/open @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +host="Guilherme Rosado@workstation.host" +pass="Portimao325814" + +sshpass -p "$pass" ssh "$host" "PsExec -i 1 cmd.exe /C start brave.exe ${1}" diff --git a/scripts/pgfmt b/scripts/pgfmt index 32c4d5e..21ca8d1 100755 --- a/scripts/pgfmt +++ b/scripts/pgfmt @@ -10,6 +10,6 @@ LANG=C pg_format \ --comma-start \ --keyword-case 1 \ --wrap-comment \ - --wrap-limit 78 \ --nogrouping \ + --format-type \ --no-extra-line diff --git a/scripts/prevday b/scripts/prevday index c0a20a5..80f38dc 100755 --- a/scripts/prevday +++ b/scripts/prevday @@ -23,7 +23,7 @@ if [[ ! -f $file ]]; then tmpl "$DAILY_TEMPLATE" >"$file" # Open the daily file - popup nvim "$file" + popup nvimr "$file" else - popup nvim "$file" + popup nvimr "$file" fi diff --git a/scripts/slugify b/scripts/slugify index b4deac1..fa09c34 100755 --- a/scripts/slugify +++ b/scripts/slugify @@ -2,24 +2,9 @@ set -euo pipefail -DISTRO=: - -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - DISTRO=$(awk -F= '/^NAME/{print ${2}}' /etc/os-release) - - if [[ ${DISTRO} = "Ubuntu"* ]]; then - if uname -a | grep -q '^Linux.*Microsoft'; then - # ubuntu via WSL Windows Subsystem for Linux - iconv -t ascii//TRANSLIT | sed -r s/[~'^']+//g | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr "[:upper:]" "[:lower:]" - else - # native ubuntu - echo "NOT IMPLEMENTED" - fi - elif [[ ${DISTRO} = "Debian"* ]]; then - # debian - echo "NOT IMPLEMENTED" - fi -elif [[ "$OSTYPE" == "darwin"* ]]; then +if [[ "$OSTYPE" == "darwin"* ]]; then # macOS OSX iconv -t ascii//TRANSLIT | sed -E s/[~'^']+//g | sed -E s/[^a-zA-Z0-9]+/-/g | sed -E s/^-+\|-+$//g | tr "[:upper:]" "[:lower:]" +else + iconv -t ascii//TRANSLIT | sed -r s/[~'^']+//g | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr "[:upper:]" "[:lower:]" fi diff --git a/scripts/tmuxin b/scripts/tmuxin index 250dd6c..e4e97b4 100755 --- a/scripts/tmuxin +++ b/scripts/tmuxin @@ -2,21 +2,12 @@ set -e -# Tags Explanation -# -c: path of the session -# -s: session name -# -n: window name -# -d: "detach" -# send-keys: C-m -> Enter Key - -# ===================== -# wallstreeters session -# ===================== -# -# manage the project wallstreeters +# ================================== +# Wallstreeters +# ================================== session="wallstreeters" -workspace="$(markpath wall-client)" +workspace="$HOME/github.com/wallstreeters/client" if tmux has-session -t $session &>/dev/null; then tmux kill-session -t "$session" @@ -26,13 +17,16 @@ tmux new-session -d -s "$session" -c "$workspace" window=1 tmux rename-window -t "${session}:${window}" "neovim" -tmux send-keys -t "${session}:${window}" "nvim -c 'Telescope git_files'" C-m window=2 tmux new-window -t "${session}:${window}" -n "server" -c "$workspace" -tmux send-keys -t "${session}:${window}" "yarn next:dev" C-m +tmux send-keys -t "${session}:${window}" "yarn docker:start && yarn psql" C-m tmux split-window -h -t "${session}:${window}" -c "$workspace" -tmux send-keys -t "${session}:${window}.2" "yarn psql" C-m +tmux send-keys -t "${session}:${window}.2" "yarn next:dev" C-m + +window=3 +tmux new-window -t "${session}:${window}" -n "docker" -c "$workspace" +tmux send-keys -t "${session}:${window}" "lazydocker" C-m tmux select-window -t :+1 diff --git a/scripts/today b/scripts/today index 91a1929..a608010 100755 --- a/scripts/today +++ b/scripts/today @@ -16,7 +16,7 @@ if [[ ! -f "$file" ]]; then tmpl "$DAILY_TEMPLATE" >"$file" # Open the daily file - popup nvim "$file" + popup nvimr "$file" else - popup nvim "$file" + popup nvimr "$file" fi diff --git a/scripts/todos b/scripts/todos index 9333f54..98eb354 100755 --- a/scripts/todos +++ b/scripts/todos @@ -1,3 +1,5 @@ #!/usr/bin/env bash -popup -d "$HOME/github.com/zet" nvim "$HOME/github.com/zet/todos.md" +ZET="$HOME/github.com/odas0r/zet" + +nvimr "$ZET/todos.md" diff --git a/scripts/xdg-open b/scripts/xdg-open new file mode 100755 index 0000000..3d9655f --- /dev/null +++ b/scripts/xdg-open @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -e + +open "$@" + diff --git a/scripts/zet b/scripts/zet index b86591a..e7cb171 120000 --- a/scripts/zet +++ b/scripts/zet @@ -1 +1 @@ -/Users/odas0r/github.com/zet-cmd/zet \ No newline at end of file +/home/odas0r/github.com/odas0r/zet-cmd/zet \ No newline at end of file diff --git a/setup b/setup index cf80154..deb7407 100755 --- a/setup +++ b/setup @@ -8,14 +8,9 @@ ln -sf "$HOME/dot/scripts" "$HOME/.local/bin/scripts" ln -sf "$HOME/dot/bashrc" "$HOME/.bashrc" ln -sf "$HOME/dot/inputrc" "$HOME/.inputrc" +ln -sf "$HOME/dot/psqlrc" "$HOME/.psqlrc" ln -sf "$HOME/dot/bash" "$HOME/.bash" -# MacOS shit -if [[ $OSTYPE == "darwin"* ]]; then - ln -sf "karabiner.json" "$HOME/.config/karabiner/karabiner.json" - ln -sf "tabnine_config.json" "/Users/odas0r/Library/Preferences/TabNine/tabnine_config.json" -fi - printf "Executing all setup scripts ✨...\n" readarray -d '' folders < <( diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 453e06f..4106eaa 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -5,34 +5,46 @@ set -g repeat-time 200 set -g history-limit 50001 - setw -g automatic-rename set-option -g renumber-windows on set -g base-index 1 setw -g pane-base-index 1 set -g mouse on +set-option -g focus-events on # colors -set -g status-style fg="#a9b1d6" -set -g window-status-current-style fg="#73daca" -set -g pane-border-style fg=colour238 -set -g pane-active-border-style fg=colour244 -set -g message-style fg="#fb4934" +# +# gruvbox +set-option -g status-style fg=colour250 # bg=bg1, fg=fg1 +set-window-option -g window-status-current-style fg=colour223 # fg=bg1 +set-option -g pane-border-style fg=colour237 #bg1 +set-option -g pane-active-border-style fg=colour250 #fg2 +set-option -g message-style bg=colour239,fg=colour223 # bg=bg2, fg=fg1 + +# tokyonight +# +# set -g status-style fg="#a9b1d6" +# set -g window-status-current-style fg="#73daca" +# set -g pane-border-style fg=colour238 +# set -g pane-active-border-style fg=colour244 +# set -g message-style fg="#fb4934" # status set -g status-left '' set -g status-left-length 0 set -g status-right '' set -g status-right-length 0 -set -g status-right '%a %Y-%m-%d %H:%M' -set -g status-right-length 30 +set -g status-right '#(date)' +set -g status-right-length 27 # sync clipboard set -g set-clipboard on # needed if using kitty-terminal -set -g default-terminal xterm-kitty -# set -g default-terminal "tmux-256color" +# set -g default-terminal xterm-kitty +set -g default-terminal 'xterm-256color' +set -ga terminal-overrides ',xterm-256color:Tc' + # Undercurl # https://github.com/folke/tokyonight.nvim#making-undercurls-work-properly-in-tmux @@ -63,6 +75,7 @@ bind -r c new-window -c "#{pane_current_path}" # set key-mode to vi set-window-option -g mode-keys vi + # vi like copy paste behaviour bind -r v copy-mode bind-key -T copy-mode-vi 'v' send -X begin-selection @@ -81,8 +94,3 @@ bind-key -r k select-pane -U bind-key -r j select-pane -D bind-key -r h select-pane -L bind-key -r l select-pane -R - - -# Fig Tmux Integration: Enabled -source-file ~/.fig/tmux -# End of Fig Tmux Integration