diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2023-10-09 00:36:04 +0200 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2023-10-09 00:36:04 +0200 |
| commit | a7522d7a7fbbeeda7fca2e98e3ce01c5837212bc (patch) | |
| tree | aec01c2633f16d9e88531ae6d5de60e9596a0032 | |
| parent | 2f3508027c334a92a4d70fcfa872d1d46754fc85 (diff) | |
fixup
| -rw-r--r-- | flake.nix | 10 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/init.fnl | 59 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/newtab/init.fnl | 36 | ||||
| -rw-r--r-- | profiles/station/neovim.nix | 3 |
4 files changed, 43 insertions, 65 deletions
@@ -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 :<leader>q<BS> ":cclose<cr>") (map :n :<leader>ll ":lopen<cr>") (map :n :<leader>l<BS> ":lclose<cr>") + (map :n :<M-space> ":cprev<cr>") (map :n :<C-space> ":cnext<cr>") + (map :n :<C-x> ":Compile ") + (map :n :<C-e> ":Recompile<CR>") (map :n "[q" ":cprevious<cr>") (map :n "]q" ":cnext<cr>") (map :n "[x" ":lprevious<cr>") @@ -37,6 +40,7 @@ (map :n "<leader>;" ":silent grep ") (map :n :<leader>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 |
