mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 00:29:43 -04:00
Attempt to switch to non-lazyvim neovim configuration
This commit is contained in:
parent
b24102d423
commit
854d0c583c
27 changed files with 247 additions and 170 deletions
5
src/user/modules/utils/modules/neovim/.luarc.json
Normal file
5
src/user/modules/utils/modules/neovim/.luarc.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"diagnostics.disable": [
|
||||
"missing-fields"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,2 +1,11 @@
|
|||
-- bootstrap lazy.nvim, LazyVim and your plugins
|
||||
require("config.lazy")
|
||||
local function load_config_directory(directory)
|
||||
local config_path = vim.fn.stdpath("config") .. "/lua/" .. directory
|
||||
local files = vim.fn.glob(config_path .. "/*.lua", false, true)
|
||||
|
||||
for _, file in ipairs(files) do
|
||||
local file_name = vim.fn.fnamemodify(file, ":t:r") -- Extract filename without extension
|
||||
require(directory .. "." .. file_name)
|
||||
end
|
||||
end
|
||||
|
||||
load_config_directory("config")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"base16-vim": { "branch": "master", "commit": "3be3cd82cd31acfcab9a41bad853d9c68d30478d" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "562dc47189ad3c8696dbf460d38603a74d544849" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "db926997af951da38e5004ec7b9fbdc480b48f5d" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "206241e451c12f78969ff5ae53af45616ffc9b72" },
|
||||
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a7f0f9c18baa70a3970ea18f9984e03b6f6c2e8a" },
|
||||
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "8724e7d028ba11604dde94dc4be63f70cccf16e0" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }
|
||||
}
|
||||
|
|
@ -1,8 +1,23 @@
|
|||
-- 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
|
||||
|
||||
-- Keep cursor centered while navigating document
|
||||
vim.keymap.set("n", "<C-U>", "<C-U>zz", { silent = true })
|
||||
vim.keymap.set("n", "<C-D>", "<C-D>zz", { silent = true })
|
||||
vim.keymap.set("n", "H", ":bprev<CR>", { silent = true })
|
||||
vim.keymap.set("n", "L", ":bnext<CR>", { silent = true })
|
||||
|
||||
-- Remap Ctrl + J/K/H/L to navigate between windows
|
||||
vim.keymap.set('n', '<C-j>', '<C-w>j', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w>k', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', '<C-h>', '<C-w>h', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', '<C-l>', '<C-w>l', { noremap = true, silent = true })
|
||||
|
||||
vim.keymap.set('n', '<C-Right>', ':vertical resize +10<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', '<C-Left>', ':vertical resize -10<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', '<C-Up>', ':horizontal resize +10<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', '<C-Down>', ':horizontal resize -10<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- Remap Shift + H/L to switch between buffers
|
||||
vim.keymap.set('n', '<S-h>', ':bprevious<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', '<S-l>', ':bnext<CR>', { noremap = true, silent = true })
|
||||
|
||||
vim.keymap.set("v", "<", "<gv")
|
||||
vim.keymap.set("v", ">", ">gv")
|
||||
|
||||
vim.keymap.set("n", "<Esc>", ':nohlsearch<Bar>let @/=""<CR>', { noremap = true, silent = true})
|
||||
|
|
|
|||
|
|
@ -1,50 +1,35 @@
|
|||
-- Bootstrap lazy.nvim
|
||||
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 })
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||
-- loading lazy.nvim so that mappings are correct.
|
||||
-- This is also a good place to setup other settings (vim.opt)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
--config = function ()
|
||||
-- vim.cmd([[
|
||||
-- hi LazyNormal guibg=#060810 ctermbg=#060810
|
||||
-- hi LazyProp guibg=NONE ctermbg=NONE
|
||||
-- ]])
|
||||
--end,
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import any extras modules here
|
||||
{ import = "lazyvim.plugins.extras.dap.core" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
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
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "github-theme" } },
|
||||
checker = { enabled = false }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "onedark" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = false },
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,30 +1,33 @@
|
|||
-- 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.o.clipboard = "unnamedplus"
|
||||
vim.g.autoformat = false
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.smartindent = true
|
||||
|
||||
vim.cmd([[
|
||||
autocmd FileType c,cpp,haskell,python setlocal tabstop=4 shiftwidth=4 softtabstop=4
|
||||
]])
|
||||
|
||||
vim.cmd([[
|
||||
au BufRead,BufNewFile *.purs set filetype=purescript
|
||||
]])
|
||||
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.smartcase = false
|
||||
vim.opt.incsearch = false
|
||||
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undofile = true
|
||||
|
||||
vim.o.termguicolors = true
|
||||
vim.o.termguicolors = false
|
||||
vim.opt.guicursor = "n-v-c:block,i:block,r:block"
|
||||
vim.g.autoformat = false
|
||||
|
||||
vim.cmd([[highlight PmenuSel guifg=#53565d guibg=#f0c981]])
|
||||
vim.opt.fillchars = { eob = " " }
|
||||
|
||||
vim.cmd([[
|
||||
autocmd FileType python,haskell,c,cpp setlocal tabstop=4 shiftwidth=4 softtabstop=4
|
||||
]])
|
||||
|
||||
vim.cmd([[
|
||||
au BufRead,BufNewFile *.purs set filetype=purescript
|
||||
]])
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
version = "*",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
config = function()
|
||||
require("bufferline").setup{}
|
||||
end
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
return {
|
||||
{
|
||||
"chriskempson/base16-vim",
|
||||
config = function()
|
||||
vim.cmd("colorscheme base16-onedark")
|
||||
vim.cmd([[
|
||||
hi Normal guibg=NONE ctermbg=NONE guifg=#FFFFFF
|
||||
hi NonText guibg=NONE ctermbg=NONE
|
||||
hi LineNr guibg=NONE ctermbg=NONE
|
||||
hi CursorLine guibg=NONE ctermbg=NONE
|
||||
hi CursorLineNr guibg=NONE ctermbg=NONE guifg=#E5C07B ctermfg=Yellow cterm=bold
|
||||
hi Search ctermfg=Black guifg=#000000 ctermbg=Gray guibg=#FFCC66
|
||||
hi Pmenu ctermbg=Gray ctermfg=Black cterm=NONE guibg=Gray guifg=Black gui=NONE
|
||||
hi PmenuSel ctermbg=Black ctermfg=Green cterm=NONE guibg=Black guifg=Green gui=NONE
|
||||
hi PmenuThumb ctermbg=Green guibg=Green
|
||||
hi PmenuSbar ctermbg=Black guibg=Black
|
||||
hi WinSeparator guibg=NONE ctermbg=NONE
|
||||
|
||||
hi GitGutterChange guibg=NONE ctermbg=NONE
|
||||
hi GitGutterAdd guibg=NONE ctermbg=NONE
|
||||
hi GitGutterDelete guibg=NONE ctermbg=NONE
|
||||
hi SignColumn ctermbg=NONE guibg=NONE
|
||||
|
||||
hi TelescopeSelection guibg=Gray guifg=Green gui=bold ctermbg=Black ctermfg=Green cterm=bold
|
||||
hi TelescopePreviewMatch ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
|
||||
|
||||
hi TreesitterContext guibg=NONE ctermbg=NONE
|
||||
|
||||
hi LazyProp guibg=NONE ctermbg=NONE
|
||||
hi IblScope guibg=NONE guifg=Yellow ctermbg=NONE ctermfg=Yellow
|
||||
]])
|
||||
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
callback = function()
|
||||
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 150 })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
{ "williamboman/mason.nvim", enabled = false },
|
||||
{ "williamboman/mason-lspconfig.nvim", enabled = false },
|
||||
{ "jay-babu/mason-nvim-dap.nvim", enabled = false },
|
||||
{ "catppuccin/nvim", enabled = false },
|
||||
{ "folke/flash.nvim", enabled = false },
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
return {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
config = function()
|
||||
require('gitsigns').setup {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '-' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signs_staged = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '-' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signs_staged_enable = true,
|
||||
signcolumn = false, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = true, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
follow_files = true
|
||||
},
|
||||
auto_attach = true,
|
||||
attach_to_untracked = false,
|
||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 0,
|
||||
ignore_whitespace = false,
|
||||
virt_text_priority = 100,
|
||||
},
|
||||
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = 'single',
|
||||
style = 'minimal',
|
||||
relative = 'cursor',
|
||||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
}
|
||||
require("which-key").add({
|
||||
{ "<leader>Gb", ":Gitsigns toggle_current_line_blame<CR>", desc = "Git blame" }
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
config = function()
|
||||
require("ibl").setup({
|
||||
--indent = { char = "│" },
|
||||
--indent = { char = "⎸" },
|
||||
indent = { char = "┆" },
|
||||
scope = {
|
||||
enabled = false
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,178 @@
|
|||
local servers = {
|
||||
"tsserver",
|
||||
"pyright",
|
||||
"nil_ls",
|
||||
"cssls",
|
||||
"html",
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
"tailwindcss",
|
||||
"bashls",
|
||||
"clangd",
|
||||
"jsonls",
|
||||
"vuels"
|
||||
--"arduino-language-server"
|
||||
}
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require('nvim-treesitter.configs').setup ({
|
||||
ensure_installed = {
|
||||
"lua",
|
||||
"c",
|
||||
"cpp",
|
||||
"python",
|
||||
"nix",
|
||||
"rust",
|
||||
"bash",
|
||||
"markdown",
|
||||
"html",
|
||||
"javascript",
|
||||
"css",
|
||||
|
||||
"vim",
|
||||
|
||||
"git_config",
|
||||
"git_rebase",
|
||||
"gitattributes",
|
||||
"gitcommit",
|
||||
"gitignore"
|
||||
},
|
||||
auto_install = true,
|
||||
sync_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
}
|
||||
})
|
||||
end
|
||||
},
|
||||
|
||||
--{
|
||||
-- "nvim-treesitter/nvim-treesitter-context",
|
||||
-- dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
-- config = function()
|
||||
-- require("treesitter-context").setup({
|
||||
-- enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
-- max_lines = 3, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
-- min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
||||
-- line_numbers = false,
|
||||
-- multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line
|
||||
-- trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
-- mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||
-- -- Separator between context and content. Should be a single character string, like '-'.
|
||||
-- -- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
|
||||
-- separator = "=",
|
||||
-- zindex = 20, -- The Z-index of the context window
|
||||
-- on_attach = nil, -- (fun(buf: integer): boolean) rurn false to disable attaching
|
||||
-- })
|
||||
-- end,
|
||||
--},
|
||||
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
},
|
||||
config = function ()
|
||||
local lsp = require('lsp-zero').preset({})
|
||||
lsp.setup_servers(servers)
|
||||
lsp.setup()
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*",
|
||||
build = "make install_jsregexp",
|
||||
},
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
enabled = function()
|
||||
local context = require("cmp.config.context")
|
||||
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")
|
||||
end
|
||||
end,
|
||||
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
|
||||
end
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<C-y>"] = cmp.mapping.confirm(),
|
||||
["<CR>"] = cmp.mapping(function(fallback)
|
||||
fallback()
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
}, {
|
||||
{ name = 'buffer' }
|
||||
}),
|
||||
})
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
local lsp = require('lspconfig')
|
||||
local navic = require('nvim-navic')
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
for _, server in ipairs(servers) do
|
||||
lsp[server].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = function(client, bufnr)
|
||||
if client.server_capabilities.documentSymbolProvider then
|
||||
navic.attach(client,bufnr)
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
lsp.lua_ls.setup{
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
require("which-key").add({
|
||||
{ "<leader>cl", ":LspInfo<CR>", desc = "LSP Info" },
|
||||
})
|
||||
end
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
return {
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"SmiteshP/nvim-navic"
|
||||
},
|
||||
config = function()
|
||||
local navic = require('nvim-navic')
|
||||
require("lualine").setup ({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'material',
|
||||
component_separators = { left = '>', right = '|'},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = true,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {
|
||||
{'filename'},
|
||||
{ function() return require("nvim-navic").get_location() end, cond = function()
|
||||
return require("nvim-navic").is_available()
|
||||
end,
|
||||
},
|
||||
},
|
||||
lualine_x = {'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {
|
||||
'lazy',
|
||||
'neo-tree',
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("neo-tree").setup({
|
||||
enable_diagnostics = false,
|
||||
window = {
|
||||
position = "left",
|
||||
width = 20,
|
||||
},
|
||||
--filesystem = {
|
||||
-- hijack_netrw_behavior = "disabled",
|
||||
--},
|
||||
})
|
||||
|
||||
local function toggle_neotree()
|
||||
local api = vim.api
|
||||
local bufs = api.nvim_list_bufs()
|
||||
|
||||
for _, buf in ipairs(bufs) do
|
||||
local name = api.nvim_buf_get_name(buf)
|
||||
if name:match("neo%-tree filesystem") then
|
||||
api.nvim_command(":Neotree close")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
api.nvim_command(":Neotree")
|
||||
end
|
||||
|
||||
require("which-key").add({
|
||||
{ "<leader>e", toggle_neotree, desc = "File Explorer" }
|
||||
})
|
||||
|
||||
--vim.fn.sign_define("DiagnosticSignError",
|
||||
-- {text = " ", texthl = "DiagnosticSignError"})
|
||||
--vim.fn.sign_define("DiagnosticSignWarn",
|
||||
-- {text = " ", texthl = "DiagnosticSignWarn"})
|
||||
--vim.fn.sign_define("DiagnosticSignInfo",
|
||||
-- {text = " ", texthl = "DiagnosticSignInfo"})
|
||||
--vim.fn.sign_define("DiagnosticSignHint",
|
||||
-- {text = "", texthl = "DiagnosticSignHint"})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
local function git_root()
|
||||
local git_dir = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||
if git_dir and git_dir ~= "" then
|
||||
return git_dir
|
||||
else
|
||||
return vim.fn.getcwd() -- Fallback to current working directory if not in a Git repo
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
brach = '0.1.x',
|
||||
dependencies = {
|
||||
{
|
||||
'nvim-lua/plenary.nvim'
|
||||
},
|
||||
{
|
||||
'nvim-tree/nvim-web-devicons'
|
||||
}
|
||||
},
|
||||
config = function()
|
||||
-- Custom Telescope command to grep from Git root
|
||||
require("which-key").add({
|
||||
{ "<leader>/", function()
|
||||
require('telescope.builtin').live_grep({ cwd = git_root() })
|
||||
end,
|
||||
desc = "grep" },
|
||||
{ "<leader>/", ":Telescope live_grep<CR>", desc = "grep" },
|
||||
{ "<leader>ff", ":Telescope fd<CR>", desc = "Search for Files" },
|
||||
{ "<leader>fp", ":Telescope oldfiles<CR>", desc = "Oldfiles" },
|
||||
{ "<leader>?", ":Telescope command_history<CR>", desc = "Command History" },
|
||||
{ "<leader>cm", ":Telescope man_pages<CR>", desc = "Manpages" },
|
||||
|
||||
-- Code
|
||||
{ "<leader>gd", ":Telescope lsp_definitions<CR>", desc = "Go to Definition" },
|
||||
{ "<leader>gr", ":Telescope lsp_references", desc = "Goto References" },
|
||||
{ "<leader>gi", ":Telescope lsp_implementations<CR>", desc = "Go to Implementations" },
|
||||
{ "<leader>gt", ":Telescope lsp_type_definitions<CR>", desc = "Go to Type Definition" },
|
||||
{ "<leader>cv", ":Telescope treesitter<CR>", desc = "Function Names & Variables" },
|
||||
{ "<leader>cd", ":Telescope diagnostics<CR>", desc = "Code Diagnostics" },
|
||||
|
||||
-- Git
|
||||
{ "<leader>Gt", ":Telescope git_branches<CR>", desc = "Git Branches" },
|
||||
{ "<leader>Gc", ":Telescope git_commits<CR>", desc = "Git Commits" },
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
spec = {
|
||||
{ "<leader>l", ":Lazy<CR>", desc = "Lazy" },
|
||||
{ "<leader>t", "<cmd>:botright new | setlocal nonumber norelativenumber | resize 10 | terminal<CR>", mode = "n", desc = "Open Terminal" },
|
||||
|
||||
--{ "<leader>wd", "<cmd>execute 'bd' | execute 'close'<CR>", desc = "Delete window & buffer" },
|
||||
-- Window & Buffer Management
|
||||
{ "<leader>w", group = "Windows"},
|
||||
{ "<leader>wc", ":close<CR>", desc = "Close Window" },
|
||||
{ "<leader>ws", ":split<CR>", desc = "Horizontal Window Split" },
|
||||
{ "<leader>wv", ":vsplit<CR>", desc = "Vertial Window Split" },
|
||||
{ "<leader>wm", "<C-w>_", desc = "Maximize Window" },
|
||||
|
||||
{ "<leader>b", group = "Buffers"},
|
||||
{ "<leader>bd", ":bd<CR>", desc = "Delete Buffer" },
|
||||
{ "<leader>bD", "execute 'close'<CR> | <cmd>execute 'bd!'", desc = "Delete Window & Buffer" },
|
||||
|
||||
{ "<leader>ca", vim.lsp.buf.code_action, desc = "Code Action" },
|
||||
{ "<leader>cr", vim.lsp.buf.rename, desc = "Rename Variable" },
|
||||
|
||||
{ "<leader>G", group = "Git"},
|
||||
{ "<leader>f", group = "Files"},
|
||||
{ "<leader>c", group = "Code"},
|
||||
{ "<leader>g", group = "Goto"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-- bootstrap lazy.nvim, LazyVim and your plugins
|
||||
require("config.lazy")
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
-- 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
|
||||
|
||||
vim.keymap.set("n", "<C-U>", "<C-U>zz", { silent = true })
|
||||
vim.keymap.set("n", "<C-D>", "<C-D>zz", { silent = true })
|
||||
vim.keymap.set("n", "H", ":bprev<CR>", { silent = true })
|
||||
vim.keymap.set("n", "L", ":bnext<CR>", { silent = true })
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
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({
|
||||
--config = function ()
|
||||
-- vim.cmd([[
|
||||
-- hi LazyNormal guibg=#060810 ctermbg=#060810
|
||||
-- hi LazyProp guibg=NONE ctermbg=NONE
|
||||
-- ]])
|
||||
--end,
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import any extras modules here
|
||||
{ import = "lazyvim.plugins.extras.dap.core" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
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
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "github-theme" } },
|
||||
checker = { enabled = false }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
-- 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.cmd([[
|
||||
autocmd FileType c,cpp,haskell,python setlocal tabstop=4 shiftwidth=4 softtabstop=4
|
||||
]])
|
||||
|
||||
vim.cmd([[
|
||||
au BufRead,BufNewFile *.purs set filetype=purescript
|
||||
]])
|
||||
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undofile = true
|
||||
|
||||
vim.o.termguicolors = true
|
||||
vim.opt.guicursor = "n-v-c:block,i:block,r:block"
|
||||
vim.g.autoformat = false
|
||||
|
||||
vim.cmd([[highlight PmenuSel guifg=#53565d guibg=#f0c981]])
|
||||
27
src/user/modules/utils/modules/nvim.old/config/pkgs.nix
Normal file
27
src/user/modules/utils/modules/nvim.old/config/pkgs.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
lsp = with pkgs; [
|
||||
nil
|
||||
marksman
|
||||
sumneko-lua-language-server stylua
|
||||
nodePackages."@tailwindcss/language-server"
|
||||
clang-tools
|
||||
#arduino-language-server
|
||||
];
|
||||
|
||||
lsp' = with pkgs.nodePackages; [
|
||||
typescript-language-server
|
||||
vscode-langservers-extracted
|
||||
bash-language-server
|
||||
pyright
|
||||
vls
|
||||
];
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
lazygit
|
||||
gcc
|
||||
];
|
||||
|
||||
in
|
||||
extraPackages ++ lsp ++ lsp'
|
||||
23
src/user/modules/utils/modules/nvim.old/default.nix
Normal file
23
src/user/modules/utils/modules/nvim.old/default.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.user.utils.neovim;
|
||||
|
||||
in
|
||||
{ options.modules.user.utils.neovim = { enable = mkEnableOption "user.utils.neovim"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
extraPackages = import ./config/pkgs.nix { inherit pkgs; };
|
||||
};
|
||||
|
||||
home.file.".config/nvim" = {
|
||||
source = ./config/lazyvim;
|
||||
recursive = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue