Implement fhackeditor, which opens or connects to an existing neovim instance
This commit is contained in:
parent
80bf43eaba
commit
f4b71c3054
9 changed files with 76 additions and 42 deletions
69
config.toml
69
config.toml
|
@ -1,8 +1,7 @@
|
|||
#:schema ../../dotdrop-config-schema.json
|
||||
|
||||
[actions]
|
||||
dconf-load = "dconf load / < ~/.config/dconf.ini"
|
||||
kanagawa-compile = "vim +KanagawaCompile +qa"
|
||||
dconf_load = "dconf load / < ~/.config/dconf.ini"
|
||||
kanagawa_compile = "vim +KanagawaCompile +qa"
|
||||
scripts_chmod = "chmod +x ~/.scripts/*"
|
||||
|
||||
[config]
|
||||
backup = true
|
||||
|
@ -17,6 +16,11 @@ longkey = false
|
|||
showdiff = false
|
||||
workdir = "~/.config/dotdrop"
|
||||
|
||||
[dotfiles.d_scripts]
|
||||
dst = "~/.scripts"
|
||||
src = ".scripts"
|
||||
actions = ["scripts_chmod"]
|
||||
|
||||
[dotfiles.d_systemd]
|
||||
dst = "~/.config/systemd/user"
|
||||
src = ".config/systemd/user"
|
||||
|
@ -28,7 +32,7 @@ src = ".config/mpv"
|
|||
[dotfiles.d_nvim]
|
||||
dst = "~/.config/nvim"
|
||||
src = ".config/nvim"
|
||||
actions = ["kanagawa-compile"]
|
||||
actions = ["kanagawa_compile"]
|
||||
instignore = ["*-lock.json"]
|
||||
|
||||
[dotfiles."f_abcde.conf"]
|
||||
|
@ -147,7 +151,7 @@ dst = "~/.pam_environment"
|
|||
[dotfiles."f_dconf.ini"]
|
||||
src = ".config/dconf.ini"
|
||||
dst = "~/.config/dconf.ini"
|
||||
actions = ["dconf-load"]
|
||||
actions = ["dconf_load"]
|
||||
|
||||
[dotfiles."f_docker-config.json"]
|
||||
src = ".docker/config.json"
|
||||
|
@ -167,11 +171,22 @@ dst = "~/.config/zellij/config.kdl"
|
|||
src = ".config/tmux/tmux.conf"
|
||||
dst = "~/.config/tmux/tmux.conf"
|
||||
|
||||
[dotfiles.f_neovide_config]
|
||||
src = ".config/neovide/config.toml"
|
||||
dst = "~/.config/neovide/config.toml"
|
||||
|
||||
[dotfiles."f_lazygit_config"]
|
||||
src = ".config/jesseduffield/lazygit/config.yml"
|
||||
dst = "~/.config/jesseduffield/lazygit/config.yml"
|
||||
|
||||
[profiles.pacman]
|
||||
dotfiles = ["f_makepkg.conf", "f_paru.conf"]
|
||||
|
||||
[profiles.terminal]
|
||||
dotfiles = [
|
||||
"d_scripts",
|
||||
"f_lazygit_config",
|
||||
"f_neovide_config",
|
||||
"d_nvim",
|
||||
"d_ssh",
|
||||
"d_zsh",
|
||||
|
@ -216,23 +231,14 @@ dotfiles = [
|
|||
"f_foot.ini",
|
||||
]
|
||||
|
||||
[profiles.Mirkwood.variables]
|
||||
wayland = true
|
||||
|
||||
[profiles.VentoyArch]
|
||||
include = ["pacman", "terminal", "media", "gpg"]
|
||||
dotfiles = ["f_dconf.ini", "f_fonts.conf"]
|
||||
|
||||
[profiles.VentoyArch.variables]
|
||||
wayland = true
|
||||
|
||||
[profiles.Shire]
|
||||
include = ["pacman", "terminal", "media", "gpg"]
|
||||
dotfiles = ["f_dconf.ini", "f_fonts.conf"]
|
||||
|
||||
[profiles.Shire.variables]
|
||||
wayland = true
|
||||
|
||||
[profiles.Moria]
|
||||
include = ["pacman", "terminal", "media", "gpg"]
|
||||
dotfiles = [
|
||||
|
@ -243,9 +249,6 @@ dotfiles = [
|
|||
"d_systemd",
|
||||
]
|
||||
|
||||
[profiles.Moria.variables]
|
||||
wayland = true
|
||||
|
||||
[profiles.Tirion]
|
||||
include = ["terminal", "gpg"]
|
||||
|
||||
|
@ -256,24 +259,12 @@ include = ["pacman", "terminal"]
|
|||
include = ["terminal", "gpg"]
|
||||
dotfiles = ["f_librewolf_overrides", "f_dconf.ini", "d_systemd"]
|
||||
|
||||
[profiles.mko-laptop.variables]
|
||||
wayland = true
|
||||
|
||||
[profiles.Isengard]
|
||||
include = ["terminal"]
|
||||
|
||||
[profiles.Isengard.variables]
|
||||
distro_id = "termux"
|
||||
|
||||
[profiles.Edoras]
|
||||
include = ["terminal"]
|
||||
|
||||
[profiles.TakamakiPC]
|
||||
include = ["terminal"]
|
||||
|
||||
[profiles.TakamakiPC.variables]
|
||||
wayland = false
|
||||
|
||||
[profiles.localhost]
|
||||
include = ["terminal"]
|
||||
|
||||
|
@ -282,3 +273,21 @@ include = ["terminal"]
|
|||
|
||||
[profiles.Evendim]
|
||||
include = ["terminal", "pacman"]
|
||||
|
||||
[profiles.Mirkwood.variables]
|
||||
wayland = true
|
||||
|
||||
[profiles.VentoyArch.variables]
|
||||
wayland = true
|
||||
|
||||
[profiles.Shire.variables]
|
||||
wayland = true
|
||||
|
||||
[profiles.Moria.variables]
|
||||
wayland = true
|
||||
|
||||
[profiles.mko-laptop.variables]
|
||||
wayland = true
|
||||
|
||||
[profiles.Isengard.variables]
|
||||
distro_id = "termux"
|
||||
|
|
2
home/.config/jesseduffield/lazygit/config.yml
Normal file
2
home/.config/jesseduffield/lazygit/config.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
os:
|
||||
editCommand: 'fhackeditor'
|
1
home/.config/neovide/config.toml
Normal file
1
home/.config/neovide/config.toml
Normal file
|
@ -0,0 +1 @@
|
|||
neovim-bin = "{{@@ env['HOME'] @@}}/.scripts/fhackeditor"
|
|
@ -43,8 +43,8 @@ export PATH="$HOME/.local/share/nvim/mason/bin:$PATH"
|
|||
# go path
|
||||
export GOPATH=~/.go
|
||||
|
||||
# Add dotfile scripts dir to path
|
||||
export PATH="$PATH:$DOTREPO/scripts"
|
||||
# Add scripts dir to path
|
||||
export PATH="$PATH:$HOME/.scripts"
|
||||
|
||||
# fzf settings
|
||||
export FD_COMMAND='fd -HLt'
|
||||
|
@ -73,7 +73,7 @@ _fzf_complete_pass() {
|
|||
}
|
||||
|
||||
# nvim ftw!
|
||||
export EDITOR=nvim
|
||||
export EDITOR='nvim'
|
||||
export PAGER="$EDITOR -R +\"lua require 'pager'\""
|
||||
export GIT_PAGER="$EDITOR -c 'set ft=git' -R +\"lua require 'pager'\""
|
||||
export PARU_PAGER="$PAGER -c 'set ft=PKGBUILD'"
|
||||
|
|
|
@ -18,6 +18,10 @@ alias o='xdg-open'
|
|||
# and handling merges
|
||||
alias dv='nvim +DiffviewOpen'
|
||||
|
||||
alias nvim="fhackeditor"
|
||||
alias vim='nvim'
|
||||
alias vi='nvim'
|
||||
|
||||
# Rename grc alias from forgit since it
|
||||
# collides with the grc colorizer
|
||||
forgit_revert_commit=fgrc
|
||||
|
|
27
home/.scripts/fhackeditor
Executable file
27
home/.scripts/fhackeditor
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
# Script to launch a new NeoVim instance or reuse an existing one
|
||||
|
||||
# Exit on error
|
||||
set -e
|
||||
|
||||
# Settings
|
||||
SOCKET="/tmp/nvim.{{@@ env['USER'] @@}}/server.pipe"
|
||||
|
||||
# Convert each argument to absolute path
|
||||
abs_args=""
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
/*) abs="$arg" ;; # already absolute
|
||||
*) abs="$(pwd)/$arg" ;;
|
||||
esac
|
||||
abs_args="$abs_args \"$abs\""
|
||||
done
|
||||
|
||||
if [ -S "$SOCKET" ]; then
|
||||
# Pipe exists and is a socket — reuse it
|
||||
echo "Sending file to existing NeoVim instance"
|
||||
eval exec nvim --server "$SOCKET" --remote $abs_args
|
||||
else
|
||||
# Socket doesn't exist — start new instance
|
||||
exec nvim --listen "$SOCKET" "$@"
|
||||
fi
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Script to launch a graphical editor if in graphical mode,
|
||||
# terminal editor otherwise
|
||||
|
||||
if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
echo "Running in graphical mode"
|
||||
else
|
||||
echo "Running in TTY mode"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue