diff options
| author | Mike Vink <> | 2023-04-04 14:38:43 +0200 |
|---|---|---|
| committer | Mike Vink <> | 2023-04-04 14:38:43 +0200 |
| commit | 18aafc4a0555c9fa8459102e7dab38213c030c5b (patch) | |
| tree | 6903e0e5cd2f1e428b182207aa7208b1c1b4736c /fnl | |
| parent | 20c97319dd707f7c1290013beb1521e69d1010b2 (diff) | |
newtab
Diffstat (limited to 'fnl')
| -rw-r--r-- | fnl/conf/init.fnl | 1 | ||||
| -rw-r--r-- | fnl/conf/newtab/init.fnl | 36 |
2 files changed, 37 insertions, 0 deletions
diff --git a/fnl/conf/init.fnl b/fnl/conf/init.fnl index 198b6e3..55cb841 100644 --- a/fnl/conf/init.fnl +++ b/fnl/conf/init.fnl @@ -7,6 +7,7 @@ (require :conf.pkgs) (require :conf.lsp) (require :conf.events) +(require :conf.newtab) ;; (require :conf.cmd) diff --git a/fnl/conf/newtab/init.fnl b/fnl/conf/newtab/init.fnl new file mode 100644 index 0000000..55309de --- /dev/null +++ b/fnl/conf/newtab/init.fnl @@ -0,0 +1,36 @@ +(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) + :/projects)] + {}) + :attach_mappings (fn [prompt_buf map] + (actions.select_default:replace (fn [] + (actions.close prompt_buf) + (local selection + (action_state.get_selected_entry)) + (P selection) + (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 {}) |
