From a7522d7a7fbbeeda7fca2e98e3ce01c5837212bc Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Mon, 9 Oct 2023 00:36:04 +0200 Subject: fixup --- flake.nix | 10 +++---- mut/neovim/fnl/conf/init.fnl | 59 ++++++++++++++++++++++++------------- mut/neovim/fnl/conf/newtab/init.fnl | 36 ---------------------- profiles/station/neovim.nix | 3 -- 4 files changed, 43 insertions(+), 65 deletions(-) delete mode 100644 mut/neovim/fnl/conf/newtab/init.fnl diff --git a/flake.nix b/flake.nix index e0c3a5d..29fb0a5 100644 --- a/flake.nix +++ b/flake.nix @@ -35,11 +35,11 @@ }) ./machines/lemptop.nix ] ++ (attrValues - (attrsets.mergeAttrsList [ - (modulesIn ./profiles/core) - (modulesIn ./profiles/station) - (modulesIn ./profiles/email) - ])); + (attrsets.mergeAttrsList (map modulesIn [ + ./profiles/core + ./profiles/station + ./profiles/email + ]))); }; templates = { diff --git a/mut/neovim/fnl/conf/init.fnl b/mut/neovim/fnl/conf/init.fnl index 8850bac..68cc26e 100644 --- a/mut/neovim/fnl/conf/init.fnl +++ b/mut/neovim/fnl/conf/init.fnl @@ -25,7 +25,10 @@ (map :n :q ":cclose") (map :n :ll ":lopen") (map :n :l ":lclose") + (map :n : ":cprev") (map :n : ":cnext") + (map :n : ":Compile ") + (map :n : ":Recompile") (map :n "[q" ":cprevious") (map :n "]q" ":cnext") (map :n "[x" ":lprevious") @@ -37,6 +40,7 @@ (map :n ";" ":silent grep ") (map :n :xb #(builtin.buffers { :sort_mru true :ignore_current_buffer true}))) + ;; I like to use the qf to run a lot of stuff that prints junk ;; Here I just check if ansi control stuff is printed and reparse the lines with efm (local qf @@ -66,30 +70,43 @@ (prettify l)))) (vim.fn.setqflist [] :a {: id : title : lines})))) +(var last_job nil) (local job (fn [cmd] (local title (table.concat cmd " ")) (vim.fn.setqflist [] " " {: title}) (local add2qf (qf (vim.fn.getqflist {:id 0 :title 1}))) - (vim.fn.jobstart - cmd - {:on_stdout (fn [id data] - (if data - (add2qf data))) - :on_stderr (fn [id data] - (if data - (add2qf data))) - :on_exit (fn [id rc] - (if (= rc 0) - (vim.cmd ":cope")))}))) + (set + last_job + {: cmd + :id (vim.fn.jobstart + cmd + {:on_stdout (fn [id data] + (if data + (add2qf data))) + :on_stderr (fn [id data] + (if data + (add2qf data))) + :on_exit (fn [id rc] + (if (= rc 0) + (vim.cmd ":cope")))})}))) -(var last_job nil) -(vim.api.nvim_create_user_command :Compile (fn [cmd] - (set last_job cmd.fargs) - (job cmd.fargs)) - {:nargs :* :bang true}) -(vim.api.nvim_create_user_command :Recompile (fn [] - (if (not= nil last_job) - (job last_job) - (vim.notify "nothing to recompile"))) - {:bang true}) +(vim.api.nvim_create_user_command + :Compile + (fn [cmd] + (job cmd.fargs)) + {:nargs :* :bang true :complete :shellcmd}) +(vim.api.nvim_create_user_command + :Recompile + (fn [] + (if (not= nil last_job) + (job last_job) + (vim.notify "nothing to recompile"))) + {:bang true}) +(vim.api.nvim_create_user_command + :Abort + (fn [] + (if (not= nil last_job) + (vim.fn.jobstop last_job.id)) + (vim.notify "killed job")) + {:bang true}) diff --git a/mut/neovim/fnl/conf/newtab/init.fnl b/mut/neovim/fnl/conf/newtab/init.fnl deleted file mode 100644 index fbf8e18..0000000 --- a/mut/neovim/fnl/conf/newtab/init.fnl +++ /dev/null @@ -1,36 +0,0 @@ -(local pickers (require :telescope.pickers)) -(local finders (require :telescope.finders)) -(local conf (. (require :telescope.config) :values)) -(local themes (require :telescope.themes)) -(local actions (require :telescope.actions)) -(local action_state (require :telescope.actions.state)) - -(fn colors [opts] - (local opts (if opts opts {})) - (local finder - (pickers.new opts - {:prompt_title :colors - :finder (finders.new_oneshot_job [:fd - :-d1 - "." - (os.getenv :HOME) - (.. (os.getenv :HOME) - :/projects)] - {}) - :attach_mappings (fn [prompt_buf map] - (actions.select_default:replace (fn [] - (actions.close prompt_buf) - (local selection - (action_state.get_selected_entry)) - (vim.cmd (.. :tabnew - (. selection - 1))) - (vim.cmd (.. :tc - (. selection - 1)))))) - :sorter (conf.generic_sorter opts)})) - (finder:find)) - -(vim.api.nvim_create_user_command :NewTab (fn [] (colors (themes.get_ivy))) {}) - -(vim.api.nvim_create_user_command :Colors colors {}) diff --git a/profiles/station/neovim.nix b/profiles/station/neovim.nix index 8796b88..47b6cee 100644 --- a/profiles/station/neovim.nix +++ b/profiles/station/neovim.nix @@ -48,10 +48,7 @@ gruvbox-material kanagawa-nvim lsp_lines-nvim - heirline-nvim gitsigns-nvim - noice-nvim - nui-nvim vim-helm # external -- cgit v1.2.3