diff --git a/nvim/.config/nvim/lua/maps.lua b/nvim/.config/nvim/lua/maps.lua index d4ee163..fc655e4 100644 --- a/nvim/.config/nvim/lua/maps.lua +++ b/nvim/.config/nvim/lua/maps.lua @@ -76,6 +76,9 @@ map.n.nore[']q'] = ':cnext' -- Location list map.n.nore['[l'] = ':lprevious' map.n.nore[']l'] = ':lnext' +-- Hunks (from gitsigns) +map.n.nore.expr['[h'] = [[&diff ? ']c' : 'Gitsigns prev_hunk']] +map.n.nore.expr[']h'] = [[&diff ? '[c' : 'Gitsigns next_hunk']] -- set our leader key to space since with hjkl, space is largely useless vim.g.mapleader = " " @@ -128,9 +131,11 @@ map.n.nore['s'] = map.n.nore['S'] = [[:lua require 'telescope.builtin'.oldfiles(require 'telescope.themes'.get_ivy())]] -- fuzzy find files in cwd -map.n.nore['f'] = [[:lua require 'telescope.builtin'.find_files()]] +map.n.nore['f'] = + [[:lua require 'telescope.builtin'.find_files({follow=true, hidden=true})]] -- general full-text search in cwd with rg -map.n.nore['F'] = [[:lua require 'telescope.builtin'.live_grep()]] +map.n.nore['F'] = + [[:lua require 'telescope'.extensions.fzf_writer.grep()]] -- git status map.n.nore['gs'] = [[:lua require 'telescope.builtin'.git_status()]] @@ -182,6 +187,9 @@ map.n.nore.silent[''] = ':TZMinimalist' -- map @@ to automatically insert citation reference at cursor map.i.nore.silent['@@'] = 'u:CiteRef' -- map cc to insert a complete citation at cursor +map.n.nore.silent['cc'] = ':CiteRef' +-- map cm to insert markdown prettified citation +map.n.nore.silent['cm'] = ':CiteMarkdown' -- SPELL CHECKING -- Spell check set to O, 'o' for 'orthography': diff --git a/nvim/.config/nvim/lua/plug/_format.lua b/nvim/.config/nvim/lua/plug/_format.lua index 815e837..abc2630 100644 --- a/nvim/.config/nvim/lua/plug/_format.lua +++ b/nvim/.config/nvim/lua/plug/_format.lua @@ -2,14 +2,22 @@ local augroup = require('helpers.augroup') -- for each filetype autoformat on save -- TODO can automatically gather from formatter table keys? +local filetypes = + 'bash,cpp,go,html,javascript,lua,python,rust,sh,typescript,zsh' +augroup({ + { + 'FileType', filetypes, 'autocmd', 'BufWritePost', '', + 'FormatWrite' + } +}, 'formatonsave') + local prettierfmt = { function() - local set_quotes = "--single-quote" - if vim.bo.filetype == "json" then set_quotes = "--double-quote" end return { exe = "prettier", args = { - "--stdin-filepath", vim.api.nvim_buf_get_name(0), set_quotes + "--stdin-filepath", vim.api.nvim_buf_get_name(0), + '--single-quote' }, stdin = true } @@ -19,44 +27,44 @@ local shfmt = { function() return {exe = "shfmt", args = {"-i 4"}, stdin = true} end } -local formatters = { - bash = shfmt, - cpp = { - function() - return { - exe = "clang-format", - args = {}, - stdin = true, - cwd = vim.fn.expand('%:p:h') -- Run clang-format in cwd of the file. - } - end - }, - go = {function() return {exe = "goimports", stdin = true} end}, - html = prettierfmt, - javascript = prettierfmt, - json = prettierfmt, - lua = { - function() - return - {exe = "lua-format", args = {"--indent-width", 4}, stdin = true} - end - }, - python = {function() return {exe = "black", args = {"-"}, stdin = true} end}, - rust = { - function() - return {exe = "rustfmt", args = {"--emit=stdout"}, stdin = true} - end - }, - sh = shfmt, - typescript = prettierfmt, - zsh = shfmt -} - -require('formatter').setup({logging = false, filetype = formatters}) - --- gather filetypes to autocorrect for each activated formatter above -local filetype = "" -for k, _ in pairs(formatters) do filetype = filetype .. "," .. k end -augroup({ - {'FileType', filetype, 'autocmd', 'BufWritePost', '', 'FormatWrite'} -}, 'formatonsave') +require('formatter').setup({ + logging = false, + filetype = { + bash = shfmt, + cpp = { + function() + return { + exe = "clang-format", + args = {}, + stdin = true, + cwd = vim.fn.expand('%:p:h') -- Run clang-format in cwd of the file. + } + end + }, + go = {function() return {exe = "goimports", stdin = true} end}, + html = prettierfmt, + javascript = prettierfmt, + lua = { + function() + return { + exe = "lua-format", + args = {"--indent-width", 4}, + stdin = true + } + end + }, + python = { + function() + return {exe = "black", args = {"-"}, stdin = true} + end + }, + rust = { + function() + return {exe = "rustfmt", args = {"--emit=stdout"}, stdin = true} + end + }, + sh = shfmt, + typescript = prettierfmt, + zsh = shfmt + } +}) diff --git a/nvim/.config/nvim/lua/plug/_telescope.lua b/nvim/.config/nvim/lua/plug/_telescope.lua index 89e2269..4b5e4ed 100644 --- a/nvim/.config/nvim/lua/plug/_telescope.lua +++ b/nvim/.config/nvim/lua/plug/_telescope.lua @@ -1,36 +1,32 @@ --- Setup up telescope fuzzy finding settings --- --- Makes use of optionally installed external programs to work fully: --- rg (ripgrep) for in-text searches --- fd for quicker directory structure searches --- lsp for a variety of lsp queries require("telescope").setup { defaults = { + file_sorter = require("telescope.sorters").get_fzy_sorter, vimgrep_arguments = { - 'rg', '--ignore-vcs', '--hidden', '--color=never', '--no-heading', - '--with-filename', '--line-number', '--column', '--smart-case' - } + 'rg', + '--ignore-vcs', + '--hidden', + '--color=never', + '--no-heading', + '--with-filename', + '--line-number', + '--column', + '--smart-case' + }, }, - pickers = { - buffers = {theme = "ivy"}, - oldfiles = {theme = "ivy"}, - find_files = { - theme = "dropdown", - -- nice minimal picker design - borderchars = { - {'─', '│', '─', '│', '┌', '┐', '┘', '└'}, - prompt = {"─", "│", " ", "│", '┌', '┐', "│", "│"}, - results = { - "─", "│", "─", "│", "├", "┤", "┘", "└" - }, - preview = { - '─', '│', '─', '│', '┌', '┐', '┘', '└' - } - }, - width = 0.8, - previewer = false, - prompt_title = false + extensions = { + fzy_native = { + override_generic_sorter = false, + override_file_sorter = true + }, + fzf_writer = { + minimum_grep_characters = 2, + minimum_files_characters = 2, + + -- Disabled by default. + -- Will probably slow down some aspects of the sorter, but can make color highlights. + use_highlighter = true, } - } + } } -require("telescope").load_extension("fzf") +require("telescope").load_extension("fzy_native") +require("telescope").load_extension("fzf_writer") diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index d77650e..0afdee0 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -159,12 +159,11 @@ require("packer").startup(function() -- fuzzy matching use { "nvim-telescope/telescope.nvim", - requires = { - {"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"}, - {"nvim-telescope/telescope-fzf-native.nvim", run = 'make'} - }, + requires = {{"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"}}, config = function() require('plug._telescope') end } + use "nvim-telescope/telescope-fzy-native.nvim" + use "nvim-telescope/telescope-fzf-writer.nvim" -- snippeting use {"hrsh7th/vim-vsnip", event = "InsertEnter"} -- snippet engine diff --git a/taskwarrior/.config/task/taskrc b/taskwarrior/.config/task/taskrc index 0b5148e..a410b3c 100644 --- a/taskwarrior/.config/task/taskrc +++ b/taskwarrior/.config/task/taskrc @@ -38,7 +38,7 @@ report.next.labels=,Project,Pri,Urg,Due,Description,Tags,Sched,Age,Recur report.overdue.filter=(status:pending or +WAITING) and +OVERDUE and -TODAY # custom today report, sorted by urgency report.today.description=Tasks scheduled for today, sorted by urgency -report.today.filter=status:pending -WAITING +TODAY or +OVERDUE limit:page +report.today.filter=status:pending -WAITING +TODAY limit:page report.today.sort=urgency- report.today.columns=id,project,priority,urgency,due,description,tags,scheduled,entry.age,recur report.today.labels=,Project,Pri,Urg,Due,Description,Tags,Sched,Age,Recur @@ -58,7 +58,6 @@ urgency.tags.coefficient=0 urgency.annotations.coefficient=0 # maybe items are not urgent at all urgency.user.tag.maybe.coefficient=-100.0 -urgency.user.tag.next.coefficient=5.0 # Holidays for calendar include /usr/share/doc/task/rc/holidays.de-DE.rc diff --git a/wayland/.config/river/init b/wayland/.config/river/init index 1ab3919..2327311 100755 --- a/wayland/.config/river/init +++ b/wayland/.config/river/init @@ -80,6 +80,12 @@ riverctl map normal $mod N spawn "dunstctl close" riverctl map normal $mod+Shift N spawn "dunstctl close-all" riverctl map normal $mod+Control N spawn "dunstctl history-pop" +# # Clear clipboard +# riverctl map normal $mod BackSpace spawn 'wl-copy -c && printf ''|xclip -selection c' + +# # PixelColor script +# riverctl map normal "Mod1" C spawn 'bash ~/.config/bin/pixelcolor' + # MOVEMENT # focus the next/previous view in the layout stack riverctl map normal $mod J focus-view next @@ -146,20 +152,20 @@ riverctl map normal $mod+Shift Comma send-to-output previous # set up 10 tags (with '0' opening the 10th one) for i in $(seq 0 9); do - tags=$((1 << (i - 1))) - if [ "$i" -eq 0 ]; then tags=$((1 << 9)); fi + tags=$((1 << (i - 1))) + if [ "$i" -eq 0 ]; then tags=$((1 << 9)); fi - # Mod+[1-9] to focus tag [0-8] - riverctl map normal $mod "$i" set-focused-tags $tags + # Mod+[1-9] to focus tag [0-8] + riverctl map normal $mod "$i" set-focused-tags $tags - # Mod+Shift+[1-9] to tag focused view with tag [0-8] - riverctl map normal $mod+Shift "$i" set-view-tags $tags + # Mod+Shift+[1-9] to tag focused view with tag [0-8] + riverctl map normal $mod+Shift "$i" set-view-tags $tags - # Mod+Ctrl+[1-9] to toggle focus of tag [0-8] - riverctl map normal $mod+Control "$i" toggle-focused-tags $tags + # Mod+Ctrl+[1-9] to toggle focus of tag [0-8] + riverctl map normal $mod+Control "$i" toggle-focused-tags $tags - # Mod+Shift+Ctrl+[1-9] to toggle tag [0-8] of focused view - riverctl map normal $mod+Shift+Control "$i" toggle-view-tags $tags + # Mod+Shift+Ctrl+[1-9] to toggle tag [0-8] of focused view + riverctl map normal $mod+Shift+Control "$i" toggle-view-tags $tags done # focus all tags @@ -171,22 +177,22 @@ riverctl map normal $mod+Shift equal set-view-tags $all_tags # Various media key mapping examples for both normal and locked mode which do # not have a modifier for mode in normal locked; do - # Eject the optical drive - riverctl map $mode None XF86Eject spawn 'eject -T' + # Eject the optical drive + riverctl map $mode None XF86Eject spawn 'eject -T' - riverctl map $mode None XF86AudioRaiseVolume spawn 'pactl set-sink-volume @DEFAULT_SINK@ +5%' - riverctl map $mode None XF86AudioLowerVolume spawn 'pactl set-sink-volume @DEFAULT_SINK@ -5%' - riverctl map $mode None XF86AudioMute spawn 'pactl set-sink-mute @DEFAULT_SINK@ toggle' + riverctl map $mode None XF86AudioRaiseVolume spawn 'pactl set-sink-volume @DEFAULT_SINK@ +5%' + riverctl map $mode None XF86AudioLowerVolume spawn 'pactl set-sink-volume @DEFAULT_SINK@ -5%' + riverctl map $mode None XF86AudioMute spawn 'pactl set-sink-mute @DEFAULT_SINK@ toggle' - # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl) - riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause' - riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause' - riverctl map $mode None XF86AudioPrev spawn 'playerctl previous' - riverctl map $mode None XF86AudioNext spawn 'playerctl next' + # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl) + riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause' + riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause' + riverctl map $mode None XF86AudioPrev spawn 'playerctl previous' + riverctl map $mode None XF86AudioNext spawn 'playerctl next' - # You can control screen backlight brighness with light (https://github.com/haikarainen/light); but we prefer brightnessctl - riverctl map $mode None XF86MonBrightnessUp spawn 'brightnessctl set 10%+' - riverctl map $mode None XF86MonBrightnessDown spawn 'brightnessctl set 10%-' + # You can control screen backlight brighness with light (https://github.com/haikarainen/light); but we prefer brightnessctl + riverctl map $mode None XF86MonBrightnessUp spawn 'brightnessctl set 10%+' + riverctl map $mode None XF86MonBrightnessDown spawn 'brightnessctl set 10%-' done # The scratchpad will live on an unused tag. Which tags are used depends on your @@ -210,14 +216,14 @@ riverctl spawn-tagmask ${all_but_scratch_tag} # device (touchscreen) # enable touch clicking for touchpads for pad in $(riverctl list-inputs | grep -i touchpad); do - riverctl input "$pad" events enabled - riverctl input "$pad" tap enabled + riverctl input "$pad" events enabled + riverctl input "$pad" tap enabled done for pad in $(riverctl list-inputs | grep -i touchscreen); do - riverctl input "$pad" events enabled - riverctl input "$pad" tap enabled - riverctl input "$pad" drag enabled - riverctl input "$pad" pointer-accel 0.5 + riverctl input "$pad" events enabled + riverctl input "$pad" tap enabled + riverctl input "$pad" drag enabled + riverctl input "$pad" pointer-accel 0.5 done setxkbmap -option "compose:menu"