BIG NEOVIM CHANGES
This commit is contained in:
47
flake.lock
generated
47
flake.lock
generated
@@ -1,5 +1,23 @@
|
||||
{
|
||||
"nodes": {
|
||||
"ags": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1718921313,
|
||||
"narHash": "sha256-TFJah1RW5qnYW7kajjAFPAS5j/0q0R3vz9zPjrRA0Mc=",
|
||||
"owner": "Aylur",
|
||||
"repo": "ags",
|
||||
"rev": "646d5ad073ff7f8b1d50cfbd40f5b8a250fcd59d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Aylur",
|
||||
"repo": "ags",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cachix": {
|
||||
"locked": {
|
||||
"lastModified": 1635350005,
|
||||
@@ -232,7 +250,7 @@
|
||||
"flake-compat": "flake-compat_2",
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-utils": "flake-utils_3",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"pre-commit-hooks-nix": "pre-commit-hooks-nix",
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
@@ -288,16 +306,16 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1717794163,
|
||||
"narHash": "sha256-Ch6ZpFPVvi7Bb6gmmuufpTEFkXqa43pC94XMfU5FEt0=",
|
||||
"lastModified": 1718714799,
|
||||
"narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "121f68ed7c6c32de5a8ce91a08ef25713d1c4755",
|
||||
"rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable-small",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
@@ -350,6 +368,22 @@
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1717794163,
|
||||
"narHash": "sha256-Ch6ZpFPVvi7Bb6gmmuufpTEFkXqa43pC94XMfU5FEt0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "121f68ed7c6c32de5a8ce91a08ef25713d1c4755",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable-small",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1720768451,
|
||||
"narHash": "sha256-EYekUHJE2gxeo2pM/zM9Wlqw1Uw2XTJXOSAO79ksc4Y=",
|
||||
@@ -394,12 +428,13 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"ags": "ags",
|
||||
"firefox-nightly": "firefox-nightly",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"hardware": "hardware",
|
||||
"home-manager": "home-manager",
|
||||
"lanzaboote": "lanzaboote",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs-stable": "nixpkgs-stable_2",
|
||||
"systems": "systems_3"
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
enable = true;
|
||||
|
||||
# null or path, leave as null if you don't want hm to manage the config
|
||||
configDir = ./.;
|
||||
configDir = null;
|
||||
|
||||
# additional packages to add to gjs's runtime
|
||||
extraPackages = with pkgs; [
|
||||
|
||||
@@ -1,101 +1,62 @@
|
||||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
with pkgs; let
|
||||
tools = [
|
||||
fswatch # File watcher utility, replacing libuv.fs_event for neovim 10.0
|
||||
fzf
|
||||
git
|
||||
sqlite
|
||||
];
|
||||
{pkgs, ...}: let
|
||||
treesitterWithGrammars = pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [
|
||||
p.bash
|
||||
p.comment
|
||||
p.css
|
||||
p.dockerfile
|
||||
p.fish
|
||||
p.gitattributes
|
||||
p.gitignore
|
||||
p.go
|
||||
p.gomod
|
||||
p.gowork
|
||||
p.hcl
|
||||
p.javascript
|
||||
p.jq
|
||||
p.json5
|
||||
p.json
|
||||
p.lua
|
||||
p.make
|
||||
p.markdown
|
||||
p.nix
|
||||
p.python
|
||||
p.rust
|
||||
p.toml
|
||||
p.typescript
|
||||
p.vue
|
||||
p.yaml
|
||||
]);
|
||||
|
||||
c = [
|
||||
];
|
||||
|
||||
gamedev = [
|
||||
# parser, linter and formatter for GDScript
|
||||
gdtoolkit_3
|
||||
gdtoolkit_4
|
||||
];
|
||||
|
||||
golang = [
|
||||
delve # debugger
|
||||
go
|
||||
gofumpt
|
||||
goimports-reviser
|
||||
golines
|
||||
gopls
|
||||
gotools
|
||||
];
|
||||
|
||||
lua = [
|
||||
lua-language-server
|
||||
stylua
|
||||
];
|
||||
|
||||
markup = [
|
||||
cbfmt # format codeblocks
|
||||
codespell
|
||||
markdownlint-cli
|
||||
mdformat
|
||||
typst-lsp
|
||||
];
|
||||
|
||||
nix = [
|
||||
alejandra
|
||||
nixd
|
||||
nil
|
||||
nixpkgs-fmt
|
||||
statix
|
||||
];
|
||||
|
||||
python = [
|
||||
pyright
|
||||
black
|
||||
isort
|
||||
python312Packages.jedi-language-server
|
||||
ruff
|
||||
ruff-lsp
|
||||
openusd
|
||||
materialx
|
||||
];
|
||||
|
||||
rust = [
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
clippy
|
||||
];
|
||||
|
||||
shell = [
|
||||
nodePackages.bash-language-server
|
||||
shellcheck
|
||||
shfmt
|
||||
];
|
||||
|
||||
web = [
|
||||
deno
|
||||
nodePackages.sql-formatter
|
||||
nodePackages.typescript-language-server
|
||||
nodePackages.prettier
|
||||
nodejs
|
||||
prettierd # multi-language formatters
|
||||
vscode-langservers-extracted
|
||||
yarn
|
||||
];
|
||||
|
||||
extraPackages =
|
||||
tools ++ c ++ gamedev ++ golang ++ lua ++ markup ++ nix ++ python ++ rust ++ shell ++ web;
|
||||
treesitter-parsers = pkgs.symlinkJoin {
|
||||
name = "treesitter-parsers";
|
||||
paths = treesitterWithGrammars.dependencies;
|
||||
};
|
||||
in {
|
||||
# for quick development
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
package = pkgs.neovim-unwrapped;
|
||||
vimAlias = true;
|
||||
coc.enable = false;
|
||||
withNodeJs = true;
|
||||
#package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default;
|
||||
plugins = with pkgs.vimPlugins; [telescope-cheat-nvim];
|
||||
inherit extraPackages;
|
||||
plugins = [
|
||||
treesitterWithGrammars
|
||||
];
|
||||
};
|
||||
home.file."./.config/nvim/" = {
|
||||
source = ./nvim;
|
||||
recursive = true;
|
||||
};
|
||||
home.file."./.config/nvim/lua/cnst/init.lua".text = ''
|
||||
require("cnst.set")
|
||||
require("cnst.remap")
|
||||
vim.opt.runtimepath:append("${treesitter-parsers}")
|
||||
'';
|
||||
# Treesitter is configured as a locally developed module in lazy.nvim
|
||||
# we hardcode a symlink here so that we can refer to it in our lazy config
|
||||
home.file."./.local/share/nvim/nix/nvim-treesitter/" = {
|
||||
recursive = true;
|
||||
source = treesitterWithGrammars;
|
||||
};
|
||||
}
|
||||
|
||||
24
home/extra/neovim/nvim/init.lua
Normal file
24
home/extra/neovim/nvim/init.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
vim.g.mapleader = " "
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.guicursor = ""
|
||||
|
||||
require("lazy").setup("plugins", {
|
||||
rocks = { enabled = false },
|
||||
dev = {
|
||||
path = "~/.local/share/nvim/nix",
|
||||
fallback = false,
|
||||
},
|
||||
})
|
||||
require("cnst")
|
||||
109
home/extra/neovim/nvim/lua/cnst/remap.lua
Normal file
109
home/extra/neovim/nvim/lua/cnst/remap.lua
Normal file
@@ -0,0 +1,109 @@
|
||||
local map = vim.keymap.set
|
||||
|
||||
local close_nvim = function()
|
||||
vim.cmd("Neotree close")
|
||||
vim.cmd("qa")
|
||||
end
|
||||
|
||||
--- General
|
||||
map("n", "+", "/", { desc = "Forward search", nowait = true })
|
||||
map("n", "-", "?", { desc = "Backward search", nowait = true })
|
||||
map("n", "<leader>n", "<cmd>enew<cr>", { desc = "New Buffer" })
|
||||
map({ "n", "t" }, "<A-w>", "<cmd>q<cr>", { desc = "Close Window" })
|
||||
map({ "n", "t" }, "<C-q>", close_nvim, { desc = "Quick Quit" })
|
||||
map({ "n", "x" }, ",", ":", { desc = "Enter command mode", nowait = true })
|
||||
|
||||
map("n", "<leader>ll", "<cmd>Lazy<cr>", { desc = "Open Lazy" })
|
||||
map("n", "<leader>mm", "<cmd>Mason<cr>", { desc = "Open Mason" })
|
||||
|
||||
map("i", "<C-v>", "<esc>p", { desc = "Paste Clipboard" })
|
||||
map("n", "<C-c>", "<cmd> %y+ <CR>", { desc = "Copy File to [C]lipboard" })
|
||||
|
||||
map({ "i", "x", "n", "s" }, "<C-s>", '<cmd>w "++p"<cr><esc>', { desc = "Save File" })
|
||||
map(
|
||||
{ "i", "x", "n", "s" },
|
||||
"<Esc><C-s>", -- <Alt>+<Control-s>
|
||||
'<cmd>wa "++p"<cr><esc>',
|
||||
{ desc = "Save All Files" }
|
||||
)
|
||||
|
||||
map(
|
||||
"n",
|
||||
"<leader>cr",
|
||||
"<cmd>let @+ = expand('%:~:.')<cr><cmd>echo 'Copied path:' @+<cr>",
|
||||
{ desc = "[C]opy [R]elative Path to Clipboard" }
|
||||
)
|
||||
map(
|
||||
"n",
|
||||
"<leader>cp",
|
||||
"<cmd>let @+ = expand('%:p')<cr><cmd>echo 'Copied path:' @+<cr>",
|
||||
{ desc = "[C]opy Full [P]ath to Clipboard" }
|
||||
)
|
||||
map("n", "<leader>gp", ":e <C-r>+<CR>", { desc = "[G]o to [P]ath from Clipboard" })
|
||||
|
||||
map("v", ">", ">gv", { desc = "Indent Right" })
|
||||
map("v", "<", "<gv", { desc = "Indent Left" })
|
||||
|
||||
-- Don't copy the replaced text after pasting in visual mode
|
||||
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste
|
||||
map("x", "p", 'p:let @+=@0<CR>:let @"=@0<CR>', { desc = "Dont copy replaced text", silent = true })
|
||||
|
||||
-- Don't reset clipboard after first paste in Visual mode
|
||||
map("v", "p", "P")
|
||||
|
||||
--- Tab motions
|
||||
-- map('n', '<C-t>s', '<cmd>tab split<cr>', { desc = 'Split Window to New Tab' })
|
||||
-- map('n', '<C-t>t', '<C-w>T', { desc = 'Maximize Window' })
|
||||
map("n", "<ESC><C-j>", "<cmd>tabprevious<cr>", { desc = "Previous Tab" })
|
||||
map("n", "<ESC><C-k>", "<cmd>tabnext<cr>", { desc = "Next Tab" })
|
||||
map("n", "<leader>tc", "<cmd>tabclose<cr>", { desc = "[T]ab [C]lose" })
|
||||
map("n", "<leader>te", "<cmd>tabedit<cr>", { desc = "[T]ab [E]dit" })
|
||||
map("n", "<leader>tn", "<cmd>tabnew<cr>", { desc = "[T]ab [N]ew" })
|
||||
|
||||
-- Buffer Motions
|
||||
-- map('n', '<A-j>', '<cmd>bprevious<cr>', { desc = 'Prev Buffer' })
|
||||
-- map('n', '<A-k>', '<cmd>bnext<cr>', { desc = 'Next Buffer' })
|
||||
-- map('n', '<A-c>', '<cmd>bdelete<cr>', { desc = 'Close Buffer' })
|
||||
|
||||
--- Debugging
|
||||
map("n", "<leader>ms", "<cmd>messages<cr>", { desc = "Show Messages" })
|
||||
map("n", "<leader>mn", "<cmd>Noice<cr>", { desc = "Show Noice Messages" })
|
||||
|
||||
map("x", "<M-s>", ":sort<cr>", { desc = "Sort Selection" })
|
||||
|
||||
--- Terminal
|
||||
-- switch between windows
|
||||
map("t", "<C-h>", "<C-\\><C-N><C-w>h", { desc = "Terminal Window Left" })
|
||||
map("t", "<C-l>", "<C-\\><C-N><C-w>l", { desc = "Terminal Window Right" })
|
||||
map("t", "<C-j>", "<C-\\><C-N><C-w>j", { desc = "Terminal Window Down" })
|
||||
map("t", "<C-k>", "<C-\\><C-N><C-w>k", { desc = "Terminal Window Up" })
|
||||
map("t", "<C-x>", vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true), { desc = "Escape Terminal Mode" })
|
||||
|
||||
-- Better Movements
|
||||
map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
-- map({ 'n', 'x' }, '<Down>', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
-- map({ 'n', 'x' }, '<Up>', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
|
||||
-- Move Lines
|
||||
-- map('n', '<A-j>', '<cmd>m .+1<cr>==', { desc = 'Move Down' })
|
||||
-- map('n', '<A-k>', '<cmd>m .-2<cr>==', { desc = 'Move Up' })
|
||||
-- map('i', '<A-j>', '<esc><cmd>m .+1<cr>==gi', { desc = 'Move Down' })
|
||||
-- map('i', '<A-k>', '<esc><cmd>m .-2<cr>==gi', { desc = 'Move Up' })
|
||||
-- map('v', '<A-j>', ":m '>+1<cr>gv=gv", { desc = 'Move Down' })
|
||||
-- map('v', '<A-k>', ":m '<-2<cr>gv=gv", { desc = 'Move Up' })
|
||||
|
||||
-- Resize window using <ctrl> arrow keys
|
||||
map({ "n", "t" }, "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase Window Height" })
|
||||
map({ "n", "t" }, "<C-Down>", "<cmd>resize -2<cr>", { desc = "Decrease Window Height" })
|
||||
map({ "n", "t" }, "<C-Left>", "<cmd>vertical resize -2<cr>", { desc = "Decrease Window Width" })
|
||||
map({ "n", "t" }, "<C-Right>", "<cmd>vertical resize +2<cr>", { desc = "Increase Window Width" })
|
||||
|
||||
-- Clear search, diff update and redraw
|
||||
-- taken from runtime/lua/_editor.lua
|
||||
map(
|
||||
"n",
|
||||
"<leader>ur",
|
||||
"<Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>",
|
||||
{ desc = "Redraw / Clear hlsearch / Diff Update" }
|
||||
)
|
||||
0
home/extra/neovim/nvim/lua/cnst/set.lua
Normal file
0
home/extra/neovim/nvim/lua/cnst/set.lua
Normal file
84
home/extra/neovim/nvim/lua/plugins/alpha.lua
Normal file
84
home/extra/neovim/nvim/lua/plugins/alpha.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
return {
|
||||
"goolord/alpha-nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
-- Header
|
||||
local logo = [[
|
||||
▄████▄ ███▄ █ ██▓▒██ ██▒ ██▒ █▓ ██▓ ███▄ ▄███▓
|
||||
▒██▀ ▀█ ██ ▀█ █ ▓██▒▒▒ █ █ ▒░▓██░ █▒▓██▒▓██▒▀█▀ ██▒
|
||||
▒▓█ ▄ ▓██ ▀█ ██▒▒██▒░░ █ ░ ▓██ █▒░▒██▒▓██ ▓██░
|
||||
▒▓▓▄ ▄██▒▓██▒ ▐▌██▒░██░ ░ █ █ ▒ ▒██ █░░░██░▒██ ▒██
|
||||
▒ ▓███▀ ░▒██░ ▓██░░██░▒██▒ ▒██▒ ▒▀█░ ░██░▒██▒ ░██▒
|
||||
░ ░▒ ▒ ░░ ▒░ ▒ ▒ ░▓ ▒▒ ░ ░▓ ░ ░ ▐░ ░▓ ░ ▒░ ░ ░
|
||||
░ ▒ ░ ░░ ░ ▒░ ▒ ░░░ ░▒ ░ ░ ░░ ▒ ░░ ░ ░
|
||||
░ ░ ░ ░ ▒ ░ ░ ░ ░░ ▒ ░░ ░
|
||||
░ ░ ░ ░ ░ ░ ░ ░ ░
|
||||
░ ░
|
||||
]]
|
||||
dashboard.section.header.val = vim.split(logo, "\n")
|
||||
|
||||
-- Buttons
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("n", " " .. " New file", "<cmd> ene <BAR> startinsert <cr>"),
|
||||
dashboard.button("f", " " .. " Find file", "<cmd> Telescope find_files <cr>"),
|
||||
dashboard.button("g", " " .. " Live grep", "<cmd> Telescope live_grep <cr>"),
|
||||
dashboard.button("r", " " .. " Recent files", "<cmd> Telescope oldfiles <cr>"),
|
||||
-- dashboard.button('s', ' ' .. ' Restore Session', "<cmd>lua require('persistence').load()<cr>"),
|
||||
dashboard.button("s", " " .. " Restore Session", "<cmd>SessionLoad<cr>"),
|
||||
dashboard.button("l", " " .. " Lazy", "<cmd> Lazy <cr>"),
|
||||
dashboard.button("h", " " .. " Check Health", "<cmd>checkhealth<cr>"),
|
||||
dashboard.button("q", " " .. " Quit", "<cmd> qa <cr>"),
|
||||
}
|
||||
for _, button in ipairs(dashboard.section.buttons) do
|
||||
button.opts.hl = "AlphaButtons"
|
||||
button.opts.hl_shortcut = "AlphaShortcut"
|
||||
end
|
||||
dashboard.section.header.opts.hl = "AlphaHeader"
|
||||
dashboard.section.buttons.opts.hl = "AlphaButtons"
|
||||
dashboard.section.footer.opts.hl = "AlphaFooter"
|
||||
dashboard.opts.layout[1].val = 8
|
||||
|
||||
-- Footer (Lazy statistics)
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
callback = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = math.floor(stats.startuptime * 100) / 100
|
||||
dashboard.section.footer.val = " Lazy-loaded "
|
||||
.. stats.loaded
|
||||
.. "/"
|
||||
.. stats.count
|
||||
.. " plugins in "
|
||||
.. ms
|
||||
.. "ms"
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
|
||||
-- -- Fortune
|
||||
-- local fortune = ""
|
||||
-- if vim.fn.executable "fortune" == 1 then
|
||||
-- local handle = io.popen "fortune"
|
||||
-- if handle ~= nil then
|
||||
-- fortune = handle:read "*a"
|
||||
-- handle:close()
|
||||
-- end
|
||||
-- end
|
||||
-- local buttons = {
|
||||
-- type = "group",
|
||||
-- val = {
|
||||
-- { type = "padding", val = 2 },
|
||||
-- { type = "text", val = fortune, opts = { position = "center" } },
|
||||
-- { type = "padding", val = 2 },
|
||||
-- },
|
||||
-- position = "center",
|
||||
-- }
|
||||
-- dashboard.opts.layout[6] = buttons
|
||||
|
||||
dashboard.config.opts.noautocmd = true
|
||||
alpha.setup(dashboard.config)
|
||||
end,
|
||||
}
|
||||
13
home/extra/neovim/nvim/lua/plugins/autopairs.lua
Normal file
13
home/extra/neovim/nvim/lua/plugins/autopairs.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
-- Optional dependency
|
||||
dependencies = { "hrsh7th/nvim-cmp" },
|
||||
config = function()
|
||||
require("nvim-autopairs").setup({})
|
||||
-- If you want to automatically add `(` after selecting a function or method
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp = require("cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
||||
6
home/extra/neovim/nvim/lua/plugins/better-escape.lua
Normal file
6
home/extra/neovim/nvim/lua/plugins/better-escape.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
"max397574/better-escape.nvim",
|
||||
config = function()
|
||||
require("better_escape").setup()
|
||||
end,
|
||||
}
|
||||
3
home/extra/neovim/nvim/lua/plugins/devicons.lua
Normal file
3
home/extra/neovim/nvim/lua/plugins/devicons.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
{ "nvim-tree/nvim-web-devicons", opts = {}, lazy = true },
|
||||
}
|
||||
9
home/extra/neovim/nvim/lua/plugins/gitsigns.lua
Normal file
9
home/extra/neovim/nvim/lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
lazy = true,
|
||||
tag = "v0.8.0",
|
||||
event = { "BufReadPost" },
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
5
home/extra/neovim/nvim/lua/plugins/hmts.lua
Normal file
5
home/extra/neovim/nvim/lua/plugins/hmts.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
"calops/hmts.nvim",
|
||||
version = "*",
|
||||
ft = "nix",
|
||||
}
|
||||
11
home/extra/neovim/nvim/lua/plugins/init.lua
Normal file
11
home/extra/neovim/nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
{
|
||||
"sainnhe/gruvbox-material",
|
||||
enabled = true,
|
||||
priority = 1000,
|
||||
opts = {},
|
||||
config = function()
|
||||
vim.cmd([[colorscheme gruvbox-material]])
|
||||
end,
|
||||
},
|
||||
}
|
||||
144
home/extra/neovim/nvim/lua/plugins/lsp.lua
Normal file
144
home/extra/neovim/nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,144 @@
|
||||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
|
||||
-- Autocompletion
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-nvim-lua" },
|
||||
|
||||
-- Snippets
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
-- Snippet Collection (Optional)
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
|
||||
{ "onsails/lspkind.nvim" },
|
||||
},
|
||||
config = function()
|
||||
local lsp = require("lsp-zero")
|
||||
lsp.preset("recommended")
|
||||
|
||||
-- don't initialize this language server
|
||||
-- we will use rust-tools to setup rust_analyzer
|
||||
lsp.skip_server_setup({ "rust_analyzer" })
|
||||
|
||||
local cmp = require("cmp")
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
local cmp_mappings = lsp.defaults.cmp_mappings({
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
})
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
lsp.setup_nvim_cmp({
|
||||
mapping = cmp_mappings,
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 75,
|
||||
ellipsis_char = "...",
|
||||
symbol_map = {
|
||||
Copilot = "",
|
||||
},
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
{ name = "copilot" },
|
||||
{ name = "path" },
|
||||
{ name = "luasnip" },
|
||||
},
|
||||
})
|
||||
|
||||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
|
||||
parser_config.nu = {
|
||||
install_info = {
|
||||
url = "https://github.com/nushell/tree-sitter-nu",
|
||||
files = { "src/parser.c" },
|
||||
branch = "main",
|
||||
},
|
||||
filetype = "nu",
|
||||
}
|
||||
|
||||
local format_sync_grp = vim.api.nvim_create_augroup("Format", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ timeout_ms = 200 })
|
||||
end,
|
||||
group = format_sync_grp,
|
||||
})
|
||||
|
||||
lsp.on_attach(function(client, bufnr)
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol, opts)
|
||||
vim.keymap.set("n", "<leader>vd", vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "<leader>a", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
|
||||
end)
|
||||
|
||||
lsp.configure("nil_ls", {
|
||||
settings = {
|
||||
["nil"] = {
|
||||
formatting = { command = { "nixpkgs-fmt" } },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lsp.configure("nushell", {
|
||||
command = { "nu", "--lsp" },
|
||||
filetypes = { "nu" },
|
||||
root_dir = require("lspconfig.util").find_git_ancestor,
|
||||
singe_file_support = true,
|
||||
})
|
||||
|
||||
lsp.configure("volar", {
|
||||
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue", "json" },
|
||||
})
|
||||
|
||||
lsp.set_server_config({
|
||||
on_init = function(client)
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end,
|
||||
})
|
||||
|
||||
lsp.nvim_workspace()
|
||||
lsp.setup()
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = false,
|
||||
float = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
41
home/extra/neovim/nvim/lua/plugins/lualine.lua
Normal file
41
home/extra/neovim/nvim/lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
local go_package = function()
|
||||
for _, line in ipairs(vim.api.nvim_buf_get_lines(0, 0, -1, true)) do
|
||||
if line:match("^package ") then
|
||||
return "⬡ " .. string.sub(line, 9)
|
||||
end
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons", optional = true },
|
||||
opts = {
|
||||
options = {
|
||||
theme = "dracula",
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = {
|
||||
{
|
||||
go_package,
|
||||
cond = function()
|
||||
return vim.bo.filetype == "go"
|
||||
end,
|
||||
},
|
||||
{ "filename" },
|
||||
},
|
||||
lualine_x = {
|
||||
"encoding",
|
||||
"fileformat",
|
||||
"filetype",
|
||||
},
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
53
home/extra/neovim/nvim/lua/plugins/neo-tree.lua
Normal file
53
home/extra/neovim/nvim/lua/plugins/neo-tree.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- optional, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
cmd = { "Neotree" },
|
||||
opts = {
|
||||
close_if_last_window = true,
|
||||
window = {
|
||||
mappings = {
|
||||
["l"] = "open",
|
||||
["h"] = "open_split",
|
||||
-- TODO: `v` is for select. Find another key for vsplit
|
||||
-- ['v'] = 'open_vsplit',
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
follow_current_file = { enabled = true },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<C-n>", "<CMD>Neotree toggle<CR>", mode = { "n", "x", "t" }, desc = "Toggle [N]eoTree", nowait = true },
|
||||
-- {
|
||||
-- '<C-b>',
|
||||
-- '<CMD>Neotree toggle buffers<CR>',
|
||||
-- mode = { 'n', 'x', 't' },
|
||||
-- desc = 'Toggle Neotree [B]uffers',
|
||||
-- nowait = true,
|
||||
-- },
|
||||
{
|
||||
"<C-f>",
|
||||
"<CMD>Neotree toggle position=current<CR>",
|
||||
mode = { "n", "x" },
|
||||
desc = "Toggle [F]ull NeoTree",
|
||||
nowait = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- file operations using built-in LSP
|
||||
{
|
||||
"antosha417/nvim-lsp-file-operations",
|
||||
config = true,
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
},
|
||||
},
|
||||
}
|
||||
10
home/extra/neovim/nvim/lua/plugins/notify.lua
Normal file
10
home/extra/neovim/nvim/lua/plugins/notify.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
lazy = true,
|
||||
opts = {
|
||||
render = "compact",
|
||||
background_colour = "#000000",
|
||||
},
|
||||
},
|
||||
}
|
||||
47
home/extra/neovim/nvim/lua/plugins/rust.lua
Normal file
47
home/extra/neovim/nvim/lua/plugins/rust.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
return {
|
||||
{
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^3",
|
||||
event = { "BufReadPost *.rs" },
|
||||
keys = {
|
||||
{
|
||||
"<Leader>a",
|
||||
mode = "n",
|
||||
function()
|
||||
vim.cmd.RustLsp("codeAction")
|
||||
end,
|
||||
{ buffer = vim.api.nvim_get_current_buf() },
|
||||
desc = "LSP Code Action",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
vim.g.rustaceanvim = {
|
||||
tools = {
|
||||
inlay_hints = {
|
||||
auto = false,
|
||||
highlight = "Debug",
|
||||
},
|
||||
hover_actions = {
|
||||
auto_focus = true,
|
||||
},
|
||||
},
|
||||
server = {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
enable = true,
|
||||
command = "clippy",
|
||||
},
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
on_attach = function(client, _)
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
68
home/extra/neovim/nvim/lua/plugins/telescope.lua
Normal file
68
home/extra/neovim/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
return {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{
|
||||
"<leader>pf",
|
||||
mode = "n",
|
||||
function() require("telescope.builtin").find_files() end,
|
||||
desc = "telescope find files"
|
||||
},
|
||||
{
|
||||
"<C-p>",
|
||||
mode = "n",
|
||||
function() require("telescope.builtin").git_files() end,
|
||||
desc = "telescope find files"
|
||||
},
|
||||
{
|
||||
"<leader>ps",
|
||||
mode = "n",
|
||||
function()
|
||||
require("telescope.builtin").live_grep()
|
||||
end,
|
||||
desc = "telescope grep string"
|
||||
},
|
||||
{
|
||||
"<leader>pt",
|
||||
mode = "n",
|
||||
function()
|
||||
require("telescope.builtin").treesitter()
|
||||
end,
|
||||
desc = "telescope treesitter"
|
||||
},
|
||||
{
|
||||
"<leader>pb",
|
||||
mode = "n",
|
||||
function() require("telescope.builtin").buffers() end,
|
||||
desc = "telescope buffers"
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local opts = {
|
||||
extensions = {
|
||||
file_browser = {
|
||||
respect_gitignore = false,
|
||||
hijack_netrw = true,
|
||||
hidden = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
require("telescope").setup(opts)
|
||||
require("telescope").load_extension("file_browser")
|
||||
end,
|
||||
},
|
||||
}
|
||||
25
home/extra/neovim/nvim/lua/plugins/treesitter.lua
Normal file
25
home/extra/neovim/nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
main = "nvim-treesitter.configs",
|
||||
dev = true,
|
||||
opts = {
|
||||
-- autotag = {
|
||||
-- enable = true
|
||||
-- },
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<CR>",
|
||||
node_incremental = "<CR>",
|
||||
scope_incremental = "<S-CR>",
|
||||
node_decremental = "<BS>",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
7
home/extra/neovim/nvim/lua/plugins/which-key.lua
Normal file
7
home/extra/neovim/nvim/lua/plugins/which-key.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
@@ -55,6 +55,27 @@
|
||||
wpa_supplicant
|
||||
xfce.thunar-archive-plugin
|
||||
xfce.thunar-volman
|
||||
|
||||
# misc.language_servers
|
||||
typescript-language-server
|
||||
typescript
|
||||
nixd
|
||||
nil
|
||||
statix
|
||||
hyprlang
|
||||
alejandra
|
||||
nixpkgs-fmt
|
||||
pyright
|
||||
isort
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
clippy
|
||||
lua-language-server
|
||||
stylua
|
||||
nodePackages_latest.nodejs
|
||||
nodePackages.prettier
|
||||
prettierd
|
||||
black
|
||||
];
|
||||
sessionVariables = {
|
||||
BROWSER = "firefox";
|
||||
|
||||
Reference in New Issue
Block a user