feat: add Neovim config

main
sgoudham 1 year ago
parent 6a47ac33f5
commit 76f234e538
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -1,4 +1,14 @@
{pkgs, ...}: { {
config,
pkgs,
flakePath,
...
}: let
symlink = fileName: {recursive ? false}: {
source = config.lib.file.mkOutOfStoreSymlink "${flakePath}/${fileName}";
inherit recursive;
};
in {
programs.neovim = { programs.neovim = {
enable = true; enable = true;
vimAlias = true; vimAlias = true;
@ -22,7 +32,7 @@
SUDO_EDITOR = "nvim"; SUDO_EDITOR = "nvim";
}; };
programs.fish.shellAbbrs = { xdg.configFile = {
"lvim" = "NVIM_APPNAME=lazyvim nvim"; "nvim" = symlink "home/apps/nvim" {recursive = true;};
}; };
} }

@ -0,0 +1,15 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": true
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
}
}
}
}

@ -0,0 +1,2 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")

@ -0,0 +1,62 @@
{
"LazyVim": { "branch": "main", "commit": "abea2807ce13c994d5697f0ff19d80f85f678b1b" },
"LuaSnip": { "branch": "master", "commit": "a658ae2906344a1d2b9c507738e585cf68e685c7" },
"SchemaStore.nvim": { "branch": "main", "commit": "78c53f2ce05b7209bf5e2e2b2e25c72a3c1444b2" },
"alpha-nvim": { "branch": "main", "commit": "9e33db324b8bb7a147bce9ea5496686ee859461d" },
"catppuccin": { "branch": "main", "commit": "278bfeb61bd627dc2a8885180a0441a1ebe65a41" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"crates.nvim": { "branch": "main", "commit": "4ce7c51b881e58f1e2f8f437f30e4e583cbac319" },
"dressing.nvim": { "branch": "master", "commit": "e6eff7a5a950a853c3903d906dbcea03f778db5f" },
"friendly-snippets": { "branch": "main", "commit": "7f6681b7d1eebba024f0caf6576fc1e94578b9cc" },
"gitsigns.nvim": { "branch": "main", "commit": "dc2962f7fce953a2a98e7c6d3d7fc4c1d1f66758" },
"indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" },
"lazy.nvim": { "branch": "main", "commit": "5af331ea65418dc9361769891921fdee4bcc837a" },
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "82685fdd0f67a694b244cb058b83761f54664d68" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "e4d56b400e9757b1dc77d620fd3069396e92d5fc" },
"mason.nvim": { "branch": "main", "commit": "5ad3e113b0c3fde3caba8630599373046f6197e8" },
"mini.ai": { "branch": "main", "commit": "5218ea75e635df78a807bc9d5a7162594fb76d02" },
"mini.comment": { "branch": "main", "commit": "877acea5b2a32ff55f808fc0ebe9aa898648318c" },
"mini.indentscope": { "branch": "main", "commit": "f60e9b51a6214c73a170ffc5445ce91560981031" },
"mini.pairs": { "branch": "main", "commit": "dfa9f6e2576bb8853be277d96b735af59d9be7c2" },
"mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "7f6fa04dbd8e8c79d1af33bc90e856b65d8641da" },
"neoconf.nvim": { "branch": "main", "commit": "08f146d53e075055500dca35e93281faff95716b" },
"neodev.nvim": { "branch": "main", "commit": "0705c72c281626f45c78d0916151d3e2bfb53fae" },
"neotest-rust": { "branch": "main", "commit": "6dce8963e5395adf079bf22e931dfce65d3fed25" },
"noice.nvim": { "branch": "main", "commit": "6c87c1d11c38180fb72bf8f45518a0a3e081afc1" },
"nui.nvim": { "branch": "main", "commit": "d146966a423e60699b084eeb28489fe3b6427599" },
"null-ls.nvim": { "branch": "main", "commit": "db09b6c691def0038c456551e4e2772186449f35" },
"nvim-cmp": { "branch": "main", "commit": "2743dd989e9b932e1b4813a4927d7b84272a14e2" },
"nvim-dap": { "branch": "master", "commit": "bb1ddce6cd951ef3c1319e4fd8596131113163c3" },
"nvim-dap-ui": { "branch": "master", "commit": "c020f660b02772f9f3d11f599fefad3268628a9e" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" },
"nvim-lspconfig": { "branch": "master", "commit": "deade69789089c3da15237697156334fb3e943f0" },
"nvim-navic": { "branch": "master", "commit": "6e8850a524307814decc1b195a2c8a51482a9886" },
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
"nvim-spectre": { "branch": "master", "commit": "dc3f0bd41e09148924ef04a4746cb708539d08db" },
"nvim-treesitter": { "branch": "master", "commit": "d9104a1d10023ed9e7eacf68639ad887425246eb" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "52f1f3280d9092bfaee5c45be5962fabee3d9654" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7f625207f225eea97ef7a6abe7611e556c396d2f" },
"nvim-web-devicons": { "branch": "master", "commit": "9ab9b0b894b2388a9dbcdee5f00ce72e25d85bf9" },
"persistence.nvim": { "branch": "main", "commit": "4b8051c01f696d8849a5cb8afa9767be8db16e40" },
"plenary.nvim": { "branch": "master", "commit": "bda256fab0eb66a15e8190937e417e6a14ee5d72" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" },
"telescope.nvim": { "branch": "master", "commit": "276362a8020c6e94c7a76d49aa00d4923b0c02f3" },
"todo-comments.nvim": { "branch": "main", "commit": "09b0b17d824d2d56f02ff15967e8a2499a89c731" },
"toggleterm.nvim": { "branch": "main", "commit": "2249e974faed67e795ffc2ca2be13b93c5d51938" },
"tokyonight.nvim": { "branch": "main", "commit": "284667adfff02b9a0adc65968c553c6096b543b6" },
"trouble.nvim": { "branch": "main", "commit": "d99e2abd10808ef91738ce98a5c767e6a51df449" },
"typescript.nvim": { "branch": "main", "commit": "de304087e6e49981fde01af8ccc5b21e8519306f" },
"vim-illuminate": { "branch": "master", "commit": "a2907275a6899c570d16e95b9db5fd921c167502" },
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
"vim-startuptime": { "branch": "master", "commit": "454b3de856b7bd298700de33d79774ca9b9e3875" },
"vimtex": { "branch": "master", "commit": "bab96ed04dd951b22663b08c670ff33960fc6419" },
"which-key.nvim": { "branch": "main", "commit": "d871f2b664afd5aed3dc1d1573bef2fb24ce0484" }
}

@ -0,0 +1,3 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here

@ -0,0 +1,52 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
local function unmap(mode, key)
vim.keymap.del(mode, key, {})
end
unmap("n", "<leader>ww")
unmap("n", "<leader>w-")
unmap("n", "<leader>w|")
unmap("n", "<leader>wd")
unmap("n", "<leader>l")
unmap("n", "H")
unmap("n", "L")
unmap("i", "<M-j>")
unmap("i", "<M-k>")
require("which-key").register({
["<leader>w"] = "which_key_ignore",
})
local function map(mode, lhs, rhs, opts)
local keys = require("lazy.core.handler").handlers.keys
---@cast keys LazyKeysHandler
-- do not create the keymap if a lazy keys handler exists
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
opts = opts or {}
opts.silent = opts.silent ~= false
if opts.remap and not vim.g.vscode then
opts.remap = nil
end
vim.keymap.set(mode, lhs, rhs, opts)
end
end
map("n", "0", "0^", { desc = "which_key_ignore " })
map("n", "<CR>", "o<ESC>", { desc = "which_key_ignore " })
map("n", "<C-u>", "<C-u>zz", { desc = "which_key_ignore " })
map("n", "<C-d>", "<C-d>zz", { desc = "which_key_ignore " })
map("n", "<leader>w", "<cmd>w<CR>", { desc = "which_key_ignore", nowait = true })
map("n", "<leader>Q", "<cmd>qa<CR>", { desc = "which_key_ignore" })
map("n", "<leader>q", "<cmd>q<CR>", { desc = "which_key_ignore", nowait = true })
-- Clipboard
map("n", "<leader>y", [["+y]], { desc = "which_key_ignore" })
map("n", "<leader>p", [["+p]], { desc = "which_key_ignore" })
map("n", "<M-h>", "<C-w>h", { desc = "Go to left window", remap = true })
map("n", "<M-j>", "<C-w>j", { desc = "Go to lower window", remap = true })
map("n", "<M-k>", "<C-w>k", { desc = "Go to upper window", remap = true })
map("n", "<M-l>", "<C-w>l", { desc = "Go to right window", remap = true })

@ -0,0 +1,38 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
-- bootstrap lazy.nvim
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.lang.rust" },
{ import = "lazyvim.plugins.extras.util.project" },
{ import = "lazyvim.plugins.extras.dap.core" },
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "plugins" },
},
defaults = {
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
},
install = { colorscheme = { "catppuccin" } },
checker = { enabled = true }, -- automatically check for plugin updates
performance = {
rtp = {
disabled_plugins = {
"gzip",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

@ -0,0 +1,10 @@
-- 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.conceallevel = 0
vim.opt.clipboard = ""
vim.opt.laststatus = 3
vim.opt.cmdheight = 0
vim.opt.updatetime = 100
vim.opt.list = false

@ -0,0 +1,25 @@
return {
{
"catppuccin/nvim",
name = "catppuccin",
opts = {
styles = { -- Handles the styles of general hi groups (see `:h highlight-args`):
comments = { "italic" }, -- Change the style of comments
},
integrations = {
navic = {
custom_bg = "#181825",
},
},
custom_highlights = function(c)
return {
["@parameter"] = { style = {} },
["@conditional"] = { style = {} },
Conditional = { style = {} },
["@namespace"] = { style = {} },
MiniIndentscopeSymbol = { fg = c.pink },
}
end,
},
},
}

@ -0,0 +1,26 @@
return {
{
"ggandor/leap.nvim",
enabled = false,
keys = false,
config = function() end,
},
{
"ggandor/flit.nvim",
enabled = false,
keys = false,
config = function() end,
},
{
"akinsho/bufferline.nvim",
enabled = false,
keys = false,
config = function() end,
},
{
"echasnovski/mini.bufremove",
enabled = false,
keys = false,
config = function() end,
},
}

@ -0,0 +1,8 @@
return {
{
"andweeb/presence.nvim",
opts = {
neovim_image_text = "Home Sweet Home",
},
},
}

@ -0,0 +1,66 @@
return {
{
"LazyVim/LazyVim",
opts = {
colorscheme = "catppuccin",
},
},
{
"folke/noice.nvim",
opts = {
presets = {
lsp_doc_border = true,
},
},
},
{
"folke/persistence.nvim",
keys = function()
-- stylua: ignore
return {
{ "<leader>as", function() require("persistence").load() end, desc = "Restore Session", },
{ "<leader>al", function() require("persistence").load({ last = true }) end, desc = "Restore Last Session", },
{ "<leader>ad", function() require("persistence").stop() end, desc = "Don't Save Current Session", },
}
end,
},
{
"nvim-neo-tree/neo-tree.nvim",
opts = {
window = {
mappings = {
["o"] = "open",
},
},
},
},
{
"stevearc/dressing.nvim",
opts = {
input = {
insert_only = false,
},
},
},
{
"akinsho/toggleterm.nvim",
config = true,
cmd = "ToggleTerm",
keys = {
{ [[<C-/>]], "<cmd>ToggleTerm<cr>", desc = "Toggle Terminal" },
},
opts = {
-- TODO: Add in keymaps for <M-hjkl> for toggleterm
open_mapping = [[<C-/]],
direction = "vertical",
size = vim.o.columns * 0.5,
shade_filetypes = {},
autochdir = true,
hide_numbers = true,
insert_mappings = true,
terminal_mappings = true,
start_in_insert = true,
shell = "fish",
},
},
}

@ -0,0 +1,102 @@
return {
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
diagnostics = {
underline = false,
},
inlay_hints = {
enabled = true,
},
autoformat = false,
---@type lspconfig.options
servers = {
lua_ls = {
---@type LazyKeys[]
settings = {
Lua = {
telemetry = {
enabled = false,
},
},
},
},
},
},
},
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-emoji",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require("luasnip")
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<M-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<M-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-p>"] = cmp.mapping.scroll_docs(-4),
["<C-n>"] = cmp.mapping.scroll_docs(4),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
-- You could replace select_next_item() with confirm({ select = true }) to get VS Code autocompletion behavior
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- this way you will only jump inside the snippet region
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(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
})
end,
},
{
"simrat39/rust-tools.nvim",
opts = {
tools = {
inlay_hints = {
auto = false,
},
},
},
},
{
"lervag/vimtex",
},
{
"echasnovski/mini.surround",
opts = {
mappings = {
add = "gsa",
delete = "gsd",
find = "gsf",
find_left = "gsF",
highlight = "gsh",
replace = "gsr",
update_n_lines = "gsn",
},
},
},
}

@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 120
Loading…
Cancel
Save