nvim updates

This commit is contained in:
2023-09-25 16:32:30 -04:00
parent 275baa228c
commit 966c050875
5 changed files with 94 additions and 60 deletions

View File

@@ -1,35 +0,0 @@
{
"bufdelete.nvim": { "branch": "master", "commit": "07d1f8ba79dec59d42b975a4df1c732b2e4e37b4" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-calc": { "branch": "main", "commit": "ce91d14d2e7a8b3f6ad86d85e34d41c1ae6268d9" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-spell": { "branch": "master", "commit": "32a0867efa59b43edbb2db67b0871cfad90c9b66" },
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
"diffview.nvim": { "branch": "main", "commit": "a111d19ccceac6530448d329c63f998f77b5626e" },
"lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
"lsp_signature.nvim": { "branch": "master", "commit": "bdf3dc7bb03edd25c2173e0e31c2fb122052ed23" },
"lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "2451adb9bdb0fd32140bf3aa8dbc17ff60050db3" },
"mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "71f1841ba6c652908678cece623f52c1fea8a6cd" },
"neogit": { "branch": "master", "commit": "dfacf16679b120c50c8a2dcefe00f77932523708" },
"nightfox.nvim": { "branch": "main", "commit": "ee3525fdfbe2ed81270a336ccbe62f433165357b" },
"nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" },
"nvim-lspconfig": { "branch": "master", "commit": "ede4114e1fd41acb121c70a27e1b026ac68c42d6" },
"nvim-treesitter": { "branch": "master", "commit": "0960322686bfa38afd4f1e0b9660473cf77e24b6" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" },
"nvim-web-devicons": { "branch": "master", "commit": "480a756df82a0c231622c9bf2173bb6634713716" },
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
"swift.nvim": { "branch": "main", "commit": "a84cb608b0076aef39d3d4b1d20448a86a73b2eb" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" },
"toggleterm.nvim": { "branch": "main", "commit": "0427b908ebefcb3701c7f2cfbdafa37d11afe71a" },
"vim-vsnip": { "branch": "master", "commit": "be277461265f1e5c7db470aa479f30956597ea9e" },
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }
}

View File

@@ -30,3 +30,33 @@ keymap("x", "J", ":move '>+1<CR>gv-gv", default_options)
-- Toggle nvim-tree open or closed
keymap("n", "<c-n>", "<CMD>:Neotree toggle<CR>", default_options)
-- LuaSnip Keymaps
local ls = require('luasnip')
-- <c-k> to expand snippets.
-- This will expand the snippet or jump to the next item within the snippet.
vim.keymap.set({ "i", "s" }, "<c-k>", function()
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end, { silent = true })
-- <c-j>
-- This will jump backwards in the snippet.
vim.keymap.set({ "i", "s" }, "<c-j>", function()
if ls.jumpable(-1) then
ls.jump(-1)
end
end, { silent = true })
-- <c-l>
-- This is for selecting withing a list of options.
vim.keymap.set("i", "<c-l>", function()
if ls.choice_active() then
ls.change_choice(1)
end
end, { silent = true })
-- Reload the snippets.
vim.keymap.set("n", "<leader><leader>s", "<cmd>source ~/.config/m-housh/lua/snippets/init.lua<cr>")

View File

@@ -6,7 +6,8 @@ return {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-vsnip",
--"hrsh7th/cmp-vsnip",
"saadparwaiz1/cmp_luasnip",
"f3fora/cmp-spell",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-emoji"
@@ -16,6 +17,7 @@ return {
local cmp = require "cmp"
local lspkind = require("lspkind")
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local luasnip = require('luasnip')
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
@@ -36,9 +38,10 @@ return {
lspkind.init({
symbol_map = {
Text = "",
Method = "",
Function = "",
Text = "",
Method = "󰡱",
Function = "󰡱",
Constructor = "",
Field = "",
Variable = "",
@@ -82,9 +85,9 @@ return {
},
experimental = {native_menu = false, ghost_text = false},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end
expand = function(args)
require('luasnip').lsp_expand(args.body)
end
},
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
@@ -98,15 +101,17 @@ return {
select = false
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, {"i", "s"}),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
@@ -117,9 +122,13 @@ return {
end, {"i", "s"})
},
sources = {
{name = "nvim_lsp"}, {name = "buffer", keyword_length = 5},
{name = "vsnip"}, {name = "calc"}, {name = "emoji"}, {name = "spell"},
{name = "path"}
{name = "nvim_lsp"},
{name = "buffer", keyword_length = 5},
{name = 'luasnip', option = { show_autosnippets = true } },
{name = "calc"},
{name = "emoji"},
{name = "spell"},
{name = "path"}
}
})

View File

@@ -1,12 +1,33 @@
-- This file contains plugin's that don't require much configuration.
return {
{
"hrsh7th/vim-vsnip",
config = function()
vim.g.vsnip_snippet_dir = os.getenv('HOME') .. '/.config/nvim/snippets/'
end
},
-- {
-- "hrsh7th/vim-vsnip",
-- config = function()
-- vim.g.vsnip_snippet_dir = os.getenv('HOME') .. '/.config/m-housh/snippets/'
-- end
-- },
-- {
-- dir = "~/LocalProjects/plugins/m-housh/swift.nvim"
-- }
{
"L3MON4D3/LuaSnip",
version = "2.*",
build = "make install_jsregexp",
config = function()
local luasnip = require('luasnip')
local types = require('luasnip.util.types')
luasnip.config.set_config {
history = true,
updateevents = "TextChanged,TextChangedI",
enable_autosnippets = true,
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = { { "<-", "Error" } },
},
},
},
}
end
}
}

View File

@@ -0,0 +1,9 @@
local ls = require('luasnip')
local s = ls.snippet
local sn = ls.snippet_node
local ms = ls.multi_snippet
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local t = ls.text_node