summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2023-06-03 12:22:09 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2023-06-03 12:22:09 -0600
commitad9bdf2f20ce1357c788a749117a3a5d2d3a3c01 (patch)
tree6503f3b07d1cf5f38187dda84f0d22812c7dd936
parent5ecf844b1f2efbdc86b1653483f17d7ecb39f8ee (diff)
move some mappings into telescope config, separate fzf
-rw-r--r--init.lua40
-rw-r--r--lua/plugins/init.lua12
-rw-r--r--lua/plugins/neo-tree.lua7
-rw-r--r--lua/plugins/telescope-fzf-native.lua8
-rw-r--r--lua/plugins/telescope.lua36
5 files changed, 48 insertions, 55 deletions
diff --git a/init.lua b/init.lua
index 160aef6..9bc1bbf 100644
--- a/init.lua
+++ b/init.lua
@@ -82,40 +82,6 @@ vim.api.nvim_create_autocmd('TextYankPost', {
pattern = '*',
})
--- [[ Configure Telescope ]]
--- See `:help telescope` and `:help telescope.setup()`
-require('telescope').setup {
- defaults = {
- mappings = {
- i = {
- ['<C-u>'] = false,
- ['<C-d>'] = false,
- },
- },
- },
-}
-
--- Enable telescope fzf native, if installed
-pcall(require('telescope').load_extension, 'fzf')
-
--- See `:help telescope.builtin`
-vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
-vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
-vim.keymap.set('n', '<leader>/', function()
- -- You can pass additional configuration to telescope to change theme, layout, etc.
- require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
- winblend = 10,
- previewer = false,
- })
-end, { desc = '[/] Fuzzily search in current buffer' })
-
-vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
-vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
-vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
-vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
-vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
-vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
-
-- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
@@ -191,12 +157,6 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
-- [[ Configure LSP ]]
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
- -- NOTE: Remember that lua is a real programming language, and as such it is possible
- -- to define small helper and utility functions so you don't have to repeat yourself
- -- many times.
- --
- -- In this case, we create a function that lets us more easily define mappings specific
- -- for LSP related items. It sets the mode, buffer and description for us each time.
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua
index b9f4cbb..9478ab5 100644
--- a/lua/plugins/init.lua
+++ b/lua/plugins/init.lua
@@ -74,18 +74,6 @@ return {
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
- -- Fuzzy Finder (files, lsp, etc)
- { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } },
-
- -- Fuzzy Finder Algorithm which requires local dependencies to be built
- {
- 'nvim-telescope/telescope-fzf-native.nvim',
- build = 'make',
- cond = function()
- return vim.fn.executable 'make' == 1
- end,
- },
-
{
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua
index e83de80..64b0549 100644
--- a/lua/plugins/neo-tree.lua
+++ b/lua/plugins/neo-tree.lua
@@ -2,9 +2,6 @@ return {
'nvim-neo-tree/neo-tree.nvim',
cmd = 'Neotree',
version = '*',
- keys = {
- { '<leader>nt', '<CMD>Neotree toggle<CR>', desc = 'Toggle [N]eo[t]ree' },
- },
dependencies = {
'nvim-lua/plenary.nvim',
'MunifTanjim/nui.nvim',
@@ -16,4 +13,8 @@ return {
hijack_netrw_behavior = 'open_current',
},
},
+ -- keys is used for Lazy-load
+ keys = {
+ { '<leader>nt', '<CMD>Neotree toggle<CR>', desc = 'Toggle [N]eo[t]ree' },
+ },
}
diff --git a/lua/plugins/telescope-fzf-native.lua b/lua/plugins/telescope-fzf-native.lua
new file mode 100644
index 0000000..1fe2371
--- /dev/null
+++ b/lua/plugins/telescope-fzf-native.lua
@@ -0,0 +1,8 @@
+return {
+ 'nvim-telescope/telescope-fzf-native.nvim',
+ build = 'make',
+ config = function()
+ pcall(require('telescope').load_extension, 'fzf')
+ return vim.fn.executable 'make' == 1
+ end,
+}
diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua
new file mode 100644
index 0000000..d182d7c
--- /dev/null
+++ b/lua/plugins/telescope.lua
@@ -0,0 +1,36 @@
+return {
+ 'nvim-telescope/telescope.nvim',
+ branch = '0.1.x',
+ dependencies = {
+ 'nvim-lua/plenary.nvim',
+ },
+ opts = {
+ defaults = {
+ mappings = {
+ i = {
+ ['<C-u>'] = false,
+ ['<C-d>'] = false,
+ },
+ },
+ },
+ },
+ -- Best place to key keymaps in this file
+ config = function()
+ vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
+ vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
+ vim.keymap.set('n', '<leader>/', function()
+ -- You can pass additional configuration to telescope to change theme, layout, etc.
+ require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
+ winblend = 10,
+ previewer = false,
+ })
+ end, { desc = '[/] Fuzzily search in current buffer' })
+ vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
+ vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
+ vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
+ vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
+ vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
+ vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
+ -- Other keybinds present for the LSP currently at init.lua
+ end,
+}