feat(nvim): Build another nvim from scratch

* Neovim: Backup original LazyVim setup to .config/nvim.lazy.d
* Neovim: Currently done with basic completions and LSP
* Git: Always use ssh to connect github remote
* Zsh: Add more antidots config
This commit is contained in:
js0ny 2024-11-28 01:48:26 +00:00
parent 74f2883139
commit eeb3387112
53 changed files with 1617 additions and 682 deletions

View file

@ -0,0 +1,71 @@
--- Available LSP goes here
--- Check https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
--- for available server and name
return {
"hrsh7th/nvim-cmp",
lazy = false,
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
},
config = function()
local cmp = require("cmp")
local lspconfig = require("lspconfig")
local capabitilies = require("cmp_nvim_lsp").default_capabilities()
local servers = require("config.servers")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
sources = cmp.config.sources(
-- This order defines the priority of sources.
{
{ name = "nvim_lsp" },
{ name = "luasnip" },
},
{
{ name = "buffer" },
{ name = "path" },
}
),
})
local keymaps = require("config.keymaps")
local keymaps_cmp = keymaps.cmp_nvim_keymaps(cmp.mapping)
local function set_keymaps()
local mappings = {}
for _, map in ipairs(keymaps_cmp) do
mappings[map.keys] = map.cmd
end
return mappings
end
cmp.setup.mapping = cmp.mapping.preset.insert(set_keymaps())
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "cmdline" },
-- Use `path` is slow under WSL since WSL loads Windows paths
-- https://github.com/zsh-users/zsh-syntax-highlighting/issues/790
-- { name = "path" },
}
})
for _, server in ipairs(servers) do
lspconfig[server].setup({
capabilities = capabitilies,
})
end
end,
}