neovim tinkering

This commit is contained in:
Bryan Ramos 2023-06-11 02:33:10 -04:00
parent 5551b085c0
commit 8b5b763920
17 changed files with 36 additions and 346 deletions

View file

@ -2,11 +2,6 @@
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.expandtab = true
local lsp = require("lsp-zero").preset({})
lsp.on_attach(function(client, bufnr)
@ -46,7 +41,7 @@ cmp.setup({
},
sources = {
{ name = "nvim_lsp" },
-- { name = "luasnip" },
{ name = "luasnip" },
-- other sources...
},
-- other configurations...
@ -72,14 +67,14 @@ cmp.setup({
if vim.api.nvim_get_mode().mode == "c" then
return true
else
return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment")
return not context.in_treesitter_capture("comment") and not context.in_syntax_group("comment")
end
end,
mapping = {
["<Tab>"] = cmp.mapping(function(fallback)
["<tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- you could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
@ -90,7 +85,7 @@ cmp.setup({
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
["<s-tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
@ -100,16 +95,14 @@ cmp.setup({
end
end, { "i", "s" }),
["<CR>"] = cmp.mapping({
["<cr>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
cmp.confirm({ behavior = cmp.confirmbehavior.replace, select = true })
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
}),
},
})

View file

@ -2,5 +2,7 @@
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
vim.api.nvim_set_keymap('n', '<C-U>', '<C-U>zz', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-D>', '<C-D>zz', { noremap = true })
vim.keymap.set("n", "<C-K>", "<C-U>zz", { silent = true })
vim.keymap.set("n", "<C-J>", "<C-D>zz", { silent = true })
vim.keymap.set("n", "<C-L>", "w", { silent = true })
vim.keymap.set("n", "<C-H>", "b", { silent = true })

View file

@ -11,7 +11,7 @@ require("lazy").setup({
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import any extras modules here
{ import = "lazyvim.plugins.extras.ui.mini-animate" },
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
-- import/override with your plugins
{ import = "plugins" },
},

View file

@ -1,3 +1,18 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undofile = true
vim.opt.guicursor = "n-v-c:block,i:block,r:block"

View file

@ -25,7 +25,10 @@ return {
-- Autocompletion
{ "hrsh7th/nvim-cmp" }, -- Required
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-path" },
{ "hrsh7th/cmp-nvim-lsp" }, -- Required
{ "L3MON4D3/LuaSnip" }, -- Required
},
},