Merge branch 'main' of git.zander.im:Zander671/nvim-config
This commit is contained in:
commit
101360066e
@ -74,73 +74,9 @@
|
|||||||
:opt true
|
:opt true
|
||||||
:run :make }]
|
:run :make }]
|
||||||
:setup
|
:setup
|
||||||
(bind! :n :<leader>fq "<cmd>Telescope quickfix<cr>")
|
(module-call! :plugin.telescope :setup)
|
||||||
(bind! :n :<leader>fr "<cmd>Telescope registers<cr>")
|
|
||||||
(bind! :n :<leader>fj "<cmd>Telescope jumplist<cr>")
|
|
||||||
(bind! :n :<leader>fa "<cmd>Telescope marks<cr>")
|
|
||||||
(bind! :n :<leader>fh "<cmd>Telescope help_tags<cr>")
|
|
||||||
(bind! :n :<leader>g "<cmd>Telescope live_grep<cr>")
|
|
||||||
(bind! :n :<leader>fg "<cmd>Telescope live_grep<cr>")
|
|
||||||
(bind! :n :<leader>d "<cmd>Telescope treesitter<cr>")
|
|
||||||
(bind! :n :<leader>b "<cmd>Telescope buffers<cr>")
|
|
||||||
(bind! :n :<leader>fu "<cmd>Telescope git_status<cr>")
|
|
||||||
(bind! :n :<leader>fm "<cmd>Telescope man_pages<cr>")
|
|
||||||
(bind! :n :<leader>fe "<cmd>Telescope diagnostics<cr>")
|
|
||||||
(bind! :n :<leader>fl "<cmd>Telescope loclist<cr>")
|
|
||||||
(bind! :n :<leader>fp "<cmd>Telescope spell_suggest<cr>")
|
|
||||||
(bind! :n :<leader>fo "<cmd>Telescope vim_options<cr>")
|
|
||||||
(bind! :n :<leader>c "<cmd>Telescope command_history<cr>")
|
|
||||||
(bind! :n :<leader>i "<cmd>Telescope find_files<cr>")
|
|
||||||
(bind! :n :<leader>i "<cmd>Telescope find_files<cr>")
|
|
||||||
(bind! :n :z= "<cmd>Telescope spell_suggest<cr>")
|
|
||||||
(fn list-git-or-default []
|
|
||||||
(let [code (os.execute "git rev-parse --is-inside-work-tree >/dev/null 2>&1")]
|
|
||||||
(if (= code 0)
|
|
||||||
(vim.cmd "Telescope git_files")
|
|
||||||
(vim.cmd "Telescope find_files"))))
|
|
||||||
(bind! :n :<leader>ff list-git-or-default)
|
|
||||||
(bind! :n :<leader>u list-git-or-default)
|
|
||||||
(fn jump-or-open-terminal []
|
|
||||||
"If no terminal buffer exists, create one. Otherwise, open new one."
|
|
||||||
(var term_count 0)
|
|
||||||
(var last_id 0)
|
|
||||||
(var terms [ ])
|
|
||||||
(each [_ id (pairs (vim.api.nvim_list_bufs))]
|
|
||||||
(let [name (vim.api.nvim_buf_get_name id)]
|
|
||||||
(when (vim.startswith name "term://")
|
|
||||||
(table.insert terms name)
|
|
||||||
(set term_count (+ term_count 1))
|
|
||||||
(set last_id id))))
|
|
||||||
(if (= term_count 0)
|
|
||||||
(vim.cmd.terminal)
|
|
||||||
(= term_count 1)
|
|
||||||
(vim.cmd.buffer last_id)
|
|
||||||
(vim.cmd "Telescope buffers default_text=term://")))
|
|
||||||
(bind! :n :<leader>t jump-or-open-terminal)
|
|
||||||
:config
|
:config
|
||||||
(vim.cmd "PackerLoad plenary.nvim")
|
(module-call! :plugin.telescope :config))
|
||||||
(vim.cmd "PackerLoad telescope-ui-select.nvim")
|
|
||||||
(vim.cmd "PackerLoad telescope-fzf-native.nvim")
|
|
||||||
(let [actions (require :telescope.actions)]
|
|
||||||
(setup! :telescope
|
|
||||||
:defaults {
|
|
||||||
:mappings {
|
|
||||||
:i { :<esc> actions.close
|
|
||||||
:<C-k> actions.move_selection_previous
|
|
||||||
:<C-j> actions.move_selection_next }
|
|
||||||
:n { :<C-k> actions.move_selection_previous
|
|
||||||
:<C-j> actions.move_selection_next }}}
|
|
||||||
:pickers {
|
|
||||||
:buffers {
|
|
||||||
;;:ignore_current_buffer true
|
|
||||||
:sort_lastused true }}
|
|
||||||
:extensions {
|
|
||||||
:ui-select [
|
|
||||||
(module-call! :telescope.themes :get_dropdown)
|
|
||||||
]
|
|
||||||
})
|
|
||||||
(module-call! :telescope :load_extension :ui-select)
|
|
||||||
(module-call! :telescope :load_extension :fzf)))
|
|
||||||
|
|
||||||
;; Trouble
|
;; Trouble
|
||||||
(use! :folke/trouble.nvim
|
(use! :folke/trouble.nvim
|
||||||
|
@ -60,7 +60,10 @@
|
|||||||
{ :name "buffer" :priority 0 :group 3 }
|
{ :name "buffer" :priority 0 :group 3 }
|
||||||
{ :name "path" :priority 0 :group 4 }]
|
{ :name "path" :priority 0 :group 4 }]
|
||||||
:view {
|
:view {
|
||||||
:entries { :name "custom" :selection_order "near_cursor" }}
|
:entries {
|
||||||
|
:name "custom"
|
||||||
|
; :selection_order "near_cursor"
|
||||||
|
}}
|
||||||
:sorting {
|
:sorting {
|
||||||
:priority_weight 2
|
:priority_weight 2
|
||||||
:comparators [
|
:comparators [
|
||||||
@ -93,7 +96,7 @@
|
|||||||
:<Tab> (cmp.mapping
|
:<Tab> (cmp.mapping
|
||||||
(fn []
|
(fn []
|
||||||
(if (cmp.visible)
|
(if (cmp.visible)
|
||||||
(cmp.select_next_item)
|
(cmp.select_prev_item)
|
||||||
(do
|
(do
|
||||||
(cmp.complete)
|
(cmp.complete)
|
||||||
(cmp.complete_common_string))))
|
(cmp.complete_common_string))))
|
||||||
@ -101,7 +104,7 @@
|
|||||||
:<S-Tab> (cmp.mapping
|
:<S-Tab> (cmp.mapping
|
||||||
(fn []
|
(fn []
|
||||||
(if (cmp.visible)
|
(if (cmp.visible)
|
||||||
(cmp.select_prev_item)
|
(cmp.select_next_item)
|
||||||
(do
|
(do
|
||||||
(cmp.complete)
|
(cmp.complete)
|
||||||
(cmp.complete_common_string))))
|
(cmp.complete_common_string))))
|
||||||
@ -109,7 +112,7 @@
|
|||||||
:<C-k> (cmp.mapping
|
:<C-k> (cmp.mapping
|
||||||
(fn []
|
(fn []
|
||||||
(if (cmp.visible)
|
(if (cmp.visible)
|
||||||
(cmp.select_next_item
|
(cmp.select_prev_item
|
||||||
{ :behavior cmp.SelectBehavior.Select })
|
{ :behavior cmp.SelectBehavior.Select })
|
||||||
(vim.api.nvim_feedkeys
|
(vim.api.nvim_feedkeys
|
||||||
(vim.api.nvim_replace_termcodes :<up>
|
(vim.api.nvim_replace_termcodes :<up>
|
||||||
@ -121,7 +124,7 @@
|
|||||||
:<C-j> (cmp.mapping
|
:<C-j> (cmp.mapping
|
||||||
(fn []
|
(fn []
|
||||||
(if (cmp.visible)
|
(if (cmp.visible)
|
||||||
(cmp.select_prev_item
|
(cmp.select_next_item
|
||||||
{ :behavior cmp.SelectBehavior.Select })
|
{ :behavior cmp.SelectBehavior.Select })
|
||||||
(vim.api.nvim_feedkeys
|
(vim.api.nvim_feedkeys
|
||||||
(vim.api.nvim_replace_termcodes :<down>
|
(vim.api.nvim_replace_termcodes :<down>
|
||||||
@ -131,24 +134,24 @@
|
|||||||
:n false)))
|
:n false)))
|
||||||
[ :i :c ])
|
[ :i :c ])
|
||||||
:<C-p> (cmp.mapping
|
:<C-p> (cmp.mapping
|
||||||
(cmp.mapping.select_next_item
|
(cmp.mapping.select_prev_item
|
||||||
{ :behavior cmp.SelectBehavior.Select })
|
{ :behavior cmp.SelectBehavior.Select })
|
||||||
[ :i :c ])
|
[ :i :c ])
|
||||||
:<C-n> (cmp.mapping
|
:<C-n> (cmp.mapping
|
||||||
(cmp.mapping.select_prev_item
|
(cmp.mapping.select_next_item
|
||||||
{ :behavior cmp.SelectBehavior.Select })
|
{ :behavior cmp.SelectBehavior.Select })
|
||||||
[ :i :c ])
|
[ :i :c ])
|
||||||
:<up> (cmp.mapping
|
:<up> (cmp.mapping
|
||||||
(fn [fallback]
|
(fn [fallback]
|
||||||
(if (cmp.visible)
|
(if (cmp.visible)
|
||||||
(cmp.select_next_item
|
(cmp.select_prev_item
|
||||||
{ :behavior cmp.SelectBehavior.Select })
|
{ :behavior cmp.SelectBehavior.Select })
|
||||||
(fallback)))
|
(fallback)))
|
||||||
[ :i :c ])
|
[ :i :c ])
|
||||||
:<down> (cmp.mapping
|
:<down> (cmp.mapping
|
||||||
(fn [fallback]
|
(fn [fallback]
|
||||||
(if (cmp.visible)
|
(if (cmp.visible)
|
||||||
(cmp.select_prev_item
|
(cmp.select_next_item
|
||||||
{ :behavior cmp.SelectBehavior.Select })
|
{ :behavior cmp.SelectBehavior.Select })
|
||||||
(fallback)))
|
(fallback)))
|
||||||
[ :i :c ])}]
|
[ :i :c ])}]
|
||||||
|
72
fnl/plugin/telescope.fnl
Normal file
72
fnl/plugin/telescope.fnl
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
(import-macros {: bind! : setup! : module-call!} :macros)
|
||||||
|
|
||||||
|
{ :setup (fn []
|
||||||
|
(bind! :n :<leader>fq "<cmd>Telescope quickfix<cr>")
|
||||||
|
(bind! :n :<leader>fr "<cmd>Telescope registers<cr>")
|
||||||
|
(bind! :n :<leader>fj "<cmd>Telescope jumplist<cr>")
|
||||||
|
(bind! :n :<leader>fa "<cmd>Telescope marks<cr>")
|
||||||
|
(bind! :n :<leader>fh "<cmd>Telescope help_tags<cr>")
|
||||||
|
(bind! :n :<leader>g "<cmd>Telescope live_grep<cr>")
|
||||||
|
(bind! :n :<leader>fg "<cmd>Telescope live_grep<cr>")
|
||||||
|
(bind! :n :<leader>d "<cmd>Telescope treesitter<cr>")
|
||||||
|
(bind! :n :<leader>b "<cmd>Telescope buffers<cr>")
|
||||||
|
(bind! :n :<leader>fu "<cmd>Telescope git_status<cr>")
|
||||||
|
(bind! :n :<leader>fm "<cmd>Telescope man_pages<cr>")
|
||||||
|
(bind! :n :<leader>fe "<cmd>Telescope diagnostics<cr>")
|
||||||
|
(bind! :n :<leader>fl "<cmd>Telescope loclist<cr>")
|
||||||
|
(bind! :n :<leader>fp "<cmd>Telescope spell_suggest<cr>")
|
||||||
|
(bind! :n :<leader>fo "<cmd>Telescope vim_options<cr>")
|
||||||
|
(bind! :n :<leader>c "<cmd>Telescope command_history<cr>")
|
||||||
|
(bind! :n :<leader>i "<cmd>Telescope find_files<cr>")
|
||||||
|
(bind! :n :<leader>i "<cmd>Telescope find_files<cr>")
|
||||||
|
(bind! :n :z= "<cmd>Telescope spell_suggest<cr>")
|
||||||
|
(fn list-git-or-default []
|
||||||
|
(let [code (os.execute "git rev-parse --is-inside-work-tree >/dev/null 2>&1")]
|
||||||
|
(if (= code 0)
|
||||||
|
(vim.cmd "Telescope git_files")
|
||||||
|
(vim.cmd "Telescope find_files"))))
|
||||||
|
(bind! :n :<leader>ff list-git-or-default)
|
||||||
|
(bind! :n :<leader>u list-git-or-default)
|
||||||
|
(fn jump-or-open-terminal []
|
||||||
|
"If no terminal buffer exists, create one. Otherwise, open new one."
|
||||||
|
(var term_count 0)
|
||||||
|
(var last_id 0)
|
||||||
|
(var terms [ ])
|
||||||
|
(each [_ id (pairs (vim.api.nvim_list_bufs))]
|
||||||
|
(when (and (vim.api.nvim_buf_is_loaded id)
|
||||||
|
(vim.api.nvim_buf_get_option id :buflisted))
|
||||||
|
(let [name (vim.api.nvim_buf_get_name id)]
|
||||||
|
(when (vim.startswith name "term://")
|
||||||
|
(table.insert terms name)
|
||||||
|
(set term_count (+ term_count 1))
|
||||||
|
(set last_id id)))))
|
||||||
|
(if (= term_count 0)
|
||||||
|
(vim.cmd.terminal)
|
||||||
|
(= term_count 1)
|
||||||
|
(vim.cmd.buffer last_id)
|
||||||
|
(vim.cmd "Telescope buffers default_text=term://")))
|
||||||
|
(bind! :n :<leader>t jump-or-open-terminal))
|
||||||
|
:config (fn []
|
||||||
|
(vim.cmd "PackerLoad plenary.nvim")
|
||||||
|
(vim.cmd "PackerLoad telescope-ui-select.nvim")
|
||||||
|
(vim.cmd "PackerLoad telescope-fzf-native.nvim")
|
||||||
|
(let [actions (require :telescope.actions)]
|
||||||
|
(setup! :telescope
|
||||||
|
:defaults {
|
||||||
|
:mappings {
|
||||||
|
:i { :<esc> actions.close
|
||||||
|
:<C-k> actions.move_selection_previous
|
||||||
|
:<C-j> actions.move_selection_next }
|
||||||
|
:n { :<C-k> actions.move_selection_previous
|
||||||
|
:<C-j> actions.move_selection_next }}}
|
||||||
|
:pickers {
|
||||||
|
:buffers {
|
||||||
|
;;:ignore_current_buffer true
|
||||||
|
:sort_lastused true }}
|
||||||
|
:extensions {
|
||||||
|
:ui-select [
|
||||||
|
(module-call! :telescope.themes :get_dropdown)
|
||||||
|
]
|
||||||
|
})
|
||||||
|
(module-call! :telescope :load_extension :ui-select)
|
||||||
|
(module-call! :telescope :load_extension :fzf))) }
|
Reference in New Issue
Block a user