refactor nvim plugins structure

This commit is contained in:
Alexander Navarro 2023-04-20 11:38:58 -04:00
parent f4bc3252ee
commit 5e6c1d45b9
6 changed files with 160 additions and 151 deletions

View file

@ -26,102 +26,5 @@ require("aleidk.keymaps")
require("aleidk.autocmds") require("aleidk.autocmds")
require("aleidk.IDE") require("aleidk.IDE")
-- [[ 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>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({
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = { "c", "cpp", "go", "lua", "python", "rust", "tsx", "typescript", "vimdoc", "vim" },
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false,
highlight = { enable = true },
indent = { enable = true, disable = { "python" } },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<c-space>",
node_incremental = "<c-space>",
scope_incremental = "<c-s>",
node_decremental = "<M-space>",
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
},
})
-- The line beneath this is called `modeline`. See `:help modeline` -- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et

View file

@ -0,0 +1,8 @@
return {
-- Add indentation guides even on blank lines
"lukas-reineke/indent-blankline.nvim",
opts = {
char = "",
show_trailing_blankline_indent = false,
},
}

View file

@ -8,8 +8,6 @@ return {
-- Detect tabstop and shiftwidth automatically -- Detect tabstop and shiftwidth automatically
"tpope/vim-sleuth", "tpope/vim-sleuth",
-- NOTE: This is where your plugins related to LSP can be installed.
-- The configuration is done below. Search for lspconfig to find it below.
{ {
-- LSP Configuration & Plugins -- LSP Configuration & Plugins
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
@ -33,8 +31,11 @@ return {
dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" }, dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" },
}, },
-- Useful plugin to show you pending keybinds. {
{ "folke/which-key.nvim", opts = {} }, -- Useful plugin to show you pending keybinds.
"folke/which-key.nvim",
opts = {},
},
{ {
-- Theme inspired by Atom -- Theme inspired by Atom
@ -45,59 +46,9 @@ return {
end, end,
}, },
{
-- Set lualine as statusline
"nvim-lualine/lualine.nvim",
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
theme = "onedark",
component_separators = "|",
section_separators = "",
},
},
},
{
-- Add indentation guides even on blank lines
"lukas-reineke/indent-blankline.nvim",
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
opts = {
char = "",
show_trailing_blankline_indent = false,
},
},
-- "gc" to comment visual regions/lines -- "gc" to comment visual regions/lines
{ "numToStr/Comment.nvim", opts = {} }, { "numToStr/Comment.nvim", opts = {} },
-- Fuzzy Finder (files, lsp, etc)
{ "nvim-telescope/telescope.nvim", version = "*", dependencies = { "nvim-lua/plenary.nvim" } },
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
{
"nvim-telescope/telescope-fzf-native.nvim",
-- NOTE: If you are having trouble with this installation,
-- refer to the README for telescope-fzf-native for more instructions.
build = "make",
cond = function()
return vim.fn.executable("make") == 1
end,
},
{
-- Highlight, edit, and navigate code
"nvim-treesitter/nvim-treesitter",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
build = ":TSUpdate",
},
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
-- These are some example plugins that I've included in the kickstart repository. -- These are some example plugins that I've included in the kickstart repository.
-- Uncomment any of the lines below to enable them. -- Uncomment any of the lines below to enable them.

View file

@ -0,0 +1,13 @@
return {
-- Set lualine as statusline
"nvim-lualine/lualine.nvim",
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
theme = "onedark",
component_separators = "|",
section_separators = "",
},
},
}

View file

@ -0,0 +1,65 @@
-- Fuzzy Finder (files, lsp, etc)
return {
"nvim-telescope/telescope.nvim",
version = "*",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{
-- Blazingly Fast Fuzzy Finder Algorithm for Telescope
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
cond = function()
return vim.fn.executable("make") == 1
end,
},
},
opts = {
defaults = {
mappings = {
i = {
["<c-u>"] = false,
["<c-d>"] = false,
},
},
},
},
config = function(_, opts)
local telescope = require("telescope")
telescope.setup(opts)
-- Enable telescope fzf native, if installed
pcall(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>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" })
end,
}

View file

@ -0,0 +1,69 @@
return {
-- Highlight, edit, and navigate code
"nvim-treesitter/nvim-treesitter",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
build = ":TSUpdate",
opts = {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = { "c", "cpp", "go", "lua", "python", "rust", "tsx", "typescript", "vimdoc", "vim" },
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false,
highlight = { enable = true },
indent = { enable = true, disable = { "python" } },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<c-space>",
node_incremental = "<c-space>",
scope_incremental = "<c-s>",
node_decremental = "<M-space>",
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
},
},
}