nvim/after/plugin/telescope.lua
Simon Lasbrugnas 36df2834e5
feat: update nvim plugins and configurations
Update Neovim plugins and keybindings for an improved development experience
. Changes include the addition of `toggleterm.nvim` for better terminal support
, `conform.nvim` for easier configurations, new themes, AI assistance with `
neoai.nvim`, version control enhancements, and more. Removed unused themes and
 plugins to streamline the setup. Refactored keybindings for better navigation
 and usability.

ChatGPT is taking its job seriously
2023-11-15 06:38:23 +01:00

27 lines
1.1 KiB
Lua

local builtin = require('telescope.builtin')
-- Function to check if the current directory is a git directory
local function is_git_directory()
return vim.fn.system('git rev-parse --is-inside-work-tree') == 1
end
-- Custom function that calls git_files if in a git directory, otherwise find_files
local function custom_git_files()
if is_git_directory() then
builtin.git_files()
else
builtin.find_files()
end
end
-- Keybindings
vim.keymap.set('n', '<leader>pf', function()
builtin.find_files({ no_ignore = true, hidden = true })
end)
vim.keymap.set('n', '<C-p>', custom_git_files, {})
vim.keymap.set('n', '<leader>ps', function() builtin.live_grep() end)
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
vim.keymap.set('n', '<leader>fa', function() builtin.find_files({ follow = true, no_ignore = true, hidden = true }) end)
vim.keymap.set('n', '<leader>fb', function() builtin.buffers() end)
vim.keymap.set('n', '<leader>fc', function() builtin.git_commits() end)
vim.keymap.set('n', '<leader>gt', function() builtin.git_status() end)