diff --git a/config/helix/config.toml b/config/helix/config.toml new file mode 100644 index 0000000..32b5ff0 --- /dev/null +++ b/config/helix/config.toml @@ -0,0 +1,18 @@ +theme = "gruvbox_dark_hard" + +[editor] +true-color = true + +[editor.indent-guides] +render = true +character = "▏" +skip-levels = 1 + +# command list here: https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs +[keys.normal] +esc = [ "collapse_selection", "keep_primary_selection" ] +X = "extend_line_above" +D = "kill_to_line_end" + +[keys.normal.'space'] +"p" = "goto_last_accessed_file" diff --git a/config/lf/lfrc b/config/lf/lfrc new file mode 100644 index 0000000..c065833 --- /dev/null +++ b/config/lf/lfrc @@ -0,0 +1,102 @@ +# ── Core ───────────────────────────────────────────────────────────────────── +set shell bash +set shellopts '-eu' +set ifs "\n" +set scrolloff 8 +set icons true +set period 1 +set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" +set cursorpreviewfmt "\033[7m" + +# ── UI ─────────────────────────────────────────────────────────────────────── +set drawbox true +set ratios 1:2:3 +set info size:time +set sortby natural +set dirfirst true + +# ── Preview ────────────────────────────────────────────────────────────────── +set previewer ~/.config/lf/preview +set cleaner ~/.config/lf/cleaner + +# ── Keybindings ────────────────────────────────────────────────────────────── + +# unmap defaults we're replacing +map m +map d +map e +map f + +# navigation (vim) +map h updir +map l open +map j down +map k up +map g top +map G bottom +map half-down +map half-up + +# enter key — writes selection path and quits (for tmux-lf-helix script) +map select-and-quit + +# go-to shortcuts +map gh cd ~ +map gc cd ~/.config +map gd cd ~/Downloads +map gb cd ~/bin + +# file operations +map dd cut +map dD delete +map yy copy +map p paste +map r rename +map R bulk-rename + +map . set hidden! +map toggle + +# new file/dir +map mf push %touch +map md push %mkdir-p + +# ── Commands ───────────────────────────────────────────────────────────────── + +cmd select-and-quit &{{ + if [ -n "$fs" ]; then + # if files are toggled/selected use those + echo "$fs" > "$lf_selection_path_file" + else + # otherwise use the hovered file + echo "$f" > "$lf_selection_path_file" + fi + lf -remote "send $id quit" +}} + +cmd bulk-rename ${{ + old=$(mktemp) + new=$(mktemp) + [ -n "$fs" ] && fs=$(ls) + printf '%s\n' "$fs" > "$old" + printf '%s\n' "$fs" > "$new" + $EDITOR "$new" + [ "$(wc -l < "$new")" -ne "$(wc -l < "$old")" ] && exit + paste "$old" "$new" | while IFS= read -r names; do + src=$(printf '%s' "$names" | cut -f1) + dst=$(printf '%s' "$names" | cut -f2) + [ "$src" = "$dst" ] && continue + mv -- "$src" "$dst" + done + rm "$old" "$new" + lf -remote "send $id unselect" +}} + +cmd open ${{ + case $(file --mime-type -b "$f") in + text/*|application/json|application/toml|application/yaml) + $EDITOR "$f" ;; + *) + xdg-open "$f" >/dev/null 2>&1 & ;; + esac +}}