summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris <[email protected]>2021-03-08 03:08:33 -0500
committerChris <[email protected]>2021-03-08 03:08:33 -0500
commit368f4042502071d087d49a8ad52059b0cc7cd16b (patch)
tree16f3c510c15ba3c69bfb5529d2631a48d9c1e4e8
parentc110240e3b95f3f157dd521eb87663cc5cbf2742 (diff)
full telescope integration, make sure to udpate neovim or selection won't work
-rw-r--r--init.vim1
-rw-r--r--keys/which-key.vim62
-rw-r--r--lua/config-telescope.lua81
3 files changed, 117 insertions, 27 deletions
diff --git a/init.vim b/init.vim
index bb350626..ecafaeac 100644
--- a/init.vim
+++ b/init.vim
@@ -54,6 +54,7 @@ else
source $HOME/.config/nvim/plug-config/markdown-preview.vim
source $HOME/.config/nvim/plug-config/neovide.vim
luafile $HOME/.config/nvim/lua/plug-colorizer.lua
+ luafile $HOME/.config/nvim/lua/config-telescope.lua
source $HOME/.config/nvim/plug-config/vimspector.vim
" source $HOME/.config/nvim/plug-config/sneak.vim
" source $HOME/.config/nvim/plug-config/rainbow.vim
diff --git a/keys/which-key.vim b/keys/which-key.vim
index 76fa40f4..fc7c2036 100644
--- a/keys/which-key.vim
+++ b/keys/which-key.vim
@@ -186,35 +186,43 @@ let g:which_key_map.m = {
" \ 's' : [':Snippets' , 'snippets'],
" TODO fix FZF preview or just move to Telescope
-" s is for search
+" s is for search powered by telescope
let g:which_key_map.s = {
\ 'name' : '+search' ,
- \ '/' : [':History/' , 'history'],
- \ ';' : [':FzfPreviewCommandPalette' , 'commands'],
- \ 'a' : [':Ag' , 'text Ag'],
- \ 'b' : [':CocCommand fzf-preview.BufferLines' , 'current buffer'],
- \ 'B' : [':CocCommand fzf-preview.Buffers' , 'open buffers'],
- \ 'c' : [':Commits' , 'commits'],
- \ 'C' : [':BCommits' , 'buffer commits'],
- \ 'd' : [':CocCommand fzf-preview.DirectoryFiles' , 'directories'],
- \ 'f' : [':CocCommand fzf-preview.ProjectFiles' , 'files'],
- \ 'g' : [':CocCommand fzf-preview.GitFiles' , 'git files'],
- \ 'G' : [':GFiles?' , 'modified git files'],
- \ 'h' : [':History' , 'file history'],
- \ 'H' : [':History:' , 'command history'],
- \ 'l' : [':Lines' , 'lines'] ,
- \ 'm' : [':CocCommand fzf-preview.Marks', 'list marks'],
- \ 'M' : [':Maps' , 'normal maps'] ,
- \ 'p' : [':Helptags' , 'help tags'] ,
- \ 'P' : [':Tags' , 'project tags'],
- \ 'q' : [':CocCommand fzf-preview.QuickFix' , 'quickfix list'],
- \ 's' : [':CocList snippets' , 'snippets'],
- \ 'S' : [':Colors' , 'color schemes'],
- \ 't' : [':Rg' , 'text Rg'],
- \ 'T' : [':BTags' , 'buffer tags'],
- \ 'w' : [':Windows' , 'search windows'],
- \ 'y' : [':Filetypes' , 'file types'],
- \ 'z' : [':FZF' , 'FZF'],
+ \ '.' : [':Telescope filetypes' , 'filetypes'],
+ \ ';' : [':Telescope commands' , 'commands'],
+ \ 'a' : [':Telescope lsp_code_actions' , 'code_actions'],
+ \ 'A' : [':Telescope builtin' , 'all'],
+ \ 'b' : [':Telescope buffers' , 'buffers'],
+ \ 'B' : [':Telescope git_branches' , 'git_branches'],
+ \ 'd' : [':Telescope lsp_document_diagnostics' , 'document_diagnostics'],
+ \ 'D' : [':Telescope lsp_workspace_diagnostics' , 'workspace_diagnostics'],
+ \ 'c' : [':Telescope git_bcommits' , 'git_bcommits'],
+ \ 'C' : [':Telescope git_bcommits' , 'git_bcommits'],
+ \ 'f' : [':Telescope find_files' , 'files'],
+ \ 'F' : [':Telescope git_files' , 'git_files'],
+ \ 'g' : [':Telescope tags' , 'tags'],
+ \ 'G' : [':Telescope current_buffer_tags' , 'buffer_tags'],
+ \ 'h' : [':Telescope command_history' , 'history'],
+ \ 'H' : [':Telescope help_tags' , 'help_tags'],
+ \ 'k' : [':Telescope keymaps' , 'keymaps'],
+ \ 'l' : [':Telescope loclist' , 'loclist'],
+ \ 'm' : [':Telescope marks' , 'marks'],
+ \ 'o' : [':Telescope vim_options' , 'vim_options'],
+ \ 'O' : [':Telescope oldfiles' , 'oldfiles'],
+ \ 'M' : [':Telescope man_pages' , 'man_pages'],
+ \ 'p' : [':Telescope fd' , 'fd'],
+ \ 'P' : [':Telescope spell_suggest' , 'spell_suggest'],
+ \ 's' : [':Telescope git_status' , 'git_status'],
+ \ 'S' : [':Telescope grep_string' , 'grep_string'],
+ \ 't' : [':Telescope live_grep' , 'text'],
+ \ 'y' : [':Telescope symbols' , 'symbols'],
+ \ 'Y' : [':Telescope lsp_workspace_symbols' , 'lsp_workspace_symbols'],
+ \ 'r' : [':Telescope registers' , 'registers'],
+ \ 'R' : [':Telescope reloader' , 'reloader'],
+ \ 'w' : [':Telescope file_browser' , 'buf_fuz_find'],
+ \ 'u' : [':Telescope colorscheme' , 'colorschemes'],
+ \ 'z' : [':Telescope current_buffer_fuzzy_find' , 'buf_fuz_find'],
\ }
"
" :CocCommand fzf-preview.AllBuffers
diff --git a/lua/config-telescope.lua b/lua/config-telescope.lua
new file mode 100644
index 00000000..c1f8adfd
--- /dev/null
+++ b/lua/config-telescope.lua
@@ -0,0 +1,81 @@
+local actions = require('telescope.actions')
+-- Global remapping
+------------------------------
+require('telescope').setup{
+ defaults = {
+ mappings = {
+ i = {
+ ["<C-j>"] = actions.move_selection_next,
+ ["<C-k>"] = actions.move_selection_previous,
+ -- To disable a keymap, put [map] = false
+ -- So, to not map "<C-n>", just put
+ -- ["<c-x>"] = false,
+
+ -- Otherwise, just set the mapping to the function that you want it to be.
+ -- ["<C-i>"] = actions.select_horizontal,
+
+ -- Add up multiple actions
+ ["<CR>"] = actions.select_default + actions.center,
+
+ -- You can perform as many actions in a row as you like
+ -- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
+ },
+ n = {
+ ["<C-j>"] = actions.move_selection_next,
+ ["<C-k>"] = actions.move_selection_previous,
+ -- ["<esc>"] = actions.close,
+ -- ["<C-i>"] = my_cool_custom_action,
+ },
+ },
+ }
+}
+
+ -- '--color=never',
+require('telescope').setup{
+ defaults = {
+ vimgrep_arguments = {
+ 'rg',
+ '--no-heading',
+ '--with-filename',
+ '--line-number',
+ '--column',
+ '--smart-case'
+ },
+ prompt_position = "bottom",
+ prompt_prefix = " ",
+ selection_caret = " ",
+ entry_prefix = " ",
+ initial_mode = "insert",
+ selection_strategy = "reset",
+ sorting_strategy = "descending",
+ layout_strategy = "horizontal",
+ layout_defaults = {
+ horizontal = {
+ mirror = false,
+ },
+ vertical = {
+ mirror = false,
+ },
+ },
+ file_sorter = require'telescope.sorters'.get_fuzzy_file,
+ file_ignore_patterns = {},
+ generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
+ shorten_path = true,
+ winblend = 0,
+ width = 0.75,
+ preview_cutoff = 120,
+ results_height = 1,
+ results_width = 0.8,
+ border = {},
+ borderchars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' },
+ color_devicons = true,
+ use_less = true,
+ set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil,
+ file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
+ grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
+ qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
+
+ -- Developer configurations: Not meant for general override
+ buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker
+ }
+}