add treesitter, which-key, nvim-cmp
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
{
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "be5b788f2dc1522c73fb7afad9092331c8aebe80" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "855c97005c8eebcdd19846f2e54706bffd40ee96" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ keymap.set("n", "<leader>nh", ":nohl<CR>", { desc = "Clear search highlights" })
|
||||
keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" })
|
||||
keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" })
|
||||
|
||||
-- keymap.set("n", "<leader>e", "<cmd>Explore<CR>", { desc = fFile Explore" })
|
||||
keymap.set("n", "<leader>=", "z=", { desc = "Spell check alternatives" })
|
||||
|
||||
-- window management
|
||||
keymap.set("n", "<leader>wv", "<C-w>v", { desc = "Split window vertically" })
|
||||
@@ -30,10 +30,3 @@ keymap.set("n", "<leader>rj", "<cmd>resize -5<CR>", { desc = "Decrease window he
|
||||
keymap.set("n", "<leader>rl", "<cmd>vertical resize +5<CR>", { desc = "Increase window width" })
|
||||
keymap.set("n", "<leader>rh", "<cmd>vertical resize -5<CR>", { desc = "Decrease window width" })
|
||||
|
||||
-- fuzzy find
|
||||
--local builtin = require('telescope.builtin')
|
||||
--vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
||||
--vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||
--vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
--vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ local opt = vim.opt
|
||||
|
||||
opt.relativenumber = true
|
||||
opt.number = true
|
||||
opt.spell = true
|
||||
|
||||
-- tabs & indentation
|
||||
opt.tabstop = 2 -- 2 spaces for tabs (prettier default)
|
||||
@@ -30,4 +31,4 @@ opt.clipboard:append("unnamedplus") -- use system clipboard as default register
|
||||
|
||||
-- split windows
|
||||
opt.splitright = true -- split vertical window to the right
|
||||
opt.splitbelow = true -- split horizantal window to the bottom
|
||||
opt.splitbelow = true -- split horizontal window to the bottom
|
||||
|
||||
84
lua/dkelly/plugins/nvim-cmp.lua
Normal file
84
lua/dkelly/plugins/nvim-cmp.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
return {
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = {
|
||||
-- Core completion sources
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
-- 'hrsh7th/cmp-treesitter', -- Uncomment if you have a cmp-treesitter source
|
||||
-- Cmdline support
|
||||
'hrsh7th/cmp-cmdline',
|
||||
-- Icons
|
||||
'onsails/lspkind-nvim',
|
||||
|
||||
-- Extras you can enable later:
|
||||
-- 'windwp/nvim-autopairs', -- autopairs integration
|
||||
-- 'lukas-reineke/cmp-under-comparator', -- fuzzy sorting
|
||||
},
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
cmp.setup({
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text", -- or "symbol" for just icons, "text" for just text
|
||||
maxwidth = 50,
|
||||
}),
|
||||
},
|
||||
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
-- no-op, snippet engine not installed
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = {
|
||||
['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
},
|
||||
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
-- { name = 'treesitter' }, -- Uncomment if you actually have cmp-treesitter
|
||||
}),
|
||||
|
||||
-- Extras you can enable later:
|
||||
-- window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
-- },
|
||||
|
||||
-- experimental = {
|
||||
-- ghost_text = true,
|
||||
-- },
|
||||
})
|
||||
|
||||
-- Cmdline completion for : (commands & paths)
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' },
|
||||
{ name = 'cmdline' },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Search completion for / (buffer)
|
||||
cmp.setup.cmdline('/', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' },
|
||||
},
|
||||
})
|
||||
|
||||
-- Autopairs integration (uncomment when you install nvim-autopairs)
|
||||
-- require('nvim-autopairs').setup{}
|
||||
-- local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
-- cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||
|
||||
-- Fuzzy sorting (uncomment when you install cmp-under-comparator)
|
||||
-- table.insert(cmp.config.sorting.comparators, require('cmp-under-comparator').under)
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim'},
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{'nvim-telescope/telescope-fzf-native.nvim', build = 'make'},
|
||||
'nvim-tree-/nvim-web-devicons',
|
||||
},
|
||||
config = function ()
|
||||
local telescope = require("telescope")
|
||||
telescope.load_extension("fzf")
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
vim.keymap.set('n', '<leader>fs', '<cmd>Telescope grep_string<cr>', { desc = 'Telescope string under cursor' })
|
||||
end
|
||||
}
|
||||
|
||||
46
lua/dkelly/plugins/treesitter.lua
Normal file
46
lua/dkelly/plugins/treesitter.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
"windwp/nvim-ts-autotag",
|
||||
},
|
||||
config = function()
|
||||
local treesitter = require("nvim-treesitter.configs")
|
||||
treesitter.setup({
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
autotag = { enable = true },
|
||||
ensure_installed = {
|
||||
-- Main programming languages
|
||||
"bash", "c", "cpp", "css", "go", "html", "javascript", "json", "lua",
|
||||
"make", "markdown", "markdown_inline", "python", "regex", "ruby",
|
||||
"rust", "toml", "tsx", "typescript", "vim",
|
||||
-- Popular config and data formats
|
||||
"dockerfile", "git_config", "gitignore", "gitattributes",
|
||||
"graphql", "ini", "sql", "xml", "csv", "mermaid",
|
||||
-- Infra/DevOps/Cloud
|
||||
"terraform", "hcl",
|
||||
-- Scripting/misc
|
||||
"perl", "r", "powershell", "fish",
|
||||
-- Documentation & web
|
||||
"latex", "scss",
|
||||
-- System
|
||||
"cmake", "nix",
|
||||
-- Other Neovim-related
|
||||
"vimdoc",
|
||||
"yaml",
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
9
lua/dkelly/plugins/which-key.lua
Normal file
9
lua/dkelly/plugins/which-key.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 500
|
||||
end,
|
||||
opt = {}
|
||||
}
|
||||
Reference in New Issue
Block a user