feat: Add better yank and delete for absolute lines

This commit is contained in:
Fabio Lenherr / DashieTM 2023-04-09 18:17:49 +02:00
parent 2e972accb1
commit 08b30c2616
7 changed files with 286 additions and 14 deletions

View file

@ -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

View file

@ -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

165
joshuto/keymap.toml Normal file
View file

@ -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" },
]

View file

@ -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: <unknown>
1: <unknown>
2: <unknown>
3: <unknown>
4: <unknown>
5: <unknown>
6: <unknown>
7: <unknown>
8: <unknown>
9: <unknown>
10: <unknown>
11: <unknown>
12: <unknown>
13: <unknown>
14: <unknown>
15: <unknown>

73
joshuto/theme.toml Normal file
View file

@ -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"

View file

@ -22,14 +22,14 @@ local term_opts = { silent = true }
-- map("n", "<ESC>", ':set norelativenumber<CR><ESC>', 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", "<F5>", ':lua require("dap").toggle_breakpoint()<CR>', opts)
@ -104,6 +104,23 @@ vim.keymap.set("n", "<leader>z", ":lua require('telescope').extensions.zoxide.li
-- trouble
map("n", "<C-f>", "<cmd>TroubleToggle<CR>", 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<CR>", term_opts)
map("n", "<leader>y", ":BetterYank<CR>", 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", "<leader>d", ":BetterDelete<CR>", term_opts)
-- gitui
map("n", "<leader>gg", function()
Util.float_term({ "gitui" }, { cwd = Util.get_root() })

View file

@ -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,
}