Telescope: fix projects binding, add Telescope resume in default (#370)

* Telescope: fix projects binding, add Telescope resume in default

The projects command had a typo preventing it from working; the
keybinding description was the same as for Telescope files.
Added `<leader>fr` for Telescope resume per default.

* Add info to release notes
This commit is contained in:
ppenguin 2024-09-08 17:44:42 +02:00 committed by GitHub
parent 67abc51902
commit 9eb6159ca3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 73 additions and 64 deletions

View file

@ -150,3 +150,9 @@ configuration formats.
- `nvf-print-config-path` will display the path to _a clone_ of your - `nvf-print-config-path` will display the path to _a clone_ of your
`init.lua`. This is not the path used by the Neovim wrapper, but an `init.lua`. This is not the path used by the Neovim wrapper, but an
identical clone. identical clone.
[ppenguin](https://github.com/ppenguin):
- Telescope:
- Fixed `project-nvim` command and keybinding
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)

View file

@ -17,17 +17,19 @@
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim.startPlugins = [ vim = {
startPlugins = [
"telescope" "telescope"
"plenary-nvim" "plenary-nvim"
]; ];
vim.maps.normal = mkMerge [ maps.normal = mkMerge [
(mkSetBinding mappings.findFiles "<cmd> Telescope find_files<CR>") (mkSetBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
(mkSetBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>") (mkSetBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
(mkSetBinding mappings.buffers "<cmd> Telescope buffers<CR>") (mkSetBinding mappings.buffers "<cmd> Telescope buffers<CR>")
(mkSetBinding mappings.helpTags "<cmd> Telescope help_tags<CR>") (mkSetBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
(mkSetBinding mappings.open "<cmd> Telescope<CR>") (mkSetBinding mappings.open "<cmd> Telescope<CR>")
(mkSetBinding mappings.resume "<cmd> Telescope resume<CR>")
(mkSetBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>") (mkSetBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
(mkSetBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>") (mkSetBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
@ -53,11 +55,11 @@ in {
( (
mkIf config.vim.projects.project-nvim.enable mkIf config.vim.projects.project-nvim.enable
(mkSetBinding mappings.findProjects "<cmd Telescope projects<CR>") (mkSetBinding mappings.findProjects "<cmd> Telescope projects<CR>")
) )
]; ];
vim.binds.whichKey.register = pushDownDefault { binds.whichKey.register = pushDownDefault {
"<leader>f" = "+Telescope"; "<leader>f" = "+Telescope";
"<leader>fl" = "Telescope LSP"; "<leader>fl" = "Telescope LSP";
"<leader>fm" = "Cellular Automaton"; "<leader>fm" = "Cellular Automaton";
@ -65,7 +67,7 @@ in {
"<leader>fvc" = "Commits"; "<leader>fvc" = "Commits";
}; };
vim.pluginRC.telescope = entryAnywhere '' pluginRC.telescope = entryAnywhere ''
local telescope = require('telescope') local telescope = require('telescope')
telescope.setup(${toLuaObject cfg.setupOpts}) telescope.setup(${toLuaObject cfg.setupOpts})
@ -88,4 +90,5 @@ in {
} }
''; '';
}; };
};
} }

View file

@ -150,13 +150,13 @@
in { in {
options.vim.telescope = { options.vim.telescope = {
mappings = { mappings = {
findProjects = mkMappingOption "Find files [Telescope]" "<leader>fp"; findProjects = mkMappingOption "Find projects [Telescope]" "<leader>fp";
findFiles = mkMappingOption "Find files [Telescope]" "<leader>ff"; findFiles = mkMappingOption "Find files [Telescope]" "<leader>ff";
liveGrep = mkMappingOption "Live grep [Telescope]" "<leader>fg"; liveGrep = mkMappingOption "Live grep [Telescope]" "<leader>fg";
buffers = mkMappingOption "Buffers [Telescope]" "<leader>fb"; buffers = mkMappingOption "Buffers [Telescope]" "<leader>fb";
helpTags = mkMappingOption "Help tags [Telescope]" "<leader>fh"; helpTags = mkMappingOption "Help tags [Telescope]" "<leader>fh";
open = mkMappingOption "Open [Telescope]" "<leader>ft"; open = mkMappingOption "Open [Telescope]" "<leader>ft";
resume = mkMappingOption "Resume (previous search) [Telescope]" "<leader>fr";
gitCommits = mkMappingOption "Git commits [Telescope]" "<leader>fvcw"; gitCommits = mkMappingOption "Git commits [Telescope]" "<leader>fvcw";
gitBufferCommits = mkMappingOption "Git buffer commits [Telescope]" "<leader>fvcb"; gitBufferCommits = mkMappingOption "Git buffer commits [Telescope]" "<leader>fvcb";