From 08b30c2616bf9cd4674c3a7b63c01f95bbed9fba Mon Sep 17 00:00:00 2001 From: Fabio Lenherr / DashieTM Date: Sun, 9 Apr 2023 18:17:49 +0200 Subject: [PATCH] feat: Add better yank and delete for absolute lines --- environment.d/envvars.conf | 4 +- hypr_desktop/hyprland.conf | 3 +- joshuto/keymap.toml | 165 +++++++++++++++++++++++++++++++++ joshuto/neovide_backtraces.log | 18 ++++ joshuto/theme.toml | 73 +++++++++++++++ nvim/lua/config/keymaps.lua | 33 +++++-- nvim/lua/config/options.lua | 4 +- 7 files changed, 286 insertions(+), 14 deletions(-) create mode 100644 joshuto/keymap.toml create mode 100644 joshuto/neovide_backtraces.log create mode 100644 joshuto/theme.toml diff --git a/environment.d/envvars.conf b/environment.d/envvars.conf index 1e1c535..c5df174 100644 --- a/environment.d/envvars.conf +++ b/environment.d/envvars.conf @@ -12,6 +12,6 @@ GPG_TTY=$(tty) PATH=$PATH:$HOME/.local/bin TEXMFHOME=$HOME/.texmf PATH=/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:$HOME/.local/bin:$HOME/.cargo/bin:$PATH -EDITOR=nvim -SUDO_EDITOR=nvim +EDITOR=nv +SUDO_EDITOR=nv RADV_PERFTEST=gpl diff --git a/hypr_desktop/hyprland.conf b/hypr_desktop/hyprland.conf index 64aad87..470e5b5 100644 --- a/hypr_desktop/hyprland.conf +++ b/hypr_desktop/hyprland.conf @@ -115,8 +115,9 @@ bind=SUPERSHIFT,S,exec,grim -g "$(slurp)" - | swappy -f - bind=SUPER,F,exec,firefox bind=SUPER,T,exec,kitty -1 bind=SUPER,Q,killactive, -bind=SUPER,M,exit, +bind=SUPERSHIFT,M,exit, bind=SUPER,E,exec,nautilus --new-window +bind=SUPER,N,exec,neovide --novsync bind=SUPER,V,togglefloating, bind=SUPER,B,fullscreen, bind=SUPER,R,exec,anyrun diff --git a/joshuto/keymap.toml b/joshuto/keymap.toml new file mode 100644 index 0000000..abe47cc --- /dev/null +++ b/joshuto/keymap.toml @@ -0,0 +1,165 @@ +[default_view] + +keymap = [ + { keys = [ "escape" ], command = "escape" }, + { keys = [ "ctrl+t" ], command = "new_tab" }, + { keys = [ "alt+t" ], command = "new_tab --cursor" }, + { keys = [ "T" ], command = "new_tab --current" }, + { keys = [ "W" ], command = "close_tab" }, + { keys = [ "ctrl+w" ], command = "close_tab" }, + { keys = [ "q" ], command = "close_tab" }, + { keys = [ "Q" ], command = "quit --output-current-directory" }, + + { keys = [ "R" ], command = "reload_dirlist" }, + { keys = [ "z", "h" ], command = "toggle_hidden" }, + { keys = [ "ctrl+h" ], command = "toggle_hidden" }, + { keys = [ "\t" ], command = "tab_switch 1" }, + { keys = [ "backtab" ], command = "tab_switch -1" }, + + { keys = [ "alt+1" ], command = "tab_switch_index 1" }, + { keys = [ "alt+2" ], command = "tab_switch_index 2" }, + { keys = [ "alt+3" ], command = "tab_switch_index 3" }, + { keys = [ "alt+4" ], command = "tab_switch_index 4" }, + { keys = [ "alt+5" ], command = "tab_switch_index 5" }, + + { keys = [ "1" ], command = "numbered_command 1" }, + { keys = [ "2" ], command = "numbered_command 2" }, + { keys = [ "3" ], command = "numbered_command 3" }, + { keys = [ "4" ], command = "numbered_command 4" }, + { keys = [ "5" ], command = "numbered_command 5" }, + { keys = [ "6" ], command = "numbered_command 6" }, + { keys = [ "7" ], command = "numbered_command 7" }, + { keys = [ "8" ], command = "numbered_command 8" }, + { keys = [ "9" ], command = "numbered_command 9" }, + + # arrow keys + { keys = [ "arrow_up" ], command = "cursor_move_up" }, + { keys = [ "arrow_down" ], command = "cursor_move_down" }, + { keys = [ "arrow_left" ], command = "cd .." }, + { keys = [ "arrow_right" ], command = "open" }, + { keys = [ "\n" ], command = "open" }, + { keys = [ "home" ], command = "cursor_move_home" }, + { keys = [ "end" ], command = "cursor_move_end" }, + { keys = [ "page_up" ], command = "cursor_move_page_up" }, + { keys = [ "page_down" ], command = "cursor_move_page_down" }, + { keys = [ "ctrl+u" ], command = "cursor_move_page_up 0.5" }, + { keys = [ "ctrl+d" ], command = "cursor_move_page_down 0.5" }, + + # vim-like keybindings + { keys = [ "k" ], command = "cursor_move_down" }, + { keys = [ "l" ], command = "cursor_move_up" }, + { keys = [ "j" ], command = "cd .." }, + { keys = [ ";" ], command = "open" }, + { keys = [ "g", "g" ], command = "cursor_move_home" }, + { keys = [ "G" ], command = "cursor_move_end" }, + { keys = [ "r" ], command = "open_with" }, + + { keys = [ "H" ], command = "cursor_move_page_home" }, + { keys = [ "L" ], command = "cursor_move_page_middle" }, + { keys = [ "M" ], command = "cursor_move_page_end" }, + + { keys = [ "[" ], command = "parent_cursor_move_up" }, + { keys = [ "]" ], command = "parent_cursor_move_down" }, + + { keys = [ "c", "d" ], command = ":cd " }, + { keys = [ "d", "d" ], command = "cut_files" }, + { keys = [ "y", "y" ], command = "copy_files" }, + { keys = [ "y", "n" ], command = "copy_filename" }, + { keys = [ "y", "." ], command = "copy_filename_without_extension" }, + { keys = [ "y", "p" ], command = "copy_filepath" }, + { keys = [ "y", "d" ], command = "copy_dirpath" }, + + { keys = [ "p", "l" ], command = "symlink_files --relative=false" }, + { keys = [ "p", "L" ], command = "symlink_files --relative=true" }, + + { keys = [ "delete" ], command = "delete_files" }, + { keys = [ "d", "D" ], command = "delete_files" }, + + { keys = [ "p", "p" ], command = "paste_files" }, + { keys = [ "p", "o" ], command = "paste_files --overwrite=true" }, + + { keys = [ "a" ], command = "rename_append" }, + { keys = [ "A" ], command = "rename_prepend" }, + + { keys = [ "f", "t" ], command = ":touch " }, + + { keys = [ " " ], command = "select --toggle=true" }, + { keys = [ "t" ], command = "select --all=true --toggle=true" }, + { keys = [ "V" ], command = "toggle_visual"}, + + { keys = [ "w" ], command = "show_tasks --exit-key=w" }, + { keys = [ "b", "b" ], command = "bulk_rename" }, + { keys = [ "=" ], command = "set_mode" }, + + { keys = [ ":" ], command = ":" }, + { keys = [ ";" ], command = ":" }, + + { keys = [ "'" ], command = ":shell " }, + { keys = [ "m", "k" ], command = ":mkdir " }, + { keys = [ "c", "w" ], command = ":rename " }, + + { keys = [ "/" ], command = ":search " }, + { keys = [ "|" ], command = ":search_inc " }, + { keys = [ "\\" ], command = ":search_glob " }, + { keys = [ "S" ], command = "search_fzf" }, + { keys = [ "C" ], command = "subdir_fzf" }, + + { keys = [ "n" ], command = "search_next" }, + { keys = [ "N" ], command = "search_prev" }, + + { keys = [ "s", "r" ], command = "sort reverse" }, + { keys = [ "s", "l" ], command = "sort lexical" }, + { keys = [ "s", "m" ], command = "sort mtime" }, + { keys = [ "s", "n" ], command = "sort natural" }, + { keys = [ "s", "s" ], command = "sort size" }, + { keys = [ "s", "e" ], command = "sort ext" }, + + { keys = [ "m", "s" ], command = "linemode size" }, + { keys = [ "m", "m" ], command = "linemode mtime" }, + { keys = [ "m", "M" ], command = "linemode sizemtime" }, + + { keys = [ "g", "r" ], command = "cd /" }, + { keys = [ "g", "c" ], command = "cd ~/.config" }, + { keys = [ "g", "d" ], command = "cd ~/Downloads" }, + { keys = [ "g", "e" ], command = "cd /etc" }, + { keys = [ "g", "h" ], command = "cd ~/" }, + { keys = [ "?" ], command = "help" } +] + +[task_view] + +keymap = [ + # arrow keys + { keys = [ "arrow_up" ], command = "cursor_move_up" }, + { keys = [ "arrow_down" ], command = "cursor_move_down" }, + { keys = [ "home" ], command = "cursor_move_home" }, + { keys = [ "end" ], command = "cursor_move_end" }, + + # vim-like keybindings + { keys = [ "j" ], command = "cursor_move_down" }, + { keys = [ "k" ], command = "cursor_move_up" }, + { keys = [ "g", "g" ], command = "cursor_move_home" }, + { keys = [ "G" ], command = "cursor_move_end" }, + + { keys = [ "w" ], command = "show_tasks" }, + { keys = [ "escape" ], command = "show_tasks" }, +] + +[help_view] + +keymap = [ + # arrow keys + { keys = [ "arrow_up" ], command = "cursor_move_up" }, + { keys = [ "arrow_down" ], command = "cursor_move_down" }, + { keys = [ "home" ], command = "cursor_move_home" }, + { keys = [ "end" ], command = "cursor_move_end" }, + + # vim-like keybindings + { keys = [ "j" ], command = "cursor_move_down" }, + { keys = [ "k" ], command = "cursor_move_up" }, + { keys = [ "g", "g" ], command = "cursor_move_home" }, + { keys = [ "G" ], command = "cursor_move_end" }, + + { keys = [ "w" ], command = "show_tasks" }, + { keys = [ "escape" ], command = "show_tasks" }, +] diff --git a/joshuto/neovide_backtraces.log b/joshuto/neovide_backtraces.log new file mode 100644 index 0000000..8933c16 --- /dev/null +++ b/joshuto/neovide_backtraces.log @@ -0,0 +1,18 @@ +2023-04-08 23:31:08 - Neovide panicked with the message 'Could not setup setting notifier for refresh_rate_idle: Error sending request 'nvim_command''. (File: src/error_handling.rs; Line: 5, Column: 5) + 0: + 1: + 2: + 3: + 4: + 5: + 6: + 7: + 8: + 9: + 10: + 11: + 12: + 13: + 14: + 15: + diff --git a/joshuto/theme.toml b/joshuto/theme.toml new file mode 100644 index 0000000..341c543 --- /dev/null +++ b/joshuto/theme.toml @@ -0,0 +1,73 @@ +[selection] +fg = "light_yellow" +bold = true + +[visual_mode_selection] +fg = "light_red" +bold = true + +[selection.prefix] +prefix = " " +size = 2 + +[executable] +fg = "light_green" +bold = true + +[regular] +fg = "white" + +[directory] +fg = "light_blue" +bold = true + +[link] +fg = "cyan" +bold = true + +[link_invalid] +fg = "red" +bold = true + +[socket] +fg = "light_magenta" +bold = true + +[ext] + +bmp.fg = "yellow" +gif.fg = "yellow" +heic.fg = "yellow" +jpg.fg = "yellow" +jpeg.fg = "yellow" +pgm.fg = "yellow" +png.fg = "yellow" +ppm.fg = "yellow" +svg.fg = "yellow" + +wav.fg = "magenta" +flac.fg = "magenta" +mp3.fg = "magenta" +amr.fg = "magenta" + +avi.fg = "magenta" +flv.fg = "magenta" +m3u.fg = "magenta" +m4a.fg = "magenta" +m4v.fg = "magenta" +mkv.fg = "magenta" +mov.fg = "magenta" +mp4.fg = "magenta" +mpg.fg = "magenta" +rmvb.fg = "magenta" +webm.fg = "magenta" +wmv.fg = "magenta" + +7z.fg = "red" +bz2.fg = "red" +gz.fg = "red" +rar.fg = "red" +tar.fg = "red" +tgz.fg = "red" +xz.fg = "red" +zip.fg = "red" diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua index 01f7c00..48f64ae 100644 --- a/nvim/lua/config/keymaps.lua +++ b/nvim/lua/config/keymaps.lua @@ -22,14 +22,14 @@ local term_opts = { silent = true } -- map("n", "", ':set norelativenumber', opts) -- crimes against humanity, but I don't care -map("n", "j", 'h', opts) -map("n", "l", 'k', opts) -map("n", "k", 'j', opts) -map("n", ";", 'l', opts) -map("v", "j", 'h', opts) -map("v", "k", 'j', opts) -map("v", "l", 'k', opts) -map("v", ";", 'l', opts) +map("n", "j", "h", opts) +map("n", "l", "k", opts) +map("n", "k", "j", opts) +map("n", ";", "l", opts) +map("v", "j", "h", opts) +map("v", "k", "j", opts) +map("v", "l", "k", opts) +map("v", ";", "l", opts) -- debug map("n", "", ':lua require("dap").toggle_breakpoint()', opts) @@ -104,6 +104,23 @@ vim.keymap.set("n", "z", ":lua require('telescope').extensions.zoxide.li -- trouble map("n", "", "TroubleToggle", term_opts) +-- better yank +function Better_yank(opts) + local current_line = unpack(vim.api.nvim_win_get_cursor(0)) + vim.api.nvim_command(current_line .. "," .. (opts.count - (current_line - 1)) .. "y") +end + +vim.api.nvim_create_user_command("BetterYank", Better_yank, { count = 1 }) map("n", "gy", ":BetterYank", term_opts) +map("n", "y", ":BetterYank", term_opts) +-- better delete +function Better_delete(opts) + local current_line = unpack(vim.api.nvim_win_get_cursor(0)) + vim.api.nvim_command(current_line .. "," .. (opts.count - (current_line - 1)) .. "d") +end + +vim.api.nvim_create_user_command("BetterDelete", Better_delete, { count = 1 }) +map("n", "d", ":BetterDelete", term_opts) + -- gitui map("n", "gg", function() Util.float_term({ "gitui" }, { cwd = Util.get_root() }) diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua index f70e8f3..4850922 100644 --- a/nvim/lua/config/options.lua +++ b/nvim/lua/config/options.lua @@ -2,8 +2,6 @@ -- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua -- Add any additional options here local options = { - clipboard = "", - mouse = "n", fileencoding = "utf-8", number = true, showmode = true, @@ -11,7 +9,7 @@ local options = { spelllang = "en_us", shell = "/usr/bin/zsh", autochdir = true, - relativenumber = true, + relativenumber = false, scrolloff = 5, scrolljump = 5, }