Skip to content

Commit

Permalink
Use built-in snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
Shatur committed May 23, 2024
1 parent 62b5112 commit 8c65fc9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 19 deletions.
8 changes: 0 additions & 8 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
path = pack/plugins/start/neogit
url = [email protected]:NeogitOrg/neogit.git
ignore = dirty
[submodule "pack/plugins/start/LuaSnip"]
path = pack/plugins/start/LuaSnip
url = [email protected]:L3MON4D3/LuaSnip.git
ignore = dirty
[submodule "pack/plugins/start/nvim-dap-virtual-text"]
path = pack/plugins/start/nvim-dap-virtual-text
url = [email protected]:theHamsta/nvim-dap-virtual-text.git
Expand Down Expand Up @@ -98,10 +94,6 @@
path = pack/plugins/start/cmp-buffer
url = [email protected]:hrsh7th/cmp-buffer.git
ignore = dirty
[submodule "pack/plugins/start/cmp_luasnip"]
path = pack/plugins/start/cmp_luasnip
url = [email protected]:saadparwaiz1/cmp_luasnip.git
ignore = dirty
[submodule "pack/plugins/start/cmp-nvim-lsp"]
path = pack/plugins/start/cmp-nvim-lsp
url = [email protected]:hrsh7th/cmp-nvim-lsp.git
Expand Down
9 changes: 9 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ vim.keymap.set({ 'i', 't' }, '<A-q>', '<Esc><Cmd>tabclose<CR>', { noremap = true
vim.keymap.set('', ']t', vim.cmd.tabnext, { noremap = true, desc = 'Go to next tab' })
vim.keymap.set('', '[t', vim.cmd.tabprevious, { noremap = true, desc = 'Go to next tab' })

-- Snippets
vim.keymap.set({ 'i', 's' }, '<Tab>', function()
if vim.snippet.active({ direction = 1 }) then
return '<cmd>lua vim.snippet.jump(1)<cr>'
else
return '<Tab>'
end
end, { expr = true })

-- Other
vim.keymap.set('', '<Leader>cd', '<Cmd>cd %:h<CR>', { noremap = true, desc = 'Change directory to current file folder' })
vim.keymap.set('', '<Backspace>', '<Cmd>buffer #<CR>', { noremap = true, desc = 'Back to previous buffer' })
Expand Down
1 change: 0 additions & 1 deletion pack/plugins/start/LuaSnip
Submodule LuaSnip deleted from de1a28
1 change: 0 additions & 1 deletion pack/plugins/start/cmp_luasnip
Submodule cmp_luasnip deleted from 05a9ab
4 changes: 1 addition & 3 deletions plugin/cmp.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
local luasnip = require('luasnip')
local cmp = require('cmp')
local cmp_autopairs = require('nvim-autopairs.completion.cmp')

Expand Down Expand Up @@ -36,7 +35,6 @@ local completion_types = {
cmp.setup({
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'crates' },
{ name = 'git' },
{ name = 'buffer' },
Expand All @@ -55,7 +53,7 @@ cmp.setup({
end,
}),
snippet = {
expand = function(args) luasnip.lsp_expand(args.body) end,
expand = function(args) vim.snippet.expand(args.body) end,
},
formatting = {
fields = { 'kind', 'abbr', 'menu' },
Expand Down
6 changes: 0 additions & 6 deletions plugin/luasnip.lua

This file was deleted.

0 comments on commit 8c65fc9

Please sign in to comment.