diff options
| -rw-r--r-- | init.vim | 1 | ||||
| -rw-r--r-- | keys/which-key.vim | 62 | ||||
| -rw-r--r-- | lua/config-telescope.lua | 81 | 
3 files changed, 117 insertions, 27 deletions
| @@ -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 +  } +} | 
