Not for normies
feat(nvim): add open file to leader . finder
1 file changed, +10 -0
+10-0nvim/lua/keymaps.lua
| @@ -23,6 +23,16 @@ vim.keymap.set('n', '<leader>.', function() | ||
| 23 | 23 | no_ignore = true, |
| 24 | 24 | previewer = false, |
| 25 | 25 | find_command = { 'rg', '--files', '--hidden', '--no-ignore', '--glob', '!.git/*', '--glob', '!target/*' }, |
| 26 | + attach_mappings = function(b, map) | |
| 27 | + local actions = require "telescope.actions" | |
| 28 | + local action_state = require "telescope.actions.state" | |
| 29 | + map({ "i", "n" }, "<C-o>", function() | |
| 30 | + local selection = action_state.get_selected_entry() | |
| 31 | + vim.cmd("!xdg-open " .. selection.path) | |
| 32 | + actions.close(b) | |
| 33 | + end) | |
| 34 | + return true | |
| 35 | + end | |
| 26 | 36 | }) |
| 27 | 37 | end, { desc = 'All Files' }) |
| 28 | 38 | for i = 1, 9 do |