Switch back from fzf to telescope within neovim
As the fzf plugin was slow on large code bases.
This reverts commit cee10964f0
.
This commit is contained in:
parent
652dbf9e39
commit
4ce11817ff
|
@ -162,15 +162,14 @@ let
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Use custom one until nixpkgs updates to that version
|
telescope-ctags-outline = pkgs.vimUtils.buildVimPlugin rec {
|
||||||
fzf-lua = pkgs.vimUtils.buildVimPlugin rec {
|
pname = "telescope-ctags-outline";
|
||||||
pname = "fzf-lua";
|
version = "35b2df9545f72352502703ba06b7ab711fa25e51";
|
||||||
version = "44f1ec92b57f15745f5f21cf224e521ce9ba0b66";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "ibhagwan";
|
owner = "fcying";
|
||||||
repo = pname;
|
repo = "${pname}.nvim";
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "AkZyCzLl4+jxQW07VI3sPRcPcFRKheXmOz0fWWfzWjw=";
|
sha256 = "e8QcD7H2unmoaLaN1JUxtOGQYBJGAXtfSnj8sW66ff4=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -226,14 +225,15 @@ in {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
plugin = fzf-lua.overrideAttrs (old: {
|
plugin = telescope-nvim;
|
||||||
patches = (old.patches or []) ++ [
|
|
||||||
./neovim/patches/fzf-lua-colors.patch
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
type = "lua";
|
type = "lua";
|
||||||
config = builtins.readFile(./neovim/plugins/fzf-lua.lua);
|
config = builtins.readFile(./neovim/plugins/telescope.lua);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
plugin = telescope-ctags-outline;
|
||||||
|
type = "lua";
|
||||||
|
config = builtins.readFile(./neovim/plugins/telescope-ctags-outline.lua);
|
||||||
}
|
}
|
||||||
|
|
||||||
dressing-nvim
|
dressing-nvim
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
local telescope = require('telescope')
|
||||||
|
local pickers = require('telescope.pickers')
|
||||||
|
local finders = require('telescope.finders')
|
||||||
|
local actions = require('telescope.actions')
|
||||||
|
local action_state = require('telescope.actions.state')
|
||||||
|
local conf = require('telescope.config').values
|
||||||
|
|
||||||
|
local custom_runs = function(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
|
||||||
|
local results = { 'CopyFileName', 'CopyRelativeFilePath', 'CopyFullFilePath' }
|
||||||
|
|
||||||
|
pickers.new(opts, {
|
||||||
|
prompt_title = 'Custom Runs',
|
||||||
|
finder = finders.new_table {
|
||||||
|
results = results
|
||||||
|
},
|
||||||
|
sorter = conf.generic_sorter(opts),
|
||||||
|
attach_mappings = function(prompt_bufnr, map)
|
||||||
|
actions.select_default:replace(function()
|
||||||
|
actions.close(prompt_bufnr)
|
||||||
|
local selection = action_state.get_selected_entry()
|
||||||
|
vim.api.nvim_call_function(selection[1], {})
|
||||||
|
end)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
}):find()
|
||||||
|
end
|
||||||
|
|
||||||
|
return telescope.register_extension({
|
||||||
|
exports = { custom_runs = custom_runs },
|
||||||
|
})
|
|
@ -113,7 +113,7 @@ function! StartProfiling()
|
||||||
execute(':profile file *')
|
execute(':profile file *')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! FilesInCurrentComposerPackage()
|
function! TelescopeCurrentComposerPackage()
|
||||||
let l:filePath = split(expand('%:p:h'), '/')
|
let l:filePath = split(expand('%:p:h'), '/')
|
||||||
|
|
||||||
while !filereadable('/' . join(l:filePath + ['composer.json'], '/')) && len(l:filePath)
|
while !filereadable('/' . join(l:filePath + ['composer.json'], '/')) && len(l:filePath)
|
||||||
|
@ -121,7 +121,7 @@ function! FilesInCurrentComposerPackage()
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
if len(l:filePath)
|
if len(l:filePath)
|
||||||
execute("lua require ('fzf-lua').files({cwd='/" . join(l:filePath, '/') . "'})")
|
execute(':Telescope find_files cwd=/' . join(l:filePath, '/'))
|
||||||
else
|
else
|
||||||
echom 'No composer package detected.'
|
echom 'No composer package detected.'
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -8,11 +8,12 @@ nnoremap L $
|
||||||
nnoremap <leader>nh :nohlsearch<cr>
|
nnoremap <leader>nh :nohlsearch<cr>
|
||||||
|
|
||||||
" Configure navigation, e.g. go to buffer, file, ...
|
" Configure navigation, e.g. go to buffer, file, ...
|
||||||
nnoremap <leader>pp :lua require('fzf-lua').builtin()<CR>
|
nnoremap <leader>pp :lua require('telescope.builtin').builtin({ include_extensions = true })<cr>
|
||||||
nnoremap <leader>pf :lua require('fzf-lua').git_files()<CR>
|
nnoremap <leader>pf :Telescope git_files<cr>
|
||||||
nnoremap <leader>pb :lua require('fzf-lua').buffers()<CR>
|
nnoremap <leader>pb :Telescope buffers<cr>
|
||||||
nnoremap <leader>pt :lua require('fzf-lua').btags()<CR>
|
nnoremap <leader>pt :Telescope ctags_outline outline<cr>
|
||||||
nnoremap <silent> <leader>pc :call FilesInCurrentComposerPackage()<cr>
|
nnoremap <leader>pr :Telescope custom_runs<cr>
|
||||||
|
nnoremap <silent> <leader>pc :call TelescopeCurrentComposerPackage()<cr>
|
||||||
|
|
||||||
" lca = lsp code action
|
" lca = lsp code action
|
||||||
nnoremap <leader>lca :lua vim.lsp.buf.code_action()<cr>
|
nnoremap <leader>lca :lua vim.lsp.buf.code_action()<cr>
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
diff --git a/lua/fzf-lua/make_entry.lua b/lua/fzf-lua/make_entry.lua
|
|
||||||
index f964766..be136d7 100644
|
|
||||||
--- a/lua/fzf-lua/make_entry.lua
|
|
||||||
+++ b/lua/fzf-lua/make_entry.lua
|
|
||||||
@@ -413,7 +413,7 @@ M.tag = function(x, opts)
|
|
||||||
return ("%s%s: %s %s"):format(
|
|
||||||
M.file(file, opts),
|
|
||||||
not line and "" or ":" .. utils.ansi_codes.green(tostring(line)),
|
|
||||||
- utils.ansi_codes.magenta(name),
|
|
||||||
+ utils.ansi_codes.blue(name),
|
|
||||||
utils.ansi_codes.green(tag)
|
|
||||||
), line
|
|
||||||
end
|
|
|
@ -1,19 +0,0 @@
|
||||||
require("fzf-lua").setup({
|
|
||||||
fzf_bin = "fzf-tmux",
|
|
||||||
fzf_opts = {
|
|
||||||
["--border"] = "rounded",
|
|
||||||
},
|
|
||||||
fzf_tmux_opts = {
|
|
||||||
["-p"] = "",
|
|
||||||
["-y"] = "1",
|
|
||||||
["-w"] = "95%",
|
|
||||||
["-h"] = "75%",
|
|
||||||
},
|
|
||||||
winopts = {
|
|
||||||
preview = {
|
|
||||||
hidden = "hidden", -- I don't like a preview, keep space for selection
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require("fzf-lua").register_ui_select()
|
|
18
home/programs/neovim/plugins/telescope-ctags-outline.lua
Normal file
18
home/programs/neovim/plugins/telescope-ctags-outline.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require('telescope').setup({
|
||||||
|
extensions = {
|
||||||
|
ctags_outline = {
|
||||||
|
ctags = { 'ctags' },
|
||||||
|
ft_opt = {
|
||||||
|
css = '--css-types=vcit',
|
||||||
|
fluid = '--xml-types=si',
|
||||||
|
markdown = '--Markdown-types=csStT',
|
||||||
|
rst = '--reStructuredText-types=csSt',
|
||||||
|
sql = '--SQL-types=tE',
|
||||||
|
xml = '--xml-types=ci',
|
||||||
|
yaml = '--Yaml-types=t',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
require('telescope').load_extension('ctags_outline')
|
31
home/programs/neovim/plugins/telescope.lua
Normal file
31
home/programs/neovim/plugins/telescope.lua
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
local telescope = require('telescope')
|
||||||
|
local actions = require('telescope.actions')
|
||||||
|
local actionsLayout = require('telescope.actions.layout')
|
||||||
|
|
||||||
|
telescope.setup({
|
||||||
|
defaults = {
|
||||||
|
layout_strategy = 'center',
|
||||||
|
layout_config = {
|
||||||
|
width = 0.6,
|
||||||
|
},
|
||||||
|
sorting_strategy = 'ascending',
|
||||||
|
default_mappings = {
|
||||||
|
i = {
|
||||||
|
["<C-j>"] = actions.move_selection_next,
|
||||||
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
["<C-c>"] = actions.close,
|
||||||
|
|
||||||
|
["<CR>"] = actions.select_default,
|
||||||
|
["<C-h>"] = actions.which_key,
|
||||||
|
["<C-v>"] = actions.select_vertical,
|
||||||
|
|
||||||
|
["<C-p>"] = actionsLayout.toggle_preview,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
preview = {
|
||||||
|
hide_on_startup = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
telescope.load_extension('custom_runs')
|
|
@ -21,14 +21,5 @@
|
||||||
|
|
||||||
sensibleOnTop = false;
|
sensibleOnTop = false;
|
||||||
|
|
||||||
plugins = with pkgs.tmuxPlugins; [
|
|
||||||
{
|
|
||||||
plugin = fzf-tmux-url;
|
|
||||||
extraConfig = ''
|
|
||||||
set -g @fzf-url-fzf-options '-p -y 1 -w 95% -h 75%'
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
extraConfig = builtins.readFile ../files/tmux;
|
extraConfig = builtins.readFile ../files/tmux;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue