├── .gitignore ├── README.md ├── alacritty └── .config │ └── alacritty │ ├── alacritty.yml │ └── xterm-256color.terminfo ├── bspwm └── .config │ └── bspwm │ ├── bspwmrc │ ├── bspwmrc-msi │ └── external_rules ├── dunst └── .config │ └── dunst │ └── dunstrc ├── flameshot └── .config │ └── flameshot │ └── flameshot.ini ├── home ├── .bashrc └── scripts │ └── install │ ├── install_env.sh │ ├── install_neovim.sh │ └── install_neovim_config.sh ├── kitty └── .config │ └── kitty │ └── kitty.conf ├── latexmk └── .config │ └── latexmk │ └── latexmkrc ├── list.txt ├── mpv └── .config │ └── mpv │ ├── .gitignore │ └── mpv.conf ├── neovim └── .config │ └── nvim │ ├── Dockerfile │ ├── actions.json │ ├── after │ ├── ftplugin │ │ ├── cpp.lua │ │ ├── oil_preview.lua │ │ ├── python.lua │ │ ├── tex.lua │ │ └── tom.lua │ └── plugin │ │ ├── apm.lua │ │ ├── async_make.lua │ │ ├── image_paste.lua │ │ ├── lsp-on-type-formatting.lua │ │ ├── python-cc.lua │ │ ├── python-env.lua │ │ ├── tex_formatter.lua │ │ └── zoom.lua │ ├── compiler │ └── python.vim │ ├── init.lua │ ├── lazy-lock.json │ ├── lua │ ├── plugins │ │ ├── init.lua │ │ ├── modules.lua │ │ └── modules │ │ │ ├── barbecue.lua │ │ │ ├── bufferline.lua │ │ │ ├── chatgpt.lua │ │ │ ├── cmp.lua │ │ │ ├── colorizer.lua │ │ │ ├── comment.lua │ │ │ ├── copilot.lua │ │ │ ├── dap.lua │ │ │ ├── diffview.lua │ │ │ ├── dressing.lua │ │ │ ├── gitsigns.lua │ │ │ ├── harpoon.lua │ │ │ ├── image.lua │ │ │ ├── local-highlight.lua │ │ │ ├── lsp │ │ │ ├── custom │ │ │ │ ├── init.lua │ │ │ │ ├── null-ls.lua │ │ │ │ ├── pylance.lua │ │ │ │ └── wolfram_ls.lua │ │ │ ├── handlers.lua │ │ │ ├── init.lua │ │ │ ├── mappings.lua │ │ │ ├── null-ls.lua │ │ │ ├── servers.lua │ │ │ └── settings.lua │ │ │ ├── lualine.lua │ │ │ ├── luasnip │ │ │ ├── init.lua │ │ │ ├── mappings.lua │ │ │ ├── settings.lua │ │ │ └── snips │ │ │ │ ├── cmake.lua │ │ │ │ ├── cpp.lua │ │ │ │ ├── lua.lua │ │ │ │ ├── python.lua │ │ │ │ ├── tex.lua │ │ │ │ └── tex_math.lua │ │ │ ├── navic.lua │ │ │ ├── neogen.lua │ │ │ ├── neogit.lua │ │ │ ├── neotest.lua │ │ │ ├── neotree.lua │ │ │ ├── noice.lua │ │ │ ├── notify.lua │ │ │ ├── nvim-tree.lua │ │ │ ├── obsidian.lua │ │ │ ├── oil.lua │ │ │ ├── peek.lua │ │ │ ├── spectre.lua │ │ │ ├── surround.lua │ │ │ ├── telescope.lua │ │ │ ├── tmux.lua │ │ │ ├── toggleterm.lua │ │ │ ├── tokyodark.lua │ │ │ ├── treesitter.lua │ │ │ ├── trouble.lua │ │ │ └── which-key.lua │ ├── tiagovla │ │ ├── autocmds.lua │ │ ├── commands.lua │ │ ├── globals.lua │ │ ├── init.lua │ │ ├── mappings.lua │ │ ├── settings.lua │ │ └── utils.lua │ └── utils │ │ ├── linkedlist.lua │ │ └── watcher.lua │ ├── spell │ └── en.utf-8.add │ └── templates │ ├── cmake │ ├── make │ └── tex.tex ├── picom └── .config │ └── picom │ ├── launch.sh │ └── picom.conf ├── polybar └── .config │ └── polybar │ ├── config.ini │ ├── config_side.ini │ ├── launch.sh │ └── scripts │ ├── bluetooth_battery.sh │ ├── mic.sh │ ├── spotify.sh │ └── toggl ├── redshift └── .config │ └── redshift.conf ├── rofi └── .config │ └── rofi │ ├── colors.rasi │ ├── config.rasi │ ├── config1.rasi │ ├── dmenu.rasi │ ├── launcher.rasi │ └── zotero.rasi ├── root └── etc │ ├── X11 │ └── xorg.conf.d │ │ └── 69-keyboard.conf │ ├── default │ └── grub │ └── udev │ └── rules.d │ ├── 99-keyboard.rules │ ├── 99-monitor-hotplug.rules │ └── 99-power-energy.rules ├── scripts └── .local │ └── bin │ ├── audible2mp3 │ ├── ez │ ├── fan_speed │ ├── fix_layout │ ├── imgur │ ├── kbd_layout │ ├── monitor_setup │ ├── notflix │ ├── profile │ ├── rcloud │ └── transfer ├── stylua └── .config │ └── .stylua.toml ├── sxhkd └── .config │ └── sxhkd │ └── sxhkdrc ├── systemd └── .config │ └── systemd │ └── user │ ├── keyboard-layout.service │ └── monitor-hotplug.service ├── tmux └── .config │ └── tmux │ ├── .gitignore │ ├── screen-256color.terminfo │ └── tmux.conf ├── wezterm └── .config │ └── wezterm │ └── wezterm.lua ├── x ├── .xinitrc └── .xprofile ├── zathura └── .config │ └── zathura │ └── zathurarc └── zsh ├── .config └── zsh │ ├── .gitignore │ ├── .zshrc │ └── config │ ├── .gitignore │ ├── aliases.zsh │ ├── exports.zsh │ ├── functions.zsh │ ├── mappings.zsh │ ├── plugins.zsh │ ├── prompt.zsh │ └── settings.zsh └── .zshenv /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | */*/mpv/watch_later/ 3 | */*/packer_compiled.lua 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # .dotfiles 2 | 3 | ## Installation 4 | ```bash 5 | stow */ 6 | ``` 7 | ## Images 8 | 9 | ![desktop0](https://github.com/tiagovla/readme/blob/master/dotfiles/images/desktop0.png) 10 | ![desktop1](https://github.com/tiagovla/readme/blob/master/dotfiles/images/desktop1.png) 11 | ![desktop2](https://github.com/tiagovla/readme/blob/master/dotfiles/images/desktop2.png) 12 | ![desktop3](https://github.com/tiagovla/readme/blob/master/dotfiles/images/desktop3.png) 13 | ![desktop4](https://github.com/tiagovla/readme/blob/master/dotfiles/images/desktop4.png) 14 | 15 | ## Firefox theme: 16 | https://addons.mozilla.org/firefox/addon/tokyodark/ 17 | -------------------------------------------------------------------------------- /alacritty/.config/alacritty/alacritty.yml: -------------------------------------------------------------------------------- 1 | window: 2 | padding: 3 | x: 4 4 | y: 2 5 | title: Terminal 6 | class: 7 | instance: Alacritty 8 | general: Alacritty 9 | 10 | scrolling: 11 | history: 10000 12 | font: 13 | normal: 14 | family: MonoLisa Nerd Font 15 | style: Medium 16 | bold: 17 | family: MonoLisa Nerd Font 18 | style: Bold 19 | italic: 20 | family: MonoLisa Nerd Font 21 | style: MediumItalic 22 | bold_italic: 23 | family: MonoLisa Nerd Font 24 | style: BoldItalic 25 | size: 10.0 26 | 27 | draw_bold_text_with_bright_colors: true 28 | 29 | colors: 30 | primary: 31 | background: "#11121D" 32 | foreground: "#a0A8CD" 33 | normal: 34 | black: "#32344a" 35 | red: "#f7768e" 36 | green: "#9ece6a" 37 | yellow: "#e0af68" 38 | blue: "#7aa2f7" 39 | magenta: "#ad8ee6" 40 | cyan: "#449dab" 41 | white: "#787c99" 42 | bright: 43 | black: "#444b6a" 44 | red: "#ff7a93" 45 | green: "#b9f27c" 46 | yellow: "#ff9e64" 47 | blue: "#7da6ff" 48 | magenta: "#bb9af7" 49 | cyan: "#0db9d7" 50 | white: "#acb0d0" 51 | 52 | # background_opacity: 1.0 53 | 54 | selection: 55 | save_to_clipboard: false 56 | 57 | live_config_reload: true 58 | 59 | shell: 60 | program: /usr/bin/zsh 61 | args: 62 | - -l 63 | - -c 64 | - "tmux attach -t $(bspc query -D -d focused --names) || tmux new-session -A -s $(bspc query -D -d focused --names)" 65 | 66 | key_bindings: 67 | - { key: I, mods: Control, chars: "\x1b[105;5u" } 68 | - { key: Return, mods: Shift, chars: "\x1b[13;2u" } 69 | - { key: Return, mods: Control, chars: "\x1b[13;5u" } 70 | -------------------------------------------------------------------------------- /alacritty/.config/alacritty/xterm-256color.terminfo: -------------------------------------------------------------------------------- 1 | # A screen-256color based TERMINFO that adds the escape sequences for italic. 2 | # 3 | # Install: 4 | # 5 | # tic screen-256color.terminfo 6 | # 7 | # Usage: 8 | # 9 | # export TERM=screen-256color 10 | # 11 | xterm-256color-italic|xterm with 256 colors and italic, 12 | sitm=\E[3m, ritm=\E[23m, 13 | use=xterm-256color, 14 | -------------------------------------------------------------------------------- /bspwm/.config/bspwm/bspwmrc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | _run() { 4 | pgrep -x "${1}" > /dev/null || "$@" & 5 | } 6 | 7 | _run dbus-update-activation-environment --all 8 | _run sxhkd 9 | 10 | bspc monitor "eDP-1" -d 1 2 3 4 5 6 7 8 9 0 10 11 11 | bspc config border_width 2 12 | bspc config borderless_monocle true 13 | bspc config focused_border_color "#353b45" 14 | bspc config gapless_monocle true 15 | bspc config normal_border_color "#282c34" 16 | bspc config single_monocle false 17 | bspc config split_ratio 0.50 18 | bspc config top_padding 20 19 | bspc config window_gap 4 20 | bspc config remove_disabled_monitors true 21 | bspc config remove_unplugged_monitors true 22 | bspc config merge_overlapping_monitors true 23 | bspc config pointer_modifier mod1 24 | bspc config pointer_action1 move 25 | bspc config pointer_action2 resize_side 26 | bspc config pointer_action2 resize_corner 27 | bspc config focus_follows_pointer true 28 | bspc config external_rules_command "${HOME}/.config/bspwm/external_rules" 29 | bspc config pointer_motion_interval 40 30 | 31 | _run xbanish 32 | _run dunst 33 | _run flameshot 34 | _run copyq 35 | _run picom 36 | _run nm-applet 37 | _run xsetroot -cursor_name left_ptr 38 | _run redshift 39 | _run polybar main 40 | _run solaar --window=hide 41 | _run localsend --hidden 42 | _run bitwarden-desktop autostart 43 | _run aw-qt --no-gui 44 | _run feh --bg-scale ~/Pictures/arch.png 45 | _run autorandr --change 46 | _run xset r rate 200 200 47 | -------------------------------------------------------------------------------- /bspwm/.config/bspwm/bspwmrc-msi: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | _run() { 4 | pgrep -x "${1}" >/dev/null || "$@" & 5 | } 6 | 7 | _run sxhkd 8 | 9 | IS_CONNECTED=$(xrandr | grep ' connected' | grep 'HDMI' | awk '{print $1}') 10 | EXTERNAL_MONITOR="HDMI-1-1" 11 | INTERNAL_MONITOR=$(xrandr | grep 'eDP' | awk '{print $1}') 12 | 13 | if [[ $1 == 0 ]]; then 14 | if [[ -n $IS_CONNECTED ]]; then 15 | ( 16 | sleep 1 17 | xrandr --output "$EXTERNAL_MONITOR" --mode 2560x1080 --rate 75 --primary --right-of "$INTERNAL_MONITOR" --output "$main_monitor" --off 18 | bspc monitor "$INTERNAL_MONITOR" -d 10 19 | bspc monitor "$EXTERNAL_MONITOR" -d 1 2 3 4 5 6 7 8 9 0 20 | bspc wm -O "$EXTERNAL_MONITOR" "$INTERNAL_MONITOR" 21 | # bspc wm -O "HDMI-1-1" "eDP-1" 22 | ) & 23 | else 24 | bspc monitor "$INTERNAL_MONITOR" -d 1 2 3 4 5 6 7 8 9 0 10 25 | fi 26 | fi 27 | 28 | bspc config border_width 2 29 | bspc config borderless_monocle true 30 | bspc config focused_border_color "#353b45" 31 | bspc config gapless_monocle true 32 | bspc config normal_border_color "#282c34" 33 | bspc config single_monocle false 34 | bspc config split_ratio 0.50 35 | bspc config top_padding 20 36 | bspc config window_gap 8 37 | 38 | bspc config external_rules_command "${HOME}/.config/bspwm/external_rules" 39 | 40 | bspc config pointer_modifier mod1 41 | bspc config pointer_action1 move 42 | bspc config pointer_action2 resize_side 43 | bspc config pointer_action2 resize_corner 44 | bspc config focus_follows_pointer true 45 | 46 | _run xbanish 47 | _run dunst 48 | _run flameshot 49 | # _run picom 50 | _run nm-applet 51 | _run clipcatd 52 | _run redshift 53 | 54 | ( 55 | _run kbd_layout 56 | _run xsetroot -cursor_name left_ptr 57 | _run xset r rate 200 120 58 | monitor_setup 59 | feh --bg-scale ~/Pictures/wallpaper.png 60 | ) & 61 | 62 | if [[ -n $IS_CONNECTED ]]; then 63 | bspc monitor "$INTERNAL_MONITOR" -g 1920x1080+0+0 64 | else 65 | bspc monitor "$INTERNAL_MONITOR" -g 1920x1080+0+0 66 | bspc monitor "$EXTERNAL_MONITOR" -g 2560x1080+0+0 67 | fi 68 | -------------------------------------------------------------------------------- /dunst/.config/dunst/dunstrc: -------------------------------------------------------------------------------- 1 | [global] 2 | monitor = 0 3 | follow = mouse 4 | width = 400 5 | offset = 20x50 6 | origin = top-right 7 | progress_bar = true 8 | progress_bar_height = 10 9 | progress_bar_frame_width = 1 10 | progress_bar_min_width = 150 11 | progress_bar_max_width = 400 12 | indicate_hidden = false 13 | notification_limit = 0 14 | shrink = no 15 | transparency = 0 16 | separator_height = 2 17 | padding = 8 18 | horizontal_padding = 8 19 | text_icon_padding = 0 20 | frame_width = 1 21 | frame_color = "#4A5057" 22 | separator_color = frame 23 | sort = yes 24 | font = MonoLisa 12 25 | line_height = 1 26 | markup = full 27 | format = "%a\n%s\n%b" 28 | alignment = left 29 | vertical_alignment = center 30 | show_age_threshold = 60 31 | word_wrap = yes 32 | ellipsize = middle 33 | ignore_newline = no 34 | stack_duplicates = true 35 | hide_duplicate_count = false 36 | show_indicators = yes 37 | icon_position = left 38 | min_icon_size = 0 39 | max_icon_size = 64 40 | icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/ 41 | icon_theme = "Tela-circle, Adwaita" 42 | enable_recursive_icon_lookup = true 43 | sticky_history = yes 44 | history_length = 20 45 | always_run_script = true 46 | title = Dunst 47 | class = Dunst 48 | ignore_dbusclose = false 49 | mouse_left_click = do_action, close_current 50 | mouse_middle_click = do_action, close_current 51 | mouse_right_click = close_all 52 | browser = /usr/bin/xdg-open 53 | 54 | [urgency_low] 55 | background = "#11121D" 56 | foreground = "#A0A8CD" 57 | timeout = 15 58 | 59 | [urgency_normal] 60 | background = "#11121D" 61 | foreground = "#A0A8CD" 62 | timeout = 25 63 | 64 | [urgency_critical] 65 | background = "#11121D" 66 | foreground = "#EE6D85" 67 | timeout = 35 68 | 69 | ; vim:ft=dosini 70 | -------------------------------------------------------------------------------- /flameshot/.config/flameshot/flameshot.ini: -------------------------------------------------------------------------------- 1 | [General] 2 | contrastOpacity=188 3 | drawColor=#800080 4 | drawFontSize=32 5 | drawThickness=16 6 | ignoreUpdateToVersion=12.0.0 7 | savePath=/home/tiagovla 8 | -------------------------------------------------------------------------------- /home/.bashrc: -------------------------------------------------------------------------------- 1 | # 2 | # ~/.bashrc 3 | # 4 | 5 | # If not running interactively, don't do anything 6 | [[ $- != *i* ]] && return 7 | 8 | alias ls='ls --color=auto' 9 | PS1='[\u@\h \W]\$ ' 10 | 11 | export PATH="$HOME/.pyenv/bin:$PATH" 12 | eval "$(pyenv init -)" 13 | eval "$(pyenv virtualenv-init -)" 14 | 15 | export PATH="$HOME/.poetry/bin:$PATH" 16 | -------------------------------------------------------------------------------- /home/scripts/install/install_env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if uname -a | grep -q Ubuntu; then 4 | echo "Installing dependencies on ubuntu..." 5 | sudo apt-get install zsh golang-go nodejs npm \ 6 | make build-essential libssl-dev zlib1g-dev \ 7 | libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git 8 | 9 | elif [ -f "/etc/arch-release" ]; then 10 | echo "Installing dependencies on arch..." 11 | sudo pacman -S zsh go 12 | fi 13 | 14 | # update tmux config 15 | curl https://raw.githubusercontent.com/tiagovla/dotfiles/master/.tmux.conf >"$HOME/.tmux.conf" 16 | 17 | # update bash config 18 | curl https://raw.githubusercontent.com/tiagovla/dotfiles/master/.bashrc >"$HOME/.bashrc" 19 | source "$HOME/.bashrc" 20 | 21 | # pyenv 22 | if ! command -v pyenv &>/dev/null; then 23 | rm "$HOME/.pyenv" -rf 24 | git clone https://github.com/pyenv/pyenv.git ~/.pyenv 25 | pyenv install 3.9.4 26 | pyenv install 2.7.18 27 | pyenv global 3.9.4 2.7.18 28 | fi 29 | 30 | # poetry 31 | if ! command -v poetry &>/dev/null; then 32 | curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python 33 | fi 34 | 35 | # zsh 36 | if ! command -v zsh &>/dev/null; then 37 | # install ohmyzsh 38 | sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 39 | # update zsh config 40 | curl https://raw.githubusercontent.com/tiagovla/dotfiles/master/.zshrc >"$HOME/.zshrc" 41 | source "$HOME/.zshrc" 42 | fi 43 | -------------------------------------------------------------------------------- /home/scripts/install/install_neovim.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if uname -a | grep -q Ubuntu; then 4 | echo "Installing dependencies on ubuntu..." 5 | sudo apt-get install ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip 6 | elif [ -f "/etc/arch-release" ]; then 7 | echo "Installing dependencies on arch..." 8 | sudo pacman -S base-devel cmake unzip ninja tree-sitter 9 | fi 10 | 11 | TMP_DIR=$(mktemp -d) 12 | if [ ! -e "$TMP_DIR" ]; then 13 | echo >&2 "Failed to create temp directory." 14 | exit 1 15 | fi 16 | trap "exit 1" HUP INT PIPE QUIT TERM 17 | trap 'rm -rf "$TMP_DIR"' EXIT 18 | echo "Created temporary directory $TMP_DIR." 19 | 20 | NEOVIM_TMP_DIR="$TMP_DIR/neovim" 21 | 22 | git clone https://github.com/neovim/neovim.git "$NEOVIM_TMP_DIR" 23 | cd "$NEOVIM_TMP_DIR" || exit 1 24 | make CMAKE_BUILD_TYPE=RelWithDebInfo 25 | sudo make install 26 | cd - >/dev/null || exit 1 27 | -------------------------------------------------------------------------------- /home/scripts/install/install_neovim_config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TMP_DIR=$(mktemp -d) 4 | if [ ! -e "$TMP_DIR" ]; then 5 | echo >&2 "Failed to create temp directory." 6 | exit 1 7 | fi 8 | trap "exit 1" HUP INT PIPE QUIT TERM 9 | trap 'rm -rf "$TMP_DIR"' EXIT 10 | echo "Created temporary directory $TMP_DIR." 11 | 12 | DOTFILES_TMP_DIR="$TMP_DIR/dotfiles" 13 | HOME_CONFIG_DIR="$HOME/.config" 14 | HOME_CONFIG_NVIM_DIR="${HOME_CONFIG_DIR}/nvim" 15 | 16 | clone_dotfiles() { 17 | echo "Cloning dotfiles..." 18 | git clone \ 19 | --depth 1 \ 20 | --filter=blob:none \ 21 | --no-checkout \ 22 | https://github.com/tiagovla/dotfiles.git \ 23 | "$DOTFILES_TMP_DIR" \ 24 | ; 25 | cd "$DOTFILES_TMP_DIR" || exit 26 | git sparse-checkout init --cone 27 | git sparse-checkout set nvim 28 | git checkout master 29 | cd - >/dev/null || exit 30 | } 31 | 32 | backup_nvim() { 33 | TIMENOW=$(date +"%s") 34 | BACKUP_PATH="${HOME_CONFIG_NVIM_DIR}_${TIMENOW}_bk" 35 | mv "$HOME_CONFIG_NVIM_DIR" "$BACKUP_PATH" || exit 36 | echo "Your old neovim configuration $HOME_CONFIG_NVIM_DIR was moved to $BACKUP_PATH." 37 | } 38 | 39 | copy_nvim() { 40 | if [ -d "$HOME_CONFIG_NVIM_DIR" ]; then 41 | echo "Nvim config backup failed." 42 | exit 43 | else 44 | echo "New configuration copied to ${HOME_CONFIG_NVIM_DIR}." 45 | mkdir -p "$HOME_CONFIG_DIR" 46 | cp -r "$DOTFILES_TMP_DIR/nvim" "$HOME_CONFIG_NVIM_DIR" 47 | fi 48 | } 49 | 50 | install_packer() { 51 | git clone \ 52 | "https://github.com/wbthomason/packer.nvim" \ 53 | "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" \ 54 | ; 55 | } 56 | 57 | ## Installation: 58 | 59 | #clone dotfiles from github 60 | clone_dotfiles 61 | #check if there is an old config 62 | [ -d "$HOME_CONFIG_NVIM_DIR" ] && backup_nvim 63 | #copy new configuration 64 | copy_nvim 65 | 66 | if [ -a "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then 67 | echo 'Packer already installed.' 68 | else 69 | install_packer 70 | fi 71 | 72 | nvim -u "$HOME_CONFIG_NVIM_DIR/init.lua" "+PackerInstall" 73 | -------------------------------------------------------------------------------- /latexmk/.config/latexmk/latexmkrc: -------------------------------------------------------------------------------- 1 | $pdf_mode = 4; 2 | $postscript_mode = $dvi_mode = 0; 3 | 4 | add_cus_dep('glo', 'gls', 0, 'run_makeglossaries'); 5 | add_cus_dep('acn', 'acr', 0, 'run_makeglossaries'); 6 | 7 | sub run_makeglossaries { 8 | my ($base_name, $path) = fileparse( $_[0] ); 9 | pushd $path; 10 | if ( $silent ) { 11 | system "makeglossaries -q '$base_name'"; #unix 12 | } 13 | else { 14 | system "makeglossaries '$base_name'"; #unix 15 | }; 16 | popd; 17 | } 18 | 19 | push @generated_exts, 'glo', 'gls', 'glg'; 20 | push @generated_exts, 'acn', 'acr', 'alg'; 21 | $clean_ext .= ' %R.ist %R.xdy'; 22 | 23 | # vim:ft=perl 24 | -------------------------------------------------------------------------------- /mpv/.config/mpv/.gitignore: -------------------------------------------------------------------------------- 1 | watch_later/ 2 | -------------------------------------------------------------------------------- /mpv/.config/mpv/mpv.conf: -------------------------------------------------------------------------------- 1 | # 2 | # Example mpv configuration file 3 | # 4 | # Warning: 5 | # 6 | # The commented example options usually do _not_ set the default values. Call 7 | # mpv with --list-options to see the default values for most options. There is 8 | # no builtin or example mpv.conf with all the defaults. 9 | # 10 | # 11 | # Configuration files are read system-wide from /usr/local/etc/mpv.conf 12 | # and per-user from ~/.config/mpv/mpv.conf, where per-user settings override 13 | # system-wide settings, all of which are overridden by the command line. 14 | # 15 | # Configuration file settings and the command line options use the same 16 | # underlying mechanisms. Most options can be put into the configuration file 17 | # by dropping the preceding '--'. See the man page for a complete list of 18 | # options. 19 | # 20 | # Lines starting with '#' are comments and are ignored. 21 | # 22 | # See the CONFIGURATION FILES section in the man page 23 | # for a detailed description of the syntax. 24 | # 25 | # Profiles should be placed at the bottom of the configuration file to ensure 26 | # that settings wanted as defaults are not restricted to specific profiles. 27 | 28 | ################## 29 | # video settings # 30 | ################## 31 | 32 | # Start in fullscreen mode by default. 33 | #fs=yes 34 | 35 | # force starting with centered window 36 | #geometry=50%:50% 37 | 38 | # don't allow a new window to have a size larger than 90% of the screen size 39 | #autofit-larger=90%x90% 40 | 41 | # Do not close the window on exit. 42 | #keep-open=yes 43 | 44 | # Do not wait with showing the video window until it has loaded. (This will 45 | # resize the window once video is loaded. Also always shows a window with 46 | # audio.) 47 | #force-window=immediate 48 | 49 | # Disable the On Screen Controller (OSC). 50 | #osc=no 51 | 52 | # Keep the player window on top of all other windows. 53 | #ontop=yes 54 | 55 | # Specify high quality video rendering preset (for --vo=gpu only) 56 | # Can cause performance problems with some drivers and GPUs. 57 | #profile=gpu-hq 58 | 59 | # Force video to lock on the display's refresh rate, and change video and audio 60 | # speed to some degree to ensure synchronous playback - can cause problems 61 | # with some drivers and desktop environments. 62 | #video-sync=display-resample 63 | 64 | # Enable hardware decoding if available. Often, this does not work with all 65 | # video outputs, but should work well with default settings on most systems. 66 | # If performance or energy usage is an issue, forcing the vdpau or vaapi VOs 67 | # may or may not help. 68 | #hwdec=auto 69 | 70 | ################## 71 | # audio settings # 72 | ################## 73 | 74 | # Specify default audio device. You can list devices with: --audio-device=help 75 | # The option takes the device string (the stuff between the '...'). 76 | #audio-device=alsa/default 77 | 78 | # Do not filter audio to keep pitch when changing playback speed. 79 | #audio-pitch-correction=no 80 | 81 | # Output 5.1 audio natively, and upmix/downmix audio with a different format. 82 | #audio-channels=5.1 83 | # Disable any automatic remix, _if_ the audio output accepts the audio format. 84 | # of the currently played file. See caveats mentioned in the manpage. 85 | # (The default is "auto-safe", see manpage.) 86 | #audio-channels=auto 87 | 88 | ################## 89 | # other settings # 90 | ################## 91 | 92 | # Pretend to be a web browser. Might fix playback with some streaming sites, 93 | # but also will break with shoutcast streams. 94 | #user-agent="Mozilla/5.0" 95 | 96 | # cache settings 97 | # 98 | # Use a large seekable RAM cache even for local input. 99 | #cache=yes 100 | # 101 | # Use extra large RAM cache (needs cache=yes to make it useful). 102 | #demuxer-max-bytes=500M 103 | #demuxer-max-back-bytes=100M 104 | # 105 | # Disable the behavior that the player will pause if the cache goes below a 106 | # certain fill size. 107 | #cache-pause=no 108 | # 109 | # Store cache payload on the hard disk instead of in RAM. (This may negatively 110 | # impact performance unless used for slow input such as network.) 111 | #cache-dir=~/.cache/ 112 | #cache-on-disk=yes 113 | 114 | # Display English subtitles if available. 115 | #slang=en 116 | 117 | # Play Finnish audio if available, fall back to English otherwise. 118 | #alang=fi,en 119 | 120 | # Change subtitle encoding. For Arabic subtitles use 'cp1256'. 121 | # If the file seems to be valid UTF-8, prefer UTF-8. 122 | # (You can add '+' in front of the codepage to force it.) 123 | #sub-codepage=cp1256 124 | 125 | # You can also include other configuration files. 126 | #include=/path/to/the/file/you/want/to/include 127 | 128 | ############ 129 | # Profiles # 130 | ############ 131 | 132 | # The options declared as part of profiles override global default settings, 133 | # but only take effect when the profile is active. 134 | 135 | # The following profile can be enabled on the command line with: --profile=eye-cancer 136 | 137 | #[eye-cancer] 138 | #sharpen=5 139 | script-opts=osc-layout=bottombar,osc-vidscale=no 140 | save-position-on-quit 141 | ytdl-format=bestvideo[height<=480]+bestaudio/best[height<=480] 142 | -------------------------------------------------------------------------------- /neovim/.config/nvim/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 AS builder 2 | 3 | ARG BUILD_APT_DEPS="ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip git binutils" 4 | ARG DEBIAN_FRONTEND=noninteractive 5 | 6 | RUN apt update && apt upgrade -y && \ 7 | apt install -y ${BUILD_APT_DEPS} && \ 8 | git clone https://github.com/neovim/neovim.git /tmp/neovim --depth=1 && \ 9 | cd /tmp/neovim && \ 10 | make CMAKE_BUILD_TYPE=Release && \ 11 | make CMAKE_INSTALL_PREFIX=/usr/local install && \ 12 | strip /usr/local/bin/nvim 13 | RUN git clone https://github.com/tiagovla/.dotfiles.git /tmp/.dotfiles --depth=1 14 | 15 | FROM ubuntu:22.04 16 | ARG DEBIAN_FRONTEND=noninteractive 17 | RUN apt update && apt upgrade -y && apt install -y gcc g++ unzip wget git python3 nodejs 18 | COPY --from=builder /usr/local /usr/local/ 19 | COPY --from=builder /tmp/.dotfiles/neovim/.config/nvim /root/.config/nvim/ 20 | 21 | CMD ["/usr/local/bin/nvim"] 22 | -------------------------------------------------------------------------------- /neovim/.config/nvim/actions.json: -------------------------------------------------------------------------------- 1 | { 2 | "rewrite_academic": { 3 | "type": "chat", 4 | "opts": { 5 | "template": "Rewrite the following text more naturally in academic form keeping the latex syntax. Do not remove cref, gls and cite latex commands. Do use cref instead of ref ommiting Chapter, Figure,... \n\n{{input}}", 6 | "strategy": "replace", 7 | "params": { 8 | "model": "gpt-3.5-turbo", 9 | "temperature": 0.5, 10 | "frequency_penalty": 0.8 11 | } 12 | } 13 | }, 14 | "rewrite": { 15 | "type": "chat", 16 | "opts": { 17 | "template": "Rewrite the following text.\n\n{{input}}", 18 | "strategy": "replace", 19 | "params": { 20 | "model": "gpt-3.5-turbo", 21 | "temperature": 0.5, 22 | "frequency_penalty": 0.8, 23 | "max_tokens": 2048 24 | } 25 | } 26 | }, 27 | "doit": { 28 | "type": "chat", 29 | "opts": { 30 | "template": "{{input}}", 31 | "strategy": "replace", 32 | "params": { 33 | "model": "gpt-3.5-turbo", 34 | "temperature": 0.5, 35 | "frequency_penalty": 0.8, 36 | "max_tokens": 2048 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/ftplugin/cpp.lua: -------------------------------------------------------------------------------- 1 | vim.opt_local.shiftwidth = 2 2 | vim.opt_local.colorcolumn = "100" 3 | vim.o.foldmethod = "marker" 4 | vim.o.foldmarker = "/*,*/" 5 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/ftplugin/oil_preview.lua: -------------------------------------------------------------------------------- 1 | -- vim.keymap.set("n", "", function() 2 | -- vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("o", true, false, true), "n", true) 3 | -- end, { silent = true }) 4 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/ftplugin/python.lua: -------------------------------------------------------------------------------- 1 | -- vim.fn.jobstart({"blackd"}) 2 | vim.cmd [[compiler python]] 3 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/ftplugin/tex.lua: -------------------------------------------------------------------------------- 1 | -- local call = vim.api.nvim_call_function 2 | vim.keymap.set("n", "gqq", "mzgqip`z", {}) 3 | -- defer 1s and call the command below 4 | vim.defer_fn(function() 5 | vim.cmd "syntax on" 6 | end, 500) 7 | 8 | -- call("TexNewMathZone", { "E", "align", 1 }) 9 | -- call("TexNewMathZone", { "F", "alignat", 1 }) 10 | -- call("TexNewMathZone", { "G", "equation", 1 }) 11 | -- call("TexNewMathZone", { "H", "flalign", 1 }) 12 | -- call("TexNewMathZone", { "I", "gather", 1 }) 13 | -- call("TexNewMathZone", { "J", "multline", 1 }) 14 | -- call("TexNewMathZone", { "K", "xalignat", 1 }) 15 | -- call("TexNewMathZone", { "L", "dmath", 0 }) 16 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/ftplugin/tom.lua: -------------------------------------------------------------------------------- 1 | vim.opt.tabstop = 2 -- number of visual spaces per TAB 2 | vim.opt.softtabstop = 2 -- number of spaces in tab when editing 3 | vim.opt.shiftwidth = 2 -- number of spaces to use for autoindent 4 | vim.opt.expandtab = false -- expand tab to spaces so that tabs are spaces 5 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/plugin/apm.lua: -------------------------------------------------------------------------------- 1 | local counter = {} 2 | local counter_mt = { __index = counter } 3 | 4 | function counter:new() 5 | local timer = vim.loop.new_timer() 6 | local history = {} 7 | for index = 1, 60 do 8 | history[index] = 0 9 | end 10 | local state = { _accumulative = 0, history = history, timer = timer } 11 | return setmetatable(state, counter_mt) 12 | end 13 | 14 | function counter:register() 15 | for index = 59, 1, -1 do 16 | self.history[index + 1] = self.history[index] 17 | end 18 | self.history[1] = self._accumulative 19 | self._accumulative = 0 20 | end 21 | 22 | function counter:tick(value) 23 | if value == nil then 24 | self._accumulative = self._accumulative + 1 25 | else 26 | self._accumulative = value 27 | end 28 | end 29 | 30 | function counter:get_history(limit) 31 | local result = {} 32 | for index = 1, limit do 33 | result[index] = self.history[index] 34 | end 35 | return result 36 | end 37 | 38 | function counter:get_average(limit) 39 | local last = self:get_history(limit) 40 | local sum = 0 41 | for _, v in ipairs(last) do 42 | sum = sum + v 43 | end 44 | return sum * 60 / limit 45 | end 46 | 47 | function counter:start() 48 | self.timer:start( 49 | 0, 50 | 1000, 51 | vim.schedule_wrap(function() 52 | self:register() 53 | end) 54 | ) 55 | end 56 | 57 | function counter:stop() 58 | self.timer:stop() 59 | end 60 | 61 | function counter:close() 62 | self.timer:close() 63 | end 64 | 65 | -- local actions = counter:new() 66 | -- local edits = counter:new() 67 | -- actions:start() 68 | -- edits:start() 69 | -- 70 | -- local ns = vim.api.nvim_create_namespace "apm" 71 | -- vim.on_key(function() 72 | -- actions:tick() 73 | -- end, ns) 74 | -- 75 | -- local augroup = vim.api.nvim_create_augroup("APM", {}) 76 | -- vim.api.nvim_create_autocmd({ "TextChanged", "TextChangedI", "TextChangedP" }, { 77 | -- group = augroup, 78 | -- callback = function() 79 | -- edits:tick() 80 | -- end, 81 | -- }) 82 | 83 | -- local timer = vim.loop.new_timer() 84 | -- timer:start( 85 | -- 0, 86 | -- 500, 87 | -- vim.schedule_wrap(function() 88 | -- local apm = "APM: " .. actions:get_average(2) .. " [" .. actions:get_average(60) .. "]" 89 | -- local epm = "EPM: " .. edits:get_average(2) .. " [" .. edits:get_average(60) .. "]" 90 | -- vim.pretty_print(apm .. " " .. epm) 91 | -- end) 92 | -- ) 93 | -- 94 | -- vim.defer_fn(function() 95 | -- actions:stop() 96 | -- actions:close() 97 | -- edits:stop() 98 | -- edits:close() 99 | -- timer:stop() 100 | -- timer:close() 101 | -- end, 20000) 102 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/plugin/async_make.lua: -------------------------------------------------------------------------------- 1 | -- local function make() 2 | -- local lines = { "" } 3 | -- local winnr = vim.fn.win_getid() 4 | -- local bufnr = vim.api.nvim_win_get_buf(winnr) 5 | -- 6 | -- local makeprg = vim.api.nvim_get_option_value("makeprg", {}) 7 | -- local efm = vim.api.nvim_get_option_value("errorformat", {}) 8 | -- 9 | -- if not makeprg then 10 | -- return 11 | -- end 12 | -- 13 | -- local cmd = vim.fn.expandcmd(makeprg) 14 | -- vim.print("Running: " .. cmd) 15 | -- 16 | -- local function on_event(job_id, data, event) 17 | -- if event == "stdout" or event == "stderr" then 18 | -- if data then 19 | -- vim.list_extend(lines, data) 20 | -- end 21 | -- end 22 | -- 23 | -- if event == "exit" then 24 | -- vim.fn.setqflist({}, " ", { 25 | -- title = cmd, 26 | -- lines = lines, 27 | -- efm = efm, 28 | -- }) 29 | -- vim.api.nvim_command "doautocmd QuickFixCmdPost" 30 | -- for i = #lines, 1, -1 do 31 | -- if lines[i] == "" then 32 | -- table.remove(lines, i) 33 | -- end 34 | -- end 35 | -- vim.print("Done: " .. cmd) 36 | -- end 37 | -- end 38 | -- 39 | -- local job_id = vim.fn.jobstart(cmd, { 40 | -- on_stderr = on_event, 41 | -- on_stdout = on_event, 42 | -- on_exit = on_event, 43 | -- stdout_buffered = true, 44 | -- stderr_buffered = true, 45 | -- }) 46 | -- end 47 | -- 48 | -- local terminal = require("toggleterm.terminal").Terminal 49 | -- 50 | -- vim.api.nvim_create_user_command("Makee", function() 51 | -- local lazygit = terminal:new { 52 | -- -- cmd = "make", 53 | -- dir = "/home/tiagovla/github/oiseau/", 54 | -- hidden = true, 55 | -- -- close_on_exit = false, 56 | -- on_stdout = function() 57 | -- print "out" 58 | -- end, 59 | -- on_stderr = function() 60 | -- print "err" 61 | -- end, 62 | -- on_exit = function() 63 | -- print "exit" 64 | -- end, 65 | -- } 66 | -- lazygit:toggle() 67 | -- lazygit:send "m" 68 | -- end, {}) 69 | -- 70 | -- vim.api.nvim_create_user_command("Make", make, {}) 71 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/plugin/image_paste.lua: -------------------------------------------------------------------------------- 1 | local ok, _ = pcall(require, "plenary") 2 | if not ok then 3 | return 4 | end 5 | 6 | local Job = require "plenary.job" 7 | local Path = require "plenary.path" 8 | 9 | local get_targets = function() 10 | local j = Job:new { 11 | command = "xclip", 12 | args = { "-selection", "clipboard", "-t", "TARGETS", "-o" }, 13 | } 14 | return vim.tbl_filter(function(x) 15 | return string.match(x, "^image/") 16 | end, j:sync()) 17 | end 18 | 19 | local function get_info(targets) 20 | if not vim.tbl_contains(targets, "image/png") then 21 | return { "image/png", "png" } 22 | else 23 | return { targets[1], vim.split(targets[1], "/")[2] } 24 | end 25 | end 26 | 27 | local function save_image(folder, target, filename, extension) 28 | local image = ("%s.%s"):format(filename, extension) 29 | local path = Path:new(folder) 30 | path:mkdir { parents = true } 31 | path = path:joinpath(image) 32 | local i = 1 33 | while path:exists() do 34 | path = path:parent():joinpath(("%s_%d.%s"):format(filename, i, extension)) 35 | i = i + 1 36 | end 37 | local cmd = [[xclip -selection clipboard -t %s -o > %s]] 38 | vim.fn.system(cmd:format(target, path)) 39 | return path 40 | end 41 | 42 | local function image_paste(func) 43 | local targets = get_targets() 44 | if #targets == 0 then 45 | return true 46 | end 47 | local target, extension = unpack(get_info(targets)) 48 | local prompt_opts = { 49 | prompt = "Image name: ", 50 | default = "image", 51 | } 52 | vim.ui.input(prompt_opts, function(filename) 53 | if not filename or #filename == 0 then 54 | return 55 | end 56 | local path = save_image("images", target, filename, extension) 57 | path = path:make_relative() 58 | if func then 59 | func(path) 60 | end 61 | end) 62 | end 63 | 64 | local function image_paste_tex() 65 | local function func(path) 66 | local cursor = vim.api.nvim_win_get_cursor(0) 67 | vim.api.nvim_buf_set_lines(0, cursor[1] - 1, cursor[1], false, { 68 | "\\begin{figure}[h]", 69 | " \\centering", 70 | " \\includegraphics[]{" .. path .. "}", 71 | "\\end{figure}", 72 | }) 73 | end 74 | image_paste(func) 75 | end 76 | 77 | vim.paste = (function(overridden) 78 | return function(lines, phase) 79 | local reg = vim.fn.getreg "+" 80 | if reg == "" and vim.bo[0].ft == "tex" then 81 | image_paste_tex() 82 | else 83 | overridden(lines, phase) 84 | end 85 | end 86 | end)(vim.paste) 87 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/plugin/lsp-on-type-formatting.lua: -------------------------------------------------------------------------------- 1 | local util = require "vim.lsp.util" 2 | -- 3 | -- local function handler(_, result, ctx) 4 | -- local client = vim.lsp.get_client_by_id(ctx.client_id) 5 | -- util.apply_text_edits(result, ctx.bufnr, client.offset_encoding) 6 | -- end 7 | -- 8 | -- local function format_on_type() 9 | -- local client = vim.lsp.get_active_clients { name = "clangd" } 10 | -- local buf = vim.api.nvim_get_current_buf() 11 | -- if #client == 0 then 12 | -- return 13 | -- else 14 | -- client = client[1] 15 | -- end 16 | -- 17 | -- local params = util.make_formatting_params {} 18 | -- local cursor = vim.api.nvim_win_get_cursor(0) 19 | -- params.position = { line = cursor[1], character = cursor[2] } 20 | -- params.ch = "\n" 21 | -- client.request("textDocument/onTypeFormatting", params, handler, buf) 22 | -- end 23 | -- 24 | -- local ns = vim.api.nvim_create_namespace "onTypeFormatting" 25 | -- local function handler_on_key(key) 26 | -- local mode = vim.api.nvim_get_mode().mode 27 | -- if mode == "i" and key == "\r" then 28 | -- if vim.bo[0].filetype == "cpp" then 29 | -- vim.pretty_print(key) 30 | -- format_on_type() 31 | -- end 32 | -- end 33 | -- end 34 | -- 35 | -- vim.on_key(handler_on_key, ns) 36 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/plugin/python-cc.lua: -------------------------------------------------------------------------------- 1 | -- Logic to parse pyproject.toml and set colorcolumn 2 | local function file_exists(file) 3 | local f = io.open(file, "rb") 4 | if f then 5 | f:close() 6 | end 7 | return f ~= nil 8 | end 9 | 10 | local function lines_from(file) 11 | if not file_exists(file) then 12 | return {} 13 | end 14 | local lines = {} 15 | for line in io.lines(file) do 16 | lines[#lines + 1] = line 17 | end 18 | return lines 19 | end 20 | 21 | local function get_root(bufnr, ft) 22 | local parser = vim.treesitter.get_parser(bufnr, ft, {}) 23 | local tree = parser:parse()[1] 24 | return tree:root() 25 | end 26 | 27 | local function get_black_length(bufnr) 28 | local query = vim.treesitter.query.parse( 29 | "toml", 30 | [[ 31 | (table 32 | (dotted_key) @dotkey (#eq? @dotkey "tool.black") 33 | (pair 34 | (bare_key) @barekey (#eq? @barekey "line-length") 35 | (integer) @length 36 | ) 37 | ) 38 | ]] 39 | ) 40 | local root = get_root(bufnr, "toml") 41 | for id, node in query:iter_captures(root, bufnr, 0, -1) do 42 | local name = query.captures[id] 43 | if name == "length" then 44 | return vim.treesitter.get_node_text(node, bufnr) 45 | end 46 | end 47 | end 48 | 49 | vim.api.nvim_create_autocmd("LspAttach", { 50 | callback = function(args) 51 | local buffer = args.buf 52 | 53 | if vim.bo[buffer].ft ~= "python" then 54 | return 55 | end 56 | local file_name = "pyproject.toml" 57 | local tmp_buf = vim.api.nvim_create_buf(false, true) 58 | vim.api.nvim_buf_set_lines(tmp_buf, 0, -1, false, lines_from(file_name)) 59 | local length = get_black_length(tmp_buf) 60 | vim.opt_local.colorcolumn = tostring(length or "88") 61 | vim.api.nvim_buf_delete(tmp_buf, {}) 62 | end, 63 | }) 64 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/plugin/python-env.lua: -------------------------------------------------------------------------------- 1 | local function get_std_envs() 2 | local envs = {} 3 | if vim.env.VIRTUAL_ENV then 4 | envs["VIRTUAL_ENV"] = table.concat({ vim.env.VIRTUAL_ENV, "bin", "python" }, "/") 5 | end 6 | local sys = vim.fn.exepath "python3" or vim.fn.exepath "python" or "/bin/python" 7 | envs["System"] = sys 8 | return envs 9 | end 10 | 11 | local function get_poetry_envs() 12 | local envs = {} 13 | local venv = vim.fn.trim(vim.fn.system "poetry env list --full-path") 14 | for match in string.gmatch(venv, "[%w%/%.%-]*virtualenv[%w%/%.%-]*") do 15 | local split = vim.fn.split(match, "/") 16 | envs["Poetry: " .. split[#split]] = table.concat({ match, "bin", "python" }, "/") 17 | end 18 | return envs 19 | end 20 | 21 | local function get_python_client() 22 | local pylance = vim.lsp.get_active_clients { name = "pylance" } 23 | local pyright = vim.lsp.get_active_clients { name = "pyright" } 24 | local clients = vim.tbl_extend("force", pylance, pyright) 25 | if #clients > 0 then 26 | return clients[1] 27 | end 28 | end 29 | 30 | local function env_handler() 31 | local client = get_python_client() 32 | if not client then 33 | vim.notify "No python clients found" 34 | end 35 | local options = vim.tbl_extend("force", get_std_envs(), get_poetry_envs()) 36 | local settings = client.config.settings 37 | local active = settings.python.pythonPath 38 | vim.ui.select(vim.tbl_keys(options), { 39 | prompt = "Select a Python Environment:", 40 | format_item = function(item) 41 | if options[item] == active then 42 | return item .. " (Active)" 43 | end 44 | return item 45 | end, 46 | }, function(selected) 47 | if selected then 48 | settings.python.pythonPath = options[selected] 49 | client.notify("workspace/didChangeConfiguration", { settings = settings }) 50 | end 51 | end) 52 | end 53 | 54 | vim.api.nvim_create_user_command("PythonEnv", env_handler, {}) 55 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/plugin/tex_formatter.lua: -------------------------------------------------------------------------------- 1 | local ts_utils = require "nvim-treesitter.ts_utils" 2 | 3 | local run_formatter = function(text) 4 | local result = table.concat(text, " ") 5 | -- vim.print(result) 6 | local width = vim.opt.textwidth:get() or "80" 7 | local j = require("plenary.job"):new { 8 | command = "fmt", 9 | args = { "-w" .. width, "-u" }, 10 | writer = { result }, 11 | } 12 | return j:sync() 13 | end 14 | 15 | -- Get the start and end positions of the given nodes. 16 | local function get_min_max_range(nodes) 17 | local min, max = nodes[1]:start(), nodes[1]:end_() 18 | for _, node in ipairs(nodes) do 19 | local start = node:start() 20 | local end_ = node:end_() 21 | min = math.min(min, start) 22 | max = math.max(max, end_) 23 | end 24 | return min, max 25 | end 26 | 27 | -- Get the root node of the tree for a specific filetype. 28 | local function get_root_node(bufnr, ft) 29 | local parser = vim.treesitter.get_parser(bufnr, ft) 30 | local tree = parser:parse()[1] 31 | return tree:root() 32 | end 33 | 34 | -- Format the lines from `start_line` to `end_line`. 35 | local function format_lines(start_line, end_line) 36 | vim.api.nvim_win_set_cursor(0, { start_line, 0 }) 37 | vim.cmd "normal! V" -- Enter visual mode 38 | vim.api.nvim_win_set_cursor(0, { end_line, 0 }) -- Select lines up to `end_line` 39 | vim.cmd "normal! gq" -- Apply formatting 40 | end 41 | 42 | -- Group nodes of specific types ("text" and "inline_formula") and format them. 43 | local function group_and_format_nodes() 44 | local groups = {} 45 | local current_group = {} 46 | local types_to_group = { "text", "inline_formula", ",", ")" } 47 | local root = get_root_node(0, "latex") 48 | 49 | -- Iterate over the root's children and group the nodes 50 | for child in root:iter_children() do 51 | if child:type() == "generic_environment" then 52 | for grandchild in child:iter_children() do 53 | if vim.tbl_contains(types_to_group, grandchild:type()) then 54 | table.insert(current_group, grandchild) 55 | elseif #current_group > 0 then 56 | table.insert(groups, current_group) 57 | current_group = {} -- Start a new group 58 | end 59 | 60 | if grandchild:type() == "section" then 61 | for grandgrandchild in grandchild:iter_children() do 62 | -- vim.print(grandgrandchild:type()) 63 | if vim.tbl_contains(types_to_group, grandgrandchild:type()) then 64 | table.insert(current_group, grandgrandchild) 65 | elseif #current_group > 0 then 66 | table.insert(groups, current_group) 67 | current_group = {} -- Start a new group 68 | end 69 | 70 | if grandgrandchild:type() == "subsection" then 71 | for grandgrandgrandchild in grandgrandchild:iter_children() do 72 | -- vim.print(grandgrandgrandchild:type()) 73 | if vim.tbl_contains(types_to_group, grandgrandgrandchild:type()) then 74 | table.insert(current_group, grandgrandgrandchild) 75 | elseif #current_group > 0 then 76 | table.insert(groups, current_group) 77 | current_group = {} -- Start a new group 78 | end 79 | end 80 | end 81 | end 82 | end 83 | end 84 | end 85 | end 86 | -- Insert last group if not empty 87 | if #current_group > 0 then 88 | table.insert(groups, current_group) 89 | end 90 | 91 | -- Save current cursor position and format the groups in reverse order 92 | local cursor_pos = vim.api.nvim_win_get_cursor(0) 93 | for i = #groups, 1, -1 do 94 | local group = groups[i] 95 | local min, max = get_min_max_range(group) 96 | -- vim.print { min, max } 97 | format_lines(min + 1, max + 1) -- +1 because Lua is 1-indexed 98 | end 99 | -- Restore the cursor position 100 | vim.api.nvim_win_set_cursor(0, cursor_pos) 101 | end 102 | 103 | -- Keymap for formatting the block 104 | vim.keymap.set("n", "q", group_and_format_nodes, {}) 105 | -------------------------------------------------------------------------------- /neovim/.config/nvim/after/plugin/zoom.lua: -------------------------------------------------------------------------------- 1 | local function toggle_win_zoom() 2 | local layout = {} 3 | 4 | for _, win in ipairs(vim.api.nvim_list_wins()) do 5 | layout[win] = vim.api.nvim_win_get_config(win) 6 | end 7 | 8 | local ok, value = pcall(vim.api.nvim_win_get_var, 0, "zoomed_win") 9 | 10 | if ok and type(value) == "table" then 11 | for win, config in pairs(value) do 12 | if vim.api.nvim_win_is_valid(win) then 13 | vim.api.nvim_win_set_config(win, config) 14 | end 15 | end 16 | vim.api.nvim_win_set_var(0, "zoomed_win", nil) 17 | else 18 | local old_config = vim.api.nvim_win_get_config(0) 19 | local config = vim.deepcopy(old_config) 20 | config.width = vim.api.nvim_get_option "columns" 21 | config.height = vim.api.nvim_get_option "lines" 22 | if old_config.height ~= config.height or old_config.width ~= config.width then 23 | vim.api.nvim_win_set_var(0, "zoomed_win", layout) 24 | vim.api.nvim_win_set_config(0, config) 25 | end 26 | end 27 | end 28 | 29 | vim.keymap.set("n", "z", toggle_win_zoom, { desc = "Zoom in window", noremap = true, silent = true }) 30 | -------------------------------------------------------------------------------- /neovim/.config/nvim/compiler/python.vim: -------------------------------------------------------------------------------- 1 | " Compiler: Python 2 | 3 | if exists("current_compiler") 4 | finish 5 | endif 6 | 7 | let current_compiler = "python" 8 | 9 | if exists(":CompilerSet") != 2 " older Vim always used :setlocal 10 | command -nargs=* CompilerSet setlocal 11 | endif 12 | 13 | " Disable Python warnings 14 | if !exists('$PYTHONWARNINGS') 15 | let $PYTHONWARNINGS="ignore" 16 | endif 17 | 18 | " Enhanced error formatting for Python (pytest, Flake8, etc.) 19 | CompilerSet efm =%E%f:%l:\ could\ not\ compile, 20 | CompilerSet efm +=%-Z%p^, 21 | CompilerSet efm +=%A%f:%l:%c:\ %t%n\ %m, 22 | CompilerSet efm +=%A%f:%l:\ %t%n\ %m, 23 | 24 | " Capture traceback in error output 25 | CompilerSet efm +=%+GTraceback%.%#, 26 | 27 | " Capture Python error messages starting with 'File', including line number and message 28 | CompilerSet efm +=%E\ \ File\ \"%f\"\\,\ line\ %l\\,%m%\\C, 29 | CompilerSet efm +=%E\ \ File\ \"%f\"\\,\ line\ %l%\\C, 30 | 31 | " Handle continuation lines, properly highlight the column where the error occurs 32 | CompilerSet efm +=%C%p^, 33 | 34 | " Capture indented error information, useful for deeper Python errors 35 | CompilerSet efm +=%+C\ \ \ \ %.%#, 36 | CompilerSet efm +=%+C\ \ %.%#, 37 | 38 | " Catch Python-specific warnings or general message at the end of an error 39 | CompilerSet efm +=%Z%\\S%\\&%m, 40 | 41 | " Ignore unnecessary lines from Python traceback 42 | CompilerSet efm +=%-G%.%# 43 | 44 | " Improved handling for pytest output (if used) 45 | CompilerSet efm +=%A%f:%l:\ %m, 46 | 47 | " Default command for running the Python code 48 | if filereadable("Makefile") 49 | CompilerSet makeprg=make 50 | else 51 | CompilerSet makeprg=python3 52 | endif 53 | 54 | " vim:foldmethod=marker:foldlevel=0 55 | -------------------------------------------------------------------------------- /neovim/.config/nvim/init.lua: -------------------------------------------------------------------------------- 1 | -- vim.lsp.set_log_level "debug" 2 | vim.deprecate = function() end -- YOLO 3 | vim.loader.enable() 4 | require "tiagovla" 5 | 6 | require "plugins" 7 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/init.lua: -------------------------------------------------------------------------------- 1 | local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" 2 | if not vim.loop.fs_stat(lazypath) then 3 | vim.fn.system { 4 | "git", 5 | "clone", 6 | "--filter=blob:none", 7 | "--single-branch", 8 | "https://github.com/folke/lazy.nvim.git", 9 | lazypath, 10 | } 11 | end 12 | vim.opt.runtimepath:prepend(lazypath) 13 | 14 | require("lazy").setup("plugins.modules", { 15 | defaults = { lazy = true }, 16 | install = { colorscheme = { "tokyodark" } }, 17 | change_detection = { 18 | enabled = true, 19 | notify = false, 20 | }, 21 | ui = { border = "rounded" }, 22 | checker = { enabled = false }, 23 | performance = { 24 | rtp = { 25 | disabled_plugins = { 26 | "gzip", 27 | "matchit", 28 | "matchparen", 29 | "netrwPlugin", 30 | "tarPlugin", 31 | "tohtml", 32 | "tutor", 33 | "zipPlugin", 34 | }, 35 | }, 36 | }, 37 | git = { timeout = 600 }, 38 | debug = false, 39 | dev = { 40 | path = "~/github", 41 | pattern = { "tiagovla" }, 42 | fallback = true, 43 | }, 44 | }) 45 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "nvim-tree/nvim-web-devicons", 4 | config = function() 5 | require("nvim-web-devicons").setup { default = true } 6 | end, 7 | }, 8 | { "famiu/bufdelete.nvim", event = "VeryLazy" }, 9 | { "krady21/compiler-explorer.nvim", event = "VeryLazy" }, 10 | { "Almo7aya/openingh.nvim", event = "VeryLazy" }, 11 | { 12 | "tiagovla/scope.nvim", 13 | event = "BufRead", 14 | config = function() 15 | require("scope").setup { restore_state = true } 16 | vim.keymap.set({ "n", "o", "x" }, "T", function() 17 | local old_tab = vim.api.nvim_get_current_tabpage() 18 | local buf = vim.api.nvim_get_current_buf() 19 | vim.cmd [[execute "normal! \T"]] 20 | local new_tab = vim.api.nvim_get_current_tabpage() 21 | if old_tab ~= new_tab then 22 | local cache = require("scope.core").cache 23 | cache[old_tab] = vim.tbl_filter(function(e) 24 | return e ~= buf 25 | end, cache[old_tab]) 26 | end 27 | end, { desc = "move into new tab", remap = true }) 28 | end, 29 | dev = true, 30 | }, 31 | { 32 | "tiagovla/buffercd.nvim", 33 | event = "BufRead", 34 | config = function() 35 | require("buffercd").setup {} 36 | end, 37 | }, 38 | { "tiagovla/tex-conceal.vim", ft = "tex" }, 39 | { 40 | "tiagovla/projet.nvim", 41 | config = function() 42 | require("projet").setup {} 43 | vim.keymap.set("n", "kk", function() 44 | require("projet").prompt() 45 | end, { desc = "Project files" }) 46 | vim.keymap.set("n", "kl", function() 47 | require("projet").toggle_editor() 48 | end, { desc = "Project files" }) 49 | end, 50 | dev = true, 51 | event = "VeryLazy", 52 | }, 53 | { 54 | "nvim-treesitter/nvim-treesitter-context", 55 | config = function() 56 | require("treesitter-context").setup { 57 | enable = true, 58 | max_lines = 0, 59 | min_window_height = 0, 60 | line_numbers = true, 61 | multiline_threshold = 20, 62 | trim_scope = "outer", 63 | mode = "cursor", 64 | separator = nil, 65 | zindex = 20, 66 | on_attach = nil, 67 | } 68 | end, 69 | }, 70 | { 71 | "OXY2DEV/markview.nvim", 72 | lazy = false, 73 | ft = "markdown", 74 | dependencies = { 75 | "nvim-treesitter/nvim-treesitter", 76 | "nvim-tree/nvim-web-devicons", 77 | }, 78 | }, 79 | { 80 | "windwp/nvim-ts-autotag", 81 | lazy = false, 82 | config = function() 83 | require("nvim-ts-autotag").setup { 84 | opts = { 85 | enable_close = true, 86 | enable_rename = true, 87 | enable_close_on_slash = false, 88 | }, 89 | per_filetype = { 90 | ["html"] = { 91 | enable_close = false, 92 | }, 93 | }, 94 | } 95 | end, 96 | }, 97 | { 98 | "lowitea/aw-watcher.nvim", 99 | lazy = false, 100 | opts = { 101 | aw_server = { 102 | host = "127.0.0.1", 103 | port = 5600, 104 | }, 105 | }, 106 | }, 107 | 108 | { 109 | "CopilotC-Nvim/CopilotChat.nvim", 110 | lazy = false, 111 | dependencies = { 112 | { "zbirenbaum/copilot.lua" }, 113 | { "nvim-lua/plenary.nvim", branch = "master" }, 114 | }, 115 | build = "make tiktoken", 116 | opts = {}, 117 | }, 118 | { 119 | "folke/snacks.nvim", 120 | priority = 1000, 121 | lazy = false, 122 | opts = { 123 | gitbrowse = { enabled = true }, 124 | bigfile = { enabled = true }, 125 | -- notifier = { enabled = true }, 126 | quickfile = { enabled = true }, 127 | words = { enabled = true }, 128 | }, 129 | }, 130 | { 131 | "yioneko/nvim-type-fmt", 132 | lazy = false, 133 | config = function() 134 | require("type-fmt").setup {} 135 | end, 136 | }, 137 | 138 | { 139 | "mfussenegger/nvim-lint", 140 | lazy = false, 141 | 142 | config = function() 143 | local lint = require "lint" 144 | lint.linters_by_ft = { 145 | ["cpp"] = { "cppcheck" }, 146 | ["hpp"] = { "cppcheck" }, 147 | } 148 | lint.linters.cppcheck.args[#lint.linters.cppcheck.args + 1] = "--check-level=exhaustive" 149 | vim.api.nvim_create_autocmd({ "BufWritePost", "BufEnter" }, { 150 | callback = function() 151 | require("lint").try_lint() 152 | end, 153 | }) 154 | end, 155 | }, 156 | } 157 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/barbecue.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "utilyre/barbecue.nvim", 3 | name = "barbecue", 4 | version = "*", 5 | dependencies = { 6 | "SmiteshP/nvim-navic", 7 | "nvim-tree/nvim-web-devicons", 8 | }, 9 | opts = {}, 10 | lazy = false, 11 | } 12 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/bufferline.lua: -------------------------------------------------------------------------------- 1 | local function get_harpoon_mark_from_id(id) 2 | local harpoon = require "harpoon" 3 | local Path = require "plenary.path" 4 | local list = harpoon:list() 5 | 6 | local buf_name = vim.api.nvim_buf_get_name(id) 7 | local root_dir = list.config.get_root_dir() 8 | local n_path = Path:new(buf_name):make_relative(root_dir) 9 | local _, idx = list:get_by_value(n_path) 10 | return idx 11 | end 12 | 13 | return { 14 | "akinsho/nvim-bufferline.lua", 15 | lazy = false, 16 | init = function() 17 | vim.keymap.set("n", "", "BufferLineCycleNext") 18 | vim.keymap.set("n", "", "BufferLineCyclePrev") 19 | end, 20 | opts = { 21 | options = { 22 | view = "multiwindow", 23 | numbers = function(opts) 24 | return get_harpoon_mark_from_id(opts.id) 25 | end, 26 | modified_icon = "●", 27 | max_prefix_length = 5, 28 | tab_size = 18, 29 | diagnostics = "nvim_lsp", 30 | separator_style = { "|", "" }, 31 | offsets = { 32 | { 33 | filetype = "NvimTree", 34 | text = "File Explorer", 35 | text_align = "center", 36 | }, 37 | }, 38 | sort_by = function(buffer_a, buffer_b) 39 | local function get_local_mark(id) 40 | return get_harpoon_mark_from_id(id) or 999999 41 | end 42 | return get_local_mark(buffer_a.id) < get_local_mark(buffer_b.id) 43 | end, 44 | }, 45 | }, 46 | } 47 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/chatgpt.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "jackMort/ChatGPT.nvim", 3 | event = "VeryLazy", 4 | config = function() 5 | require("chatgpt").setup { 6 | actions_paths = { vim.fs.joinpath(vim.fn.stdpath "config", "actions.json") }, 7 | } 8 | end, 9 | init = function() 10 | vim.keymap.set("n", "cr", "vip:ChatGPTRun rewrite", { desc = "chatGPT rewrite" }) 11 | vim.keymap.set("n", "cR", "vip:ChatGPTRun rewrite_academic", { desc = "chatGPT rewrite academic" }) 12 | vim.keymap.set("v", "cR", ":ChatGPTRun rewrite", { desc = "chatGPT rewrite" }) 13 | vim.keymap.set("v", "cr", ":ChatGPTRun rewrite_academic", { desc = "chatGPT rewrite academic" }) 14 | vim.keymap.set("v", "cd", ":ChatGPTRun doit", { desc = "chatGPT do it" }) 15 | end, 16 | dependencies = { 17 | "MunifTanjim/nui.nvim", 18 | "nvim-lua/plenary.nvim", 19 | "nvim-telescope/telescope.nvim", 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/cmp.lua: -------------------------------------------------------------------------------- 1 | local M = { 2 | { 3 | "saghen/blink.cmp", 4 | version = "v1.3.1", 5 | dependencies = { 6 | { "rafamadriz/friendly-snippets" }, 7 | { "hrsh7th/cmp-nvim-lua" }, 8 | { "kdheepak/cmp-latex-symbols" }, 9 | { "onsails/lspkind-nvim" }, 10 | { 11 | "saghen/blink.compat", 12 | version = "v2.5.0", 13 | lazy = true, 14 | opts = { 15 | impersonate_nvim_cmp = true, 16 | debug = true, 17 | }, 18 | }, 19 | { 20 | "tiagovla/zotex.nvim", 21 | config = function() 22 | require("zotex").setup {} 23 | end, 24 | dependencies = { "kkharji/sqlite.lua" }, 25 | dev = true, 26 | }, 27 | }, 28 | opts = { 29 | enabled = function() 30 | return not vim.list_contains({ "DressingInput" }, vim.bo.filetype) 31 | and vim.bo.buftype ~= "prompt" 32 | and vim.b.completion ~= false 33 | end, 34 | snippets = { 35 | preset = "luasnip", 36 | expand = function(snippet) 37 | require("luasnip").lsp_expand(snippet) 38 | end, 39 | active = function(filter) 40 | if filter and filter.direction then 41 | return require("luasnip").jumpable(filter.direction) 42 | end 43 | return require("luasnip").in_snippet() 44 | end, 45 | jump = function(direction) 46 | require("luasnip").jump(direction) 47 | end, 48 | }, 49 | cmdline = { 50 | keymap = { 51 | preset = "enter", 52 | [""] = { "show_and_insert", "select_next" }, 53 | [""] = { "show_and_insert", "select_prev" }, 54 | [""] = { "accept_and_enter", "fallback" }, 55 | }, 56 | sources = function() 57 | return vim.fn.getcmdtype() == ":" and { "cmdline" } or {} 58 | end, 59 | completion = { 60 | menu = { 61 | auto_show = function(ctx) 62 | return vim.fn.getcmdtype() == ":" 63 | end, 64 | }, 65 | }, 66 | }, 67 | appearance = { 68 | use_nvim_cmp_as_default = true, 69 | nerd_font_variant = "mono", 70 | }, 71 | sources = { 72 | default = { "lsp", "path", "snippets", "buffer", "latex_symbols", "zotex", "nvim_lua" }, 73 | providers = { 74 | nvim_lua = { 75 | name = "nvim_lua", 76 | module = "blink.compat.source", 77 | score_offset = -3, 78 | opts = {}, 79 | }, 80 | latex_symbols = { 81 | name = "latex_symbols", 82 | module = "blink.compat.source", 83 | score_offset = -3, 84 | opts = {}, 85 | }, 86 | zotex = { 87 | name = "zotex", 88 | module = "blink.compat.source", 89 | score_offset = -3, 90 | opts = {}, 91 | }, 92 | }, 93 | min_keyword_length = function(ctx) 94 | return ctx.trigger.kind == "trigger_character" and 0 or 3 95 | end, 96 | }, 97 | completion = { 98 | accept = { 99 | auto_brackets = { 100 | enabled = true, 101 | override_brackets_for_filetypes = { 102 | tex = { "{", "}" }, 103 | }, 104 | }, 105 | }, 106 | menu = { 107 | min_width = 30, 108 | scrolloff = 2, 109 | border = { "┌", "─", "┐", "│", "┘", "─", "└", "│" }, 110 | winhighlight = "Normal:Normal,FloatBorder:VertSplit,CursorLine:FocusedSymbol,Search:None", 111 | draw = { 112 | columns = { { "kind_icon" }, { "label", "label_description", gap = 1 }, { "source_icon" } }, 113 | components = { 114 | source_icon = { 115 | ellipsis = false, 116 | text = function(ctx) 117 | if ctx.item.data and ctx.item.data.citation then 118 | return "[ZoTeX]" 119 | end 120 | local map = { 121 | luasnip = "[SNIP]", 122 | buffer = "[BUF]", 123 | lsp = "[LSP]", 124 | nvim_lua = "[LUA]", 125 | path = "[PATH]", 126 | latex_symbols = "[LaTeX]", 127 | zotex = "[ZoTeX]", 128 | snippets = "[SNIP]", 129 | } 130 | return map[ctx.item.source_id] or ctx.item.source_id 131 | end, 132 | highlight = "BlinkCmpSource", 133 | }, 134 | }, 135 | }, 136 | }, 137 | }, 138 | }, 139 | opts_extend = { "sources.default" }, 140 | }, 141 | } 142 | 143 | return M 144 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/colorizer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "norcalli/nvim-colorizer.lua", 3 | ft = { "html", "css", "sass", "vim", "lua", "javascript", "typescript" }, 4 | config = function() 5 | require("colorizer").setup({ "*" }, { 6 | RGB = true, 7 | RRGGBB = true, 8 | RRGGBBAA = true, 9 | rgb_fn = true, 10 | hsl_fn = true, 11 | css = true, 12 | css_fn = true, 13 | }) 14 | end, 15 | } 16 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/comment.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "numToStr/Comment.nvim", 3 | event = "VeryLazy", 4 | config = true, 5 | } 6 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/copilot.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "zbirenbaum/copilot.lua", 3 | event = "VeryLazy", 4 | init = function() 5 | vim.api.nvim_create_user_command("ToggleCopilot", function() 6 | require("copilot.suggestion").toggle_auto_trigger() 7 | end, {}) 8 | end, 9 | opts = { 10 | panel = { 11 | keymap = { 12 | jump_next = "", 13 | jump_prev = "", 14 | accept = "", 15 | refresh = "r", 16 | open = "", 17 | }, 18 | }, 19 | suggestion = { 20 | enable = true, 21 | auto_trigger = true, 22 | keymap = { 23 | next = "", 24 | prev = "", 25 | accept = "", 26 | dismiss = "", 27 | }, 28 | }, 29 | }, 30 | } 31 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/dap.lua: -------------------------------------------------------------------------------- 1 | local M = { 2 | "mfussenegger/nvim-dap", 3 | event = "VeryLazy", 4 | dependencies = { 5 | { "theHamsta/nvim-dap-virtual-text" }, 6 | { "rcarriga/nvim-dap-ui" }, 7 | }, 8 | } 9 | 10 | function M.init() 11 | local keys = { 12 | ["db"] = { "toggle_breakpoint", "Toggle breakpoint" }, 13 | ["dB"] = { "step_back", "Step back" }, 14 | ["dc"] = { "continue", "Continue" }, 15 | ["dC"] = { "run_to_cursor", "Run to cursor" }, 16 | ["dd"] = { "disconnect", "Disconnect" }, 17 | ["dS"] = { "session", "Session" }, 18 | ["di"] = { "step_into", "Setep into" }, 19 | ["do"] = { "step_over", "Step over" }, 20 | ["du"] = { "step_out", "Step out" }, 21 | ["dp"] = { "pause.toggle", "Pause toggle" }, 22 | -- ["dr"] = { "repl.open", "REPL toggle" }, 23 | ["ds"] = { "continue", "Continue" }, 24 | ["dq"] = { "close", "Close" }, 25 | } 26 | for k, v in pairs(keys) do 27 | vim.keymap.set("n", "" .. k, function() 28 | return require("dap")[v[1]]() 29 | end, { desc = v[2] }) 30 | end 31 | vim.keymap.set("n", "dr", function() 32 | return require("dap").repl.toggle() 33 | end, { desc = "REPL toggle" }) 34 | end 35 | 36 | local function config_dap() 37 | local dap = require "dap" 38 | dap.defaults.fallback.terminal_win_cmd = "50vsplit new" 39 | 40 | dap.adapters.python = { 41 | type = "executable", 42 | command = "debugpy-adapter", 43 | } 44 | 45 | dap.adapters.cppdbg = { 46 | id = "cppdbg", 47 | type = "executable", 48 | command = "OpenDebugAD7", 49 | } 50 | 51 | local get_python_path = function() 52 | local venv_path = os.getenv "VIRTUAL_ENV" 53 | if venv_path then 54 | return venv_path .. "/bin/python" 55 | end 56 | return nil 57 | end 58 | 59 | dap.configurations.cpp = { 60 | { 61 | name = "Launch file", 62 | type = "cppdbg", 63 | request = "launch", 64 | program = function() 65 | return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") 66 | end, 67 | cwd = "${workspaceFolder}", 68 | stopAtEntry = true, 69 | }, 70 | } 71 | 72 | dap.configurations.python = { 73 | { 74 | type = "python", 75 | request = "launch", 76 | name = "Launch file", 77 | program = "${file}", 78 | pythonPath = function() 79 | local cwd = vim.fn.getcwd() 80 | if vim.fn.glob(cwd .. "/poetry.lock") then 81 | local venv = vim.fn.trim(vim.fn.system "poetry env info -p") 82 | return venv .. "/bin" .. "/python" 83 | end 84 | if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then 85 | return cwd .. "/venv/bin/python" 86 | elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then 87 | return cwd .. "/.venv/bin/python" 88 | elseif vim.fn.exists "$VIRTUAL_ENV" then 89 | return get_python_path() 90 | else 91 | return "/usr/bin/python" 92 | end 93 | end, 94 | }, 95 | } 96 | end 97 | 98 | local function config_dap_ui() 99 | local dap = require "dap" 100 | local dapui = require "dapui" 101 | dapui.setup { 102 | icons = { expanded = "▾", collapsed = "▸" }, 103 | mappings = { 104 | -- Use a table to apply multiple mappings 105 | expand = { "", "<2-LeftMouse>" }, 106 | open = "o", 107 | remove = "d", 108 | edit = "e", 109 | repl = "r", 110 | toggle = "t", 111 | }, 112 | layouts = { 113 | { 114 | elements = { 115 | "scopes", 116 | "breakpoints", 117 | "stacks", 118 | "watches", 119 | }, 120 | size = 40, 121 | position = "right", 122 | }, 123 | { 124 | elements = { 125 | "repl", 126 | }, 127 | size = 10, 128 | position = "bottom", 129 | }, 130 | }, 131 | floating = { 132 | max_height = nil, 133 | max_width = nil, 134 | border = "single", 135 | mappings = { 136 | close = { "q", "" }, 137 | }, 138 | }, 139 | windows = { indent = 1 }, 140 | } 141 | 142 | -- vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignWarn", linehl = "", numhl = "" }) 143 | 144 | dap.listeners.after.event_initialized["dapui_config"] = function() 145 | dapui.open() 146 | vim.keymap.set("v", "K", [[lua require("dapui").eval()]], { buffer = 0 }) 147 | vim.keymap.set("n", "K", [[lua require("dapui").eval()]], { buffer = 0 }) 148 | end 149 | dap.listeners.before.event_terminated["dapui_config"] = function() 150 | dapui.close() 151 | end 152 | dap.listeners.before.event_exited["dapui_config"] = function() 153 | dapui.close() 154 | end 155 | end 156 | 157 | function M.config() 158 | config_dap() 159 | config_dap_ui() 160 | require("nvim-dap-virtual-text").setup() 161 | end 162 | 163 | return M 164 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/dressing.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "stevearc/dressing.nvim", 3 | event = "VeryLazy", 4 | opts = { 5 | input = { 6 | win_options = { 7 | winblend = 0, 8 | }, 9 | }, 10 | select = { 11 | backend = { "fzf_lua", "fzf", "builtin", "nui" }, 12 | nui = { 13 | win_options = { 14 | winblend = 0, 15 | }, 16 | }, 17 | builtin = { 18 | win_options = { 19 | winblend = 0, 20 | }, 21 | }, 22 | }, 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/gitsigns.lua: -------------------------------------------------------------------------------- 1 | local M = { 2 | "lewis6991/gitsigns.nvim", 3 | event = "VeryLazy", 4 | dependencies = { "nvim-lua/plenary.nvim" }, 5 | } 6 | 7 | function M.config() 8 | require("gitsigns").setup { 9 | signs = { 10 | add = { text = "│" }, 11 | change = { text = "│" }, 12 | delete = { text = "│" }, 13 | topdelete = { text = "-" }, 14 | changedelete = { text = "~" }, 15 | untracked = { text = "│" }, 16 | }, 17 | on_attach = function(bufnr) 18 | local gs = package.loaded.gitsigns 19 | 20 | local function w(func) 21 | return function() 22 | func() 23 | vim.defer_fn(function() 24 | vim.cmd "NvimTreeRefresh" 25 | end, 50) 26 | end 27 | end 28 | 29 | local function map(mode, l, r, opts) 30 | opts = opts or {} 31 | opts.buffer = bufnr 32 | vim.keymap.set(mode, l, w(r), opts) 33 | end 34 | 35 | map("n", "]c", gs.next_hunk, { desc = "Next Hunk" }) 36 | map("n", "[c", gs.prev_hunk, { desc = "Prev Hunk" }) 37 | map("n", "hs", gs.stage_hunk, { desc = "Stage hunk" }) 38 | map("n", "hr", gs.reset_hunk, { desc = "Reset hunk" }) 39 | map("n", "hS", gs.stage_buffer, { desc = "Stage buffer" }) 40 | map("n", "hu", gs.undo_stage_hunk, { desc = "Undo stage hunk" }) 41 | map("n", "hR", gs.reset_buffer, { desc = "Reset buffer" }) 42 | map("n", "hp", gs.preview_hunk, { desc = "Preview hunk" }) 43 | map("n", "hb", gs.toggle_current_line_blame, { desc = "Toggle current line blame" }) 44 | map("n", "hd", gs.diffthis, { desc = "Diff this" }) 45 | map({ "o", "x" }, "ih", gs.select_hunk, { desc = "Select hunk" }) 46 | end, 47 | watch_gitdir = { interval = 1000 }, 48 | sign_priority = 6, 49 | update_debounce = 200, 50 | status_formatter = nil, 51 | } 52 | end 53 | 54 | return M 55 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/harpoon.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "ThePrimeagen/harpoon", 3 | lazy = false, 4 | branch = "harpoon2", 5 | dependencies = { "nvim-lua/plenary.nvim" }, 6 | config = function() 7 | local opts = { noremap = true, silent = true } 8 | local harpoon = require "harpoon" 9 | harpoon:setup() 10 | vim.keymap.set("n", "", function() 11 | harpoon.ui:toggle_quick_menu(harpoon:list()) 12 | end, opts) 13 | 14 | for i = 1, 9 do 15 | vim.keymap.set("n", "" .. i, function() 16 | harpoon:list():select(i) 17 | end, { desc = "Harpoon " .. i .. " file" }) 18 | end 19 | vim.keymap.set("n", "", function() 20 | harpoon:list():add() 21 | vim.notify "marked file" 22 | end, opts) 23 | 24 | vim.api.nvim_create_autocmd("FileType", { 25 | pattern = "harpoon", 26 | callback = function() 27 | for i = 1, 9 do 28 | vim.keymap.set("n", tostring(i), function() 29 | harpoon:list():select(i) 30 | end, { buffer = true }) 31 | end 32 | end, 33 | }) 34 | end, 35 | } 36 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/image.lua: -------------------------------------------------------------------------------- 1 | return {} -- disable it 2 | or { 3 | "3rd/image.nvim", 4 | ft = "markdown", 5 | init = function() 6 | package.path = package.path .. ";" .. vim.fn.expand "$HOME" .. "/.luarocks/share/lua/5.1/?/init.lua;" 7 | package.path = package.path .. ";" .. vim.fn.expand "$HOME" .. "/.luarocks/share/lua/5.1/?.lua;" 8 | end, 9 | config = function() 10 | require("image").setup { 11 | backend = "kitty", 12 | integrations = { 13 | markdown = { 14 | enabled = true, 15 | clear_in_insert_mode = false, 16 | download_remote_images = true, 17 | only_render_image_at_cursor = false, 18 | filetypes = { "markdown", "vimwiki" }, 19 | }, 20 | neorg = { 21 | enabled = true, 22 | clear_in_insert_mode = false, 23 | download_remote_images = true, 24 | only_render_image_at_cursor = false, 25 | filetypes = { "norg" }, 26 | }, 27 | }, 28 | max_width = nil, 29 | max_height = nil, 30 | max_width_window_percentage = nil, 31 | max_height_window_percentage = 50, 32 | window_overlap_clear_enabled = false, -- toggles images when windows are overlapped 33 | window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" }, 34 | editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus 35 | tmux_show_only_in_active_window = false, -- auto show/hide images in the correct Tmux window (needs visual-activity off) 36 | hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp" }, -- render image files as images when opened 37 | } 38 | end, 39 | enable = false, 40 | } 41 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/local-highlight.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "tzachar/local-highlight.nvim", 3 | event = "VeryLazy", 4 | config = function() 5 | require("local-highlight").setup { 6 | file_types = { "python", "cpp", "lua" }, 7 | hlgroup = "Visual", 8 | } 9 | end, 10 | } 11 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/lsp/custom/init.lua: -------------------------------------------------------------------------------- 1 | require "plugins.modules.lsp.custom.pylance" 2 | require "plugins.modules.lsp.custom.wolfram_ls" 3 | 4 | local registry = {} 5 | registry["pylance"] = "plugins.modules.lsp.custom.pylance" 6 | 7 | return registry 8 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/lsp/custom/null-ls.lua: -------------------------------------------------------------------------------- 1 | local h = require "null-ls.helpers" 2 | local methods = require "null-ls.methods" 3 | 4 | local FORMATTING = methods.internal.FORMATTING 5 | 6 | local custom = { format = {} } 7 | -- 8 | custom.format["tex-fmt"] = h.make_builtin { 9 | name = "tex-fmt", 10 | method = { FORMATTING }, 11 | filetypes = { "tex" }, 12 | generator_opts = { 13 | command = "tex-fmt", 14 | args = { "--stdin", "--tabsize", "4" }, 15 | to_stdin = true, 16 | }, 17 | factory = h.formatter_factory, 18 | } 19 | 20 | return custom 21 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/lsp/custom/wolfram_ls.lua: -------------------------------------------------------------------------------- 1 | local configs = require "lspconfig.configs" 2 | local util = require "lspconfig.util" 3 | 4 | if not configs["wolfram_ls"] then 5 | configs["wolfram_ls"] = { 6 | default_config = { 7 | filetypes = { "wolfram" }, 8 | root_dir = util.find_git_ancestor, 9 | cmd = { 10 | "WolframKernel", 11 | "-noinit", 12 | "-noprompt", 13 | "-nopaclet", 14 | "-noicon", 15 | "-nostartuppaclets", 16 | "-run", 17 | [[ Needs["LSPServer`"];LSPServer`StartServer[] ]], 18 | }, 19 | single_file_support = true, 20 | settings = { 21 | wolfram = { implicitTokens = {}, semanticTokens = true }, 22 | }, 23 | }, 24 | } 25 | end 26 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/lsp/handlers.lua: -------------------------------------------------------------------------------- 1 | vim.lsp.handlers["window/logMessage"] = function(_, content, _) 2 | if content.type == 3 then 3 | if content.message:find "pythonPath" then 4 | vim.notify(content.message) 5 | end 6 | end 7 | end 8 | -- 9 | -- vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { 10 | -- border = "single", 11 | -- }) 12 | -- 13 | -- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { 14 | -- border = "single", 15 | -- }) 16 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/lsp/init.lua: -------------------------------------------------------------------------------- 1 | local M = { 2 | "neovim/nvim-lspconfig", 3 | dependencies = { 4 | { "nvimtools/none-ls.nvim" }, 5 | { "williamboman/mason.nvim" }, 6 | { "microsoft/python-type-stubs" }, 7 | { "barreiroleo/ltex_extra.nvim" }, 8 | }, 9 | event = { "BufReadPre", "BufNewFile" }, 10 | cmd = "Mason", 11 | } 12 | function M.config() 13 | require "plugins.modules.lsp.custom" 14 | require "plugins.modules.lsp.settings" 15 | require "plugins.modules.lsp.mappings" 16 | require "plugins.modules.lsp.handlers" 17 | require "plugins.modules.lsp.null-ls" 18 | require "plugins.modules.lsp.servers" 19 | end 20 | 21 | return M 22 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/lsp/mappings.lua: -------------------------------------------------------------------------------- 1 | local mappings = {} 2 | 3 | vim.api.nvim_create_user_command("ToggleFormatting", function() 4 | if vim.g.format_on_save then 5 | vim.g.format_on_save = false 6 | vim.notify "Formatting on save disabled" 7 | else 8 | vim.g.format_on_save = true 9 | vim.notify "Formatting on save enabled" 10 | end 11 | end, {}) 12 | 13 | mappings.texlab = function() 14 | vim.keymap.set("n", "lb", "TexlabBuild", { buffer = 0, desc = "Build document" }) 15 | vim.keymap.set("n", "lv", function() 16 | vim.cmd.TexlabForward() 17 | vim.cmd [[!sleep 0.3 && bspc node last -f]] 18 | end, { buffer = 0, desc = "Forward view" }) 19 | end 20 | 21 | mappings.clangd = function() 22 | vim.keymap.set("n", "", "ClangdSwitchSourceHeader", { buffer = 0, desc = "Build document" }) 23 | end 24 | 25 | function mappings.setup(client_name, buffer) 26 | vim.keymap.set("n", "o", function() 27 | vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) 28 | end, { buffer = buffer, desc = "Toggle typehints" }) 29 | vim.keymap.set("n", "ga", vim.lsp.buf.code_action, { buffer = buffer, desc = "Code action" }) 30 | vim.keymap.set("v", "ga", vim.lsp.buf.code_action, { buffer = buffer, desc = "Code action (range)" }) 31 | vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { buffer = buffer, desc = "Go to declaration" }) 32 | vim.keymap.set("n", "gd", function() 33 | local api = require "trouble.api" 34 | if api.is_open() then 35 | api.close() 36 | end 37 | vim.cmd.Trouble "lsp_definitions focus=true auto_close=true" 38 | end, { buffer = buffer, desc = "Go to definition" }) 39 | -- vim.keymap.set("n", "gd", function() 40 | -- require("snacks").picker.lsp_definitions {} 41 | -- end, { buffer = buffer, desc = "Go to definition" }) 42 | vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { buffer = buffer, desc = "Go to inplementation" }) 43 | vim.keymap.set("n", "gr", vim.lsp.buf.rename, { buffer = buffer, desc = "Rename" }) 44 | vim.keymap.set("n", "gT", vim.lsp.buf.type_definition, { buffer = buffer, desc = "Type definition" }) 45 | vim.keymap.set( 46 | "n", 47 | "lq", 48 | vim.diagnostic.setloclist, 49 | { buffer = buffer, desc = "Diagnostics in local list" } 50 | ) 51 | vim.keymap.set("n", "lQ", vim.diagnostic.setqflist, { buffer = buffer, desc = "Diagnostics in quick list" }) 52 | vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = buffer, desc = "Hover" }) 53 | vim.keymap.set("n", "gR", vim.lsp.buf.references, { buffer = buffer, desc = "References" }) 54 | vim.keymap.set("n", "gk", vim.lsp.buf.signature_help, { buffer = buffer, desc = "Signature help" }) 55 | vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { buffer = buffer, desc = "Next diagnostic" }) 56 | vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { buffer = buffer, desc = "Prev diagnostic" }) 57 | vim.keymap.set("n", "ge", vim.diagnostic.open_float, { buffer = buffer, desc = "Open float diagnostics" }) 58 | vim.keymap.set({ "n", "v" }, "f", function() 59 | vim.lsp.buf.format { 60 | timeout_ms = 5000, 61 | -- filter = function(c) 62 | -- return c.name == "null-ls" 63 | -- end, 64 | } 65 | end, { buffer = 0, desc = "Format buffer" }) 66 | 67 | if mappings[client_name] then 68 | mappings[client_name]() 69 | end 70 | end 71 | 72 | vim.api.nvim_create_autocmd("LspAttach", { 73 | callback = function(args) 74 | local buffer = args.buf 75 | local client_name = vim.lsp.get_client_by_id(args.data.client_id)["name"] 76 | mappings.setup(client_name, buffer) 77 | end, 78 | }) 79 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/lsp/null-ls.lua: -------------------------------------------------------------------------------- 1 | local ok, null = pcall(require, "null-ls") 2 | if not ok then 3 | return 4 | end 5 | 6 | local custom = require "plugins.modules.lsp.custom.null-ls" 7 | 8 | local format = null.builtins.formatting 9 | local actions = null.builtins.code_actions 10 | local diag = null.builtins.diagnostics 11 | local completion = null.builtins.completion 12 | 13 | null.setup { 14 | sources = { 15 | -- format.blackd.with { config = { line_length = 88 } }, 16 | -- diag.textidote.with { 17 | -- args = { 18 | -- "--read-all", 19 | -- "--output", 20 | -- "singleline", 21 | -- "--no-color", 22 | -- "$FILENAME", 23 | -- }, 24 | -- timeout = 20000, 25 | -- }, 26 | format.black.with { 27 | extra_args = function(_) 28 | return { 29 | "--fast", 30 | "--quiet", 31 | } 32 | end, 33 | }, 34 | actions.gitsigns, 35 | format.bibclean, 36 | -- diag.shellcheck, 37 | diag.hadolint, 38 | -- diag.cppcheck, 39 | format.stylua, 40 | format.yamlfmt, 41 | format.clang_format, 42 | -- format.prettier.with { 43 | -- extra_args = function(_) 44 | -- return vim.bo[0].ft == "css" and { "--parser", "css" } 45 | -- end, 46 | -- }, 47 | format.cmake_format.with { 48 | cmd = "cmake-format", 49 | }, 50 | custom.format["tex-fmt"], 51 | -- format.latexindent.with { 52 | -- args = { 53 | -- "-g", 54 | -- "/dev/null", 55 | -- "-y", 56 | -- [[defaultIndent: " "]], 57 | -- }, 58 | -- }, 59 | format.shfmt.with { 60 | args = { "-s", "-i", "4" }, 61 | }, 62 | format.uncrustify, 63 | completion.spell, 64 | }, 65 | } 66 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/lsp/settings.lua: -------------------------------------------------------------------------------- 1 | require("lspconfig.ui.windows").default_options.border = "single" 2 | 3 | vim.diagnostic.config { 4 | virtual_text = false, 5 | signs = { 6 | text = { 7 | [vim.diagnostic.severity.ERROR] = "", -- "" 8 | [vim.diagnostic.severity.WARN] = "", -- "" 9 | [vim.diagnostic.severity.HINT] = "", -- "" 10 | [vim.diagnostic.severity.INFO] = "", -- "" 11 | }, 12 | 13 | linehl = { 14 | [vim.diagnostic.severity.ERROR] = "DiagnosticSignError", 15 | [vim.diagnostic.severity.WARN] = "None", 16 | [vim.diagnostic.severity.HINT] = "None", 17 | [vim.diagnostic.severity.INFO] = "None", 18 | }, 19 | numhl = { 20 | [vim.diagnostic.severity.ERROR] = "DiagnosticSignError", 21 | [vim.diagnostic.severity.WARN] = "DiagnosticSignWarn", 22 | [vim.diagnostic.severity.HINT] = "DiagnosticSignHint", 23 | [vim.diagnostic.severity.INFO] = "DiagnosticSignInfo", 24 | }, 25 | }, 26 | underline = true, 27 | update_in_insert = false, 28 | float = { border = "rounded", scope = "line", header = "" }, 29 | } 30 | 31 | require("mason").setup { 32 | ui = { 33 | border = "single", 34 | }, 35 | registries = { 36 | "github:mason-org/mason-registry", 37 | "lua:plugins.modules.lsp.custom", 38 | }, 39 | } 40 | 41 | vim.api.nvim_create_autocmd("LspAttach", { 42 | callback = function(args) 43 | local buffer = args.buf 44 | local client = vim.lsp.get_client_by_id(args.data.client_id) 45 | 46 | if not client then 47 | return 48 | end 49 | 50 | vim.bo[buffer].formatexpr = "" -- yikes 51 | 52 | if client.server_capabilities.documentHighlightProvider then 53 | local group = vim.api.nvim_create_augroup("DocumentHighlight", {}) 54 | vim.api.nvim_create_autocmd("CursorHold", { 55 | group = group, 56 | buffer = 0, 57 | callback = vim.lsp.buf.document_highlight, 58 | }) 59 | vim.api.nvim_create_autocmd("CursorMoved", { 60 | group = group, 61 | buffer = 0, 62 | callback = vim.lsp.buf.clear_references, 63 | }) 64 | end 65 | 66 | if client.server_capabilities.documentFormattingProvider then 67 | local group = vim.api.nvim_create_augroup("Formatting", {}) 68 | vim.api.nvim_create_autocmd("BufWritePre", { 69 | group = group, 70 | buffer = 0, 71 | callback = function() 72 | if vim.g.format_on_save then 73 | require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] = nil 74 | vim.lsp.buf.format { 75 | timeout_ms = 3000, 76 | } 77 | end 78 | end, 79 | }) 80 | end 81 | end, 82 | }) 83 | 84 | vim.api.nvim_create_autocmd("LspAttach", { 85 | callback = function(args) 86 | local client = vim.lsp.get_client_by_id(args.data.client_id) 87 | if not client then 88 | return 89 | end 90 | client.server_capabilities.semanticTokensProvider = nil 91 | end, 92 | }) 93 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/lualine.lua: -------------------------------------------------------------------------------- 1 | local M = { "nvim-lualine/lualine.nvim", lazy = false } 2 | 3 | function M.config() 4 | local theme = require "lualine.themes.tokyodark" 5 | local ok, p = pcall(require, "tokyodark.palette") 6 | if not ok then 7 | return 8 | end 9 | local colors = { 10 | diff_add = "#9ECE6A", 11 | diff_modify = "#7AA2F7", 12 | diff_remove = "#F7768E", 13 | border = p.bg5, 14 | } 15 | 16 | for _, session in pairs(theme.inactive) do 17 | session.gui = "underline" 18 | session.fg = colors.border 19 | end 20 | 21 | local custom_components = { 22 | pwd = function() 23 | return vim.fn.fnamemodify(vim.fn.getcwd(0, 0), ":~") 24 | end, 25 | formatting = { 26 | function() 27 | return "󰉼" 28 | end, 29 | cond = function() 30 | return vim.bo.filetype ~= "" and vim.g.format_on_save 31 | end, 32 | color = { fg = "#ff9e64" }, 33 | }, 34 | diagnostics = { 35 | function() 36 | local current = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR }) 37 | local total = 0 38 | for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do 39 | total = total + #vim.diagnostic.get(bufnr, { severity = vim.diagnostic.severity.ERROR }) 40 | end 41 | if total == 0 then 42 | return "" 43 | end 44 | return string.format("%%#Red# %d/%d", current, total) 45 | end, 46 | color = nil, 47 | }, 48 | } 49 | 50 | local default_config = { 51 | options = { 52 | theme = theme, 53 | section_separators = { left = "", right = "" }, 54 | component_separators = { left = "", right = "" }, 55 | icons_enabled = true, 56 | globalstatus = true, 57 | }, 58 | sections = { 59 | lualine_a = { { "mode", upper = true } }, 60 | lualine_b = { 61 | { "branch", icon = "" }, 62 | -- { 63 | -- require("noice").api.status.mode.get, 64 | -- cond = require("noice").api.status.mode.has, 65 | -- color = { fg = "#ff9e64" }, 66 | -- }, 67 | }, 68 | lualine_c = { 69 | { custom_components.pwd }, 70 | }, 71 | lualine_x = { custom_components.diagnostics, custom_components.formatting, "filetype" }, 72 | lualine_y = { 73 | { 74 | "diff", 75 | colored = true, 76 | diff_color = { 77 | added = { fg = colors.diff_add }, 78 | modified = { fg = colors.diff_modify }, 79 | removed = { fg = colors.diff_remove }, 80 | }, 81 | symbols = { added = "+", modified = "~", removed = "-" }, 82 | }, 83 | -- { 84 | -- require("noice").api.status.search.get, 85 | -- cond = require("noice").api.status.search.has, 86 | -- color = { fg = "#ff9e64" }, 87 | -- }, 88 | "location", 89 | }, 90 | lualine_z = {}, 91 | }, 92 | inactive_sections = { 93 | lualine_a = {}, 94 | lualine_b = {}, 95 | lualine_c = { "filename" }, 96 | lualine_x = {}, 97 | lualine_y = {}, 98 | lualine_z = {}, 99 | }, 100 | extensions = { { sections = { lualine_b = { "filetype" } }, filetypes = { "NvimTree" } } }, 101 | } 102 | 103 | require("lualine").setup(default_config) 104 | end 105 | 106 | return M 107 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/luasnip/init.lua: -------------------------------------------------------------------------------- 1 | local M = { "L3MON4D3/LuaSnip", version = "v2.*", lazy = false, dependencies = { { "rafamadriz/friendly-snippets" } } } 2 | 3 | function M.init() 4 | vim.keymap.set("i", "", function() 5 | require "luasnip.extras.select_choice"() 6 | end) 7 | local function reload_luasnip_config() 8 | require("luasnip").cleanup() 9 | for k in pairs(package.loaded) do 10 | if k:match ".*luasnip.snips.*" then 11 | package.loaded[k] = nil 12 | require(k) 13 | end 14 | end 15 | end 16 | vim.keymap.set("n", "rs", function() 17 | reload_luasnip_config() 18 | end, { desc = "Reload snippets" }) 19 | end 20 | 21 | function M.config() 22 | local ls_types = require "luasnip.util.types" 23 | local util = require "luasnip.util.util" 24 | 25 | require("luasnip/loaders/from_vscode").lazy_load {} 26 | 27 | require("luasnip.config").setup { 28 | history = true, 29 | region_check_events = "CursorMoved", 30 | delete_check_events = "TextChangedI", 31 | updateevents = "TextChanged,TextChangedI,InsertLeave", 32 | enable_autosnippets = true, 33 | store_selection_keys = "", 34 | ext_opts = { 35 | [ls_types.choiceNode] = { 36 | active = { 37 | virt_text = { { " ", "Keyword" } }, 38 | }, 39 | }, 40 | [ls_types.insertNode] = { 41 | active = { 42 | virt_text = { { "●", "Special" } }, 43 | }, 44 | }, 45 | }, 46 | parser_nested_assembler = function(_, snippet) 47 | local select = function(snip, no_move) 48 | snip.parent:enter_node(snip.indx) 49 | for _, node in ipairs(snip.nodes) do 50 | node:set_mark_rgrav(true, true) 51 | end 52 | if not no_move then 53 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("", true, false, true), "n", true) 54 | local pos_begin, pos_end = snip.mark:pos_begin_end() 55 | util.normal_move_on(pos_begin) 56 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("v", true, false, true), "n", true) 57 | util.normal_move_before(pos_end) 58 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("o", true, false, true), "n", true) 59 | end 60 | end 61 | 62 | function snippet:jump_into(dir, no_move) 63 | if self.active then 64 | if dir == 1 then 65 | self:input_leave() 66 | return self.next:jump_into(dir, no_move) 67 | else 68 | select(self, no_move) 69 | return self 70 | end 71 | else 72 | self:input_enter() 73 | if dir == 1 then 74 | select(self, no_move) 75 | return self 76 | else 77 | return self.inner_last:jump_into(dir, no_move) 78 | end 79 | end 80 | end 81 | 82 | function snippet:jump_from(dir, no_move) 83 | if dir == 1 then 84 | return self.inner_first:jump_into(dir, no_move) 85 | else 86 | self:input_leave() 87 | return self.prev:jump_into(dir, no_move) 88 | end 89 | end 90 | 91 | return snippet 92 | end, 93 | } 94 | require "plugins.modules.luasnip.snips.cmake" 95 | require "plugins.modules.luasnip.snips.cpp" 96 | require "plugins.modules.luasnip.snips.lua" 97 | require "plugins.modules.luasnip.snips.python" 98 | require "plugins.modules.luasnip.snips.tex" 99 | require "plugins.modules.luasnip.snips.tex_math" 100 | end 101 | 102 | return M 103 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/luasnip/mappings.lua: -------------------------------------------------------------------------------- 1 | local map = vim.keymap.set 2 | 3 | map("i", "", require "luasnip.extras.select_choice") 4 | -- map({ "i", "s" }, "", "luasnip-next-choice", {}) 5 | -- map({ "i", "s" }, "", "luasnip-prev-choice", {}) 6 | 7 | local function reload_luasnip_config() 8 | require("luasnip").cleanup() 9 | for k in pairs(package.loaded) do 10 | if k:match ".*luasnip.snips.*" then 11 | package.loaded[k] = nil 12 | require(k) 13 | end 14 | end 15 | end 16 | 17 | map("n", "rs", reload_luasnip_config, { desc = "Reload snippets" }) 18 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/luasnip/settings.lua: -------------------------------------------------------------------------------- 1 | local ls_types = require "luasnip.util.types" 2 | local util = require "luasnip.util.util" 3 | 4 | require("luasnip/loaders/from_vscode").lazy_load {} 5 | 6 | require("luasnip.config").setup { 7 | history = true, 8 | region_check_events = "CursorMoved", 9 | delete_check_events = "TextChangedI", 10 | updateevents = "TextChanged,TextChangedI,InsertLeave", 11 | enable_autosnippets = true, 12 | store_selection_keys = "", 13 | ext_opts = { 14 | [ls_types.choiceNode] = { 15 | active = { 16 | virt_text = { { " ", "Keyword" } }, 17 | }, 18 | }, 19 | [ls_types.insertNode] = { 20 | active = { 21 | virt_text = { { "●", "Special" } }, 22 | }, 23 | }, 24 | }, 25 | parser_nested_assembler = function(_, snippet) 26 | local select = function(snip, no_move) 27 | snip.parent:enter_node(snip.indx) 28 | for _, node in ipairs(snip.nodes) do 29 | node:set_mark_rgrav(true, true) 30 | end 31 | if not no_move then 32 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("", true, false, true), "n", true) 33 | local pos_begin, pos_end = snip.mark:pos_begin_end() 34 | util.normal_move_on(pos_begin) 35 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("v", true, false, true), "n", true) 36 | util.normal_move_before(pos_end) 37 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("o", true, false, true), "n", true) 38 | end 39 | end 40 | 41 | function snippet:jump_into(dir, no_move) 42 | if self.active then 43 | if dir == 1 then 44 | self:input_leave() 45 | return self.next:jump_into(dir, no_move) 46 | else 47 | select(self, no_move) 48 | return self 49 | end 50 | else 51 | self:input_enter() 52 | if dir == 1 then 53 | select(self, no_move) 54 | return self 55 | else 56 | return self.inner_last:jump_into(dir, no_move) 57 | end 58 | end 59 | end 60 | 61 | function snippet:jump_from(dir, no_move) 62 | if dir == 1 then 63 | return self.inner_first:jump_into(dir, no_move) 64 | else 65 | self:input_leave() 66 | return self.prev:jump_into(dir, no_move) 67 | end 68 | end 69 | 70 | return snippet 71 | end, 72 | } 73 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/luasnip/snips/cmake.lua: -------------------------------------------------------------------------------- 1 | local ls = require "luasnip" 2 | local parse = ls.parser.parse_snippet 3 | 4 | local cmake_template = [[ 5 | cmake_minimum_required(VERSION 3.10) 6 | project(${1:project}) 7 | set(CMAKE_EXPORT_COMPILE_COMMANDS 1) 8 | set(CMAKE_CXX_STANDARD 20) 9 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY \${CMAKE_BINARY_DIR}/lib) 10 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY \${CMAKE_BINARY_DIR}/lib) 11 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \${CMAKE_BINARY_DIR}/bin) 12 | file(GLOB SOURCES src/*.cpp) 13 | add_executable(${2:app} \$SOURCES) 14 | target_include_directories(${2:app} PRIVATE include) 15 | ]] 16 | 17 | ls.add_snippets("cmake", { 18 | parse({ trig = "template" }, cmake_template), 19 | }, {}) 20 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/luasnip/snips/cpp.lua: -------------------------------------------------------------------------------- 1 | local ls = require "luasnip" 2 | local s = ls.snippet 3 | local t = ls.text_node 4 | local i = ls.insert_node 5 | local fmt = require("luasnip.extras.fmt").fmt 6 | 7 | ls.add_snippets("cpp", { 8 | s( 9 | "template", 10 | fmt( 11 | [[ 12 | #include 13 | 14 | int main() {{ 15 | {} 16 | return 0; 17 | }} 18 | ]], 19 | { i(0) } 20 | ) 21 | ), 22 | }) 23 | 24 | ls.add_snippets("cpp", {}, {}) 25 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/luasnip/snips/lua.lua: -------------------------------------------------------------------------------- 1 | local ls = require "luasnip" 2 | 3 | local s = ls.snippet 4 | local sn = ls.snippet_node 5 | local t = ls.text_node 6 | local i = ls.insert_node 7 | local f = ls.function_node 8 | local c = ls.choice_node 9 | local d = ls.dynamic_node 10 | local r = ls.restore_node 11 | local l = require("luasnip.extras").lambda 12 | local rep = require("luasnip.extras").rep 13 | local p = require("luasnip.extras").partial 14 | local m = require("luasnip.extras").match 15 | local n = require("luasnip.extras").nonempty 16 | local dl = require("luasnip.extras").dynamic_lambda 17 | local fmt = require("luasnip.extras.fmt").fmt 18 | local fmta = require("luasnip.extras.fmt").fmta 19 | local types = require "luasnip.util.types" 20 | local conds = require "luasnip.extras.expand_conditions" 21 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/luasnip/snips/python.lua: -------------------------------------------------------------------------------- 1 | local ls = require "luasnip" 2 | 3 | local s = ls.snippet 4 | local t = ls.text_node 5 | local i = ls.insert_node 6 | 7 | ls.add_snippets("python", { 8 | s("importmatplotlib", { 9 | t { "from matplotlib import pyplot as plt", "" }, 10 | i(0), 11 | }), 12 | s("importnumpy", { 13 | t { "import numpy as np", "" }, 14 | i(0), 15 | }), 16 | s("defmain", { 17 | t { "def main():", "\t" }, 18 | i(0, "..."), 19 | t { "", "", "" }, 20 | t { 'if __name__ == "__main__":' }, 21 | t { "", "\tmain()" }, 22 | i(0), 23 | }), 24 | s("if__name__", { 25 | t { 'if __name__ == "__main__":', "\t" }, 26 | i(0), 27 | }), 28 | }) 29 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/luasnip/snips/tex.lua: -------------------------------------------------------------------------------- 1 | local ls = require "luasnip" 2 | local parse = ls.parser.parse_snippet 3 | local s = ls.snippet 4 | local t = ls.text_node 5 | local i = ls.insert_node 6 | local d = ls.dynamic_node 7 | local sn = ls.snippet_node 8 | local f = ls.function_node 9 | local fmt = require("luasnip.extras.fmt").fmt 10 | local rep = require("luasnip.extras").rep 11 | local events = require "luasnip.util.events" 12 | 13 | ls.add_snippets("tex", { 14 | s("centered_comment", { 15 | f(function(args) 16 | local title = args[1][1] or "" 17 | local total_length = 80 18 | local title_length = #title 19 | local padding = math.max(0, total_length - title_length - 2) 20 | local left_padding = math.floor(padding / 2) 21 | return string.rep("%", left_padding) .. " " 22 | end, { 1 }), 23 | i(1, "Title"), -- Insert node for the title 24 | f(function(args) 25 | local title = args[1][1] or "" 26 | local total_length = 80 27 | local title_length = #title 28 | local padding = math.max(0, total_length - title_length - 2) 29 | local left_padding = math.floor(padding / 2) 30 | local right_padding = padding - left_padding 31 | return " " .. string.rep("%", right_padding) 32 | end, { 1 }), 33 | }), 34 | }) 35 | 36 | local function div(tag, stag) 37 | return s({ trig = tag }, { 38 | t("\\" .. tag .. "{"), 39 | i(1), 40 | t "}", 41 | d(2, function(args) 42 | local text 43 | if args[1] == "" then 44 | text = tag 45 | else 46 | text = args[1][1]:gsub(" ", "_"):lower() 47 | end 48 | return sn(nil, { t("\\label{" .. stag .. ":"), i(1, text), t "}", t { "", "" }, i(0) }) 49 | end, { 1 }), 50 | }) 51 | end 52 | 53 | -- use mathematica to calculate whatever is written before leaving the snippet 54 | ls.add_snippets("tex", { 55 | s({ trig = "math" }, { i(1), t " ", i(0) }, { 56 | callbacks = { 57 | [1] = { 58 | [events.leave] = function(node) 59 | local from_pos, to_pos = node.mark:pos_begin_end_raw() 60 | local lines = vim.api.nvim_buf_get_lines(0, from_pos[1], to_pos[1] + 1, false) 61 | local script = ([[!wolframscript -c "ToString@TeXForm[%s]"]]):format(node:get_text()[1]) 62 | local output = vim.split(vim.api.nvim_exec(script, true), "\n") 63 | output = output[#output - 1] 64 | if #lines == 1 then 65 | vim.api.nvim_buf_set_text(0, from_pos[1], from_pos[2], to_pos[1], to_pos[2], { output }) 66 | end 67 | end, 68 | }, 69 | }, 70 | }), 71 | }, {}) 72 | 73 | ls.add_snippets("tex", { 74 | s("mk", { t { "$" }, i(1), t { "$ " }, i(0) }), 75 | s("dk", { 76 | t { "\\[", "\t" }, 77 | i(1), 78 | t { "", "\\]", "" }, 79 | i(0), 80 | }), 81 | }, { type = "autosnippets" }) 82 | 83 | local tex_template = [[ 84 | \documentclass[a4paper,12pt]{article} 85 | \usepackage[a4paper, margin=1in, total={20cm,27cm}]{geometry} 86 | \usepackage{import} 87 | \usepackage{pdfpages} 88 | \usepackage{transparent} 89 | \usepackage{xcolor} 90 | \usepackage{textcomp} 91 | \usepackage{amsmath, amssymb} 92 | \usepackage{graphicx} 93 | \usepackage{tikz} 94 | \usepackage{wrapfig} 95 | \title{$1} 96 | \author{$2} 97 | \begin{document} 98 | \maketitle 99 | \tableofcontents 100 | $0 101 | \addcontentsline{toc}{section}{Unnumbered Section} 102 | \end{document} 103 | ]] 104 | 105 | local tex_table = [[ 106 | \begin{center} 107 | \begin{tabular}{ c c c } 108 | cell1 & cell2 & cell3 \\\\ 109 | \\hline 110 | cell4 & cell5 & cell6 \\\\ 111 | \\hline 112 | cell7 & cell8 & cell9 113 | \end{tabular} 114 | \end{center} 115 | ]] 116 | 117 | ls.add_snippets("tex", { 118 | s([["]], fmt([[``{}'']], i(1))), 119 | parse({ trig = "template" }, tex_template), 120 | parse({ trig = "table" }, tex_table), 121 | s({ trig = "frame" }, { 122 | t { "\\begin{frame}", "\t" }, 123 | i(1), 124 | t { "", "\\end{frame}", "" }, 125 | i(0), 126 | }), 127 | s({ trig = "begin" }, { 128 | t "\\begin{", 129 | i(1), 130 | t { "}", "\t" }, 131 | i(2), 132 | t { "", "\\end{" }, 133 | rep(1), 134 | t { "}", "" }, 135 | i(0), 136 | }), 137 | div("chapter", "chap"), 138 | div("section", "sec"), 139 | div("subsection", "subsec"), 140 | div("subsubsection", "subsubsec"), 141 | s("superscript", { t "\\textsuperscript{", i(1), t "}", i(0) }), 142 | s("subscript", { t "\\subscript{", i(1), t "}", i(0) }), 143 | s("rm", { t "\\textrm{", i(1), t "}", i(0) }), 144 | s("gls", { t "\\gls{", i(1), t "}", i(0) }), 145 | s("glspl", { t "\\gls{", i(1), t "}", i(0) }), 146 | s("bold", { t "\\textbf{", i(1), t "}", i(0) }), 147 | s("italic", { t "\\textit{", i(1), t "}", i(0) }), 148 | s("smallcaps", { t "\\textsc{", i(1), t "}", i(0) }), 149 | s("reals", { t "\\mathbb{R}", i(0) }), 150 | }, {}) 151 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/navic.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "SmiteshP/nvim-navic", 3 | lazy = false, 4 | opts = function() 5 | return { 6 | separator = " ", 7 | highlight = true, 8 | depth_limit = 5, 9 | } 10 | end, 11 | config = function(_, opts) 12 | vim.g.navic_silence = true 13 | require("nvim-navic").setup(opts) 14 | end, 15 | } 16 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/neogen.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "danymat/neogen", 3 | cmd = "Neogen", 4 | dependencies = "nvim-treesitter/nvim-treesitter", 5 | opts = { 6 | enabled = true, 7 | }, 8 | keys = { 9 | { "gd", "Neogen", desc = "Neogen" }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/neogit.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "neogitorg/neogit", 3 | keys = { 4 | { 5 | "N", 6 | function() 7 | require("neogit").open() 8 | end, 9 | desc = "Neogit", 10 | }, 11 | { 12 | "n", 13 | function() 14 | require("neogit").open { "commit" } 15 | end, 16 | desc = "Neogit commit", 17 | }, 18 | }, 19 | dependencies = "nvim-lua/plenary.nvim", 20 | opts = { 21 | disable_commit_confirmation = true, 22 | integrations = { 23 | diffview = true, 24 | }, 25 | sections = { 26 | staged = { 27 | folded = false, 28 | hidden = false, 29 | }, 30 | untracked = { 31 | folded = true, 32 | hidden = false, 33 | }, 34 | unstaged = { 35 | folded = true, 36 | hidden = false, 37 | }, 38 | }, 39 | }, 40 | } 41 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/neotest.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "rcarriga/neotest", 3 | dependencies = { 4 | { "nvim-lua/plenary.nvim" }, 5 | { "nvim-treesitter/nvim-treesitter" }, 6 | { "antoinemadec/FixCursorHold.nvim" }, 7 | { "rcarriga/neotest-python" }, 8 | { "rouge8/neotest-rust" }, 9 | { "nvim-neotest/nvim-nio" }, 10 | }, 11 | ft = { "python" }, 12 | opts = { 13 | status = { 14 | enabled = true, 15 | signs = true, 16 | virtual_text = false, 17 | }, 18 | }, 19 | config = function(_, opts) 20 | opts.adapters = { 21 | require "neotest-python" {}, 22 | require "neotest-rust" { 23 | args = { "--no-capture" }, 24 | dap_adapter = "lldb", 25 | }, 26 | } 27 | require("neotest").setup { opts } 28 | end, 29 | } 30 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/neotree.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-neo-tree/neo-tree.nvim", 3 | cmd = "Neotree", 4 | dependencies = { 5 | { "MunifTanjim/nui.nvim" }, 6 | }, 7 | config = function() 8 | vim.g.neo_tree_remove_legacy_commands = 1 9 | 10 | require("neo-tree").setup { 11 | filesystem = { 12 | follow_current_file = true, 13 | hijack_netrw_behavior = "open_current", 14 | }, 15 | } 16 | end, 17 | } 18 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/noice.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "folke/noice.nvim", 3 | event = "VeryLazy", 4 | opts = { 5 | routes = { 6 | { 7 | view = "popup", 8 | filter = { event = "msg_show", cmdline = true, min_height = 2 }, 9 | }, 10 | { 11 | view = "popup", 12 | filter = { event = "msg_show", min_height = 20 }, 13 | }, 14 | }, 15 | messages = { 16 | enabled = true, 17 | view = "notify", 18 | view_error = "notify", 19 | }, 20 | notify = { 21 | enabled = true, 22 | view = "mini", 23 | }, 24 | cmdline = { 25 | view = "cmdline", 26 | format = { 27 | cmdline = false, 28 | -- search_down = false, 29 | -- search_up = false, 30 | -- filter = false, 31 | help = false, 32 | lua = false, 33 | }, 34 | }, 35 | lsp = { 36 | override = { 37 | ["vim.lsp.util.convert_input_to_markdown_lines"] = true, 38 | ["vim.lsp.util.stylize_markdown"] = true, 39 | ["cmp.entry.get_documentation"] = true, 40 | }, 41 | }, 42 | presets = { 43 | bottom_search = true, 44 | command_palette = false, 45 | long_message_to_split = true, 46 | inc_rename = false, 47 | lsp_doc_border = true, 48 | }, 49 | }, 50 | dependencies = { 51 | "MunifTanjim/nui.nvim", 52 | }, 53 | } 54 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/notify.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- "rcarriga/nvim-notify", 3 | -- keys = { 4 | -- { 5 | -- "un", 6 | -- function() 7 | -- require("notify").dismiss { silent = true, pending = true } 8 | -- end, 9 | -- desc = "Dismiss all Notifications", 10 | -- }, 11 | -- }, 12 | -- config = function() 13 | -- require("notify").setup { 14 | -- background_colour = "None", 15 | -- stages = "fade_in_slide_out", 16 | -- on_open = nil, 17 | -- on_close = nil, 18 | -- render = "compact", 19 | -- timeout = 1500, 20 | -- minimum_width = 20, 21 | -- max_height = function() 22 | -- return math.floor(vim.o.lines * 0.75) 23 | -- end, 24 | -- max_width = function() 25 | -- return math.floor(vim.o.columns * 0.75) 26 | -- end, 27 | -- icons = { 28 | -- ERROR = "", 29 | -- WARN = "", 30 | -- INFO = "", 31 | -- DEBUG = "", 32 | -- TRACE = "✎", 33 | -- }, 34 | -- } 35 | -- require("telescope").load_extension "notify" 36 | -- -- vim.notify = require "notify" 37 | -- end, 38 | } 39 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/obsidian.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "epwalsh/obsidian.nvim", 3 | version = "*", 4 | lazy = true, 5 | ft = "markdown", 6 | dependencies = { 7 | "nvim-lua/plenary.nvim", 8 | }, 9 | opts = { 10 | workspaces = { 11 | { 12 | name = "tiagovla", 13 | path = "~/.obsidian/tiagovla", 14 | }, 15 | }, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/oil.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "stevearc/oil.nvim", 3 | config = function() 4 | require("oil").setup { 5 | keymaps = { 6 | ["q"] = require("oil").close, 7 | ["-"] = require("oil").close, 8 | }, 9 | cleanup_delay_ms = 500, 10 | float = { 11 | max_height = 20, 12 | max_width = 60, 13 | }, 14 | } 15 | vim.keymap.set("n", "-", function() 16 | if vim.bo.filetype == "oil" then 17 | require("oil").close() 18 | else 19 | require("oil").open() 20 | end 21 | end, { desc = "File navigation" }) 22 | end, 23 | lazy = false, 24 | } 25 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/peek.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "toppair/peek.nvim", 3 | build = "deno task --quiet build:fast", 4 | ft = "markdown", 5 | init = function() 6 | vim.api.nvim_create_user_command("Peek", function() 7 | local peek = require "peek" 8 | local toggle = peek.close and peek.is_open() or peek.open 9 | toggle() 10 | end, {}) 11 | end, 12 | opts = { theme = "dark" }, 13 | } 14 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/spectre.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "nvim-pack/nvim-spectre", 3 | config = true, 4 | lazy = false, 5 | init = function() 6 | vim.keymap.set("n", "S", 'lua require("spectre").toggle()', { 7 | desc = "Toggle Spectre", 8 | }) 9 | vim.keymap.set("n", "sw", 'lua require("spectre").open_visual({select_word=true})', { 10 | desc = "Search current word", 11 | }) 12 | vim.keymap.set("v", "sw", 'lua require("spectre").open_visual()', { 13 | desc = "Search current word", 14 | }) 15 | vim.keymap.set("n", "sp", 'lua require("spectre").open_file_search({select_word=true})', { 16 | desc = "Search on current file", 17 | }) 18 | end, 19 | } 20 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/surround.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "kylechui/nvim-surround", 3 | event = "InsertEnter", 4 | config = true, 5 | } 6 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/telescope.lua: -------------------------------------------------------------------------------- 1 | local M = { 2 | "nvim-telescope/telescope.nvim", 3 | version = "*", 4 | cmd = "Telescope", 5 | dependencies = { 6 | { 7 | "tiagovla/telescope-project.nvim", 8 | dev = true, 9 | lazy = false, 10 | }, 11 | { "nvim-telescope/telescope-media-files.nvim" }, 12 | { "nvim-telescope/telescope-file-browser.nvim" }, 13 | { "jvgrootveld/telescope-zoxide" }, 14 | { "nvim-telescope/telescope-fzf-native.nvim" }, 15 | { 16 | "nvim-telescope/telescope-file-browser.nvim", 17 | dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }, 18 | }, 19 | }, 20 | } 21 | 22 | function M.init() 23 | vim.keymap.set({ "n", "v" }, "tc", "Telescope commands", { desc = "Show Commands" }) 24 | vim.keymap.set("n", "ts", "Telescope current_buffer_fuzzy_find", { desc = "FZF current buffer" }) 25 | vim.keymap.set("n", "tf", "Telescope find_files", { desc = "Find files" }) 26 | vim.keymap.set("n", "tg", "Telescope live_grep", { desc = "Live grep" }) 27 | vim.keymap.set("n", "tG", "Telescope git_files", { desc = "Git files" }) 28 | vim.keymap.set("n", "to", "Telescope oldfiles", { desc = "Old files" }) 29 | vim.keymap.set("n", "tB", "Telescope buffers", { desc = "Buffers" }) 30 | vim.keymap.set("n", "tb", "Telescope file_browser", { desc = "File Browser" }) 31 | vim.keymap.set("n", "th", "Telescope help_tags", { desc = "Help tags" }) 32 | vim.keymap.set("n", "tC", "Telescope colorscheme", { desc = "Colorscheme" }) 33 | vim.keymap.set("n", "tp", "Telescope project", { desc = "Project" }) 34 | vim.keymap.set("n", "td", "Telescope zoxide list", { desc = "Zoxide" }) 35 | vim.keymap.set("n", "tm", "Telescope man_pages", { desc = "Man pages" }) 36 | vim.keymap.set("n", "tn", "Telescope notify", { desc = "Notifications" }) 37 | end 38 | 39 | function M.config() 40 | local custom_theme = { 41 | pickers = { 42 | find_files = { 43 | find_command = { "rg", "--no-ignore", "--type=file", "--hiden", "--smart-case" }, 44 | -- find_command = { "rg", "--type=file", "--hidden", "--smart-case" }, 45 | }, 46 | live_grep = { 47 | only_sort_text = true, 48 | }, 49 | }, 50 | layout_config = { 51 | prompt_position = "bottom", 52 | horizontal = { 53 | preview_width = 0.55, 54 | results_width = 0.8, 55 | }, 56 | vertical = { 57 | mirror = false, 58 | }, 59 | width = 0.87, 60 | height = 0.80, 61 | preview_cutoff = 120, 62 | }, 63 | scroll_strategy = "cycle", 64 | vimgrep_arguments = { 65 | "rg", 66 | "--color=never", 67 | "--no-heading", 68 | "--with-filename", 69 | "--line-number", 70 | "--column", 71 | "--smart-case", 72 | }, 73 | prompt_prefix = ">", 74 | path_display = { "truncate" }, 75 | selection_strategy = "reset", 76 | sorting_strategy = "descending", 77 | layout_strategy = "horizontal", 78 | file_sorter = require("telescope.sorters").get_fuzzy_file, 79 | file_ignore_patterns = {}, 80 | generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, 81 | winblend = 0, 82 | border = {}, 83 | borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, 84 | color_devicons = true, 85 | use_less = true, 86 | set_env = { ["COLORTERM"] = "truecolor" }, 87 | file_previewer = require("telescope.previewers").vim_buffer_cat.new, 88 | grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, 89 | qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, 90 | buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, 91 | mappings = { 92 | n = { 93 | [""] = require("telescope.actions").delete_buffer, 94 | }, 95 | }, 96 | } 97 | require("telescope").setup { 98 | defaults = custom_theme, 99 | extensions = { 100 | fzf = { 101 | fuzzy = true, 102 | override_generic_sorter = true, 103 | override_file_sorter = true, 104 | case_mode = "smart_case", 105 | }, 106 | }, 107 | } 108 | require("telescope").load_extension "project" 109 | require("telescope").load_extension "zoxide" 110 | require("telescope").load_extension "file_browser" 111 | require("telescope").load_extension "fzf" 112 | local builtin = require "telescope.builtin" 113 | require("telescope._extensions.zoxide.config").setup { 114 | mappings = { 115 | [""] = { 116 | keepinsert = true, 117 | action = function(selection) 118 | builtin.find_files { cwd = selection.path } 119 | end, 120 | after_action = function(selection) 121 | vim.cmd("cd " .. selection.path) 122 | end, 123 | }, 124 | }, 125 | } 126 | end 127 | 128 | return M 129 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/tmux.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "aserowy/tmux.nvim", 3 | event = "VeryLazy", 4 | opts = { 5 | copy_sync = { 6 | enable = true, 7 | }, 8 | navigation = { 9 | enable_default_keybindings = true, 10 | }, 11 | resize = { 12 | enable_default_keybindings = true, 13 | }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/toggleterm.lua: -------------------------------------------------------------------------------- 1 | local M = { 2 | "akinsho/toggleterm.nvim", 3 | lazy = false, 4 | } 5 | 6 | local function slice_from_match(list, match) 7 | local function find_index(tbl, element) 8 | for i, v in ipairs(tbl) do 9 | if v == element then 10 | return i 11 | end 12 | end 13 | return nil 14 | end 15 | local index = find_index(list, match) 16 | if index then 17 | return { unpack(list, index + 1) } 18 | else 19 | return list 20 | end 21 | end 22 | 23 | function M.init() 24 | vim.keymap.set({ "n", "i", "v", "t", "x" }, "", "") 25 | vim.keymap.set({ "n", "v" }, "", "TermFloat") 26 | vim.keymap.set({ "n", "v" }, "", "TermBottom") 27 | vim.keymap.set({ "n", "v" }, "G", "Lazygit") 28 | 29 | local function set_terminal_keymaps() 30 | vim.keymap.set("t", "", "TermFloat") 31 | vim.keymap.set("t", "", "TermBottom") 32 | vim.keymap.set("t", "", [[h]]) 33 | vim.keymap.set("t", "", [[j]]) 34 | vim.keymap.set("t", "", [[k]]) 35 | vim.keymap.set("t", "", [[l]]) 36 | end 37 | vim.api.nvim_create_autocmd("TermOpen", { pattern = "term://*", callback = set_terminal_keymaps }) 38 | end 39 | 40 | function M.config() 41 | require("toggleterm").setup { 42 | size = 20, 43 | hide_numbers = true, 44 | autochdir = true, 45 | start_in_insert = true, 46 | insert_mappings = true, 47 | shade_terminals = true, 48 | shading_factor = 2, 49 | persist_size = true, 50 | close_on_exit = true, 51 | direction = "float", 52 | highlights = { FloatBorder = { guifg = "#4A5057" } }, 53 | float_opts = { 54 | border = "curved", 55 | winblend = 0, 56 | }, 57 | } 58 | 59 | local Terminal = require("toggleterm.terminal").Terminal 60 | 61 | local lazygit = Terminal:new { cmd = "lazygit", hidden = true, direction = "tab" } 62 | 63 | local lines = {} 64 | local running_cmd = false 65 | 66 | local on_data = function(_, _, data) 67 | for i, line in ipairs(data) do 68 | data[i] = line:gsub("\r", ""):gsub("\27%[[0-9;]*m", "") 69 | end 70 | for _, v in pairs(data) do 71 | if v == "async_make_done" then 72 | running_cmd = false 73 | local output = slice_from_match(lines, "async_make_start") 74 | output = vim.tbl_filter(function(line) 75 | return line ~= "" 76 | end, output) 77 | 78 | local efm = vim.api.nvim_get_option_value("errorformat", { buf = 0 }) 79 | vim.fn.setqflist({}, " ", { 80 | title = "make", 81 | lines = output, 82 | efm = efm, 83 | }) 84 | vim.api.nvim_command "doautocmd QuickFixCmdPost" 85 | vim.notify "Make command ended" 86 | end 87 | end 88 | 89 | if running_cmd then 90 | vim.list_extend(lines, data) 91 | end 92 | end 93 | 94 | local on_exit = function() 95 | running_cmd = false 96 | lines = {} 97 | end 98 | 99 | local term_float = Terminal:new { 100 | hidden = true, 101 | direction = "float", 102 | on_stdout = on_data, 103 | on_stderr = on_data, 104 | on_exit = on_exit, 105 | } 106 | 107 | local function make() 108 | require "toggleterm.terminal" 109 | if not term_float:is_open() then 110 | term_float:toggle() 111 | term_float:toggle() 112 | end 113 | lines = {} 114 | term_float:send({ "echo async_make_start; make; echo async_make_done" }, false) 115 | running_cmd = true 116 | vim.notify "Make command running..." 117 | end 118 | 119 | vim.api.nvim_create_user_command("Make", make, {}) 120 | vim.keymap.set({ "n", "i", "x", "t" }, "", "Make") 121 | vim.keymap.set({ "n", "i", "x" }, "", "Make") 122 | 123 | local function _smart_toggle(terminal, size, direction) 124 | if terminal:is_open() and terminal.direction ~= direction then 125 | terminal:toggle(size, direction) 126 | terminal:toggle(size, direction) 127 | elseif terminal:is_open() and not terminal:is_focused() then 128 | terminal:focus() 129 | terminal:set_mode "i" 130 | else 131 | terminal:toggle(size, direction) 132 | end 133 | end 134 | 135 | local function setup_cmd(cmd, term, size, direction) 136 | vim.api.nvim_create_user_command(cmd, function() 137 | _smart_toggle(term, size, direction) 138 | end, {}) 139 | end 140 | setup_cmd("Lazygit", lazygit, nil, "tab") 141 | setup_cmd("TermFloat", term_float, 20, "float") 142 | setup_cmd("TermBottom", term_float, 12, "horizontal") 143 | setup_cmd("TermRight", term_float, 50, "vertical") 144 | end 145 | 146 | return M 147 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/tokyodark.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "tiagovla/tokyodark.nvim", 3 | lazy = false, 4 | dev = true, 5 | priority = 1000, 6 | opts = { 7 | transparent_background = true, 8 | custom_highlights = function(hl, p) 9 | return { 10 | ["LspInlayHint"] = { bg = "#1C1C2A", fg = "#9AA0A7" }, 11 | -- ["Conceal"] = { bg = "NONE" }, 12 | ["@module"] = { link = "TSType" }, 13 | ["@property"] = { link = "Identifier" }, 14 | ["@variable"] = { fg = "#Afa8ea" }, 15 | ["@lsp.type.variable"] = { fg = "#Afa8ea" }, 16 | ["@module.latex"] = { link = "Red" }, 17 | ["@markup.link.latex"] = { link = "Blue" }, 18 | ["CmpItemKindCopilot"] = { fg = "#6CC644" }, 19 | NoiceLspProgressSpinner = { bg = "#1C1C2A" }, 20 | NoiceLspProgressClient = { bg = "#1C1C2A" }, 21 | NoiceLspProgressTitle = { bg = "#1C1C2A" }, 22 | NoiceMini = { bg = "#1C1C2A" }, 23 | NoiceCmdlineIconSearch = { link = "Blue" }, 24 | } 25 | end, 26 | }, 27 | config = function(_, opts) 28 | require("tokyodark").setup(opts) 29 | require("tokyodark").colorscheme() 30 | end, 31 | } 32 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/treesitter.lua: -------------------------------------------------------------------------------- 1 | local M = { 2 | "nvim-treesitter/nvim-treesitter", 3 | version = false, 4 | build = ":TSUpdate", 5 | lazy = false, 6 | dependencies = { 7 | { "nvim-treesitter/nvim-treesitter-textobjects" }, 8 | { "nvim-treesitter/playground" }, 9 | }, 10 | } 11 | 12 | function M.config() 13 | local treesitter = require "nvim-treesitter.configs" 14 | treesitter.setup { 15 | ensure_installed = "all", 16 | ignore_install = { "comment" }, 17 | highlight = { 18 | enable = true, 19 | additional_vim_regex_highlighting = false, 20 | use_languagetree = false, 21 | disable = function(_, bufnr) 22 | local buf_name = vim.api.nvim_buf_get_name(bufnr) 23 | local file_size = vim.api.nvim_call_function("getfsize", { buf_name }) 24 | return file_size > 256 * 1024 25 | end, 26 | }, 27 | incremental_selection = { 28 | enable = true, 29 | keymaps = { 30 | init_selection = "gnn", 31 | node_incremental = "gnn", 32 | scope_incremental = "gns", 33 | node_decremental = "gnp", 34 | }, 35 | }, 36 | context_commentstring = { 37 | enable = true, 38 | }, 39 | textobjects = { 40 | select = { 41 | enable = true, 42 | lookahead = true, 43 | keymaps = { 44 | ["af"] = "@function.outer", 45 | ["if"] = "@function.inner", 46 | ["ac"] = "@class.outer", 47 | ["ic"] = "@class.inner", 48 | ["iB"] = "@block.inner", 49 | ["aB"] = "@block.outer", 50 | ["iF"] = "@frame.inner", 51 | ["aF"] = "@frame.outer", 52 | }, 53 | }, 54 | swap = { 55 | enable = true, 56 | disable = { "lua" }, 57 | swap_next = { 58 | ["a"] = "@parameter.inner", 59 | }, 60 | swap_previous = { 61 | ["A"] = "@parameter.inner", 62 | }, 63 | }, 64 | move = { 65 | enable = true, 66 | set_jumps = true, 67 | goto_next_start = { 68 | ["]]"] = "@function.outer", 69 | }, 70 | goto_next_end = { 71 | ["]["] = "@function.outer", 72 | }, 73 | goto_previous_start = { 74 | ["[["] = "@function.outer", 75 | }, 76 | goto_previous_end = { 77 | ["[]"] = "@function.outer", 78 | }, 79 | }, 80 | }, 81 | } 82 | end 83 | 84 | return M 85 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/trouble.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "folke/trouble.nvim", 3 | event = "VeryLazy", 4 | dependencies = { "nvim-tree/nvim-web-devicons" }, 5 | keys = { 6 | { 7 | "e", 8 | function() 9 | local api = require "trouble.api" 10 | if api.is_open() then 11 | api.close() 12 | else 13 | vim.cmd.Trouble "diagnostics" 14 | end 15 | end, 16 | desc = "Toggle Trouble", 17 | }, 18 | }, 19 | opts = { 20 | keys = { 21 | [""] = "prev", 22 | [""] = "next", 23 | }, 24 | }, 25 | config = true, 26 | init = function() 27 | vim.api.nvim_create_autocmd("BufEnter", { 28 | callback = function() 29 | if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match "Trouble" ~= nil then 30 | vim.cmd.quit() 31 | end 32 | end, 33 | }) 34 | end, 35 | } 36 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/plugins/modules/which-key.lua: -------------------------------------------------------------------------------- 1 | local M = { 2 | "folke/which-key.nvim", 3 | event = "VeryLazy", 4 | } 5 | 6 | function M.config() 7 | require("which-key").setup { 8 | plugins = { 9 | marks = true, 10 | registers = true, 11 | spelling = { 12 | enabled = false, 13 | }, 14 | presets = { 15 | operators = false, 16 | motions = false, 17 | text_objects = false, 18 | windows = true, 19 | nav = true, 20 | z = true, 21 | g = true, 22 | }, 23 | }, 24 | icons = { 25 | breadcrumb = "»", 26 | separator = "➜", 27 | group = "+", 28 | }, 29 | layout = { 30 | height = { min = 4, max = 25 }, 31 | width = { min = 20, max = 50 }, 32 | spacing = 3, 33 | align = "left", 34 | }, 35 | } 36 | local wk = require "which-key" 37 | wk.add({ 38 | { "d", group = "Dap Debugger" }, 39 | { "g", group = "General" }, 40 | { "h", group = "Git Signs" }, 41 | { "t", group = "Telescope" }, 42 | }, {}) 43 | end 44 | 45 | return M 46 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/tiagovla/autocmds.lua: -------------------------------------------------------------------------------- 1 | -- highlight on yank 2 | vim.api.nvim_create_autocmd("TextYankPost", { 3 | group = vim.api.nvim_create_augroup("HighlightOnYank", {}), 4 | callback = function() 5 | vim.highlight.on_yank { higroup = "IncSearch", timeout = 300 } 6 | end, 7 | }) 8 | 9 | -- scroll off EOF 10 | vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI", "BufEnter" }, { 11 | group = vim.api.nvim_create_augroup("ScrollOffEOF", {}), 12 | callback = function() 13 | local win_h = vim.api.nvim_win_get_height(0) 14 | local off = math.min(vim.o.scrolloff, math.floor(win_h / 2)) 15 | local dist = vim.fn.line "$" - vim.fn.line "." 16 | local rem = vim.fn.line "w$" - vim.fn.line "w0" + 1 17 | if dist < off and win_h - rem + dist < off then 18 | local view = vim.fn.winsaveview() 19 | view.topline = view.topline + off - (win_h - rem + dist) 20 | vim.fn.winrestview(view) 21 | end 22 | end, 23 | }) 24 | 25 | -- change colorcolumn if visual text intersects it 26 | local cc_default_hi = vim.api.nvim_get_hl_by_name("ColorColumn", true) 27 | vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI", "BufEnter" }, { 28 | group = vim.api.nvim_create_augroup("CCHighlight", {}), 29 | callback = function() 30 | local cc = tonumber(vim.api.nvim_win_get_option(0, "colorcolumn")) 31 | if cc ~= nil then 32 | local lines = vim.api.nvim_buf_get_lines(0, vim.fn.line "w0", vim.fn.line "w$", true) 33 | local max_col = 0 34 | for _, line in pairs(lines) do 35 | max_col = math.max(max_col, vim.fn.strdisplaywidth(line)) 36 | end 37 | if max_col <= cc then 38 | vim.api.nvim_set_hl(0, "ColorColumn", cc_default_hi) 39 | else 40 | vim.api.nvim_set_hl(0, "ColorColumn", { bg = 2697787 }) 41 | end 42 | end 43 | end, 44 | }) 45 | 46 | -- keep cursor position after yanking 47 | local cursor_position 48 | vim.api.nvim_create_autocmd({ "VimEnter", "CursorMoved" }, { 49 | group = vim.api.nvim_create_augroup("RestoreCursor", {}), 50 | callback = function() 51 | cursor_position = vim.api.nvim_win_get_cursor(0) 52 | end, 53 | }) 54 | vim.api.nvim_create_autocmd("TextYankPost", { 55 | group = vim.api.nvim_create_augroup("RestoreCursor", { clear = false }), 56 | callback = function() 57 | if vim.v.event.operator == "y" then 58 | vim.api.nvim_win_set_cursor(0, cursor_position) 59 | end 60 | end, 61 | }) 62 | 63 | -- no comments next line 64 | vim.api.nvim_create_autocmd({ "BufWinEnter" }, { 65 | callback = function() 66 | vim.cmd "set formatoptions-=cro" 67 | end, 68 | }) 69 | 70 | -- templates 71 | vim.api.nvim_create_autocmd("BufNewFile", { 72 | callback = function() 73 | local c_path = vim.fn.stdpath "config" .. "/templates/" 74 | local fe, ft = vim.fn.expand "%:e", vim.bo.filetype 75 | if ft == "make" then 76 | vim.cmd("0r " .. c_path .. "make") -- Makefile 77 | elseif ft == "cmake" then 78 | vim.cmd("0r " .. c_path .. "cmake") -- CMakeLists.txt 79 | elseif ft == "tex" then 80 | vim.cmd("0r " .. c_path .. "tex.tex") -- latex.tex 81 | end 82 | end, 83 | }) 84 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/tiagovla/commands.lua: -------------------------------------------------------------------------------- 1 | local function to_numpy_array(args) 2 | local bufnr = vim.api.nvim_get_current_buf() 3 | local i = (args.line1 or vim.api.nvim_buf_get_mark(bufnr, "<")[1]) - 1 4 | local e = args.line2 or vim.api.nvim_buf_get_mark(bufnr, ">")[1] 5 | local lines = vim.api.nvim_buf_get_lines(0, i, e, false) 6 | 7 | for k, line in ipairs(lines) do 8 | lines[k] = " [" .. table.concat(vim.split(vim.trim(line):gsub("%s+", " "), " ", true), ", ") .. "]," 9 | end 10 | table.insert(lines, 1, "np.array([") 11 | table.insert(lines, "])") 12 | vim.api.nvim_buf_set_lines(0, i, e, true, lines) 13 | end 14 | 15 | local function redir(ctx) 16 | local lines = vim.split(vim.api.nvim_exec(ctx.args, true), "\n", { plain = true }) 17 | vim.cmd "new" 18 | vim.api.nvim_buf_set_lines(0, 0, -1, false, lines) 19 | vim.opt_local.modified = false 20 | end 21 | 22 | vim.api.nvim_create_user_command("NumpyArray", to_numpy_array, { range = true }) 23 | vim.api.nvim_create_user_command("Redir", redir, { nargs = "+", complete = "command" }) 24 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/tiagovla/globals.lua: -------------------------------------------------------------------------------- 1 | RELOAD = function(...) 2 | return require("plenary.reload").reload_module(...) 3 | end 4 | 5 | R = function(name) 6 | RELOAD(name) 7 | return require(name) 8 | end 9 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/tiagovla/init.lua: -------------------------------------------------------------------------------- 1 | require "tiagovla.settings" 2 | require "tiagovla.globals" 3 | 4 | vim.api.nvim_create_autocmd("User", { 5 | pattern = "VeryLazy", 6 | callback = function() 7 | require "tiagovla.mappings" 8 | require "tiagovla.autocmds" 9 | require "tiagovla.commands" 10 | end, 11 | }) 12 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/tiagovla/mappings.lua: -------------------------------------------------------------------------------- 1 | local utils = require "tiagovla.utils" 2 | 3 | local M = {} 4 | 5 | function M.setup() 6 | M.general() 7 | M.movements() 8 | end 9 | 10 | function M.general() 11 | vim.keymap.set("n", "n", "nzzzv") 12 | vim.keymap.set("n", "N", "Nzzzv") 13 | -- vim.keymap.set("n", "G", "Gzzzv") 14 | vim.keymap.set("n", "J", "mzJ`z") 15 | vim.keymap.set("i", ",", ",u") 16 | vim.keymap.set("i", ".", ".u") 17 | vim.keymap.set("i", "!", "!u") 18 | vim.keymap.set("i", "?", "?u") 19 | vim.keymap.set("n", "ll", ":luafile %") 20 | vim.keymap.set("v", "J", ":m .+1gv=gv", { silent = true }) 21 | vim.keymap.set("v", "K", ":m .-2gv=gv", { silent = true }) 22 | vim.keymap.set("n", "s", ":vsplit", { silent = true, desc = "Vertical split" }) 23 | vim.keymap.set("n", "q", M.better_close, { desc = "Close buffer" }) 24 | vim.keymap.set("n", "Q", ":%bd|e#", { desc = "Close all other buffers" }) 25 | vim.cmd [[nnoremap ]] 26 | vim.keymap.set("n", "", ":b#", { silent = true, desc = "Switch buffers" }) 27 | vim.keymap.set("n", "[q", ":cnext", { silent = true, desc = "Next item in quickfix list" }) 28 | vim.keymap.set("n", "]q", ":cprev", { silent = true, desc = "Previous item in quickfix list" }) 29 | vim.keymap.set("n", "", [[{-> v:hlsearch ? ":nohl\" : "\"}()]], { silent = true, expr = true }) 30 | vim.keymap.set( 31 | { "n", "x", "o" }, 32 | "n", 33 | '"Nn"[v:searchforward]', 34 | { expr = true, desc = "Better forward N behaviour" } 35 | ) 36 | vim.keymap.set( 37 | { "n", "x", "o" }, 38 | "N", 39 | '"nN"[v:searchforward]', 40 | { expr = true, desc = "Better backward N behaviour" } 41 | ) 42 | vim.keymap.set("v", "<", "", ">gv", { desc = "Indent current selection" }) 44 | vim.keymap.set("n", "/", "ms/", { desc = "Keeps jumplist after forward searching" }) 45 | vim.keymap.set("n", "?", "ms?", { desc = "Keeps jumplist after backward searching" }) 46 | vim.keymap.set("n", "Q", "", { desc = "Remove annoying exmode" }) 47 | vim.keymap.set("n", "q:", "", { desc = "Remove annoying exmode" }) 48 | vim.keymap.set("n", "c", '"_c') 49 | vim.keymap.set("n", "C", '"_C') 50 | vim.keymap.set("n", "s", '"_s') 51 | vim.keymap.set("n", "S", '"_S') 52 | vim.keymap.set("n", "c_", '"_c^') 53 | vim.keymap.set("n", "d_", '"_d^') 54 | vim.keymap.set("n", "", ":vertical resize +2") 55 | vim.keymap.set("n", "", ":resize +2") 56 | vim.keymap.set("n", "", ":resize -2") 57 | vim.keymap.set("n", "", ":vertical resize -2") 58 | vim.keymap.set("v", "p", "P") 59 | -- vim.keymap.set("n", "gx", function() 60 | -- vim.fn.jobstart({ "xdg-open", vim.fn.expand("", nil, nil) }, { detach = true }) 61 | -- end, {}) 62 | vim.keymap.set("n", "w", [[call feedkeys("\c-w>")]], { silent = true }) 63 | vim.keymap.set("n", "s", ":luafile %") 64 | end 65 | 66 | function M.movements() 67 | vim.keymap.set("n", "", "") 68 | vim.keymap.set("n", "", "") 69 | vim.keymap.set("n", "", "") 70 | vim.keymap.set("n", "", "") 71 | vim.keymap.set({ "i", "v" }, "", "") 72 | vim.keymap.set({ "i", "v" }, "", "") 73 | vim.keymap.set({ "i", "v" }, "", "") 74 | vim.keymap.set({ "i", "v" }, "", "") 75 | vim.keymap.set("n", "H", "gT") 76 | vim.keymap.set("n", "L", "gt") 77 | vim.keymap.set({ "n", "x", "o" }, "j", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true }) 78 | vim.keymap.set({ "n", "x", "o" }, "k", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true }) 79 | vim.keymap.set("", "", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true }) 80 | vim.keymap.set("", "", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true }) 81 | vim.keymap.set("n", "#", M.better_hlsearch) 82 | vim.keymap.set("n", "*", M.better_hlsearch) 83 | end 84 | 85 | function M.better_hlsearch() 86 | local current_word = vim.call("expand", "") 87 | vim.fn.setreg("/", "\\<" .. current_word .. "\\>") 88 | vim.api.nvim_command "set hlsearch" 89 | end 90 | 91 | function M.better_close() 92 | local tabpages = vim.api.nvim_list_tabpages() 93 | local buffers = utils.get_valid_buffers() 94 | local named_buffers = vim.tbl_filter(utils.buf_has_name, buffers) 95 | if not vim.bo[0].buflisted then 96 | vim.api.nvim_win_close(0, false) 97 | return 98 | end 99 | if #tabpages > 1 and #named_buffers <= 1 then 100 | vim.cmd.Bdelete() 101 | elseif #buffers <= 1 and not utils.buf_has_name(0) then 102 | vim.cmd.quit() 103 | else 104 | vim.cmd.Bdelete() 105 | end 106 | end 107 | 108 | M.setup() 109 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/tiagovla/settings.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.setup() 4 | M.globals() 5 | M.options() 6 | M.commands() 7 | end 8 | 9 | function M.globals() 10 | vim.g.mapleader = " " 11 | vim.g.python3_host_prog = "$HOME/.asdf/shims/python" 12 | vim.g.format_on_save = true 13 | vim.g.tex_conceal = "abdgms" 14 | vim.g.tex_flavor = "latex" 15 | end 16 | 17 | function M.options() 18 | vim.opt.sessionoptions = { 19 | "blank", 20 | "buffers", 21 | "curdir", 22 | -- "folds", 23 | -- "help", 24 | -- "options", 25 | "tabpages", 26 | "winsize", 27 | "resize", 28 | "winpos", 29 | "terminal", 30 | "globals", 31 | } 32 | vim.opt.clipboard = "unnamedplus" 33 | vim.opt.backupdir:remove { "." } 34 | vim.opt.virtualedit = "block" 35 | vim.opt.backup = true 36 | vim.opt.backupcopy = "yes" 37 | vim.opt.cmdheight = 1 38 | vim.opt.completeopt = { "menuone", "noinsert", "noselect" } 39 | vim.opt.smoothscroll = true 40 | vim.opt.exrc = true 41 | vim.opt.history = 1000 42 | vim.opt.joinspaces = false 43 | vim.opt.cinkeys:remove ":" 44 | 45 | vim.opt.incsearch = true 46 | vim.opt.infercase = true 47 | vim.opt.inccommand = "split" 48 | 49 | vim.opt.scrolloff = 20 50 | vim.opt.sidescrolloff = 15 51 | 52 | vim.opt.showbreak = "↳" 53 | vim.opt.splitkeep = "topline" 54 | vim.opt.smarttab = true 55 | -- vim.opt.wildmode = { list = "longest" } 56 | 57 | vim.opt.termguicolors = true 58 | 59 | vim.opt.shiftwidth = 4 60 | vim.opt.tabstop = 4 61 | vim.opt.softtabstop = 0 62 | vim.opt.expandtab = true 63 | vim.opt.smartindent = true 64 | vim.opt.shiftwidth = 4 65 | vim.opt.expandtab = true 66 | 67 | vim.opt.fillchars = { eob = " " } 68 | 69 | vim.opt.hidden = true 70 | vim.opt.ignorecase = true 71 | vim.opt.smartcase = true 72 | vim.opt.mouse = "a" 73 | 74 | vim.opt.shortmess:append "cAIfs" 75 | vim.opt.signcolumn = "yes" 76 | vim.opt.splitbelow = true 77 | vim.opt.splitright = true 78 | 79 | vim.opt.timeoutlen = 1200 80 | vim.opt.spelloptions:append "noplainbuffer" 81 | 82 | vim.opt.showmode = false 83 | vim.opt.hlsearch = true 84 | vim.opt.synmaxcol = 150 85 | vim.opt.cursorline = true 86 | vim.opt.updatetime = 250 87 | vim.opt.whichwrap:append "<>[]hl" 88 | 89 | vim.opt.undofile = true 90 | 91 | vim.opt.expandtab = true 92 | vim.opt.smartindent = true 93 | vim.opt.shiftwidth = 4 94 | vim.opt.tabstop = 8 95 | 96 | vim.opt.number = true 97 | vim.opt.numberwidth = 2 98 | vim.opt.relativenumber = true 99 | vim.opt.ruler = false 100 | 101 | vim.opt.wrap = false 102 | 103 | vim.opt.listchars = { 104 | tab = "!·", 105 | nbsp = "␣", 106 | trail = "·", 107 | eol = "↲", 108 | } 109 | vim.opt.list = true 110 | vim.opt.colorcolumn = tostring(80) 111 | vim.opt.conceallevel = 1 112 | end 113 | 114 | function M.commands() 115 | -- vim.cmd "set iskeyword-=_" 116 | vim.cmd "set fsync" 117 | vim.cmd "set t_ZH=^[[3m" 118 | vim.cmd "set t_ZR=^[[23m" 119 | vim.cmd [[ :cab W w]] 120 | vim.cmd [[ :cab Q q]] 121 | vim.cmd [[ autocmd BufRead * autocmd FileType ++once 122 | \ if &ft !~# 'commit\|rebase' && line("'\"") > 1 && line("'\"") <= line("$") | exe 'normal! g`"' | endif]] 123 | vim.filetype.add { 124 | extension = { 125 | rasi = "css", 126 | }, 127 | } 128 | vim.filetype.add { 129 | extension = { 130 | wl = "wolfram", 131 | }, 132 | } 133 | end 134 | 135 | M.setup() 136 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/tiagovla/utils.lua: -------------------------------------------------------------------------------- 1 | local U = {} 2 | 3 | function U.buf_is_valid(buf_num) 4 | if not buf_num or buf_num < 1 then 5 | return false 6 | end 7 | local exists = vim.api.nvim_buf_is_valid(buf_num) 8 | return vim.bo[buf_num].buflisted and exists 9 | end 10 | 11 | function U.get_valid_buffers() 12 | local buf_nums = vim.api.nvim_list_bufs() 13 | local ids = {} 14 | for _, buf in ipairs(buf_nums) do 15 | if U.buf_is_valid(buf) then 16 | ids[#ids + 1] = buf 17 | end 18 | end 19 | return ids 20 | end 21 | 22 | function U.buf_has_name(buf) 23 | return vim.api.nvim_buf_get_name(buf) ~= "" 24 | end 25 | 26 | -- function U.debug() 27 | -- vim.cmd [[ 28 | -- function! SynGroup() 29 | -- let l:s = synID(line('.'), col('.'), 1) 30 | -- echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name') 31 | -- endfun 32 | -- ]] 33 | -- vim.cmd [[nmap :call SynGroup() ]] 34 | -- end 35 | 36 | return U 37 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/utils/linkedlist.lua: -------------------------------------------------------------------------------- 1 | local list = {} 2 | list.__index = list 3 | 4 | function list:new() 5 | return setmetatable({ length = 0 }, self) 6 | end 7 | 8 | setmetatable(list, { __call = list.new }) 9 | 10 | function list:clear() 11 | self.length = 0 12 | self.first = nil 13 | self.last = nil 14 | end 15 | 16 | function list:insert_first(t) 17 | assert(t) 18 | if self.first then 19 | self.first._prev = t 20 | t._next = self.first 21 | self.first = t 22 | else 23 | self.first = t 24 | self.last = t 25 | end 26 | self.length = self.length + 1 27 | end 28 | 29 | function list:insert_after(anchor, t) 30 | if not t then 31 | anchor, t = nil, anchor 32 | end 33 | if not anchor then 34 | anchor = self.last 35 | end 36 | assert(t) 37 | if anchor then 38 | assert(t ~= anchor) 39 | if anchor._next then 40 | anchor._next._prev = t 41 | t._next = anchor._next 42 | else 43 | self.last = t 44 | end 45 | t._prev = anchor 46 | anchor._next = t 47 | self.length = self.length + 1 48 | else 49 | self:insert_first(t) 50 | end 51 | end 52 | 53 | function list:insert_last(t) 54 | self:insert_after(nil, t) 55 | end 56 | 57 | function list:insert_before(anchor, t) 58 | if not t then 59 | anchor, t = nil, anchor 60 | end 61 | if not anchor then 62 | anchor = self.first 63 | end 64 | anchor = anchor and anchor._prev 65 | assert(t) 66 | if anchor then 67 | self:insert_after(anchor, t) 68 | else 69 | self:insert_first(t) 70 | end 71 | end 72 | 73 | function list:remove(t) 74 | assert(t) 75 | if t._next then 76 | if t._prev then 77 | t._next._prev = t._prev 78 | t._prev._next = t._next 79 | else 80 | assert(t == self.first) 81 | t._next._prev = nil 82 | self.first = t._next 83 | end 84 | elseif t._prev then 85 | assert(t == self.last) 86 | t._prev._next = nil 87 | self.last = t._prev 88 | else 89 | assert(t == self.first and t == self.last) 90 | self.first = nil 91 | self.last = nil 92 | end 93 | t._next = nil 94 | t._prev = nil 95 | self.length = self.length - 1 96 | return t 97 | end 98 | 99 | function list:remove_last() 100 | if not self.last then 101 | return 102 | end 103 | return self:remove(self.last) 104 | end 105 | 106 | function list:remove_first() 107 | if not self.first then 108 | return 109 | end 110 | return self:remove(self.first) 111 | end 112 | 113 | --iterating 114 | 115 | function list:next(last) 116 | if last then 117 | return last._next 118 | else 119 | return self.first 120 | end 121 | end 122 | 123 | function list:items() 124 | return self.next, self 125 | end 126 | 127 | function list:prev(last) 128 | if last then 129 | return last._prev 130 | else 131 | return self.last 132 | end 133 | end 134 | 135 | function list:reverse_items() 136 | return self.prev, self 137 | end 138 | 139 | function list:copy() 140 | local res = self:new() 141 | for item in self:items() do 142 | res:push(item) 143 | end 144 | return res 145 | end 146 | -------------------------------------------------------------------------------- /neovim/.config/nvim/lua/utils/watcher.lua: -------------------------------------------------------------------------------- 1 | local Watcher = setmetatable({}, { 2 | __call = function(cls, ...) 3 | return cls:new(...) 4 | end, 5 | }) 6 | 7 | function Watcher:new(fname, callback) 8 | local fullpath = vim.api.nvim_call_function("fnamemodify", { fname, ":p" }) 9 | local state = { event = vim.uv.new_fs_event(), fname = fullpath, callback = callback } 10 | return setmetatable(state, { 11 | __index = Watcher, 12 | }) 13 | end 14 | 15 | function Watcher:on_change(err, fname, status) 16 | self.callback(self.event) 17 | self.event:stop() 18 | self:watch_file(fname) 19 | end 20 | 21 | function Watcher:watch_file(fname) 22 | if not vim.fs.find(fname) then 23 | vim.notify "No file found to be watched!" 24 | return 25 | end 26 | self.event:start( 27 | fname, 28 | {}, 29 | vim.schedule_wrap(function(...) 30 | self:on_change(...) 31 | end) 32 | ) 33 | end 34 | 35 | function Watcher:start() 36 | self:watch_file(self.fname) 37 | end 38 | 39 | function Watcher:stop() 40 | self.event:stop() 41 | end 42 | 43 | return Watcher 44 | -------------------------------------------------------------------------------- /neovim/.config/nvim/spell/en.utf-8.add: -------------------------------------------------------------------------------- 1 | spelllang=pt_br 2 | -------------------------------------------------------------------------------- /neovim/.config/nvim/templates/cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.24) 2 | 3 | project(project_name) 4 | 5 | set(CMAKE_CXX_STANDARD 23) 6 | set(CMAKE_EXPORT_COMPILE_COMMANDS 1) 7 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 8 | set(CMAKE_CXX_EXTENSIONS OFF) 9 | 10 | add_executable(project_executable main.cpp) 11 | target_include_directories(main PUBLIC include) 12 | 13 | include(FetchContent) 14 | FetchContent_Declare(Eigen3 15 | GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git) 16 | FetchContent_MakeAvailable(Eigen3) 17 | target_link_libraries(main PUBLIC Eigen3::Eigen) 18 | -------------------------------------------------------------------------------- /neovim/.config/nvim/templates/make: -------------------------------------------------------------------------------- 1 | .PHONY: all build clean 2 | 3 | all: build clean 4 | 5 | build: 6 | @echo build 7 | 8 | clean: 9 | @echo clean 10 | -------------------------------------------------------------------------------- /neovim/.config/nvim/templates/tex.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | \usepackage{geometry} 3 | \usepackage{graphicx} 4 | \usepackage{amssymb} 5 | \usepackage{amsmath} 6 | \usepackage{amsthm} 7 | \usepackage{booktabs} 8 | \usepackage{lipsum} 9 | \usepackage{graphicx} 10 | \usepackage{color} 11 | \usepackage{pgfplots} 12 | \usepackage{bm} 13 | 14 | \geometry{a4paper} 15 | 16 | \title{Title} 17 | \author{Tiago Amorim} 18 | 19 | \begin{document} 20 | \maketitle 21 | 22 | \end{document} 23 | -------------------------------------------------------------------------------- /picom/.config/picom/launch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Terminate already running bar instances 4 | killall -q picom 5 | # If all your bars have ipc enabled, you can also use 6 | # polybar-msg cmd quit 7 | 8 | # Launch bar1 and bar2 9 | echo "---" | tee -a /tmp/picom.log 10 | picom --backend glx 2>&1 | tee -a /tmp/picom.log & 11 | disown 12 | 13 | echo "Picom launched..." 14 | -------------------------------------------------------------------------------- /picom/.config/picom/picom.conf: -------------------------------------------------------------------------------- 1 | fading = true; 2 | fade-delta = 2; 3 | fade-in-step = 0.1; 4 | fade-out-step = 0.1; 5 | inactive-dim = 0.05; 6 | 7 | blur-background = false; 8 | blur-background-frame = false; 9 | 10 | corner-radius = 10 11 | vsync = true; 12 | backend="xrender" 13 | 14 | blur-background = false; 15 | 16 | opacity-rule = [ 17 | # "95:class_g = 'Org.gnome.Nautilus' && focused", 18 | # "80:class_g = 'Org.gnome.Nautilus' && !focused", 19 | # "95:class_g = 'Spotify' && focused", 20 | # "80:class_g = 'Spotify' && !focused", 21 | # "95:class_g = 'firefox' && focused", 22 | # "50:class_g = 'firefox' && !focused", 23 | # "95:class_g = 'Electron' && focused", 24 | "95:class_g = 'Rofi'", 25 | "80:class_g = 'Dunst'", 26 | # "98:window_type = 'normal' && focused", 27 | # "85:window_type = 'normal' && !focused", 28 | # "95:window_type = 'dialog'", 29 | # "95:window_type = 'popup_menu'", 30 | # "80:window_type = 'notification'" 31 | ]; 32 | 33 | -------------------------------------------------------------------------------- /polybar/.config/polybar/launch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | killall -q polybar && sleep 2 4 | 5 | echo "---" | tee -a /tmp/polybar1.log 6 | 7 | polybar tokyodark 2>&1 | tee -a /tmp/polybar1.log & 8 | disown 9 | 10 | echo "Bar launched..." 11 | -------------------------------------------------------------------------------- /polybar/.config/polybar/scripts/bluetooth_battery.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | bluetooth_print() { 4 | if [ "$(systemctl is-active "bluetooth.service")" = "active" ]; then 5 | devices_paired=$(bluetoothctl devices Paired | grep Device | cut -d ' ' -f 2) 6 | for device in $devices_paired; do 7 | device_info=$(bluetoothctl info "$device") 8 | if echo "$device_info" | grep -q "Audio Sink"; then 9 | if echo "$device_info" | grep -q "Connected: yes"; then 10 | echo "$device_info" | grep "Battery Percentage" | cut -d ' ' -f 4- | tr -d '()' 11 | fi 12 | fi 13 | done 14 | fi 15 | } 16 | 17 | case "$1" in 18 | --toggle) ;; #TODO: implement toggling 19 | *) 20 | bluetooth_print 21 | ;; 22 | esac 23 | -------------------------------------------------------------------------------- /polybar/.config/polybar/scripts/mic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ $(pacmd info | grep "source output" | cut -d " " -f1) -gt 0 ]]; then 4 | if ! amixer get Capture | grep -q "off"; then 5 | echo On 6 | else 7 | echo Off 8 | fi 9 | fi 10 | -------------------------------------------------------------------------------- /polybar/.config/polybar/scripts/spotify.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | bus_name="org.mpris.MediaPlayer2.spotify" 4 | object_path="/org/mpris/MediaPlayer2" 5 | domain="org.mpris.MediaPlayer2" 6 | interface="org.mpris.MediaPlayer2.Player" 7 | 8 | function join_by { 9 | local d=${1-} f=${2-} 10 | if shift 2; then 11 | printf %s "$f" "${@/#/$d}" 12 | fi 13 | } 14 | 15 | info() { 16 | if ! pgrep -x spotify >/dev/null; then 17 | echo "" 18 | exit 19 | fi 20 | 21 | meta=$(dbus-send --print-reply \ 22 | --dest=${bus_name} \ 23 | ${object_path} \ 24 | org.freedesktop.DBus.Properties.Get \ 25 | string:${interface} string:Metadata 2>&-) 26 | 27 | artist=$(echo "$meta" | sed -nr '/xesam:artist"/,+2s/^ +string "(.*)"$/\1/p' | sed -n 2p) 28 | album=$(echo "$meta" | sed -nr '/xesam:album"/,+1s/^ +variant +string "(.*)"$/\1/p') 29 | title=$(echo "$meta" | sed -nr '/xesam:title"/,+1s/^ +variant +string "(.*)"$/\1/p') 30 | 31 | format=() 32 | if [ -n "$artist" ]; then 33 | format+=("${artist}") 34 | fi 35 | format+=("$title") 36 | echo $(join_by ' - ' "${format[@]}") 37 | } 38 | 39 | toggle() { 40 | dbus-send --print-reply \ 41 | --dest=${bus_name} \ 42 | ${object_path} \ 43 | "${interface}.PlayPause" >/dev/null 44 | } 45 | 46 | previous() { 47 | dbus-send --print-reply \ 48 | --dest=${bus_name} \ 49 | ${object_path} \ 50 | "${interface}.Previous" >/dev/null 51 | } 52 | 53 | previous() { 54 | dbus-send --print-reply \ 55 | --dest=${bus_name} \ 56 | ${object_path} \ 57 | "${interface}.Previous" >/dev/null 58 | } 59 | 60 | next() { 61 | dbus-send --print-reply \ 62 | --dest=${bus_name} \ 63 | ${object_path} \ 64 | "${interface}.Next" >/dev/null 65 | } 66 | 67 | if [ "$1" == "-h" -o "$1" == "--help" ]; then 68 | echo "Parameters: --info --toggle --next --prev" 69 | elif [ $# -eq 0 -o "$1" == "--info" ]; then 70 | info 71 | else 72 | case $1 in 73 | "--toggle") 74 | toggle 75 | ;; 76 | "--next") 77 | next 78 | ;; 79 | "--prev") 80 | previous 81 | ;; 82 | *) 83 | echo >&2 "Invalid parameter, check --help." & 84 | exit 1 85 | ;; 86 | esac 87 | fi 88 | exit 0 89 | -------------------------------------------------------------------------------- /polybar/.config/polybar/scripts/toggl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from datetime import datetime, timezone, timedelta 4 | import base64, http.client, json, os 5 | 6 | TOGGL_ENTRY_URL = "https://api.track.toggl.com/api/v8/time_entries/current" 7 | TOGGL_PROJECT_URL = "https://api.track.toggl.com/api/v8/projects/" 8 | 9 | 10 | def request(url, auth): 11 | url_parts = url.split("/") 12 | host, path = url_parts[2], "/" + "/".join(url_parts[3:]) 13 | auth_bytes = f"{auth[0]}:{auth[1]}".encode("ascii") 14 | base64_auth_string = base64.b64encode(auth_bytes).decode("ascii") 15 | headers = {"Authorization": f"Basic {base64_auth_string}"} 16 | connection = http.client.HTTPSConnection(host) 17 | connection.request("GET", path, headers=headers) 18 | response = connection.getresponse() 19 | response_data = response.read().decode("utf-8") 20 | connection.close() 21 | return json.loads(response_data) 22 | 23 | 24 | def main(): 25 | api_token = os.environ.get("TOGGL_API_TOKEN") 26 | 27 | if api_token is None: 28 | exit(1) 29 | 30 | response = request(TOGGL_ENTRY_URL, auth=(api_token, "api_token")) 31 | current_data = response.get("data") 32 | 33 | if current_data and ("pid" in current_data or "description" in current_data): 34 | start_time = datetime.fromisoformat(current_data["start"]).replace( 35 | tzinfo=timezone.utc 36 | ) 37 | # start_time = start_time + timedelta(minutes=3) # HACK: fix offset 38 | elapsed_time = datetime.now(timezone.utc) - start_time 39 | hours, remainder = divmod(elapsed_time.seconds, 3600) 40 | minutes, _ = divmod(remainder, 60) 41 | 42 | if "pid" in current_data: 43 | project_id = current_data["pid"] 44 | project_response = request( 45 | f"{TOGGL_PROJECT_URL}{project_id}", auth=(api_token, "api_token") 46 | ) 47 | project_name = project_response.get("data", {}).get("name", "") 48 | else: 49 | project_name = current_data.get("description", "") 50 | 51 | print(f"{project_name} ({hours:02}:{minutes:02})") 52 | else: 53 | print("") 54 | 55 | 56 | if __name__ == "__main__": 57 | main() 58 | -------------------------------------------------------------------------------- /redshift/.config/redshift.conf: -------------------------------------------------------------------------------- 1 | [redshift] 2 | temp-day=5500 3 | temp-night=3000 4 | 5 | transition=1 6 | brightness-day=1.0 7 | brightness-night=1.0 8 | gamma-day=0.96:0.98:0.98 9 | gamma-night=1.00 10 | 11 | location-provider=manual 12 | adjustment-method=randr 13 | 14 | [manual] 15 | lat=-23.55 16 | lon=-46.64 17 | 18 | ;[randr] 19 | ;screen=0 20 | -------------------------------------------------------------------------------- /rofi/.config/rofi/colors.rasi: -------------------------------------------------------------------------------- 1 | * { 2 | bg: #11121dee; 3 | fg: #a0a8cd; 4 | prompt: #21222d; 5 | button-selected: #9fbbf3; 6 | background-color: @bg; 7 | text-color: @fg; 8 | border: #4a5057; 9 | } 10 | -------------------------------------------------------------------------------- /rofi/.config/rofi/config.rasi: -------------------------------------------------------------------------------- 1 | configuration { 2 | modi: "drun"; 3 | font: "MonoLisa Medium 12"; 4 | show-icons: true; 5 | icon-theme: "Papirus-Dark"; 6 | display-drun: ""; 7 | drun-display-format: "{name}"; 8 | sidebar-mode: false; 9 | } 10 | 11 | @theme "/dev/null" 12 | 13 | * { 14 | bg: #11121DEE; 15 | fg: #A0A8CD; 16 | prompt: #21222D; 17 | button-selected: #9FBBF3; 18 | background-color: @bg; 19 | text-color: @fg; 20 | border: #4A5057; 21 | } 22 | 23 | window { 24 | /* background-color: @bg; */ 25 | border-color: @border; 26 | border-radius: 7px; 27 | border: 2; 28 | padding: 32px; 29 | width: 50%; 30 | } 31 | 32 | prompt { 33 | background-color: @prompt; 34 | enabled: true; 35 | padding: 0.5% 32px 0% -0.5%; 36 | } 37 | 38 | entry { 39 | background-color: @prompt; 40 | expand: true; 41 | padding: 0.15% 0% 0% 0%; 42 | placeholder-color: @fg; 43 | placeholder: "Search"; 44 | } 45 | 46 | inputbar { 47 | children: [ prompt, entry ]; 48 | background-color: @prompt; 49 | border-radius: 6px; 50 | expand: false; 51 | margin: 0%; 52 | padding: 10px; 53 | } 54 | 55 | listview { 56 | columns: 4; 57 | lines: 3; 58 | fixed-columns: true; 59 | cycle: false; 60 | layout: vertical; 61 | } 62 | 63 | mainbox { 64 | children: [ inputbar, listview ]; 65 | padding: 2% 1% 2% 1%; 66 | spacing: 2%; 67 | } 68 | 69 | element { 70 | orientation: vertical; 71 | padding: 2% 0% 2% 0%; 72 | } 73 | 74 | element-icon { 75 | horizontal-align: 0.5; 76 | size: 56px; 77 | } 78 | 79 | element-text { 80 | expand: true; 81 | horizontal-align: 0.5; 82 | margin: 0.5% 0.5% -0.5% 0.5%; 83 | vertical-align: 0.5; 84 | } 85 | 86 | element-text, element-icon { 87 | background-color: inherit; 88 | text-color: inherit; 89 | } 90 | 91 | element selected { 92 | background-color: @button-selected; 93 | border-radius: 5px; 94 | text-color: @bg; 95 | } 96 | 97 | /* vim: ft=css 98 | -------------------------------------------------------------------------------- /rofi/.config/rofi/config1.rasi: -------------------------------------------------------------------------------- 1 | /* rofi.terminal: "/usr/bin/alacritty" */ 2 | configuration { 3 | display-drun: "Applications:"; 4 | display-window: "Windows:"; 5 | display-ssh: "SSH"; 6 | show-icons: true; 7 | drun-display-format: "{icon} {name}"; 8 | } 9 | 10 | * { 11 | font: "MonoLisa Medium 12"; 12 | icon-font: "MonoLisa Medium 18"; 13 | background-color: #11121DEE; 14 | foreground-color: #A0A8CD; 15 | foreground: transparent; 16 | window-bordercolor: #4A5057; 17 | color: @foreground; 18 | separator-color: @window-bordercolor; 19 | } 20 | 21 | window { 22 | background-color: @background-color; 23 | transparency: "real"; 24 | height: 53%; 25 | width: 40%; 26 | border-color: @window-bordercolor; 27 | border: 2 ; 28 | border-radius: 5px; 29 | } 30 | 31 | mainbox { 32 | background-color: transparent; 33 | padding: 30px 30px 30px 30px; 34 | } 35 | 36 | inputbar { 37 | background-color: transparent; 38 | padding: 5px 10px 25px 10px; 39 | } 40 | 41 | prompt { 42 | background-color: transparent; 43 | text-color: #FFFFFF; 44 | padding: 0px 10px 0px 0px; 45 | } 46 | 47 | entry { 48 | background-color: transparent; 49 | text-color: #FFFFFF; 50 | } 51 | 52 | listview { 53 | background-color: transparent; 54 | padding: 0px 5px 0px 5px; 55 | spacing: 0.2em; 56 | columns: 1; 57 | scrollbar: false; 58 | } 59 | 60 | element { 61 | background-color: transparent; 62 | padding: 5px 2px 5px 2px; 63 | } 64 | 65 | element.normal.normal { 66 | background-color: transparent; 67 | text-color: @foreground-color; 68 | } 69 | element.selected.normal { 70 | border-radius: 2px; 71 | background-color: #9FBBF3; 72 | color: @background-color; 73 | } 74 | element.alternate.normal { 75 | background-color: transparent; 76 | text-color: @foreground-color; 77 | } 78 | 79 | element selected { 80 | background-color: #9FBBF3; 81 | color: @background-color; 82 | } 83 | 84 | element-icon { 85 | size: 35px; 86 | border: 0px; 87 | } 88 | 89 | element-text { 90 | expand: true; 91 | vertical-align: 0.5; 92 | } 93 | 94 | element-text, element-icon { 95 | background-color: inherit; 96 | } 97 | 98 | /* vim: ft=css 99 | -------------------------------------------------------------------------------- /rofi/.config/rofi/dmenu.rasi: -------------------------------------------------------------------------------- 1 | configuration { 2 | modi: "run"; 3 | font: "MonoLisa Medium 12"; 4 | show-icons: false; 5 | icon-theme: "Tela-circle-red"; 6 | display-drun: ""; 7 | drun-display-format: "{name}"; 8 | sidebar-mode: false; 9 | } 10 | 11 | @theme "/dev/null" 12 | * { 13 | bg: #11121DEE; 14 | fg: #A0A8CD; 15 | prompt: #21222D; 16 | text-color: @fg; 17 | background-color: @bg; 18 | border-color: #4A5057; 19 | button-selected: #9FBBF3; 20 | } 21 | 22 | prompt { 23 | background-color: @prompt; 24 | enabled: false; 25 | /* padding: 0.5% 32px 0% -0.5%; */ 26 | } 27 | 28 | window { 29 | anchor: north; 30 | location: north; 31 | width: 100%; 32 | padding: 4px; 33 | children: [ horibox ]; 34 | } 35 | 36 | horibox { 37 | orientation: horizontal; 38 | children: [ prompt, entry, listview ]; 39 | } 40 | 41 | listview { 42 | layout: horizontal; 43 | spacing: 5px; 44 | lines: 100; 45 | 46 | padding: 0% 2% 0% 2%; 47 | } 48 | 49 | /* entry { */ 50 | /* expand: false; */ 51 | /* width: 10em; */ 52 | /* } */ 53 | 54 | entry { 55 | background-color: @prompt; 56 | expand: false; 57 | padding: 0% 2% 0% 2%; 58 | width: 10em; 59 | placeholder-color: @fg; 60 | placeholder: "Search"; 61 | } 62 | 63 | element { 64 | orientation: horizontal; 65 | padding: 0% 2% 0% 2%; 66 | } 67 | 68 | element-icon { 69 | horizontal-align: 0.5; 70 | size: 24px; 71 | } 72 | 73 | element-text { 74 | /* expand: true; */ 75 | /* horizontal-align: 0.5; */ 76 | /* margin: 0.5% 0.5% -0.5% 0.5%; */ 77 | horizontal-align: 0.5; 78 | } 79 | 80 | element-text, element-icon { 81 | background-color: inherit; 82 | text-color: inherit; 83 | } 84 | 85 | element selected { 86 | background-color: @button-selected; 87 | border-radius: 5px; 88 | text-color: @bg; 89 | } 90 | 91 | /* vim: ft=css 92 | -------------------------------------------------------------------------------- /rofi/.config/rofi/launcher.rasi: -------------------------------------------------------------------------------- 1 | @import "colors.rasi" configuration { 2 | modi: "drun"; 3 | display-drun: ""; 4 | drun-display-format: "{name}"; 5 | font: "MonoLisa Medium 14"; 6 | icon-theme: "Papirus-Dark"; 7 | show-icons: true; 8 | } 9 | 10 | window { 11 | border-color: @border; 12 | border-radius: 10px; 13 | border: 2; 14 | padding: 16px; 15 | width: 50%; 16 | } 17 | 18 | prompt { 19 | background-color: @prompt; 20 | enabled: true; 21 | padding: 0.5% 32px 0% -0.5%; 22 | } 23 | 24 | entry { 25 | background-color: @prompt; 26 | expand: true; 27 | padding: 0.15% 0% 0% 0%; 28 | placeholder-color: @fg; 29 | placeholder: "Search"; 30 | } 31 | 32 | inputbar { 33 | children: 34 | [ prompt, 35 | entry]; 36 | background-color: @prompt; 37 | border-radius: 6px; 38 | expand: false; 39 | margin: 0%; 40 | padding: 10px; 41 | } 42 | 43 | listview { 44 | columns: 4; 45 | lines: 3; 46 | fixed-columns: true; 47 | cycle: false; 48 | layout: vertical; 49 | } 50 | 51 | mainbox { 52 | children: 53 | [ inputbar, 54 | listview]; 55 | padding: 2% 1% 2% 1%; 56 | spacing: 2%; 57 | } 58 | 59 | element { 60 | orientation: vertical; 61 | padding: 2% 0% 2% 0%; 62 | } 63 | 64 | element-icon { 65 | horizontal-align: 0.5; 66 | size: 56px; 67 | } 68 | 69 | element-text { 70 | expand: true; 71 | horizontal-align: 0.5; 72 | vertical-align: 0.5; 73 | margin: 0.5% 0.5% -0.5% 0.5%; 74 | } 75 | 76 | element-text, 77 | element-icon { 78 | background-color: inherit; 79 | text-color: inherit; 80 | } 81 | 82 | element selected { 83 | background-color: @button-selected; 84 | border-radius: 5px; 85 | text-color: @bg; 86 | } 87 | -------------------------------------------------------------------------------- /rofi/.config/rofi/zotero.rasi: -------------------------------------------------------------------------------- 1 | @import "colors.rasi" configuration { 2 | modi: "zotero"; 3 | show-icons: false; 4 | font: "MonoLisa Medium 14"; 5 | display-zotero: ""; 6 | drun-display-format: "{name}"; 7 | sidebar-mode: false; 8 | } 9 | 10 | window { 11 | border-color: @border; 12 | border-radius: 7px; 13 | border: 2; 14 | padding: 12px; 15 | width: 60%; 16 | } 17 | 18 | prompt { 19 | background-color: @prompt; 20 | enabled: true; 21 | padding: 0% 0% 0% 1%; 22 | } 23 | 24 | entry { 25 | background-color: @prompt; 26 | expand: true; 27 | padding: 0% 0% 0% 0%; 28 | margin: 0% 0% 0% 0%; 29 | placeholder-color: @fg; 30 | placeholder: "Search"; 31 | } 32 | 33 | inputbar { 34 | children: [ prompt, entry]; 35 | background-color: @prompt; 36 | border-radius: 6px; 37 | expand: false; 38 | padding: 10px; 39 | border: 1px; 40 | border-color: @border; 41 | } 42 | 43 | listview { 44 | columns: 1; 45 | lines: 10; 46 | fixed-columns: true; 47 | cycle: false; 48 | layout: vertical; 49 | margin: 1.5% 0% 0% 0%; 50 | scrollbar: true; 51 | } 52 | 53 | scrollbar { 54 | width: 30px; 55 | handle-width: 8px; 56 | handle-color: @button-selected; 57 | padding: 0px 0px 0px 2px; 58 | } 59 | 60 | mainbox { 61 | children: [ inputbar, listview]; 62 | padding: 0% 0% 0% 0%; 63 | spacing: 0%; 64 | } 65 | 66 | element { 67 | orientation: vertical; 68 | } 69 | 70 | element-text { 71 | expand: false; 72 | horizontal-align: 0; 73 | vertical-align: 0.5; 74 | } 75 | 76 | element-text { 77 | background-color: inherit; 78 | text-color: inherit; 79 | } 80 | 81 | element selected { 82 | background-color: @button-selected; 83 | border-radius: 5px; 84 | text-color: @bg; 85 | } 86 | -------------------------------------------------------------------------------- /root/etc/X11/xorg.conf.d/69-keyboard.conf: -------------------------------------------------------------------------------- 1 | Section "InputClass" 2 | Identifier "Gaming Keyboard" 3 | MatchUSBID "258a:0016" 4 | Driver "kbd" 5 | Option "XkbLayout" "br" 6 | Option "XkbModel" "default" 7 | Option "XkbVariant" "abnt2" 8 | EndSection 9 | -------------------------------------------------------------------------------- /root/etc/default/grub: -------------------------------------------------------------------------------- 1 | # GRUB boot loader configuration 2 | 3 | GRUB_DEFAULT=0 4 | GRUB_TIMEOUT=1 5 | GRUB_DISTRIBUTOR="Arch" 6 | GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet rd.systemd.show_status=auto rd.udev.log_priority=3 vt.global_cursor_default=0 vga=current" 7 | GRUB_CMDLINE_LINUX="" 8 | 9 | # Preload both GPT and MBR modules so that they are not missed 10 | GRUB_PRELOAD_MODULES="part_gpt part_msdos" 11 | 12 | # Uncomment to enable booting from LUKS encrypted devices 13 | #GRUB_ENABLE_CRYPTODISK=y 14 | 15 | # Set to 'countdown' or 'hidden' to change timeout behavior, 16 | # press ESC key to display menu. 17 | GRUB_TIMEOUT_STYLE=menu 18 | 19 | # Uncomment to use basic console 20 | GRUB_TERMINAL_INPUT=console 21 | 22 | # Uncomment to disable graphical terminal 23 | #GRUB_TERMINAL_OUTPUT=console 24 | 25 | # The resolution used on graphical terminal 26 | # note that you can use only modes which your graphic card supports via VBE 27 | # you can see them in real GRUB with the command `vbeinfo' 28 | GRUB_GFXMODE=auto 29 | 30 | # Uncomment to allow the kernel use the same resolution used by grub 31 | GRUB_GFXPAYLOAD_LINUX=keep 32 | 33 | # Uncomment if you want GRUB to pass to the Linux kernel the old parameter 34 | # format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx" 35 | #GRUB_DISABLE_LINUX_UUID=true 36 | 37 | # Uncomment to disable generation of recovery mode menu entries 38 | GRUB_DISABLE_RECOVERY=true 39 | 40 | # Uncomment and set to the desired menu colors. Used by normal and wallpaper 41 | # modes only. Entries specified as foreground/background. 42 | #GRUB_COLOR_NORMAL="light-blue/black" 43 | #GRUB_COLOR_HIGHLIGHT="light-cyan/blue" 44 | 45 | # Uncomment one of them for the gfx desired, a image background or a gfxtheme 46 | #GRUB_BACKGROUND="/path/to/wallpaper" 47 | #GRUB_THEME="/path/to/gfxtheme" 48 | 49 | # Uncomment to get a beep at GRUB start 50 | #GRUB_INIT_TUNE="480 440 1" 51 | 52 | # Uncomment to make GRUB remember the last selection. This requires 53 | # setting 'GRUB_DEFAULT=saved' above. 54 | #GRUB_SAVEDEFAULT=true 55 | 56 | # Uncomment to disable submenus in boot menu 57 | #GRUB_DISABLE_SUBMENU=y 58 | 59 | # Probing for other operating systems is disabled for security reasons. Read 60 | # documentation on GRUB_DISABLE_OS_PROBER, if still want to enable this 61 | # functionality install os-prober and uncomment to detect and include other 62 | # operating systems. 63 | #GRUB_DISABLE_OS_PROBER=false 64 | -------------------------------------------------------------------------------- /root/etc/udev/rules.d/99-keyboard.rules: -------------------------------------------------------------------------------- 1 | SUBSYSTEM=="usb", ACTION=="bind", ATTRS{idVendor}=="258a", ATTRS{idProduct}=="0016", TAG+="systemd", ENV{SYSTEMD_USER_WANTS}+="keyboard-layout.service" 2 | -------------------------------------------------------------------------------- /root/etc/udev/rules.d/99-monitor-hotplug.rules: -------------------------------------------------------------------------------- 1 | ACTION=="change", SUBSYSTEM=="drm", ENV{HOTPLUG}=="1", TAG+="systemd", ENV{SYSTEMD_USER_WANTS}+="monitor-hotplug.service" 2 | -------------------------------------------------------------------------------- /root/etc/udev/rules.d/99-power-energy.rules: -------------------------------------------------------------------------------- 1 | SUBSYSTEM=="power_supply", ACTION=="change", RUN+="/home/tiagovla/.local/bin/fan_speed" 2 | -------------------------------------------------------------------------------- /scripts/.local/bin/audible2mp3: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | url="https://raw.githubusercontent.com/KrumpetPirate/AAXtoMP3/master/AAXtoMP3" 3 | checksum=$(ffprobe "$1" 2>&1 | grep 'file checksum' | awk -F ' == ' '{print $2}') 4 | authcode=$(curl -s "https://aax.api.j-kit.me/api/v1/activation/${checksum}") 5 | curl -sSL $url | bash -s -- "-A" "$authcode" "$1" 6 | -------------------------------------------------------------------------------- /scripts/.local/bin/ez: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | filename=$(basename -- "$1") 3 | filename="${filename%.*}" 4 | if [ -f $1 ] ; then 5 | case $1 in 6 | *.tar.bz2) tar xjf $1 ;; 7 | *.tar.gz) tar xzf $1 ;; 8 | *.tar.xz) tar xJf $1 ;; 9 | *.bz2) bunzip2 $1 ;; 10 | *.rar) unrar x $1 ;; 11 | *.gz) gunzip $1 ;; 12 | *.tar) tar xf $1 ;; 13 | *.tbz2) tar xjf $1 ;; 14 | *.tgz) tar xzf $1 ;; 15 | *.zip) unzip $1 -d $filename ;; 16 | *.Z) uncompress $1;; 17 | *.7z) 7z x $1 ;; 18 | *) echo "'$1' cannot be extracted via ez" ;; 19 | esac 20 | else 21 | echo "'$1' is not a valid file" 22 | fi 23 | -------------------------------------------------------------------------------- /scripts/.local/bin/fan_speed: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | 3 | EC_IO_FILE="/sys/kernel/debug/ec/ec0/io" 4 | PROFILE_FILE="$(dirname "$(realpath "$0")")/profile" 5 | 6 | modprobe ec_sys write_support=1 7 | grep 'WEC' "$PROFILE_FILE" | while read -r cmd address value; do 8 | echo -n "$value" | xxd -r -p | dd of=$EC_IO_FILE bs=1 seek=$((address)) count=1 conv=notrunc status=none 9 | echo "${cmd} - Address ${address} Value $((value))" 10 | done 11 | 12 | # sudo od -t x1 $EC_IO_FILE ## debug 13 | -------------------------------------------------------------------------------- /scripts/.local/bin/fix_layout: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Setting vars up 4 | COMPOSE_FILE='/usr/share/X11/locale/en_US.UTF-8/Compose' 5 | 6 | # Backing up files 7 | sudo cp ${COMPOSE_FILE} ${COMPOSE_FILE}.bak 8 | 9 | # Fixing cedilla in Compose 10 | sudo sed --in-place -e 's/ć/ç/g' ${COMPOSE_FILE} 11 | sudo sed --in-place -e 's/Ć/Ç/g' ${COMPOSE_FILE} 12 | -------------------------------------------------------------------------------- /scripts/.local/bin/imgur: -------------------------------------------------------------------------------- 1 | 2 | 3 | #!/usr/bin/env bash 4 | 5 | # Imgur script by Bart Nagel 6 | # Improvements by Tino Sino 7 | # Version 6 or more 8 | # I release this into the public domain. Do with it what you will. 9 | # The latest version can be found at https://github.com/tremby/imgur.sh 10 | 11 | # API Key provided by Bart; 12 | # replace with your own or specify yours as IMGUR_CLIENT_ID environment variable 13 | # to avoid limits 14 | default_client_id=c9a6efb3d7932fd 15 | client_id="${IMGUR_CLIENT_ID:=$default_client_id}" 16 | 17 | # Function to output usage instructions 18 | function usage { 19 | echo "Usage: $(basename $0) [ [...]]" >&2 20 | echo 21 | echo "Upload images to imgur and output their new URLs to stdout. Each one's" >&2 22 | echo "delete page is output to stderr between the view URLs." >&2 23 | echo 24 | echo "A filename can be - to read from stdin. If no filename is given, stdin is read." >&2 25 | echo 26 | echo "If xsel, xclip, pbcopy, or clip is available," >&2 27 | echo "the URLs are put on the X selection or clipboard for easy pasting." >&2 28 | echo "Use environment variables to set special options for your clipboard program (see code)." >&2 29 | } 30 | 31 | # Function to upload a path 32 | # First argument should be a content spec understood by curl's -F option 33 | function upload { 34 | curl --progress-bar -H "Authorization: Client-ID $client_id" -H "Expect: " -F "image=$1" https://api.imgur.com/3/image.xml 35 | # The "Expect: " header is to get around a problem when using this through 36 | # the Squid proxy. Not sure if it's a Squid bug or what. 37 | } 38 | 39 | # Check arguments 40 | if [ "$1" == "-h" -o "$1" == "--help" ]; then 41 | usage 42 | exit 0 43 | elif [ $# -eq 0 ]; then 44 | echo "No file specified; reading from stdin" >&2 45 | exec "$0" - 46 | fi 47 | 48 | # Check curl is available 49 | type curl &>/dev/null || { 50 | echo "Couldn't find curl, which is required." >&2 51 | exit 17 52 | } 53 | 54 | clip="" 55 | errors=false 56 | 57 | # Loop through arguments 58 | while [ $# -gt 0 ]; do 59 | file="$1" 60 | shift 61 | 62 | # Upload the image 63 | if [[ "$file" =~ ^https?:// ]]; then 64 | # URL -> imgur 65 | response=$(upload "$file") 2>/dev/null 66 | else 67 | # File -> imgur 68 | # Check file exists 69 | if [ "$file" != "-" -a ! -f "$file" ]; then 70 | echo "File '$file' doesn't exist; skipping" >&2 71 | errors=true 72 | continue 73 | fi 74 | response=$(upload "@$file") 2>/dev/null 75 | fi 76 | 77 | if [ $? -ne 0 ]; then 78 | echo "Upload failed" >&2 79 | errors=true 80 | continue 81 | elif echo "$response" | grep -q 'success="0"'; then 82 | echo "Error message from imgur:" >&2 83 | msg="${response##*}" 84 | echo "${msg%%*}" >&2 85 | errors=true 86 | continue 87 | fi 88 | 89 | # Parse the response and output our stuff 90 | url="${response##*}" 91 | url="${url%%*}" 92 | delete_hash="${response##*}" 93 | delete_hash="${delete_hash%%*}" 94 | echo $url 95 | echo "Delete page: https://imgur.com/delete/$delete_hash" >&2 96 | 97 | # Append the URL to a string so we can put them all on the clipboard later 98 | clip+="$url" 99 | if [ $# -gt 0 ]; then 100 | clip+=$'\n' 101 | fi 102 | done 103 | 104 | # Put the URLs on the clipboard if we can 105 | if type pbcopy &>/dev/null; then 106 | echo -n "$clip" | pbcopy $IMGUR_PBCOPY_OPTIONS 107 | elif type clip &>/dev/null; then 108 | echo -n "$clip" | clip $IMGUR_CLIP_OPTIONS 109 | elif [ $DISPLAY ]; then 110 | if type xsel &>/dev/null; then 111 | echo -n "$clip" | xsel -i $IMGUR_XSEL_OPTIONS 112 | elif type xclip &>/dev/null; then 113 | echo -n "$clip" | xclip -selection clipboard -in 114 | else 115 | echo "Haven't copied to the clipboard: no xsel or xclip" >&2 116 | fi 117 | else 118 | echo "Haven't copied to the clipboard: no \$DISPLAY or pbcopy or clip" >&2 119 | fi 120 | 121 | if $errors; then 122 | exit 1 123 | fi 124 | -------------------------------------------------------------------------------- /scripts/.local/bin/kbd_layout: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | fix_layout() { 3 | ids=$( 4 | xinput --list | awk -v search="Gaming Keyboard" \ 5 | '$0 ~ search {match($0, /id=[0-9]+/);\ 6 | if (RSTART) \ 7 | print substr($0, RSTART+3, RLENGTH-3)\ 8 | }' 9 | ) 10 | for i in $ids; do setxkbmap br -device "$i" >/dev/null 2>&1; done 11 | xset r rate 200 120 12 | } 13 | 14 | fix_layout 15 | -------------------------------------------------------------------------------- /scripts/.local/bin/monitor_setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | export DISPLAY=":0" 4 | is_external_active=$(xrandr | grep ' connected' | grep 'HDMI' | awk '{print $1}') 5 | external_monitor=$(xrandr | grep 'HDMI' | awk '{print $1}') 6 | main_monitor=$(xrandr | grep 'eDP' | awk '{print $1}') 7 | 8 | killall -q polybar 9 | while pgrep -u $UID -x polybar >/dev/null; do sleep 2; done 10 | if [[ -n $is_external_active ]]; then 11 | xrandr --output "$external_monitor" --mode 2560x1080 --rate 75 --primary --right-of "$main_monitor" --output "$main_monitor" --mode 1920x1080 12 | MONITOR=$main_monitor polybar --reload tokyodark -c ~/.config/polybar/config.ini /var/tmp/polybar-primary.log 2>&1 200>&- & 13 | MONITOR=$external_monitor polybar --reload tokyodark -c ~/.config/polybar/config.ini /var/tmp/polybar-secondary.log 2>&1 200>&- & 14 | for desktop in $(bspc query -D --names -m "$main_monitor"); do 15 | bspc desktop "$desktop" --to-monitor "$external_monitor" 16 | done 17 | bspc desktop Desktop --remove 2>/dev/null 18 | bspc desktop 10 --to-monitor "$main_monitor" 19 | bspc wm -O "$external_monitor" "$main_monitor" 20 | bspc monitor "$external_monitor" -o 1 2 3 4 5 6 7 8 9 0 10 21 | else 22 | xrandr --output "$main_monitor" --mode 1920x1080 --rate 60 --output "$external_monitor" --off 23 | MONITOR=$main_monitor polybar --reload tokyodark -c ~/.config/polybar/config.ini /var/tmp/polybar-primary.log 2>&1 200>&- & 24 | for desktop in $(bspc query -D -m "$external_monitor"); do 25 | bspc desktop "$desktop" --to-monitor "$main_monitor" 26 | done 27 | bspc desktop Desktop --remove 2>/dev/null 28 | bspc monitor "$main_monitor" -o 1 2 3 4 5 6 7 8 9 0 10 29 | bspc wm -O eDP-1-1 30 | fi 31 | -------------------------------------------------------------------------------- /scripts/.local/bin/notflix: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Dependencies - webtorrent, mpv 4 | 5 | mkdir -p "$HOME/.cache/notflix" 6 | 7 | menu="fzf" 8 | menu="rofi -dmenu" 9 | baseurl="https://1337x.wtf" 10 | cachedir="$HOME/.cache/notflix" 11 | 12 | if [ -z "$1" ]; then 13 | query=$(dmenu -p "Search Torrent: " <&-) 14 | else 15 | query=$1 16 | fi 17 | 18 | query=$(sed 's/ /+/g' <<<"$query") 19 | 20 | #curl -s https://1337x.to/category-search/$query/Movies/1/ > $cachedir/tmp.html 21 | curl -s "$baseurl/search/$query/1/" >"$cachedir/tmp.html" 22 | 23 | # Get Titles 24 | grep -o ']*>//g' >"$cachedir/titles.bw" 26 | 27 | result_count=$(wc -l "$cachedir/titles.bw" | awk '{print $1}') 28 | if [ "$result_count" -lt 1 ]; then 29 | notify-send "😔 No Result found. Try again 🔴" -i "NONE" 30 | exit 0 31 | fi 32 | 33 | # Seeders and Leechers 34 | grep -o '' "$cachedir/tmp.html" | 35 | sed 's/<[^>]*>//g' | sed 'N;s/\n/ /' >"$cachedir/seedleech.bw" 36 | 37 | # Size 38 | grep -o '.*<\/span>//g' | 40 | sed -e 's/<[^>]*>//g' >"$cachedir/size.bw" 41 | 42 | # Links 43 | grep -E '/torrent/' "$cachedir/tmp.html" | 44 | sed -E 's#.*(/torrent/.*)/">.*/#\1#' | 45 | sed 's/td>//g' >"$cachedir/links.bw" 46 | 47 | # Clearning up some data to display 48 | sed 's/\./ /g; s/\-/ /g' "$cachedir/titles.bw" | 49 | sed 's/[^A-Za-z0-9 ]//g' | tr -s " " >"$cachedir/tmp" && mv "$cachedir/tmp" "$cachedir/titles.bw" 50 | 51 | awk '{print NR " - ["$0"]"}' "$cachedir/size.bw" >"$cachedir/tmp" && mv "$cachedir/tmp" "$cachedir/size.bw" 52 | awk '{print "[S:"$1 ", L:"$2"]" }' "$cachedir/seedleech.bw" >"$cachedir/tmp" && mv "$cachedir/tmp" "$cachedir/seedleech.bw" 53 | 54 | # Getting the line number 55 | LINE=$(paste -d\ "$cachedir/size.bw" "$cachedir/seedleech.bw" "$cachedir/titles.bw" | 56 | $menu | 57 | cut -d\- -f1 | 58 | awk '{$1=$1; print}') 59 | 60 | if [ -z "$LINE" ]; then 61 | notify-send "😔 No Result selected. Exiting... 🔴" -i "NONE" 62 | exit 0 63 | fi 64 | notify-send "🔍 Searching Magnet seeds 🧲" -i "NONE" 65 | url=$(head -n "$LINE" "$cachedir/links.bw" | tail -n +"$LINE") 66 | fullURL="${baseurl}${url}/" 67 | 68 | # Requesting page for magnet link 69 | curl -s "$fullURL" >"$cachedir/tmp.html" 70 | magnet=$(grep -Po "magnet:\?xt=urn:btih:[a-zA-Z0-9]*" "$cachedir/tmp.html" | head -n 1) 71 | 72 | webtorrent "$magnet" --mpv 73 | 74 | # Simple notification 75 | notify-send "🎥 Enjoy Watching ☺️ " -i "NONE" 76 | -------------------------------------------------------------------------------- /scripts/.local/bin/profile: -------------------------------------------------------------------------------- 1 | -Profile Name: Quiet 2 | [Temperatures_1] 3 | >WEC 0x6A 0x2f 4 | >WEC 0x6B 0x35 5 | >WEC 0x6C 0x43 6 | >WEC 0x6D 0x50 7 | >WEC 0x6E 0x5A 8 | >WEC 0x6F 0x5F 9 | >WEC 0x70 0x64 10 | ---- 11 | [FanSpeeds_1] 12 | >WEC 0x72 0x40 13 | >WEC 0x73 0x41 14 | >WEC 0x74 0x42 15 | >WEC 0x75 0x43 16 | >WEC 0x76 0x44 17 | >WEC 0x77 0x50 18 | >WEC 0x78 0x64 19 | ---- 20 | [Temperatures_2] 21 | >WEC 0x82 0x37 22 | >WEC 0x83 0x41 23 | >WEC 0x84 0x4B 24 | >WEC 0x85 0x55 25 | >WEC 0x86 0x5A 26 | >WEC 0x87 0x5D 27 | >WEC 0x88 0x66 28 | ---- 29 | [FanSpeeds_2] 30 | >WEC 0x8A 0x37 31 | >WEC 0x8B 0x37 32 | >WEC 0x8C 0x3C 33 | >WEC 0x8D 0x41 34 | >WEC 0x8E 0x46 35 | >WEC 0x8F 0x50 36 | >WEC 0x90 0x64 37 | ---- 38 | >RwExit 39 | -------------------------------------------------------------------------------- /scripts/.local/bin/rcloud: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | if [ ! -z $1 ] 3 | then 4 | provider=$1 5 | else 6 | provider="all" 7 | fi 8 | 9 | case $provider in 10 | all|dropbox) rclone mount dropbox: ~/cloud/dropbox --daemon;;& 11 | all|box) rclone mount box: ~/cloud/box --daemon;;& 12 | all|pcloud) rclone mount pcloud: ~/cloud/pcloud --daemon;;& 13 | all|mega) rclone mount mega: ~/cloud/mega --daemon;;& 14 | all|onedrive) rclone mount onedrive: ~/cloud/onedrive --daemon;;& 15 | all|drive) rclone mount drive: ~/cloud/drive --daemon;; 16 | esac 17 | -------------------------------------------------------------------------------- /scripts/.local/bin/transfer: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | filename=$(basename "$1") 3 | res=$( 4 | curl --progress-bar --upload-file "$1" https://transfer.sh/${filename// /_} 5 | ) 6 | echo "${res/.sh/.sh/get}" | xclip -selection clipboard -in 7 | printf "%s\n" "${res/.sh/.sh/get}" 8 | -------------------------------------------------------------------------------- /stylua/.config/.stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 120 2 | line_endings = "Unix" 3 | indent_type = "Spaces" 4 | indent_width = 4 5 | quote_style = "AutoPreferDouble" 6 | no_call_parentheses = true 7 | -------------------------------------------------------------------------------- /sxhkd/.config/sxhkd/sxhkdrc: -------------------------------------------------------------------------------- 1 | ## wm independent hotkeys 2 | 3 | # terminal emulator 4 | alt + Return 5 | wezterm 6 | 7 | # program launcher 8 | alt + @space 9 | GDK_DPI_SCALE=1.5 QT_SCALE_FACTOR=1.5 GTK_THEME=Adwaita:dark rofi -terminal wezterm -show drun 10 | 11 | # program launcher with dmenu style 12 | shift + alt + @space 13 | GDK_DPI_SCALE=1.5 QT_SCALE_FACTOR=1.5 GTK_THEME=Adwaita:dark rofi -terminal wezterm -show run -theme dmenu 14 | 15 | # make sxhkd reload its configuration files: 16 | alt + Escape 17 | pkill -USR1 -x sxhkd 18 | 19 | # open browser - Default profile 20 | alt + w 21 | chrome --profile-directory="Default" 22 | 23 | # open browser - Work profile 24 | shift + alt + w 25 | chrome --profile-directory="Work" 26 | 27 | # open discord 28 | alt + d 29 | if pgrep -x Discord > /dev/null; then bspc desktop -f 6; else discord &> /dev/null &; fi 30 | 31 | # bspwm hotkeys 32 | 33 | # quit/restart bspwm 34 | alt + shift + {q,r} 35 | bspc {quit,wm -r} 36 | 37 | # close and kill 38 | alt + {_,ctrl + }q 39 | bspc node -{c,k} 40 | 41 | # alternate between the tiled and monocle layout 42 | alt + m 43 | bspc desktop -l next 44 | 45 | # send the newest marked node to the newest preselected node 46 | alt + y 47 | bspc node newest.marked.local -n newest.!automatic.local 48 | 49 | # swap the current node and the biggest window 50 | alt + g 51 | bspc node -s biggest.window 52 | 53 | 54 | # set the window state 55 | alt + {t,shift + t,s,f} 56 | bspc node -t {tiled,pseudo_tiled,floating,fullscreen} 57 | 58 | # set the node flags 59 | alt + shift + {m,x,y,z} 60 | bspc node -g {marked,locked,sticky,private} 61 | 62 | # focus the node in the given direction 63 | alt + {_,shift + }{h,j,k,l} 64 | bspc node -{f,s} {west,south,north,east} 65 | 66 | # focus the node for the given path jump 67 | alt + {p,b,comma,period} 68 | bspc node -f @{parent,brother,first,second} 69 | 70 | # focus the next/previous window in the current desktop 71 | alt + {_,shift + }c 72 | bspc node -f {next,prev}.local.!hidden.window 73 | 74 | # focus the next/previous desktop in the current monitor 75 | alt + bracket{left,right} 76 | bspc desktop -f {prev,next}.local 77 | 78 | alt + Tab 79 | bspc desktop -f last 80 | 81 | # focus the older or newer node in the focus history 82 | alt + {o,i} 83 | bspc wm -h off; \ 84 | bspc node {older,newer} -f; \ 85 | bspc wm -h on 86 | 87 | # focus or send to the given desktop 88 | alt + {_,shift + }{1-9,0} 89 | bspc {desktop -f,node -d} '{1-9,0}' 90 | 91 | alt + {_,shift + }{ minus } 92 | bspc {desktop -f,node -d} 11 93 | 94 | alt + {_,shift + }{ grave } 95 | bspc {desktop -f,node -d} 10 96 | 97 | shift + alt + comma 98 | switch_desktops --rotate 99 | # 100 | shift + alt + period 101 | switch_desktops --rotate-reverse 102 | 103 | # move/resize 104 | ctrl + alt + {h,j,k,l} 105 | {bspc node @parent/second -z left -20 0; \ 106 | bspc node @parent/first -z right -20 0, \ 107 | bspc node @parent/second -z top 0 +20; \ 108 | bspc node @parent/first -z bottom 0 +20, \ 109 | bspc node @parent/first -z bottom 0 -20; \ 110 | bspc node @parent/second -z top 0 -20, \ 111 | bspc node @parent/first -z right +20 0; \ 112 | bspc node @parent/second -z left +20 0} 113 | 114 | # custom 115 | # 116 | # increase/decrease volume 117 | alt + {Up,Down} 118 | pulsemixer --change-volume {+,-}10 119 | 120 | XF86Audio{Raise,Lower}Volume 121 | pulsemixer --change-volume {+,-}10 122 | 123 | # mute volume 124 | XF86AudioMute 125 | pulsemixer --toggle-mute && polybar-msg hook mvol 1 # pamixer 126 | 127 | # mute mic 128 | XF86AudioMicMute 129 | pactl set-source-mute @DEFAULT_SOURCE@ toggle 130 | 131 | # increase/decrease brightness 132 | XF86MonBrightness{Up,Down} 133 | brightnessctl -d intel_backlight set 25{+,-} && polybar-msg hook mbrightness 1 134 | 135 | # screenshot 136 | {Print, alt + Print} 137 | flameshot {full, gui} -p ~/Pictures/Screenshots --clipboard 138 | 139 | # vim:ft=bash 140 | # check this https://github.com/pigmonkey/dotfiles/blob/master/config/sxhkd/sxhkdrc 141 | -------------------------------------------------------------------------------- /systemd/.config/systemd/user/keyboard-layout.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fix keyboard's layout 3 | 4 | [Service] 5 | Type=oneshot 6 | Environment=DISPLAY=:0 7 | ExecStart= /bin/bash -c "~/.local/bin/kbd_layout" 8 | StandardOutput=journal 9 | -------------------------------------------------------------------------------- /systemd/.config/systemd/user/monitor-hotplug.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Reload BSPWM 3 | 4 | [Service] 5 | Type=oneshot 6 | Environment=DISPLAY=:0 7 | ExecStart= /bin/bash -c "bspc wm -r" 8 | StandardOutput=journal 9 | -------------------------------------------------------------------------------- /tmux/.config/tmux/.gitignore: -------------------------------------------------------------------------------- 1 | plugins/ 2 | -------------------------------------------------------------------------------- /tmux/.config/tmux/screen-256color.terminfo: -------------------------------------------------------------------------------- 1 | # A screen-256color based TERMINFO that adds the escape sequences for italic. 2 | # 3 | # Install: 4 | # 5 | # tic screen-256color.terminfo 6 | # 7 | # Usage: 8 | # 9 | # export TERM=screen-256color 10 | # 11 | screen-256color|screen with 256 colors and italic, 12 | sitm=\E[3m, ritm=\E[23m, 13 | use=screen-256color, 14 | -------------------------------------------------------------------------------- /tmux/.config/tmux/tmux.conf: -------------------------------------------------------------------------------- 1 | #git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm 2 | set -g @plugin 'tmux-plugins/tpm' 3 | set -g @plugin 'tmux-plugins/tmux-sensible' 4 | set -g @plugin 'christoomey/vim-tmux-navigator' 5 | set -g @plugin 'soyuka/tmux-current-pane-hostname' 6 | set -g @plugin 'tmux-plugins/tmux-yank' 7 | set -g @plugin 'akohlbecker/aw-watcher-tmux' 8 | # set -g @plugin 'tmux-plugins/tmux-resurrect' 9 | # set -g @plugin 'tmux-plugins/tmux-continuum' 10 | 11 | # config reloak 12 | bind r source ~/.config/tmux/tmux.conf 13 | 14 | # set terminal options 15 | set-option -sa terminal-overrides ",xterm*:Tc" 16 | 17 | # misc options 18 | set -g mouse on 19 | set -g allow-passthrough on 20 | set -g history-limit 10000 21 | set-window-option -g aggressive-resize on 22 | # set-window-option -g automatic-rename on 23 | 24 | # start window and pane numbering at 1 25 | set -g base-index 1 26 | set -g pane-base-index 1 27 | set-window-option -g pane-base-index 1 28 | set-option -g renumber-windows on 29 | 30 | # don't wait for an escape sequence after seeing C-b 31 | set -sg escape-time 0 32 | 33 | #vim mode 34 | set-window-option -g mode-keys vi 35 | bind -T copy-mode-vi v send-keys -X begin-selection 36 | bind -T copy-mode-vi C-v send-keys -X rectangle-toggle 37 | bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel 38 | set -g status-keys vi 39 | 40 | thm_bg="#11121d" 41 | thm_fg="#a0a8cd" 42 | thm_cyan="#89dceb" 43 | thm_black="#181825" 44 | thm_gray="#313244" 45 | thm_magenta="#cba6f7" 46 | thm_pink="#f5c2e7" 47 | thm_red="#f38ba8" 48 | thm_green="#a6e3a1" 49 | thm_yellow="#f9e2af" 50 | thm_blue="#89b4fa" 51 | thm_orange="#fab387" 52 | thm_black4="#585b70" 53 | 54 | bind-key -n C-F3 set-option -g status 55 | # status bar 56 | set -g status-style bg=default 57 | set -g status-justify left 58 | set -g status-left-length 80 59 | set -g status-right-length 80 60 | 61 | set -g status-bg "${thm_bg}" 62 | set -g status-fg "${thm_fg}" 63 | 64 | set -g message-style "fg=${thm_blue},bg=${thm_bg},align=centre" 65 | set -g message-command-style "fg=${thm_blue},bg=${thm_bg},align=centre" 66 | 67 | set -g pane-border-style fg="#282c34" 68 | set -g pane-active-border-style "bg=default fg=#4A5057" 69 | 70 | setw -g window-status-activity-style "fg=${thm_fg},bg=${thm_bg},none" 71 | setw -g window-status-separator "" 72 | setw -g window-status-style "fg=${thm_fg},bg=${thm_bg},none" 73 | 74 | wt_enabled="off" 75 | right_separator="" 76 | left_separator="" 77 | user="off" 78 | user_icon="" 79 | host="off" 80 | directory_icon="" 81 | window_icon="" 82 | session_icon="" 83 | host_icon="󰒋" 84 | date_time="off" 85 | datetime_icon="" 86 | 87 | show_directory="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$right_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics]$directory_icon #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} #{?client_prefix,#[fg=$thm_red]" 88 | show_window="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$right_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics]$window_icon #[fg=$thm_fg,bg=$thm_gray] #W #{?client_prefix,#[fg=$thm_red]" 89 | show_session="#[fg=$thm_green]}#[bg=$thm_gray]$right_separator#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg]$session_icon #[fg=$thm_fg,bg=$thm_gray] #S " 90 | show_directory_in_window_status="#[fg=$thm_bg,bg=$thm_blue] #I #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} " 91 | show_directory_in_window_status_current="#[fg=$thm_bg,bg=$thm_orange] #I #[fg=$thm_fg,bg=$thm_bg] #{b:pane_current_path} " 92 | show_window_in_window_status="#[fg=$thm_fg,bg=$thm_bg] #W #[fg=$thm_bg,bg=$thm_blue] #I#[fg=$thm_blue,bg=$thm_bg]$left_separator#[fg=$thm_fg,bg=$thm_bg,nobold,nounderscore,noitalics] " 93 | show_window_in_window_status_current="#[fg=$thm_fg,bg=$thm_gray] #W #[fg=$thm_bg,bg=$thm_orange] #I#[fg=$thm_orange,bg=$thm_bg]$left_separator#[fg=$thm_fg,bg=$thm_bg,nobold,nounderscore,noitalics] " 94 | show_user="#[fg=$thm_blue,bg=$thm_gray]$right_separator#[fg=$thm_bg,bg=$thm_blue]$user_icon #[fg=$thm_fg,bg=$thm_gray] #(whoami) " 95 | show_host="#[fg=$thm_blue,bg=$thm_gray]$right_separator#[fg=$thm_bg,bg=$thm_blue]$host_icon #[fg=$thm_fg,bg=$thm_gray] #H " 96 | show_date_time="#[fg=$thm_blue,bg=$thm_gray]$right_separator#[fg=$thm_bg,bg=$thm_blue]$datetime_icon #[fg=$thm_fg,bg=$thm_gray] $date_time " 97 | 98 | set -g status-left '#[fg=#2b2f37]#[fg=#ee6d85,bg=#2b2f37] #S ⧉ #[fg=#2b2f37,bg=default] ' 99 | set -g status-right "#[fg=#2b2f37]#[fg=#f6955b,bg=#2b2f37]#U@#H #[fg=#2b2f37,bg=default]" 100 | set -g status-interval 10 101 | set-window-option -g window-status-current-format "#[fg=#7199ee]#I*:#W" 102 | 103 | 104 | # find session 105 | bind-key C-f command-prompt -p find-session 'switch-client -t %%' 106 | 107 | # split current window horizontally/vertically 108 | bind-key - split-window -v -c "#{pane_current_path}" 109 | bind-key _ split-window -h -c "#{pane_current_path}" 110 | 111 | # navigation 112 | bind-key > swap-pane -D # swap current pane with the next one 113 | bind-key < swap-pane -U # swap current pane with the previous one 114 | bind-key Tab last-window # move to last active window 115 | 116 | #custom keys 117 | ## https://github.com/ianthehenry/dotfiles/blob/master/.tmux.conf 118 | 119 | ## Plugins 120 | run '~/.config/tmux/plugins/tpm/tpm' 121 | run-shell ~/.config/tmux/plugins/tmux-current-pane-hostname/current_pane_hostname.tmux 122 | # Use I to install 123 | # run-shell '~/.config/tmux/plugins/tmux-resurrect/resurrect.tmux' 124 | # prefix + ctrol-s to save 125 | # prefix + ctrol-r to restore 126 | # set -g @continuum-restore 'on' 127 | # run-shell '~/.config/tmux/plugins/tmux-continuum/continuum.tmux' 128 | -------------------------------------------------------------------------------- /wezterm/.config/wezterm/wezterm.lua: -------------------------------------------------------------------------------- 1 | local wezterm = require "wezterm" 2 | 3 | return { 4 | font = wezterm.font_with_fallback { 5 | { 6 | family = "Monolisa", 7 | weight = 500, 8 | harfbuzz_features = { -- https://www.monolisa.dev/playground 9 | "zero=1", -- slashed zero 10 | "ss01=1", -- normal asterisk * 11 | "ss02=1", -- script variant 12 | "ss03=0", -- alt g 13 | "ss04=0", -- alt g 14 | "ss05=1", -- alt sharp S 15 | "ss06=0", -- alt at @ 16 | "ss07=1", -- alt curly bracket 17 | "ss08=1", -- alt parenthesis --> ( 18 | "ss09=0", -- alt greater equal style 1 19 | "ss10=1", -- alt greater equal style 2 -> >= 20 | "ss11=1", -- hexadecimal -> 0x69 21 | "ss12=0", -- thin backslash -> // 22 | "ss13=1", -- alt dollar -> $ 23 | "ss14=0", -- alt & 24 | "ss15=0", -- i without serif 25 | "ss16=0", -- r without serif 26 | "ss17=1", -- alt .= and ..= 27 | }, 28 | }, 29 | { family = "JetBrains Mono", weight = 500 }, 30 | }, 31 | font_size = 17.0, 32 | cursor_blink_rate = 0, 33 | exit_behavior = "Close", 34 | force_reverse_video_cursor = true, 35 | cell_width = 0.85, 36 | window_background_opacity = 1.00, 37 | colors = { 38 | foreground = "#a0A8CD", 39 | background = "#11121D", 40 | ansi = { "#32344a", "#f7768e", "#9ece6a", "#e0af68", "#7aa2f7", "#ad8ee6", "#449dab", "#787c99" }, 41 | brights = { "#444b6a", "#ff7a93", "#b9f27c", "#ff9e64", "#7da6ff", "#bb9af7", "#0db9d7", "#acb0d0" }, 42 | cursor_fg = nil, 43 | cursor_border = "#a0A8CD", 44 | }, 45 | hide_tab_bar_if_only_one_tab = true, 46 | window_padding = { 47 | left = 4, 48 | right = 4, 49 | top = 4, 50 | bottom = 4, 51 | }, 52 | default_prog = (function() 53 | local is_wayland = os.getenv "WAYLAND_DISPLAY" 54 | local workspace_cmd = is_wayland and "$(hyprctl monitors | grep 'active workspace' | awk '{print $3}')" 55 | or "$(bspc query -D -d focused --names)" 56 | local tmux_cmd = string.format("tmux attach -t %s || tmux new -A -s %s", workspace_cmd, workspace_cmd) 57 | return { "/usr/bin/zsh", "-l", "-c", tmux_cmd } 58 | end)(), 59 | keys = { 60 | { key = "i", mods = "CTRL", action = wezterm.action { SendString = "\x1b[105;5u" } }, 61 | { key = "\r", mods = "SHIFT", action = wezterm.action { SendString = "\x1b[13;2u" } }, 62 | { key = "\r", mods = "CTRL", action = wezterm.action { SendString = "\x1b[13;5u" } }, 63 | }, 64 | warn_about_missing_glyphs = false, 65 | webgpu_preferred_adapter = wezterm.gui.enumerate_gpus()[2], 66 | front_end = "WebGpu", 67 | debug_key_events = true, 68 | max_fps = 120, 69 | window_close_confirmation = "NeverPrompt", 70 | } 71 | -------------------------------------------------------------------------------- /x/.xinitrc: -------------------------------------------------------------------------------- 1 | [ -f ~/.xprofile ] && . ~/.xprofile 2 | exec bspwm 3 | -------------------------------------------------------------------------------- /x/.xprofile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /usr/bin/prime-offload 4 | tmux has-session -t test || tmux new-session -d -s test & 5 | xset r rate 200 120 6 | 7 | export PATH="$HOME/.local/bin:$PATH" 8 | export XDG_CONFIG_HOME=$HOME/.config 9 | export XDG_CACHE_HOME=$HOME/.cache 10 | export XDG_DATA_HOME=$HOME/.local/share 11 | -------------------------------------------------------------------------------- /zathura/.config/zathura/zathurarc: -------------------------------------------------------------------------------- 1 | # Basic Settings 2 | 3 | set synctex true 4 | set synctex-editor-command "texlab inverse-search -i %{input} -l %{line}" 5 | 6 | set highlight-transparency 0.40 7 | set zoom-center "true" 8 | set selection-clipboard clipboard 9 | set render-loading "false" 10 | set zoom-min 10 11 | 12 | map toggle_index 13 | map K zoom in 14 | map J zoom out 15 | map p print 16 | map b recolor 17 | unmap f 18 | map f toggle_fullscreen 19 | map [fullscreen] f toggle_fullscreen 20 | map M mark_evaluate 21 | 22 | 23 | # theme 24 | 25 | # Light/Default mode settings: 26 | set notification-error-bg "#f44747" 27 | set notification-error-fg "#A0A8CD" 28 | set notification-warning-bg "#dcdcaa" 29 | set notification-warning-fg "#11121D" 30 | set notification-bg "#11121D" 31 | set notification-fg "#af88F1" 32 | 33 | set completion-bg "#2d2d30" 34 | set completion-fg "#A0A8CD" 35 | set completion-group-bg "#2d2d30" 36 | set completion-group-fg "#A0A8CD" 37 | set completion-highlight-bg "#062c45" 38 | set completion-highlight-fg "#A0A8CD" 39 | 40 | set index-bg "#11121D" 41 | set index-fg "#A0A8CD" 42 | set index-active-bg "#af88e1" 43 | set index-active-fg "#282a36" 44 | 45 | set inputbar-bg "#ffaf00" 46 | set inputbar-fg "#11121D" 47 | set statusbar-bg "#7199EE" 48 | set statusbar-fg "#ffffff" 49 | 50 | set highlight-color rgba(152,195,121,0.4) # #98C379 51 | set highlight-active-color rgba(254,109,133,0.4) # #fe6d85 52 | 53 | set default-bg "#11121D" 54 | set default-fg "#A0A8CD" 55 | 56 | set render-loading true 57 | set render-loading-fg "#11121D" 58 | set render-loading-bg "#A0A8CD" 59 | 60 | # Recolor mode settings 61 | set recolor-lightcolor "#11121D" # Background 62 | set recolor-darkcolor "#A0A8CD" # Foreground 63 | 64 | # Startup options 65 | set adjust-open "best-fit" 66 | set smooth-scroll "true" 67 | # set recolor true 68 | set recolor-reverse-video "true" 69 | set scroll-step 50 70 | set font "MonoLisa-Medium 15" 71 | 72 | -------------------------------------------------------------------------------- /zsh/.config/zsh/.gitignore: -------------------------------------------------------------------------------- 1 | .zcompdump 2 | plugins/* 3 | -------------------------------------------------------------------------------- /zsh/.config/zsh/.zshrc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | zmodload zsh/zprof 3 | for zfile in exports functions prompt settings aliases plugins mappings secrets; do 4 | # shellcheck disable=SC1090 5 | source "$ZDOTDIR/config/${zfile}.zsh" 6 | done 7 | 8 | autoload -Uz compinit 9 | setopt EXTENDEDGLOB 10 | if [[ -n ${ZDOTDIR}/.zcompdump(#qN.mh2) ]]; then 11 | compinit 12 | else 13 | compinit -C 14 | fi 15 | 16 | # export all_proxy="socks5://192.0.0.4:1080" 17 | eval "$(zoxide init --cmd c zsh)" 18 | -------------------------------------------------------------------------------- /zsh/.config/zsh/config/.gitignore: -------------------------------------------------------------------------------- 1 | secrets.zsh 2 | -------------------------------------------------------------------------------- /zsh/.config/zsh/config/aliases.zsh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | alias pacman='sudo pacman' 3 | alias ytd_discord='f(){ yt-dlp "$@" --recode-video webm || exit 1; unset -f f; }; f' 4 | alias :q='exit' 5 | alias qq='clear' 6 | alias Q='exit' 7 | alias la='ls -a --color=auto' 8 | alias ll='ls -la --color=auto' 9 | alias ls='exa --icons --color=auto --time-style=long-iso --group-directories-first --git' 10 | alias du='du --max-depth=1 --si' 11 | alias cat='bat -Pp' 12 | alias du='dust' 13 | alias df='duf' 14 | alias dr='docker run --rm -it' 15 | alias dc='docker compose' 16 | # alias rm='trash' 17 | # alias df='df --all --si --print-type' 18 | # -xh --si 19 | alias ports='sudo lsof -i -P -n | grep LISTEN' 20 | alias mkdir='mkdir --parents' 21 | alias grep="grep --color='auto'" 22 | alias ncdu="ncdu --color=off" 23 | alias rc="rclone" 24 | alias cf='cd "$(/bin/fd -d 2 --type directory | fzf --layout=reverse --height=10)"' 25 | alias ppy='poetry run python' 26 | alias qr='qrencode -t ansiutf8' 27 | 28 | alias cp='cp --interactive --verbose' 29 | alias ln='ln --interactive --verbose' 30 | alias mv='mv --interactive --verbose' 31 | 32 | alias ranger='alacritty --class Ranger -e /usr/bin/ranger' 33 | alias n='nvim' 34 | alias l='la' 35 | alias -s pdf="zathura" 36 | 37 | alias xcopy='xclip -selection clipboard -in' 38 | alias clip='xclip -selection clipboard -in' 39 | alias mixer='ncpamixer' 40 | 41 | alias g='git' 42 | function gs() { 43 | git status -s -b "${@}" && git ql 2>/dev/null 44 | } 45 | function gc() { 46 | git commit -v "${@}" 47 | } 48 | function g.() { 49 | git add -p "${@}" 50 | } 51 | function gd() { 52 | git diff "${@}" 53 | } 54 | function gp() { 55 | git checkout -p "${@}" 56 | } 57 | function gr() { 58 | git rebase "${@}" 59 | } 60 | function grc() { 61 | git rebase --continue "${@}" 62 | } 63 | function gar() { 64 | git add --all . 65 | } 66 | function ga() { 67 | git commit --amend --reuse-message=HEAD 68 | } 69 | 70 | function rs() { 71 | rsync -azh --no-inc-recursive --info=progress2 "$@" 72 | } 73 | 74 | function burnerfox(){ 75 | xhost +local:docker && 76 | docker run --rm \ 77 | --env="DISPLAY=$DISPLAY" --env="XAUTHORITY=$XAUTHORITY" \ 78 | --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ 79 | --volume="$HOME/.Xauthority:/root/.Xauthority:rw" \ 80 | jess/firefox 81 | } 82 | 83 | -------------------------------------------------------------------------------- /zsh/.config/zsh/config/exports.zsh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | export _JAVA_AWT_WM_NONREPARENTING=1 3 | 4 | export GDK_DPI_SCALE=1.5 5 | export GDK_SCALE=1.5 6 | 7 | export LANG=en_US.UTF-8 8 | export EDITOR='nvim' 9 | export TERMINAL="wezterm" 10 | export BROWSER="brave" 11 | export GTK_THEME=Adwaita:dark 12 | export GTEST_COLOR=1 13 | export PDFVIEWER=zathura 14 | 15 | export PATH="$HOME/.local/bin:$PATH" 16 | export PATH="$HOME/.poetry/bin:$PATH" 17 | export PATH="/opt/cuda/bin:$PATH" 18 | # export PATH="$HOME/.asdf/shims:$PATH" 19 | 20 | export XDG_CONFIG_HOME=$HOME/.config 21 | export XDG_CACHE_HOME=$HOME/.cache 22 | export XDG_DATA_HOME=$HOME/.local/share 23 | 24 | export PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring 25 | export NVCC_PREPEND_FLAGS='-ccbin /opt/cuda/bin' 26 | -------------------------------------------------------------------------------- /zsh/.config/zsh/config/functions.zsh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | function zsh_add_file() { 4 | [ -f "$ZDOTDIR/$1" ] && source "$ZDOTDIR/$1" 5 | } 6 | 7 | function zsh_add_plugin() { 8 | PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2) 9 | if [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then 10 | zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh" || 11 | zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh" 12 | else 13 | git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME" 14 | fi 15 | } 16 | 17 | function zsh_add_completion() { 18 | PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2) 19 | if [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then 20 | completion_file_path=$(ls $ZDOTDIR/plugins/$PLUGIN_NAME/_*) 21 | fpath+="$(dirname "${completion_file_path}")" 22 | zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh" 23 | else 24 | git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME" 25 | fpath+=$(ls $ZDOTDIR/plugins/$PLUGIN_NAME/_*) 26 | [ -f $ZDOTDIR/.zccompdump ] && $ZDOTDIR/.zccompdump 27 | fi 28 | completion_file="$(basename "${completion_file_path}")" 29 | if [ "$2" = true ]; then 30 | compinit "${completion_file:1}" 31 | fi 32 | } 33 | 34 | function x11-clip-wrap-widgets() { 35 | local copy_or_paste=$1 36 | shift 37 | for widget in $@; do 38 | if [[ $copy_or_paste == "copy" ]]; then 39 | eval " 40 | function _x11-clip-wrapped-$widget() { 41 | zle .$widget 42 | xclip -in -selection clipboard <<<\$CUTBUFFER 43 | } 44 | " 45 | else 46 | eval " 47 | function _x11-clip-wrapped-$widget() { 48 | CUTBUFFER=\$(xclip -out -selection clipboard) 49 | zle .$widget 50 | } 51 | " 52 | fi 53 | zle -N $widget _x11-clip-wrapped-$widget 54 | done 55 | } 56 | local copy_widgets=( 57 | vi-yank vi-yank-eol vi-delete vi-backward-kill-word vi-change-whole-line 58 | ) 59 | local paste_widgets=( 60 | vi-put-{before,after} 61 | ) 62 | 63 | x11-clip-wrap-widgets copy $copy_widgets 64 | x11-clip-wrap-widgets paste $paste_widgets 65 | -------------------------------------------------------------------------------- /zsh/.config/zsh/config/mappings.zsh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # 3 | export KEYTIMEOUT=1 4 | bindkey -v '^?' backward-delete-char 5 | bindkey '^[[A' history-beginning-search-backward 6 | bindkey '^[[B' history-beginning-search-forward 7 | bindkey '^P' history-beginning-search-backward 8 | bindkey '^N' history-beginning-search-forward 9 | -------------------------------------------------------------------------------- /zsh/.config/zsh/config/plugins.zsh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | source "$ZDOTDIR/config/functions.zsh" 4 | 5 | zsh_add_plugin "zsh-users/zsh-autosuggestions" 6 | zsh_add_plugin "Valiev/almostontop" 7 | zsh_add_plugin "Aloxaf/fzf-tab" 8 | 9 | # zsh_add_plugin "marlonrichert/zsh-autocomplete" 10 | # zsh_add_plugin "zsh-users/zsh-syntax-highlighting" 11 | # zsh_add_plugin "hlissner/zsh-autopair" 12 | 13 | # eval "$(rtx activate zsh)" 14 | if [[ ! -v VIRTUAL_ENV ]]; then 15 | eval "$(mise activate zsh)" 16 | # alias rtx='mise' 17 | fi 18 | 19 | zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 20 | zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} 21 | zstyle ':completion:*' menu no 22 | zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath' 23 | zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath' 24 | 25 | eval "$(fzf --zsh)" 26 | # export ASDF_ROOT="/opt/.asdf" 27 | # source "/opt/asdf-vm/asdf.sh" 28 | # fpath=(${ASDF_ROOT}/completions $fpath) 29 | 30 | -------------------------------------------------------------------------------- /zsh/.config/zsh/config/prompt.zsh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | setopt prompt_subst 4 | 5 | function prompt-length() { 6 | emulate -L zsh 7 | local -i COLUMNS=${2:-COLUMNS} 8 | local -i x y=${#1} m 9 | if (( y )); then 10 | while (( ${${(%):-$1%$y(l.1.0)}[-1]} )); do 11 | x=y 12 | (( y *= 2 )) 13 | done 14 | while (( y > x + 1 )); do 15 | (( m = x + (y - x) / 2 )) 16 | (( ${${(%):-$1%$m(l.x.y)}[-1]} = m )) 17 | done 18 | fi 19 | typeset -g REPLY=$x 20 | } 21 | 22 | function fill-line() { 23 | emulate -L zsh 24 | prompt-length $1 25 | local -i left_len=REPLY 26 | prompt-length $2 9999 27 | local -i right_len=REPLY 28 | local -i pad_len=$((COLUMNS - left_len - right_len - ${ZLE_RPROMPT_INDENT:-1})) 29 | if (( pad_len < 1 )); then 30 | typeset -g REPLY=$1 31 | else 32 | local pad=${(pl.$pad_len.. .)} 33 | typeset -g REPLY=${1}${pad}${2} 34 | fi 35 | } 36 | setopt transientrprompt 37 | 38 | function preexec() { 39 | timer=${timer:-$SECONDS} 40 | } 41 | 42 | function set-prompt() { 43 | emulate -L zsh 44 | local git_branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)" 45 | local top_left="", top_right="", bottom_left="", bottom_right="" 46 | git_branch=${git_branch//\%/%%} 47 | top_left="%B%F{cyan}%~%f%b " 48 | if [ $git_branch ]; then 49 | top_left+="%F{blue}git:(%f%F{red}${git_branch}%f%F{blue})%f" 50 | fi 51 | top_right='%F{yellow}%T%f' 52 | bottom_left='%B%F{%(?.green.red)}√%f%b ' 53 | bottom_right="%(?.%B%F{green} .%F{red}[%?])%f" 54 | if [ $timer ]; then 55 | timer_show=$(($SECONDS - $timer)) 56 | timer_show=$(printf '%.*f\n' 0 $timer_show) 57 | if [ ! -a $timer_show != "0" ]; then 58 | top_right="%b%F{blue}[${timer_show}s]%F{blue}" 59 | fi 60 | unset timer 61 | fi 62 | local REPLY 63 | fill-line "$top_left" "$top_right" 64 | PROMPT=$REPLY$'\n'$bottom_left 65 | RPROMPT=$bottom_right 66 | } 67 | 68 | setopt no_prompt_{bang,subst} prompt_{cr,percent,sp} 69 | autoload -Uz add-zsh-hook 70 | add-zsh-hook precmd set-prompt 71 | # 72 | #source: https://gist.github.com/romkatv/2a107ef9314f0d5f76563725b42f7cab 73 | -------------------------------------------------------------------------------- /zsh/.config/zsh/config/settings.zsh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | export HISTSIZE=1000000 3 | export SAVEHIST=1000000 4 | export HISTFILE="$HOME/.zsh_history" 5 | 6 | xset r rate 200 200 7 | 8 | setopt SHARE_HISTORY 9 | setopt APPEND_HISTORY 10 | setopt EXTENDED_HISTORY 11 | setopt HIST_EXPIRE_DUPS_FIRST 12 | setopt HIST_FIND_NO_DUPS 13 | setopt HIST_IGNORE_ALL_DUPS 14 | setopt HIST_IGNORE_DUPS 15 | setopt HIST_IGNORE_SPACE 16 | setopt HIST_REDUCE_BLANKS 17 | setopt HIST_SAVE_NO_DUPS 18 | setopt INC_APPEND_HISTORY_TIME 19 | 20 | setopt AUTO_CD 21 | -------------------------------------------------------------------------------- /zsh/.zshenv: -------------------------------------------------------------------------------- 1 | export ZDOTDIR="$HOME/.config/zsh" 2 | export GTK_IM_MODULE=cedilla 3 | export QT_IM_MODULE=cedilla 4 | export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" 5 | # export __NV_PRIME_RENDER_OFFLOAD=1 6 | # export __GLX_VENDOR_LIBRARY_NAM="nvidia" 7 | # export __VK_LAYER_NV_optimus="NVIDIA_only" 8 | 9 | if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then 10 | echo "Starting X..." 11 | [[ $(fgconsole 2>/dev/null) == 1 ]] && exec startx -- -ardelay 200 -arinterval 120 vt1 &> /dev/null 12 | fi 13 | 14 | if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty2 ]]; then 15 | echo "Starting Hyprland..." 16 | [[ $(fgconsole 2>/dev/null) == 2 ]] && exec hyprland &> /dev/null 17 | fi 18 | 19 | --------------------------------------------------------------------------------