Compare commits

...

28 Commits

Author SHA1 Message Date
0fc08678a2 chore(deps): updated nvim packages 2023-09-08 13:03:04 +03:00
ff83bc9ef1 feat(nvim): added toggleterm, updated plugins 2023-09-08 00:46:10 +03:00
492cb4dbd8 chore(nvim): consolidated lsp configs 2023-09-08 00:45:36 +03:00
bc608cd578 feat(shell): switch to starship because it's fast 2023-09-08 00:43:37 +03:00
acae4fec73 chore(scripts): cleanup x-hr 2023-09-08 00:40:33 +03:00
446d8971e7 chore(nvim): small tweaks, documentation 2023-09-08 00:39:10 +03:00
2f917c9285 chore(shell): documentation, cleanup 2023-09-08 00:34:51 +03:00
1d851708eb chore(tmux): drop unused plugins, update config 2023-09-08 00:29:32 +03:00
renovate[bot]
c3d4b51927 chore(deps): update actions/checkout action to v4 (#10)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-05 12:48:18 +03:00
6d8c04977c chore(nvim): plugins cleanup, updates 2023-09-05 00:19:20 +03:00
64fc8a13d3 feat(config): alacritty configuration 2023-09-05 00:17:40 +03:00
73e6f8a321 feat(nvim): combined and removed plugins 2023-09-02 22:34:03 +03:00
68727e4869 fix(scripts): fzf install script tweaks 2023-09-02 15:56:19 +03:00
c10654c50a feat(nvim): add lazy-lock.json for plugin stability 2023-09-02 13:35:36 +03:00
4de181e3b2 feat(nvim): combined and removed plugins 2023-09-02 13:35:10 +03:00
8eb0d2bcab chore(scripts): experimental git-crypt 2023-08-31 15:03:34 +03:00
3154fabe26 chore(brew): update bundle, HOMEBREW_NO_ENV_HINTS 2023-08-31 15:03:10 +03:00
fb9301c095 chore(tmux): tweak theme config 2023-08-31 11:27:57 +03:00
906487f939 chore(nvim): keymappings 2023-08-31 10:26:57 +03:00
11c0a05c84 fix(repo): font authors file permissions 2023-08-31 09:58:17 +03:00
1ced69d3d7 feat(config): tunkki alias file 2023-08-31 09:57:48 +03:00
168194aa74 fix(dfm): shfmt paths, permissions 2023-08-31 09:57:20 +03:00
51afab44ef fix(shell): add missing hostname to config loaders 2023-08-31 09:56:26 +03:00
31e04ce865 fix(lint): added missing shfmt, linted files 2023-08-31 09:55:00 +03:00
6b76bc825c feat(shell): fix p10k instant promp, update config 2023-08-30 20:26:45 +03:00
10994347aa fix(antigen): remove autoenv bundle 2023-08-30 20:25:54 +03:00
76b2236c63 fix(tools): fix fzf installation 2023-08-30 20:25:16 +03:00
288e63c9d9 chore(dotbot): link whole local folder 2023-08-30 20:15:05 +03:00
103 changed files with 4498 additions and 3534 deletions

View File

@@ -19,7 +19,7 @@ indent_size = 1
indent_size = 1
indent_style = tab
[local/bin/*]
[{local/bin/*,**/*.sh,**/zshrc}]
shell_variant = bash # --language-variant
binary_next_line = true
switch_case_indent = true # --case-indent

View File

@@ -5,7 +5,7 @@ jobs:
debug-changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Create changelog text
id: changelog
uses: loopwerk/tag-changelog@v1

View File

@@ -5,7 +5,7 @@ jobs:
name: Linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: GitHub Actions
uses: reviewdog/action-actionlint@v1
with:

View File

@@ -12,7 +12,7 @@ jobs:
created: ${{ steps.daily-version.outputs.created }}
version: ${{ steps.daily-version.outputs.version }}
steps:
- uses: actions/checkout@v3 # Checkout our working repository
- uses: actions/checkout@v4 # Checkout our working repository
- name: Create tag if necessary
uses: fregante/daily-version-action@v2
id: daily-version

View File

@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

1
.gitignore vendored
View File

@@ -4,7 +4,6 @@ Brewfile.lock.json
*cache
.idea
.vscode
config/fzf
config/cheat/cheatsheets/pure-bash-bible/*
config/cheat/cheatsheets/tldr/*
config/git/credentials

18
.gitmodules vendored
View File

@@ -26,24 +26,12 @@
[submodule "tmux/catppuccin"]
path = config/tmux/plugins/tmux
url = https://github.com/catppuccin/tmux.git
[submodule "tmux/tmux-1password"]
path = config/tmux/plugins/tmux-1password
url = https://github.com/yardnsm/tmux-1password.git
[submodule "tmux/tmux-autoreload"]
path = config/tmux/plugins/tmux-autoreload
url = https://github.com/b0o/tmux-autoreload.git
[submodule "tmux/tmux-continuum"]
path = config/tmux/plugins/tmux-continuum
url = https://github.com/tmux-plugins/tmux-continuum
[submodule "tmux/tmux-fzf"]
path = config/tmux/plugins/tmux-fzf
url = https://github.com/sainnhe/tmux-fzf.git
[submodule "tmux/tmux-menus"]
path = config/tmux/plugins/tmux-menus
url = https://github.com/jaclu/tmux-menus.git
[submodule "tmux/tmux-notify"]
path = config/tmux/plugins/tmux-notify
url = https://github.com/ChanderG/tmux-notify.git
[submodule "tmux/tmux-resurrect"]
path = config/tmux/plugins/tmux-resurrect
url = https://github.com/tmux-plugins/tmux-resurrect
@@ -53,12 +41,6 @@
[submodule "tmux/tmux-sessionist"]
path = config/tmux/plugins/tmux-sessionist
url = https://github.com/tmux-plugins/tmux-sessionist.git
[submodule "tmux/tmux-suspend"]
path = config/tmux/plugins/tmux-suspend
url = https://github.com/MunifTanjim/tmux-suspend.git
[submodule "tmux/tmux-yank"]
path = config/tmux/plugins/tmux-yank
url = https://github.com/tmux-plugins/tmux-yank.git
[submodule "tmux/vim-tmux-navigator"]
path = config/tmux/plugins/vim-tmux-navigator
url = https://github.com/christoomey/vim-tmux-navigator.git

View File

@@ -5,3 +5,22 @@
external-sources=true
includeAllWorkspaceSymbols=true
# SC2039: In POSIX sh, 'local' is undefined.
# https://github.com/koalaman/shellcheck/wiki/SC2039
disable=SC2039
# SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
# https://github.com/koalaman/shellcheck/wiki/SC2166
disable=SC2166
# SC2154: Variable is referenced but not assigned
# https://github.com/koalaman/shellcheck/wiki/SC2154
disable=SC2154
# SC1091: Not following <file>
# https://github.com/koalaman/shellcheck/wiki/SC1091
disable=SC1091
# SC2174: When used with -p, -m only applies to the deepest directory.
# https://github.com/koalaman/shellcheck/wiki/SC2174
disable=SC2174

View File

@@ -10,28 +10,15 @@ git submodule add --name tmux/tpm \
-f https://github.com/tmux-plugins/tpm.git config/tmux/plugins/tpm
git submodule add --name tmux/catppuccin \
-f https://github.com/catppuccin/tmux.git config/tmux/plugins/tmux
git submodule add --name tmux/tmux-1password \
-f https://github.com/yardnsm/tmux-1password.git config/tmux/plugins/tmux-1password
git submodule add --name tmux/tmux-autoreload \
-f https://github.com/b0o/tmux-autoreload.git config/tmux/plugins/tmux-autoreload
git submodule add --name tmux/tmux-continuum \
-f https://github.com/tmux-plugins/tmux-continuum config/tmux/plugins/tmux-continuum
git submodule add --name tmux/tmux-fzf \
-f https://github.com/sainnhe/tmux-fzf.git config/tmux/plugins/tmux-fzf
git submodule add --name tmux/tmux-menus \
-f https://github.com/jaclu/tmux-menus.git config/tmux/plugins/tmux-menus
git submodule add --name tmux/tmux-notify \
-f https://github.com/ChanderG/tmux-notify.git config/tmux/plugins/tmux-notify
git submodule add --name tmux/tmux-resurrect \
-f https://github.com/tmux-plugins/tmux-resurrect config/tmux/plugins/tmux-resurrect
git submodule add --name tmux/tmux-sensible \
-f https://github.com/tmux-plugins/tmux-sensible.git config/tmux/plugins/tmux-sensible
git submodule add --name tmux/tmux-sessionist \
-f https://github.com/tmux-plugins/tmux-sessionist.git config/tmux/plugins/tmux-sessionist
git submodule add --name tmux/tmux-suspend \
-f https://github.com/MunifTanjim/tmux-suspend.git config/tmux/plugins/tmux-suspend
git submodule add --name tmux/tmux-yank \
-f https://github.com/tmux-plugins/tmux-yank.git config/tmux/plugins/tmux-yank
git submodule add --name tmux/vim-tmux-navigator \
-f https://github.com/christoomey/vim-tmux-navigator.git config/tmux/plugins/vim-tmux-navigator

View File

@@ -7,12 +7,13 @@ export DOTFILES="$HOME/.dotfiles"
# Run x-load-configs in your terminal to reload the files.
function x-load-configs()
{
HOST="$(hostname -s)"
# Load the shell dotfiles, and then some:
for file in $DOTFILES/config/{exports,alias,functions}; do
[ -r "$file" ] && source "$file"
[ -r "$file-secret" ] && source "$file-secret"
[ -r "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
[ -r "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
[ -r "$file-$HOST" ] && source "$file-$HOST"
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret"
done
}
x-load-configs
@@ -20,6 +21,6 @@ x-load-configs
# Import ssh keys in keychain
ssh-add -A 2>/dev/null;
# shellcheck source=../config/fzf/fzf.bash
[ -f "${DOTFILES}/config/fzf/fzf.bash" ] \
&& source "${DOTFILES}/config/fzf/fzf.bash"

View File

@@ -1,24 +0,0 @@
{
"useTaobaoRegistry": false,
"presets": {
"v2-router-vuex-scss-prettier": {
"useConfigFiles": false,
"plugins": {
"@vue/cli-plugin-babel": {},
"@vue/cli-plugin-router": {
"historyMode": false
},
"@vue/cli-plugin-vuex": {},
"@vue/cli-plugin-eslint": {
"config": "prettier",
"lintOn": [
"save"
]
}
},
"vueVersion": "2",
"cssPreprocessor": "dart-sass"
}
}
}

View File

@@ -13,10 +13,19 @@ function x-load-configs()
{
# Load the shell dotfiles, and then some:
for file in $DOTFILES/config/{exports,alias,functions}; do
HOST="$(hostname -s)"
# global (exports|alias|functions) file for all hosts
# shellcheck source=../config/exports
[ -r "$file" ] && source "$file"
# global secret file, git ignored
# shellcheck source=../config/exports-secret
[ -r "$file-secret" ] && source "$file-secret"
[ -r "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
[ -r "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
# host specific (exports|alias|functions) file
# shellcheck source=../config/exports
[ -r "$file-$HOST" ] && source "$file-$HOST"
# host specific (exports|alias|functions) file, git ignored
# shellcheck source=../config/exports
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret"
done
}
x-load-configs
@@ -25,7 +34,6 @@ export HISTFILE="$XDG_STATE_HOME"/zsh/history
autoload -U colors zsh/terminfo
colors
setopt correct
export ZSH_CUSTOM_COMPLETION_PATH="$XDG_CONFIG_HOME/zsh/completion"
x-dc "$ZSH_CUSTOM_COMPLETION_PATH"
@@ -41,11 +49,9 @@ fi
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
# Import ssh keys in keychain
ssh-add -A 2>/dev/null;
# Try to load antigen, if present
ANTIGEN_ZSH_PATH="$XDG_BIN_HOME/antigen.zsh"
# shellcheck source=../../.local/bin/antigen.zsh
[[ -f "$ANTIGEN_ZSH_PATH" ]] && source "$ANTIGEN_ZSH_PATH"
# antigen is present
@@ -58,11 +64,10 @@ have antigen && {
antigen apply
}
# shellcheck source=../config/fzf/fzf.zsh
[ -f "${DOTFILES}/config/fzf/fzf.zsh" ] \
&& source "${DOTFILES}/config/fzf/fzf.zsh"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
# shellcheck source=config/zsh/p10k.zsh
export P10K_LOCATION="$XDG_CONFIG_HOME/zsh/p10k.zsh"
[[ ! -f $P10K_LOCATION ]] || source "$P10K_LOCATION"
# Start starship
eval "$(starship init zsh)"

View File

@@ -0,0 +1,310 @@
# Configuration for Alacritty, the GPU enhanced terminal emulator
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty it self.
env:
# TERM env customization.
#
# If this property is not set, alacritty will set it to xterm-256color.
#
# Note that some xterm terminfo databases don't declare support for italics.
# You can verify this by checking for the presence of `smso` and `sitm` in
# `infocmp xterm-256color`.
TERM: xterm-256color
# Window dimensions in character columns and lines
# (changes require restart)
window:
dimensions:
columns: 130
lines: 40
# Adds this many blank pixels of padding around the window
# Units are physical pixels; this is not DPI aware.
# (change requires restart)
padding:
x: 5
y: 5
decorations: buttonless
opacity: 0.85
# When true, bold text is drawn using the bright variant of colors.
draw_bold_text_with_bright_colors: true
# Font configuration (changes require restart)
font:
# The normal (roman) font face to use.
normal:
family: JetBrainsMono Nerd Font
# Style can be specified to pick a specific face.
# style: Regular
# The bold font face
bold:
family: JetBrainsMono Nerd Font
# Style can be specified to pick a specific face.
style: Bold
# The italic font face
italic:
family: JetBrainsMono Nerd Font
# Style can be specified to pick a specific face.
style: Italic
# Point size of the font
size: 14.0
# Offset is the extra space around each character. offset.y can be thought of
# as modifying the linespacing, and offset.x as modifying the letter spacing.
offset:
x: 0
y: 0
# Glyph offset determines the locations of the glyphs within their cells with
# the default being at the bottom. Increase the x offset to move the glyph to
# the right, increase the y offset to move the glyph upward.
glyph_offset:
x: 0
y: 0
# Should display the render timer
debug.render_timer: false
# https://github.com/catppuccin/alacritty
colors:
primary:
background: "#1E1E2E" # base
foreground: "#CDD6F4" # text
# Bright and dim foreground colors
dim_foreground: "#CDD6F4" # text
bright_foreground: "#CDD6F4" # text
# Cursor colors
cursor:
text: "#1E1E2E" # base
cursor: "#F5E0DC" # rosewater
vi_mode_cursor:
text: "#1E1E2E" # base
cursor: "#B4BEFE" # lavender
# Search colors
search:
matches:
foreground: "#1E1E2E" # base
background: "#A6ADC8" # subtext0
focused_match:
foreground: "#1E1E2E" # base
background: "#A6E3A1" # green
footer_bar:
foreground: "#1E1E2E" # base
background: "#A6ADC8" # subtext0
# Keyboard regex hints
hints:
start:
foreground: "#1E1E2E" # base
background: "#F9E2AF" # yellow
end:
foreground: "#1E1E2E" # base
background: "#A6ADC8" # subtext0
# Selection colors
selection:
text: "#1E1E2E" # base
background: "#F5E0DC" # rosewater
# Normal colors
normal:
black: "#45475A" # surface1
red: "#F38BA8" # red
green: "#A6E3A1" # green
yellow: "#F9E2AF" # yellow
blue: "#89B4FA" # blue
magenta: "#F5C2E7" # pink
cyan: "#94E2D5" # teal
white: "#BAC2DE" # subtext1
# Bright colors
bright:
black: "#585B70" # surface2
red: "#F38BA8" # red
green: "#A6E3A1" # green
yellow: "#F9E2AF" # yellow
blue: "#89B4FA" # blue
magenta: "#F5C2E7" # pink
cyan: "#94E2D5" # teal
white: "#A6ADC8" # subtext0
# Dim colors
dim:
black: "#45475A" # surface1
red: "#F38BA8" # red
green: "#A6E3A1" # green
yellow: "#F9E2AF" # yellow
blue: "#89B4FA" # blue
magenta: "#F5C2E7" # pink
cyan: "#94E2D5" # teal
white: "#BAC2DE" # subtext1
indexed_colors:
- { index: 16, color: "#FAB387" }
- { index: 17, color: "#F5E0DC" }
# Visual Bell
#
# Any time the BEL code is received, Alacritty "rings" the visual bell. Once
# rung, the terminal background will be set to white and transition back to the
# default background color. You can control the rate of this transition by
# setting the `duration` property (represented in milliseconds). You can also
# configure the transition function by setting the `animation` property.
#
# Possible values for `animation`
# `Ease`
# `EaseOut`
# `EaseOutSine`
# `EaseOutQuad`
# `EaseOutCubic`
# `EaseOutQuart`
# `EaseOutQuint`
# `EaseOutExpo`
# `EaseOutCirc`
# `Linear`
#
# To completely disable the visual bell, set its duration to 0.
#
# visual_bell:
# animation: EaseOutExpo
# duration: 0
# Key bindings
#
# Each binding is defined as an object with some properties. Most of the
# properties are optional. All of the alphabetical keys should have a letter for
# the `key` value such as `V`. Function keys are probably what you would expect
# as well (F1, F2, ..). The number keys above the main keyboard are encoded as
# `Key1`, `Key2`, etc. Keys on the number pad are encoded `Number1`, `Number2`,
# etc. These all match the glutin::VirtualKeyCode variants.
#
# Possible values for `mods`
# `Command`, `Super` refer to the super/command/windows key
# `Control` for the control key
# `Shift` for the Shift key
# `Alt` and `Option` refer to alt/option
#
# mods may be combined with a `|`. For example, requiring control and shift
# looks like:
#
# mods: Control|Shift
#
# The parser is currently quite sensitive to whitespace and capitalization -
# capitalization must match exactly, and piped items must not have whitespace
# around them.
#
# Either an `action`, `chars`, or `command` field must be present.
# `action` must be one of `Paste`, `PasteSelection`, `Copy`, or `Quit`.
# `chars` writes the specified string every time that binding is activated.
# These should generally be escape sequences, but they can be configured to
# send arbitrary strings of bytes.
# `command` must be a map containing a `program` string, and `args` array of
# strings. For example:
# - { ... , command: { program: "alacritty", args: ["-e", "vttest"] } }
key_bindings:
- { key: V, mods: Command, action: Paste }
- { key: C, mods: Command, action: Copy }
- { key: Q, mods: Command, action: Quit }
- { key: W, mods: Command, action: Quit }
- { key: N, mods: Command, action: SpawnNewInstance }
- { key: Home, chars: "\eOH", mode: AppCursor }
- { key: Home, chars: "\e[1~", mode: ~AppCursor }
- { key: End, chars: "\eOF", mode: AppCursor }
- { key: End, chars: "\e[4~", mode: ~AppCursor }
- { key: PageUp, mods: Shift, chars: "\e[5;2~" }
- { key: PageUp, mods: Control, chars: "\e[5;5~" }
- { key: PageUp, chars: "\e[5~" }
- { key: PageDown, mods: Shift, chars: "\e[6;2~" }
- { key: PageDown, mods: Control, chars: "\e[6;5~" }
- { key: PageDown, chars: "\e[6~" }
- { key: Left, mods: Shift, chars: "\e[1;2D" }
- { key: Left, mods: Control, chars: "\e[1;5D" }
- { key: Left, mods: Alt, chars: "\e[1;3D" }
- { key: Left, chars: "\e[D", mode: ~AppCursor }
- { key: Left, chars: "\eOD", mode: AppCursor }
- { key: Right, mods: Shift, chars: "\e[1;2C" }
- { key: Right, mods: Control, chars: "\e[1;5C" }
- { key: Right, mods: Alt, chars: "\e[1;3C" }
- { key: Right, chars: "\e[C", mode: ~AppCursor }
- { key: Right, chars: "\eOC", mode: AppCursor }
- { key: Up, mods: Shift, chars: "\e[1;2A" }
- { key: Up, mods: Control, chars: "\e[1;5A" }
- { key: Up, mods: Alt, chars: "\e[1;3A" }
- { key: Up, chars: "\e[A", mode: ~AppCursor }
- { key: Up, chars: "\eOA", mode: AppCursor }
- { key: Down, mods: Shift, chars: "\e[1;2B" }
- { key: Down, mods: Control, chars: "\e[1;5B" }
- { key: Down, mods: Alt, chars: "\e[1;3B" }
- { key: Down, chars: "\e[B", mode: ~AppCursor }
- { key: Down, chars: "\eOB", mode: AppCursor }
- { key: Tab, mods: Shift, chars: "\e[Z" }
- { key: F1, chars: "\eOP" }
- { key: F2, chars: "\eOQ" }
- { key: F3, chars: "\eOR" }
- { key: F4, chars: "\eOS" }
- { key: F5, chars: "\e[15~" }
- { key: F6, chars: "\e[17~" }
- { key: F7, chars: "\e[18~" }
- { key: F8, chars: "\e[19~" }
- { key: F9, chars: "\e[20~" }
- { key: F10, chars: "\e[21~" }
- { key: F11, chars: "\e[23~" }
- { key: F12, chars: "\e[24~" }
- { key: Back, chars: "" }
- { key: Back, mods: Alt, chars: "\e" }
- { key: Insert, chars: "\e[2~" }
- { key: Delete, chars: "\e[3~" }
# shortcuts for tmux. the leader key is control-b (0x02)
- { key: W, mods: Command, chars: "\x02&" } # close tab (kill)
- { key: T, mods: Command, chars: "\x02c" } # new tab
- { key: RBracket, mods: Command|Shift, chars: "\x02n" } # select next tab
- { key: LBracket, mods: Command|Shift, chars: "\x02p" } # select previous tab
- { key: RBracket, mods: Command, chars: "\x02o" } # select next pane
- { key: LBracket, mods: Command, chars: "\x02;" } # select last (previously used) pane
- { key: F, mods: Command, chars: "\x02/" } # search (upwards) (see tmux.conf)
# Mouse bindings
#
# Currently doesn't support modifiers. Both the `mouse` and `action` fields must
# be specified.
#
# Values for `mouse`:
# - Middle
# - Left
# - Right
# - Numeric identifier such as `5`
#
# Values for `action`:
# - Paste
# - PasteSelection
# - Copy (TODO)
mouse_bindings:
- { mouse: Middle, action: PasteSelection }
mouse:
double_click: { threshold: 300 }
triple_click: { threshold: 300 }
selection:
semantic_escape_chars: ',│`|:"'' ()[]{}<>'
# Shell
#
# You can set shell.program to the path of your favorite shell, e.g. /bin/fish.
# Entries in shell.args are passed unmodified as arguments to the shell.
#
#shell:
# program: /bin/bash
# args:
# - --login

4
config/alias-tunkki Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# Setting aliases for tunkki
alias nvim="/snap/nvim/current/usr/bin/nvim"

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# shellcheck shell=zsh
# shellcheck shell=bash
# vim: filetype=zsh
export DOTFILES="$HOME/.dotfiles"

View File

@@ -24,6 +24,8 @@ have ansible && {
export ANDROID_HOME="$XDG_DATA_HOME/android"
export HOMEBREW_NO_ENV_HINTS=true
# composer, https://getcomposer.org/
export COMPOSER_HOME="$XDG_STATE_HOME/composer"
export COMPOSER_BIN="$COMPOSER_HOME/vendor/bin"

View File

@@ -61,12 +61,16 @@ scheduler()
# Defines default antigen bundles
x-default-antigen-bundles()
{
export ZSH_TMUX_AUTOSTART=true
export ZSH_TMUX_AUTOSTART=false
export ZSH_TMUX_CONFIG="$DOTFILES/config/tmux/tmux.conf"
export ZSH_TMUX_UNICODE=true
export ZSH_TMUX_AUTOQUIT=false
export ZSH_TMUX_DEFAULT_SESSION_NAME=main
# Add keychain to ssh-agent args when on macOS
have brew && zstyle :omz:plugins:ssh-agent ssh-add-args --apple-load-keychain
# these should be always available
antigen bundle autoenv
antigen bundle tmux
antigen bundle colored-man-pages
antigen bundle command-not-found
@@ -79,12 +83,9 @@ x-default-antigen-bundles()
# these should be available if there's need
have brew && antigen bundle brew
have nvm && antigen bundle nvm
# have nvm && antigen bundle nvm
have nvm && antigen bundle "$DOTFILES/config/zsh/plugins/nvm-auto-use"
have php && antigen bundle php
have python && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
have rvm && antigen bundle unixorn/rvm-plugin
# the theme to use
antigen theme romkatv/powerlevel10k
}

382
config/fzf/completion.bash Executable file
View File

@@ -0,0 +1,382 @@
# ____ ____
# / __/___ / __/
# / /_/_ / / /_
# / __/ / /_/ __/
# /_/ /___/_/ completion.bash
#
# - $FZF_TMUX (default: 0)
# - $FZF_TMUX_OPTS (default: empty)
# - $FZF_COMPLETION_TRIGGER (default: '**')
# - $FZF_COMPLETION_OPTS (default: empty)
if [[ $- =~ i ]]; then
# To use custom commands instead of find, override _fzf_compgen_{path,dir}
if ! declare -f _fzf_compgen_path > /dev/null; then
_fzf_compgen_path() {
echo "$1"
command find -L "$1" \
-name .git -prune -o -name .hg -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \
-a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
}
fi
if ! declare -f _fzf_compgen_dir > /dev/null; then
_fzf_compgen_dir() {
command find -L "$1" \
-name .git -prune -o -name .hg -prune -o -name .svn -prune -o -type d \
-a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
}
fi
###########################################################
# To redraw line after fzf closes (printf '\e[5n')
bind '"\e[0n": redraw-current-line' 2> /dev/null
__fzf_comprun() {
if [[ "$(type -t _fzf_comprun 2>&1)" = function ]]; then
_fzf_comprun "$@"
elif [[ -n "${TMUX_PANE-}" ]] && { [[ "${FZF_TMUX:-0}" != 0 ]] || [[ -n "${FZF_TMUX_OPTS-}" ]]; }; then
shift
fzf-tmux ${FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}} -- "$@"
else
shift
fzf "$@"
fi
}
__fzf_orig_completion() {
local l comp f cmd
while read -r l; do
if [[ "$l" =~ ^(.*\ -F)\ *([^ ]*).*\ ([^ ]*)$ ]]; then
comp="${BASH_REMATCH[1]}"
f="${BASH_REMATCH[2]}"
cmd="${BASH_REMATCH[3]}"
[[ "$f" = _fzf_* ]] && continue
printf -v "_fzf_orig_completion_${cmd//[^A-Za-z0-9_]/_}" "%s" "${comp} %s ${cmd} #${f}"
if [[ "$l" = *" -o nospace "* ]] && [[ ! "${__fzf_nospace_commands-}" = *" $cmd "* ]]; then
__fzf_nospace_commands="${__fzf_nospace_commands-} $cmd "
fi
fi
done
}
_fzf_opts_completion() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="
-x --extended
-e --exact
--algo
-i +i
-n --nth
--with-nth
-d --delimiter
+s --no-sort
--tac
--tiebreak
-m --multi
--no-mouse
--bind
--cycle
--no-hscroll
--jump-labels
--height
--literal
--reverse
--margin
--inline-info
--prompt
--pointer
--marker
--header
--header-lines
--ansi
--tabstop
--color
--no-bold
--history
--history-size
--preview
--preview-window
-q --query
-1 --select-1
-0 --exit-0
-f --filter
--print-query
--expect
--sync"
case "${prev}" in
--tiebreak)
COMPREPLY=( $(compgen -W "length begin end index" -- "$cur") )
return 0
;;
--color)
COMPREPLY=( $(compgen -W "dark light 16 bw" -- "$cur") )
return 0
;;
--history)
COMPREPLY=()
return 0
;;
esac
if [[ "$cur" =~ ^-|\+ ]]; then
COMPREPLY=( $(compgen -W "${opts}" -- "$cur") )
return 0
fi
return 0
}
_fzf_handle_dynamic_completion() {
local cmd orig_var orig ret orig_cmd orig_complete
cmd="$1"
shift
orig_cmd="$1"
orig_var="_fzf_orig_completion_$cmd"
orig="${!orig_var-}"
orig="${orig##*#}"
if [[ -n "$orig" ]] && type "$orig" > /dev/null 2>&1; then
$orig "$@"
elif [[ -n "${_fzf_completion_loader-}" ]]; then
orig_complete=$(complete -p "$orig_cmd" 2> /dev/null)
_completion_loader "$@"
ret=$?
# _completion_loader may not have updated completion for the command
if [[ "$(complete -p "$orig_cmd" 2> /dev/null)" != "$orig_complete" ]]; then
__fzf_orig_completion < <(complete -p "$orig_cmd" 2> /dev/null)
if [[ "${__fzf_nospace_commands-}" = *" $orig_cmd "* ]]; then
eval "${orig_complete/ -F / -o nospace -F }"
else
eval "$orig_complete"
fi
fi
return $ret
fi
}
__fzf_generic_path_completion() {
local cur base dir leftover matches trigger cmd
cmd="${COMP_WORDS[0]}"
if [[ $cmd == \\* ]]; then
cmd="${cmd:1}"
fi
cmd="${cmd//[^A-Za-z0-9_=]/_}"
COMPREPLY=()
trigger=${FZF_COMPLETION_TRIGGER-'**'}
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ "$cur" == *"$trigger" ]]; then
base=${cur:0:${#cur}-${#trigger}}
eval "base=$base"
dir=
[[ $base = *"/"* ]] && dir="$base"
while true; do
if [[ -z "$dir" ]] || [[ -d "$dir" ]]; then
leftover=${base/#"$dir"}
leftover=${leftover/#\/}
[[ -z "$dir" ]] && dir='.'
[[ "$dir" != "/" ]] && dir="${dir/%\//}"
matches=$(eval "$1 $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_COMPLETION_OPTS-} $2" __fzf_comprun "$4" -q "$leftover" | while read -r item; do
printf "%q " "${item%$3}$3"
done)
matches=${matches% }
[[ -z "$3" ]] && [[ "${__fzf_nospace_commands-}" = *" ${COMP_WORDS[0]} "* ]] && matches="$matches "
if [[ -n "$matches" ]]; then
COMPREPLY=( "$matches" )
else
COMPREPLY=( "$cur" )
fi
printf '\e[5n'
return 0
fi
dir=$(dirname "$dir")
[[ "$dir" =~ /$ ]] || dir="$dir"/
done
else
shift
shift
shift
_fzf_handle_dynamic_completion "$cmd" "$@"
fi
}
_fzf_complete() {
# Split arguments around --
local args rest str_arg i sep
args=("$@")
sep=
for i in "${!args[@]}"; do
if [[ "${args[$i]}" = -- ]]; then
sep=$i
break
fi
done
if [[ -n "$sep" ]]; then
str_arg=
rest=("${args[@]:$((sep + 1)):${#args[@]}}")
args=("${args[@]:0:$sep}")
else
str_arg=$1
args=()
shift
rest=("$@")
fi
local cur selected trigger cmd post
post="$(caller 0 | awk '{print $2}')_post"
type -t "$post" > /dev/null 2>&1 || post=cat
cmd="${COMP_WORDS[0]//[^A-Za-z0-9_=]/_}"
trigger=${FZF_COMPLETION_TRIGGER-'**'}
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ "$cur" == *"$trigger" ]]; then
cur=${cur:0:${#cur}-${#trigger}}
selected=$(FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_COMPLETION_OPTS-} $str_arg" __fzf_comprun "${rest[0]}" "${args[@]}" -q "$cur" | $post | tr '\n' ' ')
selected=${selected% } # Strip trailing space not to repeat "-o nospace"
if [[ -n "$selected" ]]; then
COMPREPLY=("$selected")
else
COMPREPLY=("$cur")
fi
printf '\e[5n'
return 0
else
_fzf_handle_dynamic_completion "$cmd" "${rest[@]}"
fi
}
_fzf_path_completion() {
__fzf_generic_path_completion _fzf_compgen_path "-m" "" "$@"
}
# Deprecated. No file only completion.
_fzf_file_completion() {
_fzf_path_completion "$@"
}
_fzf_dir_completion() {
__fzf_generic_path_completion _fzf_compgen_dir "" "/" "$@"
}
_fzf_complete_kill() {
_fzf_proc_completion "$@"
}
_fzf_proc_completion() {
_fzf_complete -m --header-lines=1 --preview 'echo {}' --preview-window down:3:wrap --min-height 15 -- "$@" < <(
command ps -eo user,pid,ppid,start,time,command 2> /dev/null ||
command ps -eo user,pid,ppid,time,args # For BusyBox
)
}
_fzf_proc_completion_post() {
awk '{print $2}'
}
_fzf_host_completion() {
_fzf_complete +m -- "$@" < <(
command cat <(command tail -n +1 ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^\s*host\(name\)\? ' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}' | command grep -v '[*?%]') \
<(command grep -oE '^[[a-z0-9.,:-]+' ~/.ssh/known_hosts | tr ',' '\n' | tr -d '[' | awk '{ print $1 " " $1 }') \
<(command grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0') |
awk '{if (length($2) > 0) {print $2}}' | sort -u
)
}
_fzf_var_completion() {
_fzf_complete -m -- "$@" < <(
declare -xp | sed -En 's|^declare [^ ]+ ([^=]+).*|\1|p'
)
}
_fzf_alias_completion() {
_fzf_complete -m -- "$@" < <(
alias | sed -En 's|^alias ([^=]+).*|\1|p'
)
}
# fzf options
complete -o default -F _fzf_opts_completion fzf
# fzf-tmux is a thin fzf wrapper that has only a few more options than fzf
# itself. As a quick improvement we take fzf's completion. Adding the few extra
# fzf-tmux specific options (like `-w WIDTH`) are left as a future patch.
complete -o default -F _fzf_opts_completion fzf-tmux
d_cmds="${FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir}"
a_cmds="
awk bat cat diff diff3
emacs emacsclient ex file ftp g++ gcc gvim head hg hx java
javac ld less more mvim nvim patch perl python ruby
sed sftp sort source tail tee uniq vi view vim wc xdg-open
basename bunzip2 bzip2 chmod chown curl cp dirname du
find git grep gunzip gzip hg jar
ln ls mv open rm rsync scp
svn tar unzip zip"
# Preserve existing completion
__fzf_orig_completion < <(complete -p $d_cmds $a_cmds 2> /dev/null)
if type _completion_loader > /dev/null 2>&1; then
_fzf_completion_loader=1
fi
__fzf_defc() {
local cmd func opts orig_var orig def
cmd="$1"
func="$2"
opts="$3"
orig_var="_fzf_orig_completion_${cmd//[^A-Za-z0-9_]/_}"
orig="${!orig_var-}"
if [[ -n "$orig" ]]; then
printf -v def "$orig" "$func"
eval "$def"
else
complete -F "$func" $opts "$cmd"
fi
}
# Anything
for cmd in $a_cmds; do
__fzf_defc "$cmd" _fzf_path_completion "-o default -o bashdefault"
done
# Directory
for cmd in $d_cmds; do
__fzf_defc "$cmd" _fzf_dir_completion "-o nospace -o dirnames"
done
unset cmd d_cmds a_cmds
_fzf_setup_completion() {
local kind fn cmd
kind=$1
fn=_fzf_${1}_completion
if [[ $# -lt 2 ]] || ! type -t "$fn" > /dev/null; then
echo "usage: ${FUNCNAME[0]} path|dir|var|alias|host|proc COMMANDS..."
return 1
fi
shift
__fzf_orig_completion < <(complete -p "$@" 2> /dev/null)
for cmd in "$@"; do
case "$kind" in
dir) __fzf_defc "$cmd" "$fn" "-o nospace -o dirnames" ;;
var) __fzf_defc "$cmd" "$fn" "-o default -o nospace -v" ;;
alias) __fzf_defc "$cmd" "$fn" "-a" ;;
*) __fzf_defc "$cmd" "$fn" "-o default -o bashdefault" ;;
esac
done
}
# Environment variables / Aliases / Hosts / Process
_fzf_setup_completion 'var' export unset printenv
_fzf_setup_completion 'alias' unalias
_fzf_setup_completion 'host' ssh telnet
_fzf_setup_completion 'proc' kill
fi

325
config/fzf/completion.zsh Executable file
View File

@@ -0,0 +1,325 @@
# ____ ____
# / __/___ / __/
# / /_/_ / / /_
# / __/ / /_/ __/
# /_/ /___/_/ completion.zsh
#
# - $FZF_TMUX (default: 0)
# - $FZF_TMUX_OPTS (default: '-d 40%')
# - $FZF_COMPLETION_TRIGGER (default: '**')
# - $FZF_COMPLETION_OPTS (default: empty)
# Both branches of the following `if` do the same thing -- define
# __fzf_completion_options such that `eval $__fzf_completion_options` sets
# all options to the same values they currently have. We'll do just that at
# the bottom of the file after changing options to what we prefer.
#
# IMPORTANT: Until we get to the `emulate` line, all words that *can* be quoted
# *must* be quoted in order to prevent alias expansion. In addition, code must
# be written in a way works with any set of zsh options. This is very tricky, so
# careful when you change it.
#
# Start by loading the builtin zsh/parameter module. It provides `options`
# associative array that stores current shell options.
if 'zmodload' 'zsh/parameter' 2>'/dev/null' && (( ${+options} )); then
# This is the fast branch and it gets taken on virtually all Zsh installations.
#
# ${(kv)options[@]} expands to array of keys (option names) and values ("on"
# or "off"). The subsequent expansion# with (j: :) flag joins all elements
# together separated by spaces. __fzf_completion_options ends up with a value
# like this: "options=(shwordsplit off aliases on ...)".
__fzf_completion_options="options=(${(j: :)${(kv)options[@]}})"
else
# This branch is much slower because it forks to get the names of all
# zsh options. It's possible to eliminate this fork but it's not worth the
# trouble because this branch gets taken only on very ancient or broken
# zsh installations.
() {
# That `()` above defines an anonymous function. This is essentially a scope
# for local parameters. We use it to avoid polluting global scope.
'local' '__fzf_opt'
__fzf_completion_options="setopt"
# `set -o` prints one line for every zsh option. Each line contains option
# name, some spaces, and then either "on" or "off". We just want option names.
# Expansion with (@f) flag splits a string into lines. The outer expansion
# removes spaces and everything that follow them on every line. __fzf_opt
# ends up iterating over option names: shwordsplit, aliases, etc.
for __fzf_opt in "${(@)${(@f)$(set -o)}%% *}"; do
if [[ -o "$__fzf_opt" ]]; then
# Option $__fzf_opt is currently on, so remember to set it back on.
__fzf_completion_options+=" -o $__fzf_opt"
else
# Option $__fzf_opt is currently off, so remember to set it back off.
__fzf_completion_options+=" +o $__fzf_opt"
fi
done
# The value of __fzf_completion_options here looks like this:
# "setopt +o shwordsplit -o aliases ..."
}
fi
# Enable the default zsh options (those marked with <Z> in `man zshoptions`)
# but without `aliases`. Aliases in functions are expanded when functions are
# defined, so if we disable aliases here, we'll be sure to have no pesky
# aliases in any of our functions. This way we won't need prefix every
# command with `command` or to quote every word to defend against global
# aliases. Note that `aliases` is not the only option that's important to
# control. There are several others that could wreck havoc if they are set
# to values we don't expect. With the following `emulate` command we
# sidestep this issue entirely.
'emulate' 'zsh' '-o' 'no_aliases'
# This brace is the start of try-always block. The `always` part is like
# `finally` in lesser languages. We use it to *always* restore user options.
{
# Bail out if not interactive shell.
[[ -o interactive ]] || return 0
# To use custom commands instead of find, override _fzf_compgen_{path,dir}
if ! declare -f _fzf_compgen_path > /dev/null; then
_fzf_compgen_path() {
echo "$1"
command find -L "$1" \
-name .git -prune -o -name .hg -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \
-a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
}
fi
if ! declare -f _fzf_compgen_dir > /dev/null; then
_fzf_compgen_dir() {
command find -L "$1" \
-name .git -prune -o -name .hg -prune -o -name .svn -prune -o -type d \
-a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
}
fi
###########################################################
__fzf_comprun() {
if [[ "$(type _fzf_comprun 2>&1)" =~ function ]]; then
_fzf_comprun "$@"
elif [ -n "${TMUX_PANE-}" ] && { [ "${FZF_TMUX:-0}" != 0 ] || [ -n "${FZF_TMUX_OPTS-}" ]; }; then
shift
if [ -n "${FZF_TMUX_OPTS-}" ]; then
fzf-tmux ${(Q)${(Z+n+)FZF_TMUX_OPTS}} -- "$@"
else
fzf-tmux -d ${FZF_TMUX_HEIGHT:-40%} -- "$@"
fi
else
shift
fzf "$@"
fi
}
# Extract the name of the command. e.g. foo=1 bar baz**<tab>
__fzf_extract_command() {
local token tokens
tokens=(${(z)1})
for token in $tokens; do
token=${(Q)token}
if [[ "$token" =~ [[:alnum:]] && ! "$token" =~ "=" ]]; then
echo "$token"
return
fi
done
echo "${tokens[1]}"
}
__fzf_generic_path_completion() {
local base lbuf cmd compgen fzf_opts suffix tail dir leftover matches
base=$1
lbuf=$2
cmd=$(__fzf_extract_command "$lbuf")
compgen=$3
fzf_opts=$4
suffix=$5
tail=$6
setopt localoptions nonomatch
eval "base=$base"
[[ $base = *"/"* ]] && dir="$base"
while [ 1 ]; do
if [[ -z "$dir" || -d ${dir} ]]; then
leftover=${base/#"$dir"}
leftover=${leftover/#\/}
[ -z "$dir" ] && dir='.'
[ "$dir" != "/" ] && dir="${dir/%\//}"
matches=$(eval "$compgen $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_COMPLETION_OPTS-}" __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" | while read item; do
item="${item%$suffix}$suffix"
echo -n "${(q)item} "
done)
matches=${matches% }
if [ -n "$matches" ]; then
LBUFFER="$lbuf$matches$tail"
fi
zle reset-prompt
break
fi
dir=$(dirname "$dir")
dir=${dir%/}/
done
}
_fzf_path_completion() {
__fzf_generic_path_completion "$1" "$2" _fzf_compgen_path \
"-m" "" " "
}
_fzf_dir_completion() {
__fzf_generic_path_completion "$1" "$2" _fzf_compgen_dir \
"" "/" ""
}
_fzf_feed_fifo() (
command rm -f "$1"
mkfifo "$1"
cat <&0 > "$1" &
)
_fzf_complete() {
setopt localoptions ksh_arrays
# Split arguments around --
local args rest str_arg i sep
args=("$@")
sep=
for i in {0..${#args[@]}}; do
if [[ "${args[$i]-}" = -- ]]; then
sep=$i
break
fi
done
if [[ -n "$sep" ]]; then
str_arg=
rest=("${args[@]:$((sep + 1)):${#args[@]}}")
args=("${args[@]:0:$sep}")
else
str_arg=$1
args=()
shift
rest=("$@")
fi
local fifo lbuf cmd matches post
fifo="${TMPDIR:-/tmp}/fzf-complete-fifo-$$"
lbuf=${rest[0]}
cmd=$(__fzf_extract_command "$lbuf")
post="${funcstack[1]}_post"
type $post > /dev/null 2>&1 || post=cat
_fzf_feed_fifo "$fifo"
matches=$(FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_COMPLETION_OPTS-} $str_arg" __fzf_comprun "$cmd" "${args[@]}" -q "${(Q)prefix}" < "$fifo" | $post | tr '\n' ' ')
if [ -n "$matches" ]; then
LBUFFER="$lbuf$matches"
fi
command rm -f "$fifo"
}
_fzf_complete_telnet() {
_fzf_complete +m -- "$@" < <(
command grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0' |
awk '{if (length($2) > 0) {print $2}}' | sort -u
)
}
_fzf_complete_ssh() {
_fzf_complete +m -- "$@" < <(
setopt localoptions nonomatch
command cat <(command tail -n +1 ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2> /dev/null | command grep -i '^\s*host\(name\)\? ' | awk '{for (i = 2; i <= NF; i++) print $1 " " $i}' | command grep -v '[*?%]') \
<(command grep -oE '^[[a-z0-9.,:-]+' ~/.ssh/known_hosts | tr ',' '\n' | tr -d '[' | awk '{ print $1 " " $1 }') \
<(command grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0') |
awk '{if (length($2) > 0) {print $2}}' | sort -u
)
}
_fzf_complete_export() {
_fzf_complete -m -- "$@" < <(
declare -xp | sed 's/=.*//' | sed 's/.* //'
)
}
_fzf_complete_unset() {
_fzf_complete -m -- "$@" < <(
declare -xp | sed 's/=.*//' | sed 's/.* //'
)
}
_fzf_complete_unalias() {
_fzf_complete +m -- "$@" < <(
alias | sed 's/=.*//'
)
}
_fzf_complete_kill() {
_fzf_complete -m --header-lines=1 --preview 'echo {}' --preview-window down:3:wrap --min-height 15 -- "$@" < <(
command ps -eo user,pid,ppid,start,time,command 2> /dev/null ||
command ps -eo user,pid,ppid,time,args # For BusyBox
)
}
_fzf_complete_kill_post() {
awk '{print $2}'
}
fzf-completion() {
local tokens cmd prefix trigger tail matches lbuf d_cmds
setopt localoptions noshwordsplit noksh_arrays noposixbuiltins
# http://zsh.sourceforge.net/FAQ/zshfaq03.html
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
tokens=(${(z)LBUFFER})
if [ ${#tokens} -lt 1 ]; then
zle ${fzf_default_completion:-expand-or-complete}
return
fi
cmd=$(__fzf_extract_command "$LBUFFER")
# Explicitly allow for empty trigger.
trigger=${FZF_COMPLETION_TRIGGER-'**'}
[ -z "$trigger" -a ${LBUFFER[-1]} = ' ' ] && tokens+=("")
# When the trigger starts with ';', it becomes a separate token
if [[ ${LBUFFER} = *"${tokens[-2]-}${tokens[-1]}" ]]; then
tokens[-2]="${tokens[-2]-}${tokens[-1]}"
tokens=(${tokens[0,-2]})
fi
lbuf=$LBUFFER
tail=${LBUFFER:$(( ${#LBUFFER} - ${#trigger} ))}
# Trigger sequence given
if [ ${#tokens} -gt 1 -a "$tail" = "$trigger" ]; then
d_cmds=(${=FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir})
[ -z "$trigger" ] && prefix=${tokens[-1]} || prefix=${tokens[-1]:0:-${#trigger}}
[ -n "${tokens[-1]}" ] && lbuf=${lbuf:0:-${#tokens[-1]}}
if eval "type _fzf_complete_${cmd} > /dev/null"; then
prefix="$prefix" eval _fzf_complete_${cmd} ${(q)lbuf}
zle reset-prompt
elif [ ${d_cmds[(i)$cmd]} -le ${#d_cmds} ]; then
_fzf_dir_completion "$prefix" "$lbuf"
else
_fzf_path_completion "$prefix" "$lbuf"
fi
# Fall back to default completion
else
zle ${fzf_default_completion:-expand-or-complete}
fi
}
[ -z "$fzf_default_completion" ] && {
binding=$(bindkey '^I')
[[ $binding =~ 'undefined-key' ]] || fzf_default_completion=$binding[(s: :w)2]
unset binding
}
zle -N fzf-completion
bindkey '^I' fzf-completion
} always {
# Restore the original options.
eval $__fzf_completion_options
'unset' '__fzf_completion_options'
}

9
config/fzf/fzf.bash Normal file → Executable file
View File

@@ -1,13 +1,12 @@
# Setup fzf
# ---------
if [[ ! "$PATH" == */Users/ivuorinen/.config/fzf/bin* ]]; then
PATH="${PATH:+${PATH}:}/Users/ivuorinen/.config/fzf/bin"
fi
# Auto-completion
# ---------------
[[ $- == *i* ]] && source "/Users/ivuorinen/.config/fzf/shell/completion.bash" 2> /dev/null
# shellcheck source=completion.bash
[[ $- == *i* ]] && source "$HOME/.dotfiles/config/fzf/completion.bash" 2> /dev/null
# Key bindings
# ------------
source "/Users/ivuorinen/.config/fzf/shell/key-bindings.bash"
# shellcheck source=key-bindings.bash
source "$HOME/.dotfiles/config/fzf/key-bindings.bash"

9
config/fzf/fzf.zsh Normal file → Executable file
View File

@@ -1,13 +1,12 @@
# Setup fzf
# ---------
if [[ ! "$PATH" == *$HOME/.config/fzf/bin* ]]; then
PATH="${PATH:+${PATH}:}$HOME/.config/fzf/bin"
fi
# Auto-completion
# ---------------
[[ $- == *i* ]] && source "$HOME/.config/fzf/shell/completion.zsh" 2> /dev/null
# shellcheck source=completion.zsh
[[ $- == *i* ]] && source "$HOME/.dotfiles/config/fzf/completion.zsh" 2> /dev/null
# Key bindings
# ------------
source "$HOME/.config/fzf/shell/key-bindings.zsh"
# shellcheck source=key-bindings.zsh
source "$HOME/.dotfiles/config/fzf/key-bindings.zsh"

103
config/fzf/key-bindings.bash Executable file
View File

@@ -0,0 +1,103 @@
# ____ ____
# / __/___ / __/
# / /_/_ / / /_
# / __/ / /_/ __/
# /_/ /___/_/ key-bindings.bash
#
# - $FZF_TMUX_OPTS
# - $FZF_CTRL_T_COMMAND
# - $FZF_CTRL_T_OPTS
# - $FZF_CTRL_R_OPTS
# - $FZF_ALT_C_COMMAND
# - $FZF_ALT_C_OPTS
# Key bindings
# ------------
__fzf_select__() {
local cmd opts
cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | cut -b3-"}"
opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse ${FZF_DEFAULT_OPTS-} ${FZF_CTRL_T_OPTS-} -m"
eval "$cmd" |
FZF_DEFAULT_OPTS="$opts" $(__fzfcmd) "$@" |
while read -r item; do
printf '%q ' "$item" # escape special chars
done
}
if [[ $- =~ i ]]; then
__fzfcmd() {
[[ -n "${TMUX_PANE-}" ]] && { [[ "${FZF_TMUX:-0}" != 0 ]] || [[ -n "${FZF_TMUX_OPTS-}" ]]; } &&
echo "fzf-tmux ${FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}} -- " || echo "fzf"
}
fzf-file-widget() {
local selected="$(__fzf_select__ "$@")"
READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}$selected${READLINE_LINE:$READLINE_POINT}"
READLINE_POINT=$(( READLINE_POINT + ${#selected} ))
}
__fzf_cd__() {
local cmd opts dir
cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type d -print 2> /dev/null | cut -b3-"}"
opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse ${FZF_DEFAULT_OPTS-} ${FZF_ALT_C_OPTS-} +m"
dir=$(set +o pipefail; eval "$cmd" | FZF_DEFAULT_OPTS="$opts" $(__fzfcmd)) && printf 'builtin cd -- %q' "$dir"
}
__fzf_history__() {
local output opts script
opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} -n2..,.. --scheme=history --bind=ctrl-r:toggle-sort ${FZF_CTRL_R_OPTS-} +m --read0"
script='BEGIN { getc; $/ = "\n\t"; $HISTCOUNT = $ENV{last_hist} + 1 } s/^[ *]//; print $HISTCOUNT - $. . "\t$_" if !$seen{$_}++'
output=$(
set +o pipefail
builtin fc -lnr -2147483648 |
last_hist=$(HISTTIMEFORMAT='' builtin history 1) perl -n -l0 -e "$script" |
FZF_DEFAULT_OPTS="$opts" $(__fzfcmd) --query "$READLINE_LINE"
) || return
READLINE_LINE=${output#*$'\t'}
if [[ -z "$READLINE_POINT" ]]; then
echo "$READLINE_LINE"
else
READLINE_POINT=0x7fffffff
fi
}
# Required to refresh the prompt after fzf
bind -m emacs-standard '"\er": redraw-current-line'
bind -m vi-command '"\C-z": emacs-editing-mode'
bind -m vi-insert '"\C-z": emacs-editing-mode'
bind -m emacs-standard '"\C-z": vi-editing-mode'
if (( BASH_VERSINFO[0] < 4 )); then
# CTRL-T - Paste the selected file path into the command line
bind -m emacs-standard '"\C-t": " \C-b\C-k \C-u`__fzf_select__`\e\C-e\er\C-a\C-y\C-h\C-e\e \C-y\ey\C-x\C-x\C-f"'
bind -m vi-command '"\C-t": "\C-z\C-t\C-z"'
bind -m vi-insert '"\C-t": "\C-z\C-t\C-z"'
# CTRL-R - Paste the selected command from history into the command line
bind -m emacs-standard '"\C-r": "\C-e \C-u\C-y\ey\C-u"$(__fzf_history__)"\e\C-e\er"'
bind -m vi-command '"\C-r": "\C-z\C-r\C-z"'
bind -m vi-insert '"\C-r": "\C-z\C-r\C-z"'
else
# CTRL-T - Paste the selected file path into the command line
bind -m emacs-standard -x '"\C-t": fzf-file-widget'
bind -m vi-command -x '"\C-t": fzf-file-widget'
bind -m vi-insert -x '"\C-t": fzf-file-widget'
# CTRL-R - Paste the selected command from history into the command line
bind -m emacs-standard -x '"\C-r": __fzf_history__'
bind -m vi-command -x '"\C-r": __fzf_history__'
bind -m vi-insert -x '"\C-r": __fzf_history__'
fi
# ALT-C - cd into the selected directory
bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"'
bind -m vi-command '"\ec": "\C-z\ec\C-z"'
bind -m vi-insert '"\ec": "\C-z\ec\C-z"'
fi

172
config/fzf/key-bindings.fish Executable file
View File

@@ -0,0 +1,172 @@
# ____ ____
# / __/___ / __/
# / /_/_ / / /_
# / __/ / /_/ __/
# /_/ /___/_/ key-bindings.fish
#
# - $FZF_TMUX_OPTS
# - $FZF_CTRL_T_COMMAND
# - $FZF_CTRL_T_OPTS
# - $FZF_CTRL_R_OPTS
# - $FZF_ALT_C_COMMAND
# - $FZF_ALT_C_OPTS
# Key bindings
# ------------
function fzf_key_bindings
# Store current token in $dir as root for the 'find' command
function fzf-file-widget -d "List files and folders"
set -l commandline (__fzf_parse_commandline)
set -l dir $commandline[1]
set -l fzf_query $commandline[2]
set -l prefix $commandline[3]
# "-path \$dir'*/\\.*'" matches hidden files/folders inside $dir but not
# $dir itself, even if hidden.
test -n "$FZF_CTRL_T_COMMAND"; or set -l FZF_CTRL_T_COMMAND "
command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | sed 's@^\./@@'"
test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%
begin
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS"
eval "$FZF_CTRL_T_COMMAND | "(__fzfcmd)' -m --query "'$fzf_query'"' | while read -l r; set result $result $r; end
end
if [ -z "$result" ]
commandline -f repaint
return
else
# Remove last token from commandline.
commandline -t ""
end
for i in $result
commandline -it -- $prefix
commandline -it -- (string escape $i)
commandline -it -- ' '
end
commandline -f repaint
end
function fzf-history-widget -d "Show command history"
test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%
begin
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT $FZF_DEFAULT_OPTS --scheme=history --bind=ctrl-r:toggle-sort,ctrl-z:ignore $FZF_CTRL_R_OPTS +m"
set -l FISH_MAJOR (echo $version | cut -f1 -d.)
set -l FISH_MINOR (echo $version | cut -f2 -d.)
# history's -z flag is needed for multi-line support.
# history's -z flag was added in fish 2.4.0, so don't use it for versions
# before 2.4.0.
if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ];
history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result
and commandline -- $result
else
history | eval (__fzfcmd) -q '(commandline)' | read -l result
and commandline -- $result
end
end
commandline -f repaint
end
function fzf-cd-widget -d "Change directory"
set -l commandline (__fzf_parse_commandline)
set -l dir $commandline[1]
set -l fzf_query $commandline[2]
set -l prefix $commandline[3]
test -n "$FZF_ALT_C_COMMAND"; or set -l FZF_ALT_C_COMMAND "
command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
-o -type d -print 2> /dev/null | sed 's@^\./@@'"
test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%
begin
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS"
eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)' +m --query "'$fzf_query'"' | read -l result
if [ -n "$result" ]
cd -- $result
# Remove last token from commandline.
commandline -t ""
commandline -it -- $prefix
end
end
commandline -f repaint
end
function __fzfcmd
test -n "$FZF_TMUX"; or set FZF_TMUX 0
test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%
if [ -n "$FZF_TMUX_OPTS" ]
echo "fzf-tmux $FZF_TMUX_OPTS -- "
else if [ $FZF_TMUX -eq 1 ]
echo "fzf-tmux -d$FZF_TMUX_HEIGHT -- "
else
echo "fzf"
end
end
bind \ct fzf-file-widget
bind \cr fzf-history-widget
bind \ec fzf-cd-widget
if bind -M insert > /dev/null 2>&1
bind -M insert \ct fzf-file-widget
bind -M insert \cr fzf-history-widget
bind -M insert \ec fzf-cd-widget
end
function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath, fzf query, and optional -option= prefix'
set -l commandline (commandline -t)
# strip -option= from token if present
set -l prefix (string match -r -- '^-[^\s=]+=' $commandline)
set commandline (string replace -- "$prefix" '' $commandline)
# eval is used to do shell expansion on paths
eval set commandline $commandline
if [ -z $commandline ]
# Default to current directory with no --query
set dir '.'
set fzf_query ''
else
set dir (__fzf_get_dir $commandline)
if [ "$dir" = "." -a (string sub -l 1 -- $commandline) != '.' ]
# if $dir is "." but commandline is not a relative path, this means no file path found
set fzf_query $commandline
else
# Also remove trailing slash after dir, to "split" input properly
set fzf_query (string replace -r "^$dir/?" -- '' "$commandline")
end
end
echo $dir
echo $fzf_query
echo $prefix
end
function __fzf_get_dir -d 'Find the longest existing filepath from input string'
set dir $argv
# Strip all trailing slashes. Ignore if $dir is root dir (/)
if [ (string length -- $dir) -gt 1 ]
set dir (string replace -r '/*$' -- '' $dir)
end
# Iteratively check if dir exists and strip tail end of path
while [ ! -d "$dir" ]
# If path is absolute, this can keep going until ends up at /
# If path is relative, this can keep going until entire input is consumed, dirname returns "."
set dir (dirname -- "$dir")
end
echo $dir
end
end

120
config/fzf/key-bindings.zsh Executable file
View File

@@ -0,0 +1,120 @@
# ____ ____
# / __/___ / __/
# / /_/_ / / /_
# / __/ / /_/ __/
# /_/ /___/_/ key-bindings.zsh
#
# - $FZF_TMUX_OPTS
# - $FZF_CTRL_T_COMMAND
# - $FZF_CTRL_T_OPTS
# - $FZF_CTRL_R_OPTS
# - $FZF_ALT_C_COMMAND
# - $FZF_ALT_C_OPTS
# Key bindings
# ------------
# The code at the top and the bottom of this file is the same as in completion.zsh.
# Refer to that file for explanation.
if 'zmodload' 'zsh/parameter' 2>'/dev/null' && (( ${+options} )); then
__fzf_key_bindings_options="options=(${(j: :)${(kv)options[@]}})"
else
() {
__fzf_key_bindings_options="setopt"
'local' '__fzf_opt'
for __fzf_opt in "${(@)${(@f)$(set -o)}%% *}"; do
if [[ -o "$__fzf_opt" ]]; then
__fzf_key_bindings_options+=" -o $__fzf_opt"
else
__fzf_key_bindings_options+=" +o $__fzf_opt"
fi
done
}
fi
'emulate' 'zsh' '-o' 'no_aliases'
{
[[ -o interactive ]] || return 0
# CTRL-T - Paste the selected file path(s) into the command line
__fsel() {
local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | cut -b3-"}"
setopt localoptions pipefail no_aliases 2> /dev/null
local item
eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_CTRL_T_OPTS-}" $(__fzfcmd) -m "$@" | while read item; do
echo -n "${(q)item} "
done
local ret=$?
echo
return $ret
}
__fzfcmd() {
[ -n "${TMUX_PANE-}" ] && { [ "${FZF_TMUX:-0}" != 0 ] || [ -n "${FZF_TMUX_OPTS-}" ]; } &&
echo "fzf-tmux ${FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}} -- " || echo "fzf"
}
fzf-file-widget() {
LBUFFER="${LBUFFER}$(__fsel)"
local ret=$?
zle reset-prompt
return $ret
}
zle -N fzf-file-widget
bindkey -M emacs '^T' fzf-file-widget
bindkey -M vicmd '^T' fzf-file-widget
bindkey -M viins '^T' fzf-file-widget
# ALT-C - cd into the selected directory
fzf-cd-widget() {
local cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type d -print 2> /dev/null | cut -b3-"}"
setopt localoptions pipefail no_aliases 2> /dev/null
local dir="$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_ALT_C_OPTS-}" $(__fzfcmd) +m)"
if [[ -z "$dir" ]]; then
zle redisplay
return 0
fi
zle push-line # Clear buffer. Auto-restored on next prompt.
BUFFER="builtin cd -- ${(q)dir}"
zle accept-line
local ret=$?
unset dir # ensure this doesn't end up appearing in prompt expansion
zle reset-prompt
return $ret
}
zle -N fzf-cd-widget
bindkey -M emacs '\ec' fzf-cd-widget
bindkey -M vicmd '\ec' fzf-cd-widget
bindkey -M viins '\ec' fzf-cd-widget
# CTRL-R - Paste the selected command from history into the command line
fzf-history-widget() {
local selected num
setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null
selected=( $(fc -rl 1 | awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' |
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} ${FZF_DEFAULT_OPTS-} -n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,ctrl-z:ignore ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) )
local ret=$?
if [ -n "$selected" ]; then
num=$selected[1]
if [ -n "$num" ]; then
zle vi-fetch-history -n $num
fi
fi
zle reset-prompt
return $ret
}
zle -N fzf-history-widget
bindkey -M emacs '^R' fzf-history-widget
bindkey -M vicmd '^R' fzf-history-widget
bindkey -M viins '^R' fzf-history-widget
} always {
eval $__fzf_key_bindings_options
'unset' '__fzf_key_bindings_options'
}

View File

@@ -18,6 +18,8 @@ tap "xwmx/taps"
brew "act"
# Mozilla CA certificate store
brew "ca-certificates"
# Cryptography and SSL/TLS Toolkit
brew "openssl@3"
# Interpreted, interactive, object-oriented programming language
brew "python@3.11"
# YAML Parser
@@ -100,8 +102,6 @@ brew "dnsmasq"
brew "dog"
# Lightning-fast linter for .env files written in Rust
brew "dotenv-linter"
# Tool to verify that your files are in harmony with your .editorconfig
brew "editorconfig-checker"
# Useful examples at the command-line
brew "eg-examples"
# Run arbitrary commands when files change
@@ -411,6 +411,7 @@ mas "Actions", id: 1586435171
mas "Audiobook Builder", id: 1437681957
mas "Ivory", id: 6444602274
mas "Keynote", id: 409183694
mas "LastPass", id: 926036361
mas "Numbers", id: 409203825
mas "Pages", id: 409201541
mas "Tailscale", id: 1475387142

View File

@@ -1,6 +1 @@
tags
test.sh
.luarc.json
nvim
lazy-lock.json
session.vim

View File

@@ -1,3 +1,4 @@
-- luacheck: globals vim
local key = vim.api.nvim_set_keymap
local remap = { noremap = true, silent = true }
@@ -8,12 +9,12 @@ vim.g.maplocalleader = " "
-- Set 'Space' as <NOP> key to leadermap key
key("n", "<Space>", "<NOP>", remap)
-- Filetype specialties.
require("filetype")
-- Global, windows options of neovim:
require("options")
-- Filetype specialties.
require("filetype")
-- To adminstrate packages:
require("plugin-manager")

View File

@@ -0,0 +1,52 @@
{
"barbecue.nvim": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" },
"bufdelete.nvim": { "branch": "master", "commit": "07d1f8ba79dec59d42b975a4df1c732b2e4e37b4" },
"catppuccin": { "branch": "main", "commit": "a937d546f4783a1ff67f84043d2d7871ad4ecd83" },
"close-buffers.nvim": { "branch": "master", "commit": "3acbcad1211572342632a6c0151f839e7dead27f" },
"comment-box.nvim": { "branch": "main", "commit": "dd1a48f8d06102e9b87ae1e0069bc365c006979b" },
"dressing.nvim": { "branch": "master", "commit": "c1e1d5fa44fe08811b6ef4aadac2b50e602f9504" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"gitsigns.nvim": { "branch": "main", "commit": "983f1a216cca1a079399ba050bc4b9ce130de83a" },
"harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" },
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
"lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "dfdd771b792fbb4bad8e057d72558255695aa1a7" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "6148b51db945b55b3b725da39eaea6441e59dff8" },
"mason.nvim": { "branch": "main", "commit": "ee6a7f179ebf8aa9da9d53b1cf1b57d292ea0182" },
"mini.nvim": { "branch": "main", "commit": "707dca4f4152c2d9c9b4c5e02635f78dfd33db50" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "80dc74d081823649809f78370fa5b204aa9a853a" },
"neodev.nvim": { "branch": "main", "commit": "dcd34653b0f1d3e7ea9aeb3e37dc7c8da445c4fe" },
"neogen": { "branch": "main", "commit": "cb1f384df804c1bf729332c4f728253fe17962d4" },
"nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-dap": { "branch": "master", "commit": "0e6b7c47dd70e80793ed39271b2aa712d9366dbc" },
"nvim-dap-go": { "branch": "main", "commit": "1b508e9db330108d3b5d62a6d9cc01fe6bbdd4e0" },
"nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" },
"nvim-lspconfig": { "branch": "master", "commit": "0517d8522dcec286b1dba47aa3ee1ed8f523aed6" },
"nvim-navic": { "branch": "master", "commit": "9c89730da6a05acfeb6a197e212dfadf5aa60ca0" },
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
"nvim-regexplainer": { "branch": "main", "commit": "4250c8f3c1307876384e70eeedde5149249e154f" },
"nvim-treesitter": { "branch": "master", "commit": "dfcfdb0e7bcb362c4de1ed7d0015c21957c91ba7" },
"nvim-treesitter-context": { "branch": "master", "commit": "b6c763db8cc486215ba96e0a67418848a710ab25" },
"nvim-web-devicons": { "branch": "master", "commit": "bc11ee2498de2310de5776477dd9dce65d03b464" },
"nvim-window-picker": { "branch": "main", "commit": "1b1bb834b0acb9eebb11a61664efc665757f1ba2" },
"plenary.nvim": { "branch": "master", "commit": "a56bf0071bf63d35274fdc4738bb1e8821cfd2ea" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"refactoring.nvim": { "branch": "master", "commit": "2ec9bc0fb5f3c8c6a0f776f0159dd2a3b1663554" },
"restoreview": { "branch": "main", "commit": "03d00d59a9ba640db6b44192ed0fcc9d7261dcd2" },
"schemastore.nvim": { "branch": "main", "commit": "b6e498b2e34af832311472a07d4d5e349e2e7c62" },
"smartcolumn.nvim": { "branch": "main", "commit": "d01b99355c7fab13233f48d0f28dc097e68a03f7" },
"stickybuf.nvim": { "branch": "master", "commit": "4c667bc837e5e3fec5a8857ee99f1a229fc76df9" },
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
"tabnine": { "branch": "master", "commit": "dcca6d2f9e8bbcde36aab87b9b87890810e4056d" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "ad7b637c72549713b9aaed7c4f9c79c62bcbdff0" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
"telescope.nvim": { "branch": "master", "commit": "18f10f28007cb8b4d50324217349c3f568684be2" },
"toggleterm.nvim": { "branch": "main", "commit": "b90a1381e9b5b8596f49070ee86c71db267ac868" },
"trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" },
"twilight.nvim": { "branch": "main", "commit": "a4843e6e67092a1e6fa9666f02bf0ab59174c1df" },
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
"vim-wakatime": { "branch": "master", "commit": "0d2efa2daff34b27b0d227d4c3b136811c93db93" },
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" },
"wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" }
}

View File

@@ -29,3 +29,118 @@ local autoCommands = {
}
M.nvim_create_augroups(autoCommands)
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
},
callback = function(event)
vim.b[event.buf].miniindentscope_disable = true
end,
})
-- ╭──────────────────────────────────────────────────────────╮
-- │ taken from LazyVim repository │
-- ╭─────────────────────────────────────────────────────────────────────────────╮
-- │ https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua│
-- ╰─────────────────────────────────────────────────────────────────────────────╯
local function augroup(name)
return vim.api.nvim_create_augroup("ivuorinen_" .. name, { clear = true })
end
-- Check if we need to reload the file when it changed
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, {
group = augroup("checktime"),
command = "checktime",
})
-- Highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", {
group = augroup("highlight_yank"),
callback = function()
vim.highlight.on_yank()
end,
})
-- resize splits if window got resized
vim.api.nvim_create_autocmd({ "VimResized" }, {
group = augroup("resize_splits"),
callback = function()
local current_tab = vim.fn.tabpagenr()
vim.cmd("tabdo wincmd =")
vim.cmd("tabnext " .. current_tab)
end,
})
-- go to last loc when opening a buffer
vim.api.nvim_create_autocmd("BufReadPost", {
group = augroup("last_loc"),
callback = function()
local exclude = { "gitcommit" }
local buf = vim.api.nvim_get_current_buf()
if vim.tbl_contains(exclude, vim.bo[buf].filetype) then
return
end
local mark = vim.api.nvim_buf_get_mark(buf, '"')
local lcount = vim.api.nvim_buf_line_count(buf)
if mark[1] > 0 and mark[1] <= lcount then
pcall(vim.api.nvim_win_set_cursor, 0, mark)
end
end,
})
-- close some filetypes with <q>
vim.api.nvim_create_autocmd("FileType", {
group = augroup("close_with_q"),
pattern = {
"PlenaryTestPopup",
"help",
"lspinfo",
"man",
"notify",
"qf",
"spectre_panel",
"startuptime",
"tsplayground",
"neotest-output",
"checkhealth",
"neotest-summary",
"neotest-output-panel",
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
end,
})
-- wrap and check for spell in text filetypes
vim.api.nvim_create_autocmd("FileType", {
group = augroup("wrap_spell"),
pattern = { "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- Auto create dir when saving a file, in case some intermediate directory does not exist
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
group = augroup("auto_create_dir"),
callback = function(event)
if event.match:match("^%w%w+://") then
return
end
local file = vim.loop.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end,
})

View File

@@ -5,9 +5,7 @@
and WhichKey register. Slowly migrating to the WhichKey system,
and tweaking the groupings as I go.
--]]
local key = vim.api.nvim_set_keymap
local remap = { noremap = true, silent = true }
-- luacheck: globals vim CAPABILITIES
local wk = require("which-key")
@@ -15,16 +13,19 @@ local wk = require("which-key")
-- │ Register keybindings │
-- ╰──────────────────────────────────────────────────────────╯
-- Register in all modes, prefix <leader>
-- ╭──────────────────────────────────────────────────────────╮
-- │ Register in all modes, prefix <leader> │
-- ╰──────────────────────────────────────────────────────────╯
wk.register({
b = {
name = "Buffer",
n = {
"<cmd>tabnew<cr>",
"New tab",
name = "+buffer",
n = { "<cmd>tabnew<cr>", "[n]ew tab" },
a = {
name = "+annotate"
-- defined in plugins/neogen.lua
},
c = {
name = "Comments",
name = "+comments",
b = {
"<cmd>lua require('comment-box').lbox()<cr>",
"Left aligned fixed size box with left aligned text",
@@ -39,30 +40,42 @@ wk.register({
},
},
d = {
name = "Delete buffers",
name = "+delete buffers",
h = {
"<CMD>lua require('close_buffers').delete({type = 'hidden'})<CR>",
"Delete hidden buffers",
},
},
t = { ":TabnineToggle<cr>", "Toggle TabNine" },
},
D = {
name = "[D]iagnostics (Trouble)",
name = "+Diagnostics (Trouble)",
t = { ":TroubleToggle<CR>", "[D]iagnostics [t]oggle" },
-- Quick navigation between diagonostics.
f = { ":lua vim.diagnostic.open_float()<CR>", "[D]iagnostics: Open [f]loat" },
n = { ":lua vim.diagnostic.goto_next()<CR>", "[D]iagnostics: [n]ext" },
p = { ":lua vim.diagnostic.goto_prev()<CR>", "[D]iagnostics: [p]rev" },
---
x = { function() require("trouble").open() end, "Open Trouble" },
w = { function() require("trouble").open("workspace_diagnostics") end, "Workspace diagnostics" },
d = { function() require("trouble").open("document_diagnostics") end, "Document diagnostics" },
q = { function() require("trouble").open("quickfix") end, "Quickfix" },
l = { function() require("trouble").open("loclist") end, "Loclist" },
r = { function() require("trouble").open("lsp_references") end, "LSP References" },
},
e = {
function() vim.cmd("Neotree focus source=filesystem position=left") end,
"Toggle the sidebar tree",
},
f = {
name = "[f]ind",
name = "+find",
-- Find recursively files across the root folder subfiles.
f = { ':lua require("telescope.builtin").find_files()<cr>', "[f]ind [f]iles" },
-- Find recursively a text across the root folder subfiles.
g = { ':lua require("telescope.builtin").live_grep()<cr>', "[f]ind text with [g]rep" },
},
h = {
name = "[h]arpoon",
name = "+harpoon",
a = { "<cmd>lua require('harpoon.mark').add_file()<cr>", "[h]arpoon: [A]dd file" },
r = { "<cmd>lua require('harpoon.mark').rm_file()<cr>", "[h]arpoon: [r]emove file" },
m = { "<cmd>lua require('harpoon.ui').toggle_quick_menu()<cr>", "[h]arpoon: harpoon [m]enu" },
@@ -74,119 +87,107 @@ wk.register({
},
--- Remap debugging to "H" from LV default of "h"
H = {
name = "[H]elp/Conceal/Telescope",
name = "+help/Conceal/Treesitter",
c = {
name = "[c]onceal",
name = "+conceal",
h = { ":set conceallevel=1<cr>", "hide/conceal" },
s = { ":set conceallevel=0<cr>", "show/unconceal" },
},
t = {
name = "Treesitter",
name = "+treesitter",
t = { vim.treesitter.inspect_tree, "show tree" },
c = { ":=vim.treesitter.get_captures_at_cursor()<cr>", "show capture" },
n = { ":=vim.treesitter.get_node():type()<cr>", "show node" },
},
},
o = {
g = {
-- defined in plugins/gitsigns.lua
name = "+git",
b = {
name = "+blame",
},
},
},
p = {
name = "[p]lugins",
i = { function() require("lazy").install() end, "[p]lugins [i]nstall" },
s = { function() require("lazy").home() end, "[p]lugins [s]tatus" },
S = { function() require("lazy").sync() end, "[p]lugins [S]ync" },
u = { function() require("lazy").check() end, "[p]lugins Check [u]pdates" },
U = { function() require("lazy").update() end, "[p]lugins [U]pdate" },
name = "+plugins",
i = { function() require("lazy").install() end, "plugins [i]nstall" },
s = { function() require("lazy").home() end, "plugins [s]tatus" },
S = { function() require("lazy").sync() end, "plugins [S]ync" },
u = { function() require("lazy").check() end, "plugins Check [u]pdates" },
U = { function() require("lazy").update() end, "plugins [U]pdate" },
},
q = {
name = "[q]uit",
q = { ":qa<cr>", "[q]uit: [q]uit all" },
f = { ":qa!<cr>", "[q]uit: all with [f]orce" },
name = "+quit",
q = { ":qa<cr>", "quit: [q]uit all" },
f = { ":qa!<cr>", "quit: all with [f]orce" },
},
r = {
-- defined in plugins/refactoring-nvim.lua
name = "+refactor",
},
t = {
name = "[t]elescope",
name = "+telescope",
-- Find recursively TODOs, NOTEs, FIXITs, ... across the root folder subfiles.
t = { ":TodoTelescope<cr>", "[t]elescope: [t]odo" },
},
x = { ":Bdelete<CR>", "[x]: Close current buffer" },
x = { ":Bdelete<CR>", "Close current buffer" },
}, { prefix = "<leader>" })
-- Normal mode, prefix <leader>
--
-- ╭──────────────────────────────────────────────────────────╮
-- │ Normal mode, prefix <leader> │
-- ╰──────────────────────────────────────────────────────────╯
wk.register({
b = { name = "Buffer" },
}, { mode = "n", prefix = "<leader>" })
-- Insert mode, prefix <leader>
--
-- ╭──────────────────────────────────────────────────────────╮
-- │ Insert mode, prefix <leader> │
-- ╰──────────────────────────────────────────────────────────╯
wk.register({
b = { name = "Buffer" },
}, { mode = "i", prefix = "<leader>" })
--
-- ╭──────────────────────────────────────────────────────────╮
-- │ Insert mode, no prefix │
-- ╰──────────────────────────────────────────────────────────╯
wk.register({
["<C-s>"] = { "<cmd>w<cr>", "Save file" },
["<C-Home>"] = { "<Home>", "Do just Home on CTRL + Home" },
}, { mode = "i", prefix = "" })
--
-- ╭──────────────────────────────────────────────────────────╮
-- │ All modes, no prefix │
-- ╰──────────────────────────────────────────────────────────╯
wk.register({
["<C-s>"] = { "<cmd>w<cr>", "Save file" },
["<C-End>"] = { "<End>", "Do just End on CTRL + End" },
}, { prefix = "" })
--
-- ╭──────────────────────────────────────────────────────────╮
-- │ Other keymappings, still to move │
-- ╰──────────────────────────────────────────────────────────╯
local key = vim.api.nvim_set_keymap
local remap = { noremap = true, silent = true }
-- Go to the next block.
--key('n', '<C-Down>', 'g%', remap )
-- Loop through brackets blocks.
--key('n', '<C-Up>', 'z%', remap )
-- Do just End on CTRL + End.
key("i", "<C-End>", "<End>", remap)
key("n", "<C-End>", "<End>", remap)
-- Do just Home on CTRL + Home.
key("i", "<C-Home>", "<End>", remap)
-- Highlight the word after pressing enter.
key(
"n",
"<CR>",
[[:let searchTerm = '\v<'.expand("<cword>").'>' <bar> let @/ = searchTerm <bar> echo '/'.@/ <bar> call histadd("search", searchTerm) <bar> set hls<cr>]],
remap
)
-- Highlight the visual selection after pressing enter.
key(
"v",
"<CR>",
[["*y:silent! let searchTerm = '\V'.substitute(escape(@*, '\/'), "\n", '\\n', "g") <bar> let @/ = searchTerm <bar> echo '/'.@/ <bar> call histadd("search", searchTerm) <bar> set hls<cr>]],
remap
)
-- Toggle highlight of search
key("n", "<C-c>", ":set hlsearch!<CR>", remap)
-- Toggle the sidebar tree of the root folder.
key("n", "<leader>e", "", {
noremap = true,
silent = true,
desc = "Open NeoTree without warnings",
callback = function() vim.cmd("Neotree toggle source=filesystem position=left") end,
})
-- Try to correct the current word.
key("i", "<C-b>", "ea<C-x><C-s>", remap)
-- Toggle built-in nvim spell checking.
key("n", "<F5>", ":setlocal spell!<CR>", remap)
-- Move lines normally like an IDE when line wraps
key("i", "<Down>", [[v:count ? 'j' : '<c-o>gj']], { expr = true, noremap = true, silent = true })
key("i", "<Up>", [[v:count ? 'k' : '<c-o>gk']], { expr = true, noremap = true, silent = true })
key("n", "<Down>", [[v:count ? 'j' : 'gj']], { expr = true, noremap = true, silent = true })
key("n", "<Up>", [[v:count ? 'k' : 'gk']], { expr = true, noremap = true, silent = true })
-- Set 'CTRL + v' as 'paster'
-- key('', '<C-v>', 'map"_d<Esc>i', remap )
key("v", "<C-v>", "p", remap)
-- Set 'CTRL + x' as 'cut'
key("v", "<C-x>", "mad`ai<Right>", { silent = true })
-- Set 'CTRL + c' as 'copier'
key("v", "<C-c>", "may`ai", remap)
key("i", "<C-v>", "<Esc>:Registers<CR>", remap)
-- Set 'CTRL + s as save'
key("n", "<C-s>", "<cmd>w<cr>", remap)
-- Create mark.
key("n", "'", "`", remap)
-- Move normaly bottom and up with C+Up and C+Down.
key("i", "<C-Up>", "<C-o>gk", remap)
key("i", "<C-Down>", "<C-o>gj", remap)
@@ -213,67 +214,9 @@ key("i", "<S-Down>", "<C-o>v<Down>", remap)
key("i", "<S-Left>", "<Esc>v<Left>", remap)
key("i", "<S-Right>", "<C-o>v<Right>", remap)
-- Set 'SHIFT + special-keys' as 'select' like a modern text editor.
key("i", "<S-Home>", "<Esc>v<Home>", remap)
key("i", "<S-End>", "<C-o>v<End><Left>", remap)
key("n", "<S-Home>", "v<Home>", remap)
key("n", "<S-End>", "v<End><Left>", remap)
key("n", "<S-PageUp>", "", remap)
key("n", "<S-PageDown>", "<Esc>:call Visual_Scroll_Down()<CR>i<Right><Left>", remap)
-- Indent the current visual selection.
key("v", "<", "<gv", remap)
key("v", ">", ">gv", remap)
-- Set 'Backspace' as 'delete selection' for the visual selection.
key("v", "<BS>", '"_di', remap)
---
-- Barbar keymappings
local map = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true }
-- Move to previous/next
map("n", "<C-,>", "<Cmd>BufferPrevious<CR>", opts)
map("n", "<C-.>", "<Cmd>BufferNext<CR>", opts)
-- Re-order to previous/next
map("n", "<C-<>", "<Cmd>BufferMovePrevious<CR>", opts)
map("n", "<C->>", "<Cmd>BufferMoveNext<CR>", opts)
-- Goto buffer in position...
map("n", "<C-1>", "<Cmd>BufferGoto 1<CR>", opts)
map("n", "<C-2>", "<Cmd>BufferGoto 2<CR>", opts)
map("n", "<C-3>", "<Cmd>BufferGoto 3<CR>", opts)
map("n", "<C-4>", "<Cmd>BufferGoto 4<CR>", opts)
map("n", "<C-5>", "<Cmd>BufferGoto 5<CR>", opts)
map("n", "<C-6>", "<Cmd>BufferGoto 6<CR>", opts)
map("n", "<C-7>", "<Cmd>BufferGoto 7<CR>", opts)
map("n", "<C-8>", "<Cmd>BufferGoto 8<CR>", opts)
map("n", "<C-9>", "<Cmd>BufferGoto 9<CR>", opts)
map("n", "<C-0>", "<Cmd>BufferLast<CR>", opts)
-- Pin/unpin buffer
map("n", "<C-p>", "<Cmd>BufferPin<CR>", opts)
-- Close buffer
-- map('n', '<C-c>', '<Cmd>BufferClose<CR>', opts)
-- Wipeout buffer
-- :BufferWipeout
-- Close commands
-- :BufferCloseAllButCurrent
-- :BufferCloseAllButPinned
-- :BufferCloseAllButCurrentOrPinned
-- :BufferCloseBuffersLeft
-- :BufferCloseBuffersRight
-- Magic buffer-picking mode
map("n", "<C-p>", "<Cmd>BufferPick<CR>", opts)
-- Sort automatically by...
map("n", "<Space>bb", "<Cmd>BufferOrderByBufferNumber<CR>", opts)
map("n", "<Space>bd", "<Cmd>BufferOrderByDirectory<CR>", opts)
map("n", "<Space>bl", "<Cmd>BufferOrderByLanguage<CR>", opts)
map("n", "<Space>bw", "<Cmd>BufferOrderByWindowNumber<CR>", opts)
-- Other:
-- :BarbarEnable - enables barbar (enabled by default)
-- :BarbarDisable - very bad command, should never be used

View File

@@ -1,10 +1,9 @@
-- Completion for snippets.
-- luacheck: globals vim CAPABILITIES
local vim = vim
CAPABILITIES = vim.lsp.protocol.make_client_capabilities()
CAPABILITIES = require("cmp_nvim_lsp").default_capabilities(CAPABILITIES)
CAPABILITIES.textDocument.completion.completionItem.snippetSupport = true
--CAPABILITIES.offsetEncoding = 'utf-8'
-- [[ Configure LSP ]]
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
@@ -81,6 +80,7 @@ local servers = {
jsonls = {},
lua_ls = {
Lua = {
diagnostics = { globals = { "vim" } },
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
@@ -100,7 +100,6 @@ require("neodev").setup()
-- nvim-cmp supports additional completion capabilities,
-- so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
-- Ensure the servers above are installed
local mason_lspconfig = require("mason-lspconfig")
@@ -121,26 +120,80 @@ mason_lspconfig.setup_handlers({
end,
})
-- Bash Language Server
require("lsp.bash")
-- eslint_d + prettierd
-- require 'lsp.eslint_d_prettierd'
-- Configure language servers for specific languages
local lspconfig = require("lspconfig")
-- Bash Language Server
lspconfig.bashls.setup({
cmd = {
"bash-language-server",
"start",
},
filetypes = { "sh", "zsh" },
capabilities = CAPABILITIES,
})
-- HTML
require("lsp.html")
lspconfig.html.setup({ capabilities = CAPABILITIES })
-- JSON
require("lsp.json")
lspconfig.jsonls.setup({
settings = {
json = {
schemas = require("schemastore").json.schemas(),
validate = { enable = true },
},
},
capabilities = CAPABILITIES,
})
-- Python
require("lsp.python")
lspconfig.pylsp.setup({})
-- CSS + Less + SCSS
require("lsp.scss")
lspconfig.cssls.setup({
cmd = { "vscode-css-language-server", "--stdio" },
filetypes = { "css", "scss", "less" },
-- root_dir = root_pattern("package.json", ".git") or bufdir,
settings = {
css = {
validate = true,
},
less = {
validate = true,
},
scss = {
validate = true,
},
},
single_file_support = true,
capabilities = CAPABILITIES,
on_attach = function(client, bufnr)
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
end,
})
-- rome
require("lsp.rome")
local util = require("lspconfig.util")
lspconfig.rome.setup({
root_dir = util.root_pattern("rome.json"),
single_file_support = true,
on_attach = function(client, bufnr)
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
end,
capabilities = CAPABILITIES,
})
-- Typescript + Javascript
require("lsp.typescript")
lspconfig.tsserver.setup({
capabilities = CAPABILITIES,
on_attach = function(client, bufnr)
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
end,
})
lspconfig.lua_ls.setup({})
lspconfig.yamlls.setup({})

View File

@@ -1,8 +0,0 @@
require("lspconfig").bashls.setup({
cmd = {
"bash-language-server",
"start",
},
filetypes = { "sh", "zsh" },
capabilities = CAPABILITIES,
})

View File

@@ -1,25 +0,0 @@
local eslint = require("eslint")
local null_ls = require("null-ls")
-- local sources = { null_ls.builtins.formatting.prettierd }
null_ls.setup()
eslint.setup({
bin = "eslint_d",
code_actions = {
enable = true,
apply_on_save = {
enable = true,
types = { "directive", "problem", "suggestion", "layout" },
},
disable_rule_comment = {
enable = true,
location = "separate_line", -- or `same_line`
},
},
diagnostics = {
enable = true,
report_unused_disable_directives = false,
run_on = "type", -- or `save`
},
})

View File

@@ -1 +0,0 @@
require("lspconfig").html.setup({ capabilities = CAPABILITIES })

View File

@@ -1,9 +0,0 @@
require("lspconfig").jsonls.setup({
settings = {
json = {
schemas = require("schemastore").json.schemas(),
validate = { enable = true },
},
},
capabilities = CAPABILITIES,
})

View File

@@ -1 +0,0 @@
require("lspconfig").pylsp.setup({})

View File

@@ -1,31 +0,0 @@
local util = require("lspconfig.util")
-- local config = require 'lspconfig.configs'
-- This duplicate exec is just a workaruond, if don't execute at first,
-- the nvim will stuck when you first init rome socket
-- local rome_cmd = { 'rome', 'lsp-proxy' }
-- local merged_table = vim.tbl_extend("keep", {
-- textDocument = {
-- formatting = {
-- dynamicRegistration = true
-- }
-- }
-- }, capabilities);
--
require("lspconfig").rome.setup({
-- cmd = rome_cmd,
-- filetypes = {
-- 'javascript',
-- 'javascriptreact',
-- 'typescript',
-- 'typescriptreact',
-- 'json'
-- },
root_dir = util.root_pattern("rome.json"),
single_file_support = true,
on_attach = function(client, bufnr)
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
end,
capabilities = CAPABILITIES,
})

View File

@@ -1,22 +0,0 @@
-- CSS + Less + SASS Language Server
require("lspconfig").cssls.setup({
cmd = { "vscode-css-language-server", "--stdio" },
filetypes = { "css", "scss", "less" },
-- root_dir = root_pattern("package.json", ".git") or bufdir,
settings = {
css = {
validate = true,
},
less = {
validate = true,
},
scss = {
validate = true,
},
},
single_file_support = true,
capabilities = CAPABILITIES,
on_attach = function(client, bufnr)
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
end,
})

View File

@@ -1,6 +0,0 @@
require("lspconfig").tsserver.setup({
capabilities = CAPABILITIES,
on_attach = function(client, bufnr)
if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) end
end,
})

View File

@@ -15,7 +15,7 @@ return {
floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
floating_window_above_cur_line = false, -- try to place the floating above the current line when possible Note:
floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note:
-- will set to true when fully tested, set to false will use whichever side has more space
-- this setting will be helpful if you do not want the PUM and floating win overlap
close_timeout = 4000, -- close floating window after ms when laster parameter is entered

View File

@@ -1,58 +1,29 @@
local option = vim.api.nvim_set_option
local set = vim.api.nvim_set_var
-- Fix moving through lines 'gk' and 'gj'
vim.wo.linebreak = true
-- Enable break indent
vim.o.breakindent = true
-- luacheck: globals vim
-- Use the new FileType system of Neovim.
-- let g:do_filetype_lua = 1
-- Save undo history
vim.o.undofile = true
-- Show lines number (hybrid)
vim.wo.number = true
vim.wo.relativenumber = true
-- Keep signcolumn on by default
vim.wo.signcolumn = "yes"
vim.wo.linebreak = true -- Fix moving through lines 'gk' and 'gj'
vim.o.breakindent = true -- Enable break indent
vim.o.undofile = true -- Save undo history
vim.wo.number = true -- Show lines number (hybrid)
vim.wo.relativenumber = true -- Show lines number (hybrid)
vim.wo.signcolumn = "yes" -- Keep signcolumn on by default
-- Case-insensitive searching UNLESS \C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- To have a extra line :)
vim.o.cmdheight = 0
-- Set wrap for words
vim.wo.wrap = true
-- Always show tabs
vim.o.showtabline = 2
-- Show xtra spaces
vim.opt.list = true
-- Set wildmenu for later use
vim.o.wildmenu = true
-- Highlighting search
vim.o.hlsearch = true
-- Set ruler for better look
vim.o.ruler = true
-- No nice message
vim.o.hidden = true
-- Partial commands only in the screen
vim.o.showcmd = true
-- Match braces when inserting new ones :)
vim.o.showmatch = true
vim.o.cmdheight = 0 -- To have a extra line :)
vim.wo.wrap = true -- Set wrap for words
vim.o.showtabline = 2 -- Always show tabs
vim.opt.list = true -- Show xtra spaces
vim.o.wildmenu = true -- Set wildmenu for later use
vim.o.hlsearch = true -- Highlighting search
vim.o.ruler = true -- Set ruler for better look
vim.o.hidden = true -- No nice message
vim.o.showcmd = true -- Partial commands only in the screen
vim.o.showmatch = true -- Match braces when inserting new ones
-- Cursor line
---- Cursor column
@@ -61,39 +32,19 @@ vim.wo.cursorline = true
vim.o.cursorcolumn = true
vim.wo.cursorcolumn = true
-- Off scroll when moving through the buffer
vim.o.scrolloff = 40
vim.o.scrolloff = 40 -- Off scroll when moving through the buffer
vim.go.termguicolors = true -- For terminal RGB colours
vim.go.t_Co = "256" -- Colours, I believe
vim.go.t_ut = "" -- Colours, I believe
vim.o.laststatus = 3 -- Space for tabs
vim.o.softtabstop = 2 -- Space for tabs
vim.o.expandtab = true -- Expand tab to use spaces instead
vim.o.tabstop = 2 -- Space for tabs
vim.bo.shiftwidth = 2 -- Space for tabs
vim.o.shiftwidth = 2 -- Space for tabs
-- For terminal RGB colours
vim.go.termguicolors = true
-- Colours, I believe
vim.go.t_Co = "256"
vim.go.t_ut = ""
-- Space for tabs
vim.o.laststatus = 3
-- Space for tabs
vim.o.softtabstop = 2
-- Expand tab to use spaces instead
vim.o.expandtab = true
-- Space for tabs
vim.o.tabstop = 2
-- Space for tabs
vim.bo.shiftwidth = 2
-- Space for tabs
vim.o.shiftwidth = 2
-- Format options to not create new lines with comments
vim.o.formatoptions = "tqj"
-- Mouse working with neovim
vim.o.mouse = "a"
vim.o.formatoptions = "tqj" -- Format options to not create new lines with comments
vim.o.mouse = "a" -- Mouse working with neovim
-- viminfo file
-- vim.o.viminfo = vim.o.viminfo .. '~/.config/nvim/viminfo'
@@ -102,17 +53,13 @@ vim.o.mouse = "a"
vim.o.spelllang = "en_gb"
vim.bo.spelllang = "en_gb"
-- Global statusline.
vim.opt.laststatus = 3
vim.opt.laststatus = 2 -- Global statusline.
-- When "on" the commands listed below move the cursor to the first non-blank
-- of the line. When off the cursor is kept in the same column (if possible).
-- https://neovim.io/doc/user/options.html#'startofline'
vim.opt.startofline = true
-- Columns line "limit"
-- vim.o.cc = '85'
-- Set path for better searching across the system
-- vim.o.path = vim.o.path .. '**'
@@ -120,34 +67,39 @@ vim.opt.startofline = true
vim.o.completeopt = "menuone,longest,noselect"
vim.o.shortmess = vim.o.shortmess .. "c"
-- Menu Transparency.
vim.go.pumblend = 10
vim.go.pumblend = 10 -- Menu Transparency.
--------------------Variables-----------------
-- ╭──────────────────────────────────────────────────────────╮
-- │ Variables │
-- ╰──────────────────────────────────────────────────────────╯
set("one_allow_itali:set cursorlinec:set cursorlines", 1)
set("do_filetype_lua", 1)
set("MRU_File", "~/.cache/vim_mru_files")
vim.api.nvim_set_var("one_allow_itali:set cursorlinec:set cursorlines", 1)
vim.api.nvim_set_var("do_filetype_lua", 1)
vim.api.nvim_set_var("MRU_File", "~/.cache/vim_mru_files")
--------------------API------------------------
-- ╭──────────────────────────────────────────────────────────╮
-- │ API │
-- ╰──────────────────────────────────────────────────────────╯
-- Change title accordingly.
-- option('title', true)
vim.api.nvim_set_option("title", true)
-- Set clipboard to be global across the system
option("clipboard", "unnamedplus")
vim.api.nvim_set_option("clipboard", "unnamedplus")
-- Basic fold column
option("foldcolumn", "1")
vim.api.nvim_set_option("foldcolumn", "1")
-- Set dictionary to language spell
option("dictionary", "/usr/share/dict/words")
vim.api.nvim_set_option("dictionary", "/usr/share/dict/words")
-- Wildignore for when opening files :0
option("wildignore", "*/tmp*/,*/node_modules/*,_site,*/__pycache__/,*/venv/*,*/target/*,*/.vim$,~$,*/.log")
vim.api.nvim_set_option(
"wildignore",
"*/tmp*/,*/node_modules/*,_site,*/__pycache__/,*/venv/*,*/target/*,*/.vim$,~$,*/.log"
)
-- Folding
option("foldmethod", "syntax")
-- File format for neovim reading
option("fileformat", "unix")
vim.api.nvim_set_option("foldmethod", "syntax")
vim.api.nvim_set_option('foldenable', false)
vim.api.nvim_set_option('foldminlines', 5)

View File

@@ -1,5 +1,6 @@
-- Package manager https://github.com/folke/lazy.nvim
-- :help lazy.nvim.txt
-- luacheck: globals vim
-- To install lazy.nvim automatically.
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
@@ -17,5 +18,23 @@ end
vim.opt.rtp:prepend(lazypath)
-- Plugins start here:
require("lazy").setup("plugins")
local options = {
defaults = { lazy = false },
install = { colorscheme = { "catppuccin" } },
performance = {
cache = {
enabled = true,
},
rtp = {
disabled_plugins = {
"matchit",
"matchparen",
"netrwPlugin",
"tohtml",
"tutor",
},
},
},
}
require("lazy").setup("plugins", options)

View File

@@ -1,11 +1,13 @@
-- Winbar with context.
-- A VS Code like winbar for Neovim
-- https://github.com/utilyre/barbecue.nvim
return {
"utilyre/barbecue.nvim",
dependencies = {
"neovim/nvim-lspconfig",
"SmiteshP/nvim-navic",
"kyazdani42/nvim-web-devicons", -- Optional
"kyazdani42/nvim-web-devicons",
},
version = "*",
config = {
theme = "catppuccin",

View File

@@ -1 +0,0 @@
return { "kazhala/close-buffers.nvim" }

View File

@@ -1,4 +0,0 @@
return {
"LudoPinelli/comment-box.nvim",
opts = {},
}

View File

@@ -1,29 +0,0 @@
return {
"anuvyklack/fold-preview.nvim",
dependencies = { "anuvyklack/keymap-amend.nvim", "ray-x/lsp_signature.nvim" },
config = function()
local fp = require("fold-preview")
local map = require("fold-preview").mapping
local keymap = vim.keymap
keymap.amend = require("keymap-amend")
fp.setup({
default_keybindings = false,
-- another settings
})
keymap.amend("n", "K", function(original)
if not fp.show_preview() then original() end
-- or
-- if not fp.toggle_preview() then original() end
-- to close preview on second press on K.
end)
keymap.amend("n", "h", map.close_preview_open_fold)
keymap.amend("n", "l", map.close_preview_open_fold)
keymap.amend("n", "zo", map.close_preview)
keymap.amend("n", "zO", map.close_preview)
keymap.amend("n", "zc", map.close_preview_without_defer)
keymap.amend("n", "zR", map.close_preview)
keymap.amend("n", "zM", map.close_preview_without_defer)
end,
}

View File

@@ -1,4 +1,6 @@
-- Show signs of GIT written in lua
-- Git integration for buffers
-- https://github.com/lewis6991/gitsigns.nvim
-- luacheck: globals vim
return {
"lewis6991/gitsigns.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
@@ -11,8 +13,8 @@ return {
changedelete = { hl = "GitSignsChange", text = "~", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
@@ -37,19 +39,19 @@ return {
end, { expr = true })
-- Actions
map("n", "<leader>hs", gs.stage_hunk, { desc = "Stage Hunk" })
map("n", "<leader>hr", gs.reset_hunk, { desc = "Reset Hunk" })
map("v", "<leader>hs", function() gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) end)
map("v", "<leader>hr", function() gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) end)
map("n", "<leader>hS", gs.stage_buffer, { desc = "Stage Buffer" })
map("n", "<leader>hu", gs.undo_stage_hunk, { desc = "Undo Stage Hunk" })
map("n", "<leader>hR", gs.reset_buffer, { desc = "Reset Buffer" })
map("n", "<leader>hp", gs.preview_hunk, { desc = "Preview Hunk" })
map("n", "<leader>hb", function() gs.blame_line({ full = true }) end, { desc = "Blame Line" })
map("n", "<leader>tb", gs.toggle_current_line_blame, { desc = "Toggle Current Line Blame" })
map("n", "<leader>hd", gs.diffthis, { desc = "Diff This" })
map("n", "<leader>hD", function() gs.diffthis("~") end)
map("n", "<leader>td", gs.toggle_deleted, { desc = "Toggle Deleted" })
map("n", "<leader>oghs", gs.stage_hunk, { desc = "Stage Hunk" })
map("n", "<leader>oghr", gs.reset_hunk, { desc = "Reset Hunk" })
map("v", "<leader>oghs", function() gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) end)
map("v", "<leader>oghr", function() gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) end)
map("n", "<leader>oghS", gs.stage_buffer, { desc = "Stage Buffer" })
map("n", "<leader>oghu", gs.undo_stage_hunk, { desc = "Undo Stage Hunk" })
map("n", "<leader>oghR", gs.reset_buffer, { desc = "Reset Buffer" })
map("n", "<leader>oghp", gs.preview_hunk, { desc = "Preview Hunk" })
map("n", "<leader>ogbl", function() gs.blame_line({ full = true }) end, { desc = "Blame Line" })
map("n", "<leader>ogbt", gs.toggle_current_line_blame, { desc = "Toggle Current Line Blame" })
map("n", "<leader>oghd", gs.diffthis, { desc = "Diff This" })
map("n", "<leader>oghD", function() gs.diffthis("~") end)
map("n", "<leader>ogtd", gs.toggle_deleted, { desc = "Toggle Deleted" })
-- Text object
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")

View File

@@ -1 +0,0 @@
return { "ThePrimeagen/harpoon" }

View File

@@ -1,70 +0,0 @@
-- Floating statuslines for Neovim
-- https://github.com/b0o/incline.nvim
--
-- Lightweight floating statuslines, best used with
-- Neovim's global statusline (set laststatus=3).
return {
"b0o/incline.nvim",
config = {
debounce_threshold = {
falling = 50,
rising = 0,
},
hide = {
cursorline = true,
focused_win = false,
only_win = true,
},
highlight = {
groups = {
InclineNormal = {
default = true,
group = "NormalFloat",
},
InclineNormalNC = {
default = true,
group = "NormalFloat",
},
},
},
ignore = {
buftypes = "special",
filetypes = {},
floating_wins = true,
unlisted_buffers = true,
wintypes = "special",
},
render = "basic",
window = {
margin = {
horizontal = 1,
vertical = 1,
},
options = {
signcolumn = "no",
wrap = false,
},
padding = 1,
padding_char = " ",
placement = {
horizontal = "right",
vertical = "top",
},
width = "fit",
winhighlight = {
active = {
EndOfBuffer = "None",
Normal = "InclineNormal",
Search = "None",
},
inactive = {
EndOfBuffer = "None",
Normal = "InclineNormalNC",
Search = "None",
},
},
zindex = 10,
},
},
}

View File

@@ -1,28 +1,24 @@
-- luacheck: globals vim
return {
--
-- Menu
--
-- Icons on menu
"onsails/lspkind-nvim",
-- plenary: full; complete; entire; absolute; unqualified.
-- All the lua functions I don't want to write twice.
-- https://github.com/nvim-lua/plenary.nvim
{ "nvim-lua/plenary.nvim", lazy = true },
-- Restore folds and cursor position
"senderle/restoreview",
--
-- Appearance
--
-- lua `fork` of vim-web-devicons for neovim
-- https://github.com/nvim-tree/nvim-web-devicons
{ "kyazdani42/nvim-web-devicons" },
-- The theme of choise, catppuccin
---- https://github.com/catppuccin/nvim
-- https://github.com/catppuccin/nvim
{
"catppuccin/nvim",
name = "catppuccin",
priority = 10000,
enabled = true,
lazy = false,
config = function()
vim.cmd.colorscheme("catppuccin")
end,
config = function() vim.cmd.colorscheme("catppuccin") end,
opts = {
flavour = "mocha",
transparent_background = true,
@@ -34,7 +30,8 @@ return {
integrations = {
aerial = true,
barbecue = {
dim_dirname = true, -- directory name is dimmed by default
-- directory name is dimmed by default
dim_dirname = true,
bold_basename = true,
dim_context = false,
alt_background = false,
@@ -50,7 +47,6 @@ return {
mason = true,
neotree = true,
notify = true,
nvimtree = false,
native_lsp = {
enabled = true,
virtual_text = {
@@ -73,9 +69,8 @@ return {
symbols_outline = true,
telescope = {
enabled = true,
style = "catppuccin"
style = "catppuccin",
},
ts_rainbow = true,
treesitter = true,
lsp_trouble = true,
which_key = true,
@@ -83,16 +78,187 @@ return {
},
},
"rcarriga/nvim-notify",
-- Notifications as a popup
-- https://github.com/rcarriga/nvim-notify
{
"rcarriga/nvim-notify",
keys = {
{
"<leader>un",
function() require("notify").dismiss({ silent = true, pending = true }) end,
desc = "Dismiss all Notifications",
},
},
opts = {
timeout = 3000,
max_height = function() return math.floor(vim.o.lines * 0.75) end,
max_width = function() return math.floor(vim.o.columns * 0.75) end,
},
init = function() vim.notify = require("notify") end,
},
-- vscode-like pictograms for neovim lsp completion items
-- https://github.com/onsails/lspkind.nvim
{ "onsails/lspkind-nvim" },
-- Save and restore Vim views automatically
-- https://github.com/senderle/restoreview
{ "senderle/restoreview" },
-- Create key bindings that stick. WhichKey is a lua plugin for Neovim that
-- displays a popup with possible keybindings of the command you started typing.
-- https://github.com/folke/which-key.nvim
{
"folke/which-key.nvim",
enabled = true,
lazy = false,
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
opts = {
plugins = { spelling = true, marks = true, registers = true },
},
},
-- Neovim plugin to improve the default vim.ui interfaces
-- https://github.com/stevearc/dressing.nvim
{
"stevearc/dressing.nvim",
lazy = true,
init = function()
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.select = function(...)
require("lazy").load({ plugins = { "dressing.nvim" } })
return vim.ui.select(...)
end
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.input = function(...)
require("lazy").load({ plugins = { "dressing.nvim" } })
return vim.ui.input(...)
end
end,
},
-- A tree like view for symbols in Neovim using the LSP.
-- https://github.com/simrat39/symbols-outline.nvim
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
keys = { { "<leader>bs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
opts = {
-- add your options that should be passed to the setup() function here
position = "right",
},
},
-- Getting you where you want with the fewest keystrokes.
-- https://github.com/ThePrimeagen/harpoon
{ "ThePrimeagen/harpoon" },
-- A Neovim plugin hiding your colorcolumn when unneeded.
-- https://github.com/m4xshen/smartcolumn.nvim
{
"m4xshen/smartcolumn.nvim",
opts = {
colorcolumn = { "80", "100", "120" },
disabled_filetypes = {
"dashboard",
"help",
"json",
"lazy",
"lazyterm",
"mason",
"neo-tree",
"notify",
"starter",
"toggleterm",
"Trouble",
},
},
},
-- Status information for LSP.
"j-hui/fidget.nvim",
-- https://github.com/j-hui/fidget.nvim
{ "j-hui/fidget.nvim" },
-- A neovim lua plugin to help easily manage multiple terminal windows
-- https://github.com/akinsho/toggleterm.nvim
{
'akinsho/toggleterm.nvim',
version = "*",
opts = {
open_mapping = [[<c-t>]],
insert_mappings = true,
-- direction = "float",
float_opts = {
width = function()
return math.floor(vim.o.columns * 0.9)
end,
height = function()
return math.floor(vim.o.lines * 0.9)
end,
},
}
},
-- Close buffer without messing up with the window.
"famiu/bufdelete.nvim",
-- https://github.com/famiu/bufdelete.nvim
{ "famiu/bufdelete.nvim" },
"nyoom-engineering/oxocarbon.nvim",
-- Delete multiple vim buffers based on different conditions
-- https://github.com/kazhala/close-buffers.nvim
{ "kazhala/close-buffers.nvim" },
-- JSONLS
"b0o/schemastore.nvim",
-- https://github.com/b0o/schemastore.nvim
{ "b0o/schemastore.nvim" },
-- sleuth.vim: Heuristically set buffer options
-- https://github.com/tpope/vim-sleuth
{ "tpope/vim-sleuth" },
-- Neovim plugin for locking a buffer to a window
-- https://github.com/stevearc/stickybuf.nvim
{ "stevearc/stickybuf.nvim", opts = {} },
-- Describe the regexp under the cursor
-- https://github.com/bennypowers/nvim-regexplainer
{
"bennypowers/nvim-regexplainer",
requires = {
"nvim-treesitter/nvim-treesitter",
"MunifTanjim/nui.nvim",
},
opts = {
-- automatically show the explainer when the cursor enters a regexp
auto = true,
},
},
-- Clarify and beautify your comments using boxes and lines.
-- https://github.com/LudoPinelli/comment-box.nvim
{ "LudoPinelli/comment-box.nvim", opts = {} },
-- Tabnine Client for Neovim
-- https://github.com/codota/tabnine-nvim
{
"codota/tabnine-nvim",
name = "tabnine",
build = vim.loop.os_uname().sysname == "Windows_NT" and "pwsh.exe -file .\\dl_binaries.ps1" or "./dl_binaries.sh",
cmd = { "TabnineStatus", "TabnineDisable", "TabnineEnable", "TabnineToggle" },
event = "User",
opts = {
accept_keymap = "<C-CR>",
dismiss_keymap = "<C-Esc>",
},
},
-- Vim plugin for automatic time tracking and metrics generated from your programming activity.
-- https://github.com/wakatime/vim-wakatime
{
"wakatime/vim-wakatime",
lazy = false,
enabled = true,
},
}

View File

@@ -1,9 +0,0 @@
return {
"mrjones2014/legendary.nvim",
-- since legendary.nvim handles all your keymaps/commands,
-- its recommended to load legendary.nvim before other plugins
priority = 10000,
lazy = false,
-- sqlite is only needed if you want to use frecency sorting
-- dependencies = { 'kkharji/sqlite.lua' }
}

View File

@@ -1,36 +0,0 @@
-- Signs for built-in marks.
return {
"chentoast/marks.nvim",
config = {
-- whether to map keybinds or not. default true
default_mappings = true,
-- which builtin marks to show. default {}
builtin_marks = { ".", "<", ">", "^" },
-- whether movements cycle back to the beginning/end of buffer. default true
cyclic = true,
-- whether the shada file is updated after modifying uppercase marks. default false
force_write_shada = false,
-- how often (in ms) to redraw signs/recompute mark positions.
-- higher values will have better performance but may cause visual lag,
-- while lower values may cause performance penalties. default 150.
refresh_interval = 250,
-- sign priorities for each type of mark - builtin marks, uppercase marks, lowercase
-- marks, and bookmarks.
-- can be either a table with all/none of the keys, or a single number, in which case
-- the priority applies to all marks.
-- default 10.
sign_priority = { lower = 10, upper = 15, builtin = 8, bookmark = 20 },
-- disables mark tracking for specific filetypes. default {}
excluded_filetypes = {},
-- marks.nvim allows you to configure up to 10 bookmark groups, each with its own
-- sign/virttext. Bookmarks can be used to group together positions and quickly move
-- across multiple buffers. default sign is '!@#$%^&*()' (from 0 to 9), and
-- default virt_text is "".
bookmark_0 = {
sign = "",
virt_text = "hello world",
},
mappings = {},
},
}

View File

@@ -50,7 +50,7 @@ return {
-- Animate common Neovim actions
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-animate.md
require("mini.animate").setup()
-- require("mini.animate").setup()
-- Go forward/backward with square brackets
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-bracketed.md
@@ -62,11 +62,11 @@ return {
-- Autocompletion and signature help plugin
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-completion.md
require("mini.completion").setup()
-- require("mini.completion").setup()
-- Automatic highlighting of word under cursor
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-cursorword.md
require("mini.cursorword").setup()
-- require("mini.cursorword").setup()
-- Highlight patterns in text
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-hipatterns.md
@@ -86,7 +86,12 @@ return {
-- Visualize and work with indent scope
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-indentscope.md
require("mini.indentscope").setup()
require("mini.indentscope").setup({
draw = {
delay = 0,
-- animation = require("mini.indentscope").gen_animation("none"),
},
})
-- Jump to next/previous single character
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-jump.md
@@ -120,6 +125,10 @@ return {
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-statusline.md
require("mini.statusline").setup()
-- Fast and feature-rich surround actions
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-surround.md
require("mini.surround").setup()
-- Minimal and fast tabline showing listed buffers
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-tabline.md
require("mini.tabline").setup()

View File

@@ -1,4 +1,6 @@
-- File-tree manager.
-- https://github.com/nvim-neo-tree/neo-tree.nvim
-- luacheck: globals vim
-- Unless you are still migrating, remove the deprecated commands from v1.x
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
@@ -7,7 +9,7 @@ return {
"nvim-neo-tree/neo-tree.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"kyazdani42/nvim-web-devicons", -- not strictly required, but recommended
"kyazdani42/nvim-web-devicons",
"MunifTanjim/nui.nvim",
{
-- only needed if you want to use the commands with "_with_window_picker" suffix
@@ -39,13 +41,17 @@ return {
vim.fn.sign_define("DiagnosticSignHint", { text = "󰌵", texthl = "DiagnosticSignHint" })
require("neo-tree").setup({
close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab
popup_border_style = "rounded", -- "double", "none", "rounded", "shadow", "single" or "solid"
-- Close Neo-tree if it is the last window left in the tab
close_if_last_window = true,
-- "double", "none", "rounded", "shadow", "single" or "solid"
popup_border_style = "rounded",
enable_git_status = true,
enable_diagnostics = true,
enable_normal_mode_for_inputs = false, -- Enable normal mode for input dialogs.
-- Enable normal mode for input dialogs.
enable_normal_mode_for_inputs = false,
open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes
-- when opening files, do not use windows containing these filetypes or buftypes
open_files_do_not_replace_types = { "terminal", "trouble", "qf" },
-- popup_border_style is for input and confirmation dialogs.
-- Configurtaion of floating window is done in the individual source sections.
@@ -53,14 +59,20 @@ return {
close_floats_on_escape_key = true,
default_source = "filesystem",
git_status_async = true,
log_level = "info", -- "trace", "debug", "info", "warn", "error", "fatal"
log_to_file = false, -- true, false, "/path/to/file.log", use :NeoTreeLogs to show the file
open_files_in_last_window = true, -- false = open files in top left window
resize_timer_interval = 100, -- in ms, needed for containers to redraw right aligned and faded content
sort_case_insensitive = true, -- used when sorting files and directories in the tree
use_popups_for_input = false, -- If false, inputs will use vim.ui.input() instead of custom floats.
sort_function = nil, -- use a custom function for sorting files and directories in the tree
-- "trace", "debug", "info", "warn", "error", "fatal"
log_level = "info",
-- true, false, "/path/to/file.log", use :NeoTreeLogs to show the file
log_to_file = false,
-- false = open files in top left window
open_files_in_last_window = true,
-- in ms, needed for containers to redraw right aligned and faded content
resize_timer_interval = 100,
-- used when sorting files and directories in the tree
sort_case_insensitive = true,
-- If false, inputs will use vim.ui.input() instead of custom floats.
use_popups_for_input = false,
-- use a custom function for sorting files and directories in the tree
sort_function = nil,
event_handlers = {
-- {
-- event = "before_render",
@@ -114,21 +126,22 @@ return {
end,
},
},
default_component_configs = {
container = {
enable_character_fade = true,
},
indent = {
indent_size = 2,
padding = 1, -- extra padding on left hand side
-- extra padding on left hand side
padding = 1,
-- indent guides
with_markers = true,
indent_marker = "",
last_indent_marker = "",
highlight = "NeoTreeIndentMarker",
-- expander config, needed for nesting files
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
-- if nil and file nesting is enabled, will enable expanders
with_expanders = true,
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
@@ -137,7 +150,8 @@ return {
folder_closed = "",
folder_open = "",
folder_empty = "-",
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
-- The next two settings are only a fallback,
-- if you use nvim-web-devicons and configure default icons there
-- then these will never be used.
default = "*",
highlight = "NeoTreeFileIcon",
@@ -154,10 +168,10 @@ return {
git_status = {
symbols = {
-- Change type
added = "˖", -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = "±", -- or "", but this is redundant info if you use git_status_colors on the name
deleted = "", -- this can only be used in the git_status source
renamed = "", -- this can only be used in the git_status source
added = "˖",
modified = "±",
deleted = "",
renamed = "",
-- Status type
untracked = "?",
ignored = "",
@@ -167,70 +181,24 @@ return {
},
},
},
renderers = {
directory = {
{ "indent" },
{ "icon" },
{ "current_filter" },
{
"container",
width = "100%",
right_padding = 0,
--max_width = 60,
content = {
{ "name", zindex = 10 },
-- {
-- "symlink_target",
-- zindex = 10,
-- highlight = "NeoTreeSymbolicLinkTarget",
-- },
{ "clipboard", zindex = 10 },
{ "diagnostics", errors_only = true, zindex = 20, align = "right" },
},
},
},
file = {
{ "indent" },
{ "icon" },
{
"container",
width = "100%",
right_padding = 0,
--max_width = 60,
content = {
{
"name",
use_git_status_colors = false,
zindex = 10,
},
-- {
-- "symlink_target",
-- zindex = 10,
-- highlight = "NeoTreeSymbolicLinkTarget",
-- },
{ "clipboard", zindex = 10 },
{ "bufnr", zindex = 10 },
-- { "harpoon_index" }, --> This is what actually adds the component in where you want it
{ "modified", zindex = 20, align = "right" },
{ "diagnostics", zindex = 20, align = "right" },
{ "git_status", zindex = 20, align = "right" },
},
},
},
},
-- A list of functions, each representing a global custom command
-- that will be available in all sources (if not overridden in `opts[source_name].commands`)
-- see `:h neo-tree-custom-commands-global`
commands = {},
window = { -- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for
window = {
-- see https://github.com/MunifTanjim/nui.nvim/tree/main/lua/nui/popup for
-- possible options. These can also be functions that return these options.
position = "left", -- left, right, float, current
width = 40, -- applies to left and right positions
-- left, right, float, current
position = "left",
-- applies to left and right positions
width = 40,
mapping_options = {
noremap = true,
nowait = true,
},
popup = { -- settings that apply to float position only
-- settings that apply to float position only
popup = {
size = {
height = "80%",
width = "50%",
@@ -244,48 +212,59 @@ return {
mappings = {
["<space>"] = {
"toggle_node",
nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use
-- disable `nowait` if you have existing combos
-- starting with this char that you want to use
nowait = false,
},
["<2-LeftMouse>"] = "open",
["<cr>"] = "open",
["<esc>"] = "cancel", -- close preview or floating neo-tree window
-- close preview or floating neo-tree window
["<esc>"] = "cancel",
["P"] = { "toggle_preview", config = { use_float = true } },
["l"] = "focus_preview",
["S"] = "open_split",
["s"] = "open_vsplit",
-- ["S"] = "split_with_window_picker",
-- ["s"] = "vsplit_with_window_picker",
-- ["S"] = "open_split",
-- ["s"] = "open_vsplit",
["S"] = "split_with_window_picker",
["s"] = "vsplit_with_window_picker",
["t"] = "open_tabnew",
-- ["<cr>"] = "open_drop",
-- ["t"] = "open_tab_drop",
["w"] = "open_with_window_picker",
--["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing
-- -- enter preview mode, which shows the current node without focusing
--["P"] = "toggle_preview",
["C"] = "close_node",
-- ['C'] = 'close_all_subnodes',
["z"] = "close_all_nodes",
--["Z"] = "expand_all_nodes",
["a"] = {
"add",
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc).
-- see `:h neo-tree-file-actions` for details
-- some commands may take optional config options,
-- see `:h neo-tree-mappings` for details
config = {
show_path = "none", -- "none", "relative", "absolute"
-- "none", "relative", "absolute"
show_path = "relative",
},
},
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
-- also accepts the optional config.show_path option like "add".
-- this also supports BASH style brace expansion.
["A"] = "add_directory",
["d"] = "delete",
["r"] = "rename",
["y"] = "copy_to_clipboard",
["x"] = "cut_to_clipboard",
["p"] = "paste_from_clipboard",
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
-- takes text input for destination, also accepts the optional config.show_path option like "add":
-- ["c"] = {
-- "copy",
-- config = {
-- show_path = "none" -- "none", "relative", "absolute"
-- }
--}
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add".
["c"] = "copy",
-- takes text input for destination, also accepts the optional config.show_path option like "add".
["m"] = "move",
["q"] = "close_window",
["R"] = "refresh",
["?"] = "show_help",
@@ -295,9 +274,10 @@ return {
},
nesting_rules = {},
filesystem = {
commands = {}, -- Add a custom command or override a global one using the same function name
-- Add a custom command or override a global one using the same function name
commands = {},
components = {
harpoon_index = function(config, node, state)
harpoon_index = function(config, node, _)
local Marked = require("harpoon.mark")
local path = node:get_id()
local succuss, index = pcall(Marked.get_index_of, path)
@@ -311,11 +291,59 @@ return {
end
end,
},
renderers = {
directory = {
{ "indent" },
{ "icon" },
{ "current_filter" },
{
"container",
width = "100%",
right_padding = 0,
--max_width = 60,
content = {
{ "name", zindex = 10 },
{ "clipboard", zindex = 10 },
{ "diagnostics", errors_only = true, zindex = 20, align = "right" },
},
},
},
file = {
{ "indent" },
{ "icon" },
{
"container",
width = "100%",
right_padding = 0,
--max_width = 60,
content = {
{
"name",
use_git_status_colors = false,
zindex = 10,
},
-- {
-- "symlink_target",
-- zindex = 10,
-- highlight = "NeoTreeSymbolicLinkTarget",
-- },
{ "clipboard", zindex = 10 },
{ "bufnr", zindex = 10 },
{ "harpoon_index", zindex = 20, align = "right" },
{ "modified", zindex = 20, align = "right" },
{ "diagnostics", zindex = 20, align = "right" },
{ "git_status", zindex = 20, align = "right" },
},
},
},
},
filtered_items = {
visible = false, -- when true, they will just be displayed differently than normal items
-- when true, they will just be displayed differently than normal items
visible = false,
hide_dotfiles = false,
hide_gitignored = false,
hide_hidden = true, -- only works on Windows for hidden files/directories
-- only works on Windows for hidden files/directories
hide_hidden = true,
hide_by_name = {
".git",
".DS_Store",
@@ -324,7 +352,8 @@ return {
".mypy_cache",
"node_modules",
},
hide_by_pattern = { -- uses glob style patterns
-- uses glob style patterns
hide_by_pattern = {
--"*.meta",
--"*/src/*/tsconfig.json",
"*-cache",
@@ -341,26 +370,34 @@ return {
},
},
find_by_full_path_words = true,
group_empty_dirs = false, -- when true, empty folders will be grouped together
bind_to_cwd = false, -- true creates a 2-way binding between vim's cwd and neo-tree's root
search_limit = 50, -- max number of search results when using filters
-- when true, empty folders will be grouped together
group_empty_dirs = false,
-- true creates a 2-way binding between vim's cwd and neo-tree's root
bind_to_cwd = false,
-- max number of search results when using filters
search_limit = 50,
follow_current_file = {
enabled = false, -- This will find and focus the file in the active buffer every time
-- -- the current file is changed while the tree is open.
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
-- This will find and focus the file in the active buffer every time
-- the current file is changed while the tree is open.
enabled = false,
-- `false` closes auto expanded dirs, such as with `:Neotree reveal`
leave_dirs_open = false,
},
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
-- netrw disabled, opening a directory opens neo-tree
-- in whatever position is specified in window.position
-- "open_current", -- netrw disabled, opening a directory opens within the
-- window like netrw would, regardless of window.position
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes
hijack_netrw_behavior = "open_default",
-- This will use the OS level file watchers to detect changes
-- instead of relying on nvim autocmd events.
use_libuv_file_watcher = true,
window = {
mappings = {
["."] = "set_root",
["/"] = "fuzzy_finder",
["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm
-- fuzzy sorting using the fzy algorithm
["#"] = "fuzzy_sorter",
["<bs>"] = "navigate_up",
["<c-up>"] = "navigate_up",
["<c-x>"] = "clear_filter",
@@ -370,7 +407,8 @@ return {
["gp"] = "prev_git_modified",
["H"] = "toggle_hidden",
},
fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode
-- define keymaps for filter popup window in fuzzy_finder_mode
fuzzy_finder_mappings = {
["<down>"] = "move_cursor_down",
["<C-n>"] = "move_cursor_down",
["<up>"] = "move_cursor_up",
@@ -380,11 +418,14 @@ return {
},
buffers = {
follow_current_file = {
enabled = true, -- This will find and focus the file in the active buffer every time
-- -- the current file is changed while the tree is open.
leave_dirs_open = true, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
-- This will find and focus the file in the active buffer every time
-- the current file is changed while the tree is open.
enabled = true,
-- `false` closes auto expanded dirs, such as with `:Neotree reveal`
leave_dirs_open = true,
},
group_empty_dirs = true, -- when true, empty folders will be grouped together
-- when true, empty folders will be grouped together
group_empty_dirs = true,
show_unloaded = true,
window = {
mappings = {

View File

@@ -1,6 +1,9 @@
local prefix = "<leader>a"
-- A better annotation generator. Supports multiple languages and annotation conventions.
-- https://github.com/danymat/neogen
return {
"danymat/neogen",
dependencies = "nvim-treesitter/nvim-treesitter",
version = "*",
cmd = "Neogen",
opts = {
snippet_engine = "luasnip",
@@ -11,10 +14,10 @@ return {
},
},
keys = {
{ prefix .. "<cr>", function() require("neogen").generate({ type = "current" }) end, desc = "Current" },
{ prefix .. "c", function() require("neogen").generate({ type = "class" }) end, desc = "Class" },
{ prefix .. "f", function() require("neogen").generate({ type = "func" }) end, desc = "Function" },
{ prefix .. "t", function() require("neogen").generate({ type = "type" }) end, desc = "Type" },
{ prefix .. "F", function() require("neogen").generate({ type = "file" }) end, desc = "File" },
{ "<leader>baa", function() require("neogen").generate({ type = "current" }) end, desc = "Current" },
{ "<leader>bac", function() require("neogen").generate({ type = "class" }) end, desc = "Class" },
{ "<leader>baf", function() require("neogen").generate({ type = "func" }) end, desc = "Function" },
{ "<leader>bat", function() require("neogen").generate({ type = "type" }) end, desc = "Type" },
{ "<leader>baF", function() require("neogen").generate({ type = "file" }) end, desc = "File" },
},
}

View File

@@ -1,257 +0,0 @@
-- Completion menu.
-- Icons to display.
local icons = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = " T ",
Book = "",
}
-- Load loaders from VSCode.
--require("luasnip.loaders.from_vscode").lazy_load({
-- paths = { "~/.local/share/lazy/friendly-snippets" }
--})
return {
"hrsh7th/nvim-cmp",
dependencies = {
{ "octaltree/cmp-look" },
--
{ "hrsh7th/cmp-nvim-lsp" },
--
{ "hrsh7th/cmp-nvim-lua" },
-- Buffer words.
{ "hrsh7th/cmp-buffer" },
-- Path autocompletion.
{ "hrsh7th/cmp-path" },
--
{ "hrsh7th/cmp-cmdline" },
--
{ "saadparwaiz1/cmp_luasnip" },
--
{ "hrsh7th/vim-vsnip" },
--
{ "rafamadriz/friendly-snippets" },
-- Snippets for lua.
{ "L3MON4D3/LuaSnip" }, --config = "luasnip" },
--
{ "hrsh7th/cmp-vsnip" },
--
-- Signature for functions.
--{ 'hrsh7th/cmp-nvim-lsp-signature-help' },
--
{ "hrsh7th/vim-vsnip-integ" },
-- Make arimathetic operations.
{ "hrsh7th/cmp-calc" },
-- Emoji.
{ "hrsh7th/cmp-emoji" },
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
luasnip.config.setup({})
-- Load specialities from LuaSnip.
-- Set it with VSCode-like mode.
luasnip.config.set_config({
history = true,
updateevents = "TextChanged,TextChangedI",
})
cmp.setup({
-- Window documentation, for defining its dimensions.
window = {
-- Max 10 items on display for documentation.
max_height = 10,
completion = {
side_padding = 0,
col_offset = 1,
},
},
-- Snippet support.
snippet = {
expand = function(args) require("luasnip").lsp_expand(args.body) end,
},
-- How the match works based on the input.
matching = {
-- Whethever we allow fuzzy matching or not.
disallow_fuzzy_matching = false,
},
-- Mapping each keybind.
mapping = {
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end,
["<S-Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end,
},
-- Formatting the menu display.
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(_, vim_item)
vim_item.menu = vim_item.kind
-- load lspkind icons
--vim_item.kind = string.format(
-- "%s %s",
-- icons[vim_item.kind],
-- vim_item.kind
--)
vim_item.kind = icons[vim_item.kind]
--vim_item.menu = string.format(
-- "%s %s",
-- ({
-- nvim_lsp = "力",
-- nvim_lua = "",
-- luasnip = icons.Color,
-- path = "﫶",
-- buffer = "﬘ ",
-- look = icons.Book,
-- emoji = "😎",
-- })[entry.source.name],
-- name
--)
return vim_item
end,
},
-- Experimental features.
experimental = {
-- It will type a shadow text of the intended completion.
ghost_text = { hl_group = "Comment" },
},
-- Sources for completion, since it is modular; cmp accepts
-- Multiple modules.
sources = {
-- Simple signature, normally outside an object.
--{ name = 'nvim_lsp_signature_help', priority = 15 },
-- More snippets.
-- For all types of languages.
{
name = "friendly-snippets",
priority = 11,
},
-- For the Nvim lua specifics commands.
{
name = "nvim_lua",
priority = 8,
},
-- Support with the current active LSP.
-- Anything that LSP supports and can share with CMP.
{
name = "nvim_lsp",
priority = 11,
--max_item_count = 10,
},
-- Snippets in general to facilitate life.
-- Type a often typed methods, like for in C.
-- { name = "luasnip", priority = 6 },
-- Show path based on the backslashes.
-- Type any path, relatively or globally.
{
name = "path",
priority = 9,
},
-- Words from buffer.
{
name = "buffer",
priority = 4,
},
-- Max item count.
-- Dictionary for words.
-- Type any word that is on the /usr/share/dict/words
--{
-- name = 'look',
-- priority = 1,
-- keyword_length = 3,
-- max_item_count = 4,
-- option = {
-- convert_case = true,
-- loud = true,
-- dict = '/usr/share/dict/words'
-- },
--},
-- Emoji.
-- Activate with ":".
{ name = "emoji", priority = 2, option = { insert = true } },
-- Calculate expressions based on the current line.
-- Activate with something like "4 + 5".
{
name = "calc",
priority = 10,
},
},
})
end,
}
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -1,10 +1,8 @@
--
-- Shows how to use the DAP plugin to debug your code.
--
-- Primarily focused on configuring the debugger for Go, but can
-- be extended to other languages as well. That's why it's called
-- kickstart.nvim and not kitchen-sink.nvim ;)
-- https://github.com/mfussenegger/nvim-dap
-- luacheck: globals vim
return {
"mfussenegger/nvim-dap",
dependencies = {
@@ -30,7 +28,7 @@ return {
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-- handlers = {},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
@@ -38,24 +36,38 @@ return {
-- Update this to ensure that you have the debuggers for the langs you want
"bash",
"delve",
"jq",
"js",
"lua",
"php",
"python",
"stylua",
},
handlers = {
function(config)
-- all sources with no handler get passed here
-- Keep original functionality
require("mason-nvim-dap").default_setup(config)
end,
},
})
-- Basic debugging keymaps, feel free to change to your liking!
vim.keymap.set("n", "<F5>", dap.continue, { desc = "Debug: Start/Continue" })
vim.keymap.set("n", "<F1>", dap.step_into, { desc = "Debug: Step Into" })
vim.keymap.set("n", "<F2>", dap.step_over, { desc = "Debug: Step Over" })
vim.keymap.set("n", "<F3>", dap.step_out, { desc = "Debug: Step Out" })
vim.keymap.set("n", "<leader>Db", dap.toggle_breakpoint, { desc = "Debug: Toggle Breakpoint" })
vim.keymap.set(
"n",
"<leader>DB",
function() dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) end,
{ desc = "Debug: Set Breakpoint" }
)
local wk = require("which-key")
wk.register({
-- Basic debugging keymaps, feel free to change to your liking!
["<F5>"] = { dap.continue, "Debug: Start/Continue" },
["<F1>"] = { dap.step_into, "Debug: Step Into" },
["<F2>"] = { dap.step_over, "Debug: Step Over" },
["<F3>"] = { dap.step_out, "Debug: Step Out" },
["<leader>Db"] = { dap.toggle_breakpoint, "Debug: Toggle Breakpoint" },
["<leader>DB"] = {
function() dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) end,
"Debug: Set Breakpoint",
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
["<F7>"] = { dapui.toggle, "Debug: See last session result." },
}, { prefix = "", mode = "n" })
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
@@ -79,9 +91,6 @@ return {
},
})
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
vim.keymap.set("n", "<F7>", dapui.toggle, { desc = "Debug: See last session result." })
dap.listeners.after.event_initialized["dapui_config"] = dapui.open
dap.listeners.before.event_terminated["dapui_config"] = dapui.close
dap.listeners.before.event_exited["dapui_config"] = dapui.close

View File

@@ -1,24 +1,30 @@
-- Quickstart configs for Nvim LSP
-- https://github.com/neovim/nvim-lspconfig
-- luacheck: globals vim
return {
-- LSP auto-complete.
"neovim/nvim-lspconfig",
dependencies = {
-- Automatically install LSPs to stdpath for neovim
{ "williamboman/mason.nvim", config = true },
"williamboman/mason-lspconfig.nvim",
{ "williamboman/mason.nvim", config = true },
{ "williamboman/mason-lspconfig.nvim" },
-- Useful status updates for LSP
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ "j-hui/fidget.nvim", tag = "legacy", opts = {} },
-- NOTE: using tag legacy, fidget is being re-written completely
{ "j-hui/fidget.nvim", event = "LspAttach", tag = "legacy", opts = {} },
-- Additional lua configuration, makes nvim stuff amazing!
"folke/neodev.nvim",
{ "folke/neodev.nvim" },
},
init = function()
-- disable lsp watcher. Too slow on linux
local ok, wf = pcall(require, "vim.lsp._watchfiles")
if ok then wf._watchfunc = function()
return function() end
end end
if ok then
wf._watchfunc = function()
return function() end
end
end
end,
config = function()
-- Switch for controlling whether you want autoformatting.

View File

@@ -1,9 +0,0 @@
return {
"chrisgrieser/nvim-origami",
event = "BufReadPost", -- later or on keypress would prevent saving folds
opts = {
keepFoldsAcrossSessions = true,
pauseFoldsOnSearch = true,
setupFoldKeymaps = true,
},
}

View File

@@ -1,5 +0,0 @@
return {
"bennypowers/nvim-regexplainer",
opts = {},
ft = { "html", "javascript", "javascriptreact", "typescript", "typescriptreact" },
}

View File

@@ -1,17 +0,0 @@
--[[
Old text Command New text
--------------------------------------------------------------------------------
surround_words ysiw) (surround_words)
make strings ys$" "make strings"
[delete ar*ound me!] ds] delete around me!
"change quot*es" cs'" "change quotes"
<b>or tag* types</b> csth1<CR> <h1>or tag types</h1>
delete(functi*on calls) dsf function calls
]]
return {
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function() require("nvim-surround").setup() end,
}

View File

@@ -1,9 +0,0 @@
return {
"nvim-treesitter/nvim-treesitter-context",
lazy = false,
enabled = true,
opts = {
enable = true,
mode = "cursor", -- cursor, or topline
},
}

View File

@@ -1,110 +1,102 @@
-- Treesitter (more highlight for syntax_on).
-- Nvim Treesitter configurations and abstraction layer
-- https://github.com/nvim-treesitter/nvim-treesitter
-- luacheck: globals vim
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = {
"bash",
"c",
"cmake",
"comment",
"diff",
"dockerfile",
"gitignore",
"go",
"graphql",
"html",
"javascript",
"json",
"json5",
"latex",
"lua",
"markdown",
"php",
"phpdoc",
"python",
"regex",
"scss",
"terraform",
"todotxt",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"vue",
"yaml",
},
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Autoinstall languages that are not installed.
auto_install = true,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
enable = true,
disable = {},
--injections = {
-- python = {
-- docstrings: "markdown",
-- },
--}
},
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<c-space>",
node_incremental = "<c-space>",
scope_incremental = "<c-s>",
node_decremental = "<M-space>",
},
},
textobjects = {
select = {
-- List of parsers to ignore installing (or "all")
ignore_install = {},
modules = {},
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = "all",
highlight = {
enable = true,
disable = {},
--injections = {
-- python = {
-- docstrings: "markdown",
-- },
--}
},
indent = { enable = true },
incremental_selection = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
init_selection = "<c-space>",
node_incremental = "<c-space>",
scope_incremental = "<c-s>",
node_decremental = "<M-space>",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
move = {
enable = true,
-- whether to set jumps in the jumplist
set_jumps = true,
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
},
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
},
})
end,
})
end,
},
{
"nvim-treesitter/nvim-treesitter-context",
lazy = false,
enabled = true,
opts = {
enable = true,
mode = "cursor", -- cursor, or topline
},
},
}

View File

@@ -1,55 +0,0 @@
-- Fold code.
return {
"anuvyklack/pretty-fold.nvim",
config = {
fill_char = "",
sections = {
left = {
"content",
},
right = {
" ",
"number_of_folded_lines",
": ",
"percentage",
" ",
function(config) return config.fill_char:rep(3) end,
},
},
remove_fold_markers = false,
-- Keep the indentation of the content of the fold string.
keep_indentation = true,
-- Possible values:
-- "delete" : Delete all comment signs from the fold string.
-- "spaces" : Replace all comment signs with equal number of spaces.
-- false : Do nothing with comment signs.
process_comment_signs = "spaces",
-- Comment signs additional to the value of `&commentstring` option.
comment_signs = {
{ "/**", "*/" }, -- multiline comment
{ "<!--", "-->" }, -- multiline comment
{ "%--[[", "--]]" }, -- multiline comment
},
-- List of patterns that will be removed from content foldtext section.
stop_words = {
"@brief%s*", -- (for C++) Remove '@brief' and all spaces after.
},
add_close_pattern = true,
matchup_patterns = {
{ "{", "}" },
{ "%(", ")" }, -- % to escape lua pattern char
{ "%[", "]" }, -- % to escape lua pattern char
{ "if%s", "end" },
{ "do%s", "end" },
{ "for%s", "end" },
{ "function%s*%(", "end" }, -- 'function(' or 'function ('
},
},
}

View File

@@ -1,14 +0,0 @@
return {
{
"jay-babu/project.nvim",
name = "project_nvim",
event = "VeryLazy",
opts = { ignore_lsp = { "lua_ls" } },
},
{
"nvim-telescope/telescope.nvim",
optional = true,
dependencies = { "project_nvim" },
opts = function() require("telescope").load_extension("projects") end,
},
}

View File

@@ -1,6 +1,9 @@
return {
"ThePrimeagen/refactoring.nvim",
dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter" },
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
},
cmd = { "Refactor" },
opts = {},
keys = {

View File

@@ -1,7 +0,0 @@
return {
"m4xshen/smartcolumn.nvim",
opts = {
colorcolumn = { "80", "100", "120" },
disabled_filetypes = { "help", "text", "markdown", "json", "lazy", "starter", "neo-tree" },
},
}

View File

@@ -1 +0,0 @@
return { "stevearc/stickybuf.nvim", opts = {} }

View File

@@ -1,8 +0,0 @@
return {
"codota/tabnine-nvim",
name = "tabnine",
build = vim.loop.os_uname().sysname == "Windows_NT" and "pwsh.exe -file .\\dl_binaries.ps1" or "./dl_binaries.sh",
cmd = { "TabnineStatus", "TabnineDisable", "TabnineEnable", "TabnineToggle" },
event = "User",
opts = { accept_keymap = "<C-e>" },
}

View File

@@ -1,9 +1,11 @@
-- Telescope, a see-all-through file manager.
-- vim: ts=2 sw=2 si et
-- luacheck: globals vim
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/popup.nvim",
"nvim-lua/plenary.nvim",
{ "nvim-lua/plenary.nvim" },
{ "nvim-lua/popup.nvim" },
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
@@ -14,7 +16,7 @@ return {
build = "make",
cond = function() return vim.fn.executable("make") == 1 end,
},
"nvim-telescope/telescope-file-browser.nvim",
{ "nvim-telescope/telescope-file-browser.nvim" },
},
config = function()
local actions = require("telescope.actions")
@@ -77,56 +79,77 @@ return {
-- Developer configurations: Not meant for general override
buffer_previewer_maker = previewers.buffer_previewer_maker,
},
pickers = {
buffers = {
mappings = {
i = {
["<c-d>"] = actions.delete_buffer + actions.move_to_top,
},
},
},
},
extensions_list = { "themes", "terms" },
})
pcall(require("telescope").load_extension, "fzf")
pcall(require("telescope").load_extension, "file_browser")
pcall(require("telescope").load_extension, "harpoon")
-- See `:help telescope.builtin`
vim.keymap.set("n", "<leader>?", require("telescope.builtin").oldfiles, { desc = "[?] Find recently opened files" })
vim.keymap.set("n", "<leader><space>", require("telescope.builtin").buffers, { desc = "[ ] Find existing buffers" })
vim.keymap.set("n", "<leader>/", function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
winblend = 10,
previewer = false,
}))
end, { desc = "[/] Fuzzily search in current buffer" })
local tbi = require("telescope.builtin")
local wk = require("which-key")
wk.register({
["?"] = {
function() tbi.oldfiles() end,
"[?] Find recently opened files",
},
["<space>"] = {
function() tbi.buffers() end,
"[ ] Find existing buffers",
},
["/"] = {
function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
tbi.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
winblend = 10,
previewer = false,
}))
end,
"[/] Fuzzily search in current buffer",
},
vim.keymap.set(
"n",
"<leader>tg",
require("telescope.builtin").git_files,
{ desc = "[T]elescope: Search [G]it files" }
)
vim.keymap.set("n", "<leader>tf", require("telescope.builtin").find_files, { desc = "[T]elescope: Search [F]iles" })
vim.keymap.set("n", "<leader>th", require("telescope.builtin").help_tags, { desc = "[T]elescope: Search [H]elp" })
vim.keymap.set(
"n",
"<leader>tw",
require("telescope.builtin").grep_string,
{ desc = "[T]elescope: Search current [W]ord" }
)
vim.keymap.set(
"n",
"<leader>tr",
require("telescope.builtin").live_grep,
{ desc = "[T]elescope: Search by G[r]ep" }
)
vim.keymap.set(
"n",
"<leader>td",
require("telescope.builtin").diagnostics,
{ desc = "[T]elescope: Search [D]iagnostics" }
)
t = {
b = {
"<cmd>Telescope file_browser<CR>",
"[T]elescope: File [B]rowser",
},
d = {
function() tbi.diagnostics() end,
"[T]elescope: Search [D]iagnostics",
},
vim.keymap.set(
"n",
"<leader>tb",
":Telescope file_browser<CR>",
{ desc = "[T]elescope: File [B]rowser", noremap = true }
)
f = {
function() tbi.find_files() end,
"[T]elescope: Search [F]iles",
},
g = {
function() tbi.git_files() end,
"[T]elescope: Search [G]it files",
},
h = {
function() tbi.help_tags() end,
"[T]elescope: Search [H]elp",
},
r = {
function() tbi.live_grep() end,
"[T]elescope: Search by G[r]ep",
},
w = {
function() tbi.grep_string() end,
"[T]elescope: Search current [W]ord",
},
},
}, { prefix = "<leader>" })
end,
}

View File

@@ -1,48 +1,83 @@
-- Trouble for diagnostics of plugins
-- A pretty diagnostics, references, telescope results,
-- quickfix and location list to help you solve all
-- the trouble your code is causing.
-- https://github.com/folke/trouble.nvim
return {
"folke/trouble.nvim",
dependencies = "kyazdani42/nvim-web-devicons",
config = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
position = "bottom", -- position of the list can be: bottom, top, left, right
height = 10, -- height of the trouble list when position is top or bottom
width = 50, -- width of the list when position is left or right
icons = true, -- use devicons for filenames
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
action_keys = { -- key mappings for actions in the trouble list
-- position of the list can be: bottom, top, left, right
position = "bottom",
-- height of the trouble list when position is top or bottom
height = 6,
-- width of the list when position is left or right
width = 50,
-- use devicons for filenames
icons = true,
-- "workspace_diagnostics", "document_diagnostics",
-- "quickfix", "lsp_references", "loclist"
mode = "workspace_diagnostics",
-- icon used for open folds
fold_open = "",
-- icon used for closed folds
fold_closed = "",
-- group results by file
group = true,
-- add an extra new line on top of the list
padding = true,
-- key mappings for actions in the trouble list
action_keys = {
-- map to {} to remove a mapping, for example:
-- close = {},
close = "q", -- close the list
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
open_split = { "<c-x>" }, -- open buffer in new split
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
open_tab = { "<c-t>" }, -- open buffer in new tab
jump_close = { "o" }, -- jump to the diagnostic and close the list
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
toggle_preview = "P", -- toggle auto_preview
hover = "K", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
close_folds = { "zM", "zm" }, -- close all folds
open_folds = { "zR", "zr" }, -- open all folds
toggle_fold = { "zA", "za" }, -- toggle fold of current file
previous = "k", -- preview item
next = "j", -- next item
-- close the list
close = "q",
-- cancel the preview and get back to your last window / buffer / cursor
cancel = "<esc>",
-- manually refresh
refresh = "r",
-- jump to the diagnostic or open / close folds
jump = { "<cr>", "<tab>" },
-- open buffer in new split
open_split = { "<c-x>" },
-- open buffer in new vsplit
open_vsplit = { "<c-v>" },
-- open buffer in new tab
open_tab = { "<c-t>" },
-- jump to the diagnostic and close the list
jump_close = { "o" },
-- toggle between "workspace" and "document" diagnostics mode
toggle_mode = "m",
-- toggle auto_preview
toggle_preview = "P",
-- opens a small popup with the full multiline message
hover = "K",
-- preview the diagnostic location
preview = "p",
-- close all folds
close_folds = { "zM", "zm" },
-- open all folds
open_folds = { "zR", "zr" },
-- toggle fold of current file
toggle_fold = { "zA", "za" },
-- preview item
previous = "k",
-- next item
next = "j",
},
indent_lines = true, -- add an indent guide below the fold icons
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = false, -- automatically close the list when you have no diagnostics
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
auto_fold = false, -- automatically fold a file trouble list at creation
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
-- add an indent guide below the fold icons
indent_lines = true,
-- automatically open the list when you have diagnostics
auto_open = false,
-- automatically close the list when you have no diagnostics
auto_close = true,
-- automatically preview the location of the diagnostic.
-- <esc> to close preview and go back to last window
auto_preview = true,
-- automatically fold a file trouble list at creation
auto_fold = false,
-- for the given modes, automatically jump if there is only a single result
auto_jump = { "lsp_definitions" },
signs = {
-- icons / text used for a diagnostic
error = "",
@@ -51,6 +86,7 @@ return {
information = "",
other = "",
},
use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
-- enabling this will use the signs defined in your lsp client
use_diagnostic_signs = false,
},
}

View File

@@ -1,16 +1,25 @@
-- Dim
-- Twilight dims inactive portions of the
-- code you're editing using TreeSitter
-- https://github.com/folke/twilight.nvim
return {
"folke/twilight.nvim",
config = {
dimming = {
alpha = 0.5, -- amount of dimming
inactive = false, -- when true, other windows will be fully dimmed (unless they contain the same buffer)
-- amount of dimming
alpha = 0.2,
-- when true, other windows will be fully dimmed (unless they contain the same buffer)
inactive = false,
},
context = 3, -- amount of lines we will try to show around the current line
treesitter = true, -- use treesitter when available for the filetype
-- amount of lines we will try to show around the current line
context = 3,
-- use treesitter when available for the filetype
-- treesitter is used to automatically expand the visible text,
-- but you can further control the types of nodes that should always be fully expanded
expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types
treesitter = true,
-- for treesitter, we we always try to expand to the top-most ancestor with these types
expand = {
"function",
"while_statement",
"for_statement",

View File

@@ -1,54 +0,0 @@
-- Colorizer for strings.
-- Minimise code.
local set = vim.api.nvim_set_var
return {
"RRethy/vim-hexokinase",
build = "cd ~/.local/share/nvim/lazy/vim-hexokinase && make hexokinase",
init = function()
-- All possible highlighters
set("Hexokinase_highlighters", {
"virtual",
"sign_column",
"background",
"backgroundfull",
-- 'foreground',
-- 'foregroundfull'
})
-- Patterns to match for all filetypes
-- Can be a comma separated string or a list of strings
-- All possible values
set("Hexokinase_optInPatterns", {
"full_hex",
"triple_hex",
"rgb",
"rgba",
"hsl",
"hsla",
"colour_names",
})
-- Filetype specific patterns to match
-- entry value must be comma seperated list
set("Hexokinase_ftOptInPatterns", {
css = "full_hex,rgb,rgba,hsl,hsla,colour_names",
html = "full_hex,rgb,rgba,hsl,hsla,colour_names",
})
-- Sample value, to keep default behaviour don't define this', variable
set("Hexokinase_ftEnabled", {
"css",
"html",
"javascript",
"scss",
"sass",
"lua",
})
-- Turn the colors on.
--vim.cmd('au BufEnter * HexokinaseTurnOn')
end,
}

View File

@@ -1,23 +0,0 @@
-- Move faster between context.
return {
"andymass/vim-matchup",
dependencies = "nvim-treesitter/nvim-treesitter",
config = {
highlight = {
enable = true,
disable = {},
},
indent = {
enable = false,
disable = {},
},
autotag = {
enable = true,
},
matchup = {
enable = true, -- mandatory, false will disable the whole extension
--disable = { "c", "ruby" }, -- optional, list of language that will be disabled
},
},
}

View File

@@ -1 +0,0 @@
return { "tpope/vim-sleuth" }

View File

@@ -1,5 +0,0 @@
return {
"wakatime/vim-wakatime",
lazy = false,
enabled = true,
}

View File

@@ -1,15 +0,0 @@
local vim = vim
return {
"folke/which-key.nvim",
enabled = true,
lazy = false,
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
},
}

View File

@@ -20,8 +20,9 @@ return {
wilder.set_option('renderer', wilder.popupmenu_renderer({
highlights = {
gradient = gradient, -- must be set
-- must be set
-- selected_gradient key can be set to apply gradient highlighting for the selected candidate.
gradient = gradient,
},
highlighter = wilder.highlighter_with_gradient({
wilder.basic_highlighter(), -- or wilder.lua_fzy_highlighter(),

143
config/starship.toml Normal file
View File

@@ -0,0 +1,143 @@
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
format = """
$os\
$directory\
$git_branch\
$git_state\
$git_status\
$fill\
$battery\
$username\
$hostname\
$aws\
$gcloud\
$conda\
$golang\
$nodejs\
$php\
$python\
$package\
$line_break\
$character"""
# Timeout for commands executed by starship (in milliseconds).
# command_timeout = 1000
[character]
success_symbol = "[→](bold green)"
error_symbol = "[→](red)"
vimcmd_symbol = "[←](green)"
[aws]
symbol = " "
format = '[$symbol($profile )(\($region\) )(\[$duration\] )]($style)'
[cmd_duration]
disabled = true
[directory]
read_only = " 󰌾"
style = "blue"
[docker_context]
symbol = " "
[fill]
symbol = '·'
style = 'bold black'
[gcloud]
format = ' [($symbol)$account(@$domain)(\($region\))]($style) '
[git_branch]
symbol = " "
truncation_length = 20
truncation_symbol = '…'
ignore_branches = ['master', 'main']
[git_status]
up_to_date = '✓'
staged = '[++\($count\)](green)'
[git_state]
format = '\([$state( $progress_current/$progress_total)]($style)\) '
style = "bright-black"
[git_metrics]
added_style = 'bold blue'
format = '[+$added]($added_style)/[-$deleted]($deleted_style) '
disabled = false
[golang]
symbol = " "
[hostname]
ssh_symbol = " "
[nodejs]
symbol = " "
format = '[$symbol($version )]($style)'
version_format = '${major}.${minor}'
[os]
format = "[$symbol]($style) "
style = "bold blue"
disabled = false
[os.symbols]
Alpaquita = " "
Alpine = " "
Amazon = " "
Android = " "
Arch = " "
Artix = " "
CentOS = " "
Debian = " "
DragonFly = " "
Emscripten = " "
EndeavourOS = " "
Fedora = " "
FreeBSD = " "
Garuda = "󰛓 "
Gentoo = " "
HardenedBSD = "󰞌 "
Illumos = "󰈸 "
Linux = " "
Mabox = " "
Macos = " "
Manjaro = " "
Mariner = " "
MidnightBSD = " "
Mint = " "
NetBSD = " "
NixOS = " "
OpenBSD = "󰈺 "
openSUSE = " "
OracleLinux = "󰌷 "
Pop = " "
Raspbian = " "
Redhat = " "
RedHatEnterprise = " "
Redox = "󰀘 "
Solus = "󰠳 "
SUSE = " "
Ubuntu = " "
Unknown = " "
Windows = "󰍲 "
[package]
symbol = "󰏗 "
format = '[$symbol($version )]($style)'
version_format = '${major}.${minor}'
[php]
format = '[$symbol($version )]($style)'
version_format = '${major}.${minor}'
[python]
symbol = " "
format = "[$virtualenv]($style) "
style = "bright-black"

View File

@@ -4,34 +4,9 @@
# - https://tmuxguide.readthedocs.io/en/latest/tmux/tmux.html
# - https://github.com/dreamsofcode-io/tmux/blob/main/tmux.conf
# Set plugins install dir
set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.dotfiles/config/tmux/plugins'
## Install plugins, starting with plugin manager
set -g @tpm_plugins ' \
tmux-plugins/tpm \
b0o/tmux-autoreload \
catppuccin/tmux \
ChanderG/tmux-notify \
christoomey/vim-tmux-navigator \
yardnsm/tmux-1password \
jaclu/tmux-menus \
sainnhe/tmux-fzf \
MunifTanjim/tmux-suspend \
tmux-plugins/tmux-continuum \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-sessionist \
tmux-plugins/tmux-yank \
'
set-option -sa terminal-overrides ",xterm*:Tc"
# Mouse support
set -g mouse on
# Make delay shorter
set -sg escape-time 0
# ╭──────────────────────────────────────────────────────────╮
# │ Bindings │
# ╰──────────────────────────────────────────────────────────╯
# Set <prefix> to Control + Space
unbind C-b
@@ -44,110 +19,32 @@ bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Control-Tab & Control-Shift-Tab to switch windows
bind -n C-Tab previous-window
bind -n C-S-Tab next-window
# Shift Alt vim keys to switch windows
bind -n M-H previous-window
bind -n M-L next-window
# Reload tmux config with <prefix> + r
bind r source-file ~/.dotfiles/config/tmux/tmux.conf \; display "tmux cfg reloaded!"
# Open a new window with <prefix> + N
bind N new-window
# Plugins related configurations
# Set default directory for new windows in this session to current directory:
bind M-c attach-session -c "#{pane_current_path}"
## https://github.com/jaclu/tmux-menus
set -g @menus_trigger 'm'
# Open a new window in the current directory
bind C new-window -c "#{pane_current_path}"
## https://github.com/jaclu/tmux-1password
set -g @1password-key 'x'
## https://github.com/catppuccin/tmux
set -g @catppuccin_flavour 'mocha' # latte/frappe/macchiato/mocha
set -g @catppuccin_window_tabs_enabled on # or off to disable window_tabs
set -g @catppuccin_window_status_enable "yes"
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_status_modules "application session date_time"
set -g @catppuccin_date_time_text "%Y-%m-%d %H:%M"
set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_directory_text "#{pane_current_path}"
## https://github.com/MunifTanjim/tmux-mode-indicator
set -g status-right '%Y-%m-%d %H:%M #{tmux_mode_indicator}'
set -g @mode_indicator_prefix_prompt ' WAIT '
set -g @mode_indicator_copy_prompt ' COPY '
set -g @mode_indicator_sync_prompt ' SYNC '
set -g @mode_indicator_empty_prompt ' TMUX '
set -g @mode_indicator_prefix_mode_style 'bg=blue,fg=black'
set -g @mode_indicator_copy_mode_style 'bg=yellow,fg=black'
set -g @mode_indicator_sync_mode_style 'bg=red,fg=black'
set -g @mode_indicator_empty_mode_style 'bg=cyan,fg=black'
## https://github.com/MunifTanjim/tmux-suspend
set -g @suspend_key 'F12'
set -g @suspend_suspended_options " \
@mode_indicator_custom_prompt:: ---- , \
@mode_indicator_custom_mode_style::bg=brightblack\\,fg=black, \
"
## https://github.com/tmux-plugins/tmux-continuum
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
set -g @continuum-boot-options 'iterm'
## https://github.com/tmux-plugins/tmux-resurrect
set -g @resurrect-strategy-nvim 'session'
## https://github.com/b0o/tmux-autoreload
set-option -g @tmux-autoreload-configs '~/.dotfiles/config/tmux/tmux.conf'
## https://github.com/sainnhe/tmux-fzf
TMUX_FZF_LAUNCH_KEY="l"
## https://github.com/ChanderG/tmux-notify
set -g @tnotify-verbose 'on'
# set vi-mode
set-window-option -g mode-keys vi
# keybindings
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind '"' split-window -v -c "#{pane_current_path}"
bind '!' split-window -h -c "#{pane_current_path}"
@@ -166,5 +63,72 @@ bind Escape copy-mode
unbind p
bind p paste-buffer
# ╭──────────────────────────────────────────────────────────╮
# │ Settings │
# ╰──────────────────────────────────────────────────────────╯
# Mouse support
set -g mouse on
# Make delay shorter
set -sg escape-time 0
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on
# set vi-mode
set-window-option -g mode-keys vi
# ╭──────────────────────────────────────────────────────────╮
# │ Plugins │
# ╰──────────────────────────────────────────────────────────╯
# Set plugins install dir
set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.dotfiles/config/tmux/plugins'
## Install plugins, starting with plugin manager
set -g @tpm_plugins ' \
catppuccin/tmux \
tmux-plugins/tmux-continuum \
jaclu/tmux-menus \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-sessionist \
tmux-plugins/tmux-yank \
tmux-plugins/tpm \
'
# ╭──────────────────────────────────────────────────────────╮
# │ Plugins related configurations │
# ╰──────────────────────────────────────────────────────────╯
## https://github.com/jaclu/tmux-menus
set -g @menus_trigger 'm'
## https://github.com/catppuccin/tmux
set -g @catppuccin_flavour "mocha" # latte/frappe/macchiato/mocha
set -g @catppuccin_window_tabs_enabled on # or off to disable window_tabs
set -g @catppuccin_window_status_enable "yes"
## set -g @catppuccin_window_right_separator "█"
set -g @catppuccin_window_number_position "left"
set -g @catppuccin_window_middle_separator ": "
set -g @catppuccin_window_default_fill "none"
set -g @catppuccin_window_current_fill "all"
set -g @catppuccin_status_modules "application session date_time"
set -g @catppuccin_status_left_separator "█"
set -g @catppuccin_status_right_separator "█"
set -g @catppuccin_date_time_text "%Y-%m-%d %H:%M"
## https://github.com/tmux-plugins/tmux-continuum
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
## https://github.com/tmux-plugins/tmux-resurrect
set -g @resurrect-strategy-nvim 'session'
# Finally run the tmux plugin manager
run '~/.dotfiles/config/tmux/plugins/tpm/tpm'

View File

@@ -1,177 +0,0 @@
#compdef _git-profile git-profile
# zsh completion for git-profile -*- shell-script -*-
__git-profile_debug()
{
local file="$BASH_COMP_DEBUG_FILE"
if [[ -n ${file} ]]; then
echo "$*" >> "${file}"
fi
}
_git-profile()
{
local shellCompDirectiveError=1
local shellCompDirectiveNoSpace=2
local shellCompDirectiveNoFileComp=4
local shellCompDirectiveFilterFileExt=8
local shellCompDirectiveFilterDirs=16
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace
local -a completions
__git-profile_debug "\n========= starting completion logic =========="
__git-profile_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
# The user could have moved the cursor backwards on the command-line.
# We need to trigger completion from the $CURRENT location, so we need
# to truncate the command-line ($words) up to the $CURRENT location.
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
words=("${=words[1,CURRENT]}")
__git-profile_debug "Truncated words[*]: ${words[*]},"
lastParam=${words[-1]}
lastChar=${lastParam[-1]}
__git-profile_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
# For zsh, when completing a flag with an = (e.g., git-profile -n=<TAB>)
# completions must be prefixed with the flag
setopt local_options BASH_REMATCH
if [[ "${lastParam}" =~ '-.*=' ]]; then
# We are dealing with a flag with an =
flagPrefix="-P ${BASH_REMATCH}"
fi
# Prepare the command to obtain completions
requestComp="${words[1]} __complete ${words[2,-1]}"
if [ "${lastChar}" = "" ]; then
# If the last parameter is complete (there is a space following it)
# We add an extra empty parameter so we can indicate this to the go completion code.
__git-profile_debug "Adding extra empty parameter"
requestComp="${requestComp} \"\""
fi
__git-profile_debug "About to call: eval ${requestComp}"
# Use eval to handle any environment variables and such
out=$(eval ${requestComp} 2>/dev/null)
__git-profile_debug "completion output: ${out}"
# Extract the directive integer following a : from the last line
local lastLine
while IFS='\n' read -r line; do
lastLine=${line}
done < <(printf "%s\n" "${out[@]}")
__git-profile_debug "last line: ${lastLine}"
if [ "${lastLine[1]}" = : ]; then
directive=${lastLine[2,-1]}
# Remove the directive including the : and the newline
local suffix
(( suffix=${#lastLine}+2))
out=${out[1,-$suffix]}
else
# There is no directive specified. Leave $out as is.
__git-profile_debug "No directive found. Setting do default"
directive=0
fi
__git-profile_debug "directive: ${directive}"
__git-profile_debug "completions: ${out}"
__git-profile_debug "flagPrefix: ${flagPrefix}"
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
__git-profile_debug "Completion received error. Ignoring completions."
return
fi
while IFS='\n' read -r comp; do
if [ -n "$comp" ]; then
# If requested, completions are returned with a description.
# The description is preceded by a TAB character.
# For zsh's _describe, we need to use a : instead of a TAB.
# We first need to escape any : as part of the completion itself.
comp=${comp//:/\\:}
local tab=$(printf '\t')
comp=${comp//$tab/:}
__git-profile_debug "Adding completion: ${comp}"
completions+=${comp}
lastComp=$comp
fi
done < <(printf "%s\n" "${out[@]}")
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
__git-profile_debug "Activating nospace."
noSpace="-S ''"
fi
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
# File extension filtering
local filteringCmd
filteringCmd='_files'
for filter in ${completions[@]}; do
if [ ${filter[1]} != '*' ]; then
# zsh requires a glob pattern to do file filtering
filter="\*.$filter"
fi
filteringCmd+=" -g $filter"
done
filteringCmd+=" ${flagPrefix}"
__git-profile_debug "File filtering command: $filteringCmd"
_arguments '*:filename:'"$filteringCmd"
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
# File completion for directories only
local subdir
subdir="${completions[1]}"
if [ -n "$subdir" ]; then
__git-profile_debug "Listing directories in $subdir"
pushd "${subdir}" >/dev/null 2>&1
else
__git-profile_debug "Listing directories in ."
fi
local result
_arguments '*:dirname:_files -/'" ${flagPrefix}"
result=$?
if [ -n "$subdir" ]; then
popd >/dev/null 2>&1
fi
return $result
else
__git-profile_debug "Calling _describe"
if eval _describe "completions" completions $flagPrefix $noSpace; then
__git-profile_debug "_describe found some completions"
# Return the success of having called _describe
return 0
else
__git-profile_debug "_describe did not find completions."
__git-profile_debug "Checking if we should do file completion."
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
__git-profile_debug "deactivating file completion"
# We must return an error code here to let zsh know that there were no
# completions found by _describe; this is what will trigger other
# matching algorithms to attempt to find completions.
# For example zsh can match letters in the middle of words.
return 1
else
# Perform file completion
__git-profile_debug "Activating file completion"
# We must return the result of this command, so it must be the
# last command, or else we must store its result to return it.
_arguments '*:filename:_files'" ${flagPrefix}"
fi
fi
fi
}
# don't run the completion function when being source-ed or eval-ed
if [ "$funcstack[1]" = "_git-profile" ]; then
_git-profile
fi

File diff suppressed because it is too large Load Diff

View File

@@ -9,13 +9,19 @@ export DOTFILES="$HOME/.dotfiles"
# Run x-load-configs in your terminal to reload the files.
function x-load-configs()
{
# Load the shell dotfiles, and then some:
for file in $DOTFILES/config/{exports,alias,functions}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file"
[ -r "$file-secret" ] && [ -f "$file-secret" ] && source "$file-secret"
[ -r "$file-$HOSTNAME" ] && [ -f "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
[ -r "$file-$HOSTNAME-secret" ] && [ -f "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
done
HOST="$(hostname -s)"
# Load the shell dotfiles, and then some:
for file in $DOTFILES/config/{exports,alias,functions}; do
# global (exports|alias|functions) file for all hosts
# shellcheck source=../../../config/exports
[ -r "$file" ] && source "$file"
# shellcheck source=../../../config/exports
[ -r "$file-secret" ] && source "$file-secret"
# shellcheck source=../../../config/exports
[ -r "$file-$HOST" ] && source "$file-$HOST"
# shellcheck source=../../../config/exports
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret"
done
}
x-load-configs
@@ -24,14 +30,16 @@ export LC_ALL=fi_FI.utf8
export RVM_PATH="$HOME/.rvm"
export PATH="$RVM_PATH/bin:$PATH"
# shellcheck source=$HOME/.rvm/scripts/rvm
[[ -s "$RVM_PATH/scripts/rvm" ]] && source "$RVM_PATH/scripts/rvm" # Load RVM into a shell session *as a function*
# Try to load antigen, if present
ANTIGEN_ZSH_PATH="$XDG_BIN_HOME/antigen.zsh"
# shellcheck source=$HOME/.local/bin/antigen.zsh
[[ -f "$ANTIGEN_ZSH_PATH" ]] && source "$ANTIGEN_ZSH_PATH"
# If antigen was loaded
if command -v antigen &> /dev/null; then
if command -v antigen &>/dev/null; then
antigen use oh-my-zsh
# config/functions
@@ -47,4 +55,5 @@ alias nano='nano -wS -$'
alias gpg=gpg2
ACME_PATH="$HOME/.acme.sh"
# shellcheck source=$HOME/.acme.sh/acme.sh.env
[[ -s "$ACME_PATH/acme.sh.env" ]] && . "$ACME_PATH/acme.sh.env"

View File

@@ -28,9 +28,9 @@
~/.config/:
glob: true
path: config/**
~/.local/bin/:
~/.local/:
glob: true
path: local/bin/**
path: local/**
~/.ssh/:
glob: true
mode: 0600

View File

@@ -16,7 +16,7 @@
SCRIPT=$(basename "$0")
VERSION_NVM="v0.39.3"
VERSION_NVM="v0.39.5"
# shellcheck source=./../../scripts/shared.sh
source "$SHARED_SCRIPT"
@@ -184,8 +184,8 @@ function section_helpers
case "$1" in
path)
# shellcheck disable=2001
for i in $(echo "$PATH" | sed 's/:/ /g'); do echo "$i"; done;
;;
for i in $(echo "$PATH" | sed 's/:/ /g'); do echo "$i"; done
;;
*) menu_usage "$USAGE_PREFIX" "${MENU[@]}" ;;
esac
}
@@ -250,10 +250,12 @@ function section_dotfiles
shfmt)
# Format shell scripts according to following rules.
find "$DOTFILES" \
-type f -perm +111 \
-type f -executable \
-not -path '*/.git/*' \
-not -path '*dotbot*' \
-not -path '*tmux*' \
-not -path '*config/fzf*' \
-not -path '*bin/fzf*' \
-not -path '*tmux/plugins*' \
-not -name '*.pl' \
-not -name '*.py' \
-not -name '*.php' \

BIN
local/bin/fzf Executable file

Binary file not shown.

241
local/bin/fzf-tmux Executable file
View File

@@ -0,0 +1,241 @@
#!/usr/bin/env bash
# fzf-tmux: starts fzf in a tmux pane
# usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]
fail() {
>&2 echo "$1"
exit 2
}
fzf="$(command -v fzf 2> /dev/null)" || fzf="$(dirname "$0")/fzf"
[[ -x "$fzf" ]] || fail 'fzf executable not found'
args=()
opt=""
skip=""
swap=""
close=""
term=""
[[ -n "$LINES" ]] && lines=$LINES || lines=$(tput lines) || lines=$(tmux display-message -p "#{pane_height}")
[[ -n "$COLUMNS" ]] && columns=$COLUMNS || columns=$(tput cols) || columns=$(tmux display-message -p "#{pane_width}")
help() {
>&2 echo 'usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]
LAYOUT OPTIONS:
(default layout: -d 50%)
Popup window (requires tmux 3.2 or above):
-p [WIDTH[%][,HEIGHT[%]]] (default: 50%)
-w WIDTH[%]
-h HEIGHT[%]
-x COL
-y ROW
Split pane:
-u [HEIGHT[%]] Split above (up)
-d [HEIGHT[%]] Split below (down)
-l [WIDTH[%]] Split left
-r [WIDTH[%]] Split right
'
exit
}
while [[ $# -gt 0 ]]; do
arg="$1"
shift
[[ -z "$skip" ]] && case "$arg" in
-)
term=1
;;
--help)
help
;;
--version)
echo "fzf-tmux (with fzf $("$fzf" --version))"
exit
;;
-p*|-w*|-h*|-x*|-y*|-d*|-u*|-r*|-l*)
if [[ "$arg" =~ ^-[pwhxy] ]]; then
[[ "$opt" =~ "-E" ]] || opt="-E"
elif [[ "$arg" =~ ^.[lr] ]]; then
opt="-h"
if [[ "$arg" =~ ^.l ]]; then
opt="$opt -d"
swap="; swap-pane -D ; select-pane -L"
close="; tmux swap-pane -D"
fi
else
opt=""
if [[ "$arg" =~ ^.u ]]; then
opt="$opt -d"
swap="; swap-pane -D ; select-pane -U"
close="; tmux swap-pane -D"
fi
fi
if [[ ${#arg} -gt 2 ]]; then
size="${arg:2}"
else
if [[ "$1" =~ ^[0-9%,]+$ ]] || [[ "$1" =~ ^[A-Z]$ ]]; then
size="$1"
shift
else
continue
fi
fi
if [[ "$arg" =~ ^-p ]]; then
if [[ -n "$size" ]]; then
w=${size%%,*}
h=${size##*,}
opt="$opt -w$w -h$h"
fi
elif [[ "$arg" =~ ^-[whxy] ]]; then
opt="$opt ${arg:0:2}$size"
elif [[ "$size" =~ %$ ]]; then
size=${size:0:((${#size}-1))}
if [[ -n "$swap" ]]; then
opt="$opt -p $(( 100 - size ))"
else
opt="$opt -p $size"
fi
else
if [[ -n "$swap" ]]; then
if [[ "$arg" =~ ^.l ]]; then
max=$columns
else
max=$lines
fi
size=$(( max - size ))
[[ $size -lt 0 ]] && size=0
opt="$opt -l $size"
else
opt="$opt -l $size"
fi
fi
;;
--)
# "--" can be used to separate fzf-tmux options from fzf options to
# avoid conflicts
skip=1
continue
;;
*)
args+=("$arg")
;;
esac
[[ -n "$skip" ]] && args+=("$arg")
done
if [[ -z "$TMUX" ]]; then
"$fzf" "${args[@]}"
exit $?
fi
# --height option is not allowed. CTRL-Z is also disabled.
args=("${args[@]}" "--no-height" "--bind=ctrl-z:ignore")
# Handle zoomed tmux pane without popup options by moving it to a temp window
if [[ ! "$opt" =~ "-E" ]] && tmux list-panes -F '#F' | grep -q Z; then
zoomed_without_popup=1
original_window=$(tmux display-message -p "#{window_id}")
tmp_window=$(tmux new-window -d -P -F "#{window_id}" "bash -c 'while :; do for c in \\| / - '\\;' do sleep 0.2; printf \"\\r\$c fzf-tmux is running\\r\"; done; done'")
tmux swap-pane -t $tmp_window \; select-window -t $tmp_window
fi
set -e
# Clean up named pipes on exit
id=$RANDOM
argsf="${TMPDIR:-/tmp}/fzf-args-$id"
fifo1="${TMPDIR:-/tmp}/fzf-fifo1-$id"
fifo2="${TMPDIR:-/tmp}/fzf-fifo2-$id"
fifo3="${TMPDIR:-/tmp}/fzf-fifo3-$id"
if tmux_win_opts=$(tmux show-options -p remain-on-exit \; show-options -p synchronize-panes 2> /dev/null); then
tmux_win_opts=( $(sed '/ off/d; s/synchronize-panes/set-option -p synchronize-panes/; s/remain-on-exit/set-option -p remain-on-exit/; s/$/ \\;/' <<< "$tmux_win_opts") )
tmux_off_opts='; set-option -p synchronize-panes off ; set-option -p remain-on-exit off'
else
tmux_win_opts=( $(tmux show-window-options remain-on-exit \; show-window-options synchronize-panes | sed '/ off/d; s/^/set-window-option /; s/$/ \\;/') )
tmux_off_opts='; set-window-option synchronize-panes off ; set-window-option remain-on-exit off'
fi
cleanup() {
\rm -f $argsf $fifo1 $fifo2 $fifo3
# Restore tmux window options
if [[ "${#tmux_win_opts[@]}" -gt 0 ]]; then
eval "tmux ${tmux_win_opts[*]}"
fi
# Remove temp window if we were zoomed without popup options
if [[ -n "$zoomed_without_popup" ]]; then
tmux display-message -p "#{window_id}" > /dev/null
tmux swap-pane -t $original_window \; \
select-window -t $original_window \; \
kill-window -t $tmp_window \; \
resize-pane -Z
fi
if [[ $# -gt 0 ]]; then
trap - EXIT
exit 130
fi
}
trap 'cleanup 1' SIGUSR1
trap 'cleanup' EXIT
envs="export TERM=$TERM "
if [[ "$opt" =~ "-E" ]]; then
tmux_version=$(tmux -V | sed 's/[^0-9.]//g')
if [[ $(awk '{print ($1 > 3.2)}' <<< "$tmux_version" 2> /dev/null || bc -l <<< "$tmux_version > 3.2") = 1 ]]; then
FZF_DEFAULT_OPTS="--border $FZF_DEFAULT_OPTS"
opt="-B $opt"
elif [[ $tmux_version = 3.2 ]]; then
FZF_DEFAULT_OPTS="--margin 0,1 $FZF_DEFAULT_OPTS"
else
echo "fzf-tmux: tmux 3.2 or above is required for popup mode" >&2
exit 2
fi
fi
[[ -n "$FZF_DEFAULT_OPTS" ]] && envs="$envs FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS")"
[[ -n "$FZF_DEFAULT_COMMAND" ]] && envs="$envs FZF_DEFAULT_COMMAND=$(printf %q "$FZF_DEFAULT_COMMAND")"
[[ -n "$RUNEWIDTH_EASTASIAN" ]] && envs="$envs RUNEWIDTH_EASTASIAN=$(printf %q "$RUNEWIDTH_EASTASIAN")"
[[ -n "$BAT_THEME" ]] && envs="$envs BAT_THEME=$(printf %q "$BAT_THEME")"
echo "$envs;" > "$argsf"
# Build arguments to fzf
opts=$(printf "%q " "${args[@]}")
pppid=$$
echo -n "trap 'kill -SIGUSR1 -$pppid' EXIT SIGINT SIGTERM;" >> $argsf
close="; trap - EXIT SIGINT SIGTERM $close"
export TMUX=$(cut -d , -f 1,2 <<< "$TMUX")
mkfifo -m o+w $fifo2
if [[ "$opt" =~ "-E" ]]; then
cat $fifo2 &
if [[ -n "$term" ]] || [[ -t 0 ]]; then
cat <<< "\"$fzf\" $opts > $fifo2; out=\$? $close; exit \$out" >> $argsf
else
mkfifo $fifo1
cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; out=\$? $close; exit \$out" >> $argsf
cat <&0 > $fifo1 &
fi
tmux popup -d "$PWD" $opt "bash $argsf" > /dev/null 2>&1
exit $?
fi
mkfifo -m o+w $fifo3
if [[ -n "$term" ]] || [[ -t 0 ]]; then
cat <<< "\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" >> $argsf
else
mkfifo $fifo1
cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" >> $argsf
cat <&0 > $fifo1 &
fi
tmux \
split-window -c "$PWD" $opt "bash -c 'exec -a fzf bash $argsf'" $swap \
$tmux_off_opts \
> /dev/null 2>&1 || { "$fzf" "${args[@]}"; exit $?; }
cat $fifo2
exit "$(cat $fifo3)"

View File

@@ -4,4 +4,3 @@
# and anyone else who expects to see a 'python' executable
exec python3 "$@"

View File

@@ -10,7 +10,7 @@
# Modified by Ismo Vuorinen <https://github.com/ivuorinen> 2023
# Determine width of terminal
hr_col_count="$(tput cols)"
hr_col_count="$( (tput cols - 4) )"
if [ -z "${hr_col_count+set}" ] || [ "$hr_col_count" -lt 1 ]; then
hr_col_count="${COLUMNS:-80}"
fi
@@ -23,10 +23,10 @@ hr_reset="\033[0m"
# Prints the HR line
hr_draw_char() {
local CHAR="$1"
local LINE=''
LINE=$(printf "%*s" "$((hr_col_count - 2))")
local LINE=""
LINE=$(printf "%*s" "$((hr_col_count - 3))" " ")
LINE="${LINE// /${CHAR}}"
echo -e "${hr_color}${LINE:0:${hr_col_count}}${hr_reset}"
echo -e "${hr_color}${LINE:0:${hr_col_count}}${hr_reset}"
}
# Passes param and calls hr()
@@ -36,18 +36,5 @@ hr() {
done
}
# Determine if file is being run directly or sourced
(
[[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] \
|| [[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" \
&& printf '%s' "${PWD%/}/")$(basename -- "$0") != "${.sh.file}" ]] \
|| [[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)
) && sourced=1 || sourced=0
# Either instantiate immediately, or set alias for later
if [ "$sourced" -eq 0 ]; then
[ "$0" == "${BASH_SOURCE[0]}" ] && hr "$@"
else
export alias hr='hr'
fi
hr "$@"

View File

@@ -31,26 +31,28 @@
# 2. Functions to minise code.
#{
# I.
notify () {
# I.
notify()
{
notify-call \
--replace-file "$replace_id" \
"$@"
notify-call \
--replace-file "$replace_id" \
"$@"
}
}
# II.
stop () {
# II.
stop()
{
# A.
#pkill -INT -f 'ffmpeg -f alsa -ac 1 -i pulse -f x11grab -r 30 -s '
giph --stop
# A.
#pkill -INT -f 'ffmpeg -f alsa -ac 1 -i pulse -f x11grab -r 30 -s '
giph --stop
# C.
eww update record_menu=false
# C.
eww update record_menu=false
}
}
#}
# #. Kill previous giph process.
@@ -76,7 +78,7 @@ fi
case "$1" in
# A. Supported.
'mkv' | 'gif' | 'webm' | 'mp4' ) ;;
'mkv' | 'gif' | 'webm' | 'mp4') ;;
# B. Not supported.
*)
@@ -93,7 +95,7 @@ fi
# II. Execute itself.
exec $0 $format $2
;;
;;
esac
@@ -170,7 +172,7 @@ fi
gtk-launch \
"$(xdg-mime query default inode/directory)" \
"$path_recordings/" \
>/dev/null 2>&1 &
> /dev/null 2>&1 &
fi

68
local/man/man1/fzf-tmux.1 Normal file
View File

@@ -0,0 +1,68 @@
.ig
The MIT License (MIT)
Copyright (c) 2013-2023 Junegunn Choi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
..
.TH fzf-tmux 1 "Jun 2023" "fzf 0.42.0" "fzf-tmux - open fzf in tmux split pane"
.SH NAME
fzf-tmux - open fzf in tmux split pane
.SH SYNOPSIS
.B fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]
.SH DESCRIPTION
fzf-tmux is a wrapper script for fzf that opens fzf in a tmux split pane or in
a tmux popup window. It is designed to work just like fzf except that it does
not take up the whole screen. You can safely use fzf-tmux instead of fzf in
your scripts as the extra options will be silently ignored if you're not on
tmux.
.SH LAYOUT OPTIONS
(default layout: \fB-d 50%\fR)
.SS Popup window
(requires tmux 3.2 or above)
.TP
.B "-p [WIDTH[%][,HEIGHT[%]]]"
.TP
.B "-w WIDTH[%]"
.TP
.B "-h WIDTH[%]"
.TP
.B "-x COL"
.TP
.B "-y ROW"
.SS Split pane
.TP
.B "-u [height[%]]"
Split above (up)
.TP
.B "-d [height[%]]"
Split below (down)
.TP
.B "-l [width[%]]"
Split left
.TP
.B "-r [width[%]]"
Split right

1327
local/man/man1/fzf.1 Normal file

File diff suppressed because it is too large Load Diff

0
local/share/fonts/JetBrainsMono-AUTHORS.txt Executable file → Normal file
View File

View File

@@ -7,10 +7,13 @@ source "$HOME/.dotfiles/scripts/shared.sh"
FZF_GIT="https://github.com/junegunn/fzf.git"
FZF_PATH="${XDG_CONFIG_HOME}/fzf"
FZF_BUILD="/tmp/fzf"
if [ ! -d "$FZF_PATH" ]; then
git clone --depth 1 "$FZF_GIT" "$FZF_PATH"
"$FZF_PATH/install" --xdg --all --no-update-rc
if [ ! -d "$FZF_BUILD" ]; then
git clone --depth 1 "$FZF_GIT" "$FZF_BUILD"
"$FZF_BUILD/install" \
--xdg \
--bin
else
msg_done "fzf ($FZF_PATH/) already installed"
fi

Some files were not shown because too many files have changed in this diff Show More