summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorKyren223 <ulmliad223@gmail.com>2024-07-14 16:31:42 +0300
committerKyren223 <ulmliad223@gmail.com>2024-07-14 16:31:42 +0300
commit282c1c9db72670719d4d3e7b924d90d14228f06d (patch)
treef624044467648ec8ce49b7aca6ef21ec3c6aa5a4 /.config/nvim
parent0df12a6506bacc7afb709df7443bf31bcc3d84ed (diff)
Neovim: snippets now load automatically, changed TODO.md
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/TODO.md5
-rw-r--r--.config/nvim/lazy-lock.json1
-rw-r--r--.config/nvim/lua/custom/completion.lua13
3 files changed, 10 insertions, 9 deletions
diff --git a/.config/nvim/TODO.md b/.config/nvim/TODO.md
index c91c2b8..85b67d7 100644
--- a/.config/nvim/TODO.md
+++ b/.config/nvim/TODO.md
@@ -12,6 +12,7 @@
- TODO: Look for a list of sources for completions to add more cool stuff https://github.com/hrsh7th/nvim-cmp/wiki/List-of-sources
- TODO: learn what dot repeat is
+- TODO: Configure more text objects (they are amazing!)
# VERY IMPORTANT
@@ -21,10 +22,6 @@ Sort quickfix actions to be first and then the rest less important ones
Alt enter should show a list of code actions
A lightbulb somewhere ONLY if the cursor (not line) has a code action and ONLY if it's a quickfix
-## TODO: Completions and snippets
-Make my own snippets per file type
-HAVE ACTUAL GOOD SORTING FOR SNIPPETS (hopefully this is possible)
-
# Look at in the future
- Database integration plugins
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json
index 74c9ded..301fbf4 100644
--- a/.config/nvim/lazy-lock.json
+++ b/.config/nvim/lazy-lock.json
@@ -49,6 +49,7 @@
"nvim-spectre": { "branch": "master", "commit": "9a28f926d3371b7ef02243cbbb653a0478d06e31" },
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
"nvim-treesitter": { "branch": "master", "commit": "c1ad655b6a0c83ab48e55240f367e2bc0c15af31" },
+ "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
"nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" },
"octo.nvim": { "branch": "master", "commit": "aa5dfa573220a0a511a25ee14ce1570b6c23e56a" },
"oil.nvim": { "branch": "master", "commit": "10fbfdd37b6904c0776c5db1a27ab47eecba335e" },
diff --git a/.config/nvim/lua/custom/completion.lua b/.config/nvim/lua/custom/completion.lua
index 85a963f..5cf8c7b 100644
--- a/.config/nvim/lua/custom/completion.lua
+++ b/.config/nvim/lua/custom/completion.lua
@@ -1,4 +1,7 @@
-require('custom.snippets.lua')
+for _, ft_path in ipairs(vim.api.nvim_get_runtime_file('lua/custom/snippets/*.lua', true)) do
+ loadfile(ft_path)()
+end
+
local luasnip = require('luasnip')
local lspkind = require('lspkind')
local cmp = require('cmp')
@@ -37,10 +40,10 @@ cmp.setup({
enabled = is_enabled,
completion = { completeopt = 'menu,menuone,noinsert' },
sources = cmp.config.sources({
- { name = 'nvim_lsp' }, -- for lsp
- { name = 'luasnip' }, -- for snippets
+ { name = 'nvim_lsp' }, -- for lsp
+ { name = 'luasnip' }, -- for snippets
{ name = 'lazydev', group_index = 0 }, -- for lazydev.nvim
- { name = 'path' }, -- for filesystem
+ { name = 'path' }, -- for filesystem
}, {}),
snippet = {
expand = function(args)
@@ -73,7 +76,7 @@ cmp.setup({
format = function(entry, vim_item)
local kind = lspkind.cmp_format({ mode = 'symbol_text', maxwidth = 50 })(entry, vim_item)
local strings = vim.split(kind.kind, '%s', { trimempty = true })
- kind.kind = ' ' .. (strings[1] or '') .. ' ' -- left (icon)
+ kind.kind = ' ' .. (strings[1] or '') .. ' ' -- left (icon)
kind.menu = ' ' .. (strings[2] or '') .. '' -- right (text)
return kind
end,