summaryrefslogtreecommitdiff
path: root/fnl/conf/newtab
diff options
context:
space:
mode:
authorMike Vink <>2023-04-04 14:38:43 +0200
committerMike Vink <>2023-04-04 14:38:43 +0200
commit18aafc4a0555c9fa8459102e7dab38213c030c5b (patch)
tree6903e0e5cd2f1e428b182207aa7208b1c1b4736c /fnl/conf/newtab
parent20c97319dd707f7c1290013beb1521e69d1010b2 (diff)
newtab
Diffstat (limited to 'fnl/conf/newtab')
-rw-r--r--fnl/conf/newtab/init.fnl36
1 files changed, 36 insertions, 0 deletions
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 {})