···
1
1
{ inputs , ... }:
2
2
{
3
3
perSystem = { system, lib, pkgs, ... }: let
4
4
-
vim_appname = "lassvim";
5
5
-
nvim_deps = with pkgs; [
4
4
+
nvim-appname = "lassvim";
5
5
+
6
6
+
lsp-packages = with pkgs; [
6
7
nodejs # copilot
7
7
-
neovim
8
8
-
vale
9
8
terraform-ls
10
9
nodePackages.pyright
11
11
-
sumneko-lua-language-server
12
12
-
13
13
-
# based on ./suggested-pkgs.json nvim
14
14
-
delve
10
10
+
11
11
+
# based on ./suggested-pkgs.json
15
12
gopls
16
13
golangci-lint
17
14
nodePackages.bash-language-server
18
15
taplo-lsp
19
16
marksman
17
17
+
selene
20
18
rust-analyzer
21
19
yaml-language-server
22
20
nil
23
23
-
gomodifytags
24
24
-
gofumpt
25
25
-
iferr
26
26
-
impl
27
27
-
gotools
28
21
shellcheck
29
22
shfmt
30
30
-
isort
31
31
-
black
32
23
ruff
33
33
-
nixpkgs-fmt
24
24
+
ruff-lsp
25
25
+
nixfmt-rfc-style
34
26
terraform-ls
35
27
clang-tools
36
28
nodePackages.prettier
37
29
stylua
30
30
+
# based on https://github.com/ray-x/go.nvim#go-binaries-install-and-update
31
31
+
go
32
32
+
gofumpt
33
33
+
gomodifytags
34
34
+
gotools
35
35
+
delve
36
36
+
golines
37
37
+
gomodifytags
38
38
+
gotests
39
39
+
iferr
40
40
+
impl
41
41
+
reftools
42
42
+
ginkgo
43
43
+
richgo
44
44
+
govulncheck
45
45
+
46
46
+
#ocaml-ng.ocamlPackages_5_0.ocaml-lsp
47
47
+
#ocaml-ng.ocamlPackages_5_0.ocamlformat
38
48
# does not build yet on aarch64
39
39
-
] ++ lib.optional (pkgs.stdenv.hostPlatform.system == "x86_64-linux") pkgs.deno; # lsp
40
40
-
nvim_config = pkgs.runCommand "nvim_config" { } ''
41
41
-
mkdir -p $out/parser
49
49
+
] ++ lib.optional (pkgs.stdenv.hostPlatform.system == "x86_64-linux") pkgs.deno
50
50
+
++ lib.optional (!pkgs.stdenv.hostPlatform.isDarwin) sumneko-lua-language-server;
42
51
43
43
-
ln -s ${inputs.astro-nvim}/* $out/
44
44
-
rm $out/lua
45
45
-
mkdir -p $out/lua
46
46
-
ln -s ${inputs.astro-nvim}/lua/* $out/lua
47
47
-
ln -s ${./user} $out/lua/user
52
52
+
lspEnv = pkgs.buildEnv {
53
53
+
name = "lspEnv";
54
54
+
paths = lsp-packages;
55
55
+
};
48
56
49
49
-
${lib.concatMapStringsSep "\n" (grammar: ''
50
50
-
ln -s $(readlink -f ${grammar}/parser/*.so) $out/parser/${lib.last (builtins.split "-" grammar.name)}.so
51
51
-
'') pkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies}
52
52
-
'';
57
57
+
treesitter-grammars = pkgs.runCommand "treesitter-grammars" { } (
58
58
+
lib.concatMapStringsSep "\n" (grammar: ''
59
59
+
mkdir -p $out
60
60
+
ln -s $(readlink -f ${grammar}/parser/*.so) $out/${lib.last (builtins.split "-" grammar.name)}.so
61
61
+
'') pkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies
62
62
+
);
63
63
+
53
64
in {
54
65
packages.vim = pkgs.writeShellScriptBin "vim" ''
55
66
set -efux
56
67
unset VIMINIT
57
57
-
export PATH=$PATH:${pkgs.buildEnv {
58
58
-
name = "nvim_deps";
59
59
-
paths = nvim_deps;
60
60
-
}}/bin
61
61
-
export NVIM_APPNAME=${vim_appname}
62
62
-
mkdir -p $HOME/.config $HOME/.local/share/
63
63
-
ln -sfT ${nvim_config} "$HOME"/.config/${vim_appname}
64
64
-
nvim --headless -c 'quitall'
65
65
-
if [[ -d $HOME/.local/share/lassvim/lazy/telescope-fzf-native.nvim ]]; then
66
66
-
mkdir -p "$HOME/.local/share/lassvim/lazy/telescope-fzf-native.nvim/build"
67
67
-
ln -sf "${pkgs.vimPlugins.telescope-fzf-native-nvim}/build/libfzf.so" "$HOME/.local/share/lassvim/lazy/telescope-fzf-native.nvim/build/libfzf.so"
68
68
-
fi
69
69
-
exec nvim "$@"
68
68
+
export PATH=${lspEnv}/bin:$PATH
69
69
+
export NVIM_APPNAME=${nvim-appname}
70
70
+
71
71
+
XDG_CONFIG_HOME=''${XDG_CONFIG_HOME:-$HOME/.config}
72
72
+
XDG_DATA_HOME=''${XDG_DATA_HOME:-$HOME/.local/share}
73
73
+
74
74
+
mkdir -p "$XDG_CONFIG_HOME/$NVIM_APPNAME" "$XDG_DATA_HOME"
75
75
+
chmod -R u+w "$XDG_CONFIG_HOME/$NVIM_APPNAME"
76
76
+
rm -rf "$XDG_CONFIG_HOME/$NVIM_APPNAME"
77
77
+
cp -arfT '${./config}'/ "$XDG_CONFIG_HOME/$NVIM_APPNAME"
78
78
+
chmod -R u+w "$XDG_CONFIG_HOME/$NVIM_APPNAME"
79
79
+
${pkgs.neovim}/bin/nvim --headless -c 'quitall' # install plugins
80
80
+
mkdir -p "$XDG_DATA_HOME/$NVIM_APPNAME/lib/" "$XDG_DATA_HOME/$NVIM_APPNAME/site/"
81
81
+
ln -sfT "${pkgs.vimPlugins.telescope-fzf-native-nvim}/build/libfzf.so" "$XDG_DATA_HOME/$NVIM_APPNAME/lib/libfzf.so"
82
82
+
ln -sfT "${treesitter-grammars}" "$XDG_DATA_HOME/$NVIM_APPNAME/site/parser"
83
83
+
exec ${pkgs.neovim}/bin/nvim "$@"
70
84
'';
71
85
};
72
86
}
···
1
1
+
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
2
2
+
if not vim.loop.fs_stat(lazypath) then
3
3
+
-- stylua: ignore
4
4
+
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable",
5
5
+
lazypath })
6
6
+
end
7
7
+
vim.opt.rtp:prepend(lazypath)
8
8
+
9
9
+
vim.api.nvim_create_user_command("RaiseTmuxPane", function()
10
10
+
-- run shell command
11
11
+
12
12
+
local out = vim.fn.system("tmux list-panes -a -F '#I #{pane_tty}'")
13
13
+
local tty = vim.env.TTY
14
14
+
if tty == nil then
15
15
+
return
16
16
+
end
17
17
+
local _, _, window_id = string.find(out, "(%d+) " .. tty)
18
18
+
if window_id == nil then
19
19
+
return
20
20
+
end
21
21
+
vim.fn.system("tmux select-window -t '" .. window_id .. "'")
22
22
+
end, {})
23
23
+
24
24
+
vim.api.nvim_create_user_command("Nurl", function()
25
25
+
local url = vim.fn.input("Enter a URL: ")
26
26
+
local rev = vim.fn.input("Enter the revision (e.g., v0.2.0 or empty string): ")
27
27
+
28
28
+
local cmd = string.format("nurl %s %s 2>/dev/null", url, rev)
29
29
+
30
30
+
local output = vim.fn.systemlist(cmd)
31
31
+
if vim.v.shell_error == 0 and #output > 0 then
32
32
+
vim.api.nvim_put(output, "l", true, true)
33
33
+
else
34
34
+
print("Error executing command or command returned empty result.")
35
35
+
end
36
36
+
end, {})
37
37
+
38
38
+
require("lazy").setup({
39
39
+
{
40
40
+
"AstroNvim/AstroNvim",
41
41
+
import = "astronvim.plugins",
42
42
+
},
43
43
+
{ import = "plugins" },
44
44
+
})
···
1
1
+
{
2
2
+
"AstroNvim": { "branch": "main", "commit": "ce7cad66837c076052b8293787454bf5a43b448e" },
3
3
+
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
4
4
+
"CopilotChat.nvim": { "branch": "canary", "commit": "51ec2b45fed9cb0c8551c94ee2f2fb68de1e970a" },
5
5
+
"LuaSnip": { "branch": "master", "commit": "825a61bad1d60d917a7962d73cf3c683f4e0407e" },
6
6
+
"NeoSolarized.nvim": { "branch": "master", "commit": "208e65a3ede945b8a1d00104a4441217c5e23509" },
7
7
+
"SchemaStore.nvim": { "branch": "main", "commit": "20ceee9ede7cb68ce01dc45a7d5924cefc9aa671" },
8
8
+
"aerial.nvim": { "branch": "master", "commit": "24ebacab5821107c50f628e8e7774f105c08fe9b" },
9
9
+
"alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" },
10
10
+
"astrocommunity": { "branch": "main", "commit": "14647de59010546fb116bd52f179f4956c4d9a80" },
11
11
+
"astrocore": { "branch": "main", "commit": "7a77e6d53218937a70362f68ce561590b4d46bd1" },
12
12
+
"astrolsp": { "branch": "main", "commit": "2ac3632dabe1bafb6548af0e6b7d779a7fbb1327" },
13
13
+
"astrotheme": { "branch": "main", "commit": "e056b8216214f7140eda3e0adcfc27efba705231" },
14
14
+
"astroui": { "branch": "main", "commit": "780b77962a8604f3ad2e89c112d7adef3e2d1773" },
15
15
+
"auto-save.nvim": { "branch": "main", "commit": "979b6c82f60cfa80f4cf437d77446d0ded0addf0" },
16
16
+
"better-escape.nvim": { "branch": "master", "commit": "7e86edafb8c7e73699e0320f225464a298b96d12" },
17
17
+
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
18
18
+
"cmp-dap": { "branch": "master", "commit": "ea92773e84c0ad3288c3bc5e452ac91559669087" },
19
19
+
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
20
20
+
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
21
21
+
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
22
22
+
"copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" },
23
23
+
"crates.nvim": { "branch": "main", "commit": "b4f4987ccdb1cc3899ee541ef4375c73c48c4570" },
24
24
+
"dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
25
25
+
"friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" },
26
26
+
"gitsigns.nvim": { "branch": "main", "commit": "2d1271962f8fb21e9089363f1ccdda52f03bedfa" },
27
27
+
"go.nvim": { "branch": "master", "commit": "abd282564a31c5dec14e2038ebf04fdac9ea3278" },
28
28
+
"guess-indent.nvim": { "branch": "main", "commit": "b8ae749fce17aa4c267eec80a6984130b94f80b2" },
29
29
+
"guihua.lua": { "branch": "master", "commit": "f8ef84df19369bd1fcb8c3210a3b9db13026b7bc" },
30
30
+
"heirline.nvim": { "branch": "master", "commit": "03cff30d7e7d3ba6fdc00925f015822f79cef908" },
31
31
+
"icon-picker.nvim": { "branch": "master", "commit": "3ee9a0ea9feeef08ae35e40c8be6a2fa2c20f2d3" },
32
32
+
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
33
33
+
"lazy.nvim": { "branch": "main", "commit": "bef521ac89c8d423f9d092e37b58e8af0c099309" },
34
34
+
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
35
35
+
"mason-lspconfig.nvim": { "branch": "main", "commit": "9dfcf2036c223920826140f0151d929a43f9eceb" },
36
36
+
"mason-null-ls.nvim": { "branch": "main", "commit": "e270134d83ba59425edc53356c6fd337b61bb8dd" },
37
37
+
"mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" },
38
38
+
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
39
39
+
"mini.bufremove": { "branch": "main", "commit": "931a3bb514147d9e812767275c4beba6b779b1d3" },
40
40
+
"neo-tree.nvim": { "branch": "main", "commit": "16d1b194376bf1fc2acd89ccb3c29ba8315bfcea" },
41
41
+
"neoconf.nvim": { "branch": "main", "commit": "f41d28e3f9c873de17ecab12e767fc8cfd94c7a2" },
42
42
+
"neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
43
43
+
"none-ls.nvim": { "branch": "main", "commit": "fff481b65d88415933b9574dc0e1947724bcf64a" },
44
44
+
"nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" },
45
45
+
"nvim-autopairs": { "branch": "master", "commit": "dbfc1c34bed415906395db8303c71039b3a3ffb4" },
46
46
+
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
47
47
+
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
48
48
+
"nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
49
49
+
"nvim-dap-go": { "branch": "main", "commit": "36abe1d320cb61bfdf094d4e0fe815ef58f2302a" },
50
50
+
"nvim-dap-python": { "branch": "master", "commit": "66560f0ebddf96604f7037e1efad3ba6942761e6" },
51
51
+
"nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" },
52
52
+
"nvim-lspconfig": { "branch": "master", "commit": "70279e07f130489325292a32d9d604fca65506b2" },
53
53
+
"nvim-nio": { "branch": "master", "commit": "173f285eebb410199273fa178aa517fd2d7edd80" },
54
54
+
"nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" },
55
55
+
"nvim-treesitter": { "branch": "master", "commit": "be4d6e858fe7543dcafa085118ebb7759246ed7c" },
56
56
+
"nvim-treesitter-textobjects": { "branch": "master", "commit": "45f90966a53a4e1bac374fe9aac530b7b5925c76" },
57
57
+
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
58
58
+
"nvim-ts-context-commentstring": { "branch": "main", "commit": "734ebad31c81c6198dfe102aa23280937c937c42" },
59
59
+
"nvim-ufo": { "branch": "main", "commit": "49acf0010ccc08d727582da8cbf5e4c3f3b0cc53" },
60
60
+
"nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" },
61
61
+
"nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" },
62
62
+
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
63
63
+
"project.nvim": { "branch": "main", "commit": "4317ce951459a53ba45ffed2495ac6752211364b" },
64
64
+
"promise-async": { "branch": "main", "commit": "93540c168c5ed2b030ec3e6c40ab8bbb85e36355" },
65
65
+
"rainbow-delimiters.nvim": { "branch": "master", "commit": "580bc045c7ab3ab3ebd267774038c0d8cc19c789" },
66
66
+
"resession.nvim": { "branch": "master", "commit": "742aba4998123fc11f490a3aeffe8f550b2cb789" },
67
67
+
"rustaceanvim": { "branch": "master", "commit": "e2dbf91daed26d4dd7263affbecbf9a36e0096e5" },
68
68
+
"smart-splits.nvim": { "branch": "master", "commit": "50f52146e4504a3fc0f0d5830c8560a16a95dd08" },
69
69
+
"spaceless.nvim": { "branch": "main", "commit": "8d46bc098dba18d4e19bce89bf19aab5007ef767" },
70
70
+
"telescope.nvim": { "branch": "master", "commit": "4626aaa2bcfdacf55fd6d44b430e2df81b2403ff" },
71
71
+
"todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" },
72
72
+
"toggleterm.nvim": { "branch": "main", "commit": "193786e0371e3286d3bc9aa0079da1cd41beaa62" },
73
73
+
"venv-selector.nvim": { "branch": "main", "commit": "3c57922256e7e26205a25f5a42ecf7104d9f2c78" },
74
74
+
"vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" },
75
75
+
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
76
76
+
}
···
1
1
+
return {
2
2
+
"AstroNvim/astrolsp",
3
3
+
-- we must use the function override because table merging
4
4
+
-- does not play nicely with list-like tables
5
5
+
---@param opts AstroLSPOpts
6
6
+
opts = function(plugin, opts)
7
7
+
-- safely extend the servers list
8
8
+
opts.servers = opts.servers or {}
9
9
+
vim.list_extend(opts.servers, {
10
10
+
"pyright",
11
11
+
"clangd",
12
12
+
"bashls",
13
13
+
"gopls",
14
14
+
"taplo",
15
15
+
"marksman",
16
16
+
"pyright",
17
17
+
"nil_ls",
18
18
+
"terraformls",
19
19
+
"lua_ls",
20
20
+
"ruff_lsp",
21
21
+
"rust_analyzer",
22
22
+
"gopls",
23
23
+
"yamlls",
24
24
+
"denols",
25
25
+
"ocamllsp",
26
26
+
-- add more servers as needed...
27
27
+
})
28
28
+
opts.formatting = opts.formatting or {}
29
29
+
opts.formatting.format_on_save = false
30
30
+
end,
31
31
+
}
···
1
1
+
return {
2
2
+
"AstroNvim/astroui",
3
3
+
}
···
1
1
+
return
2
2
+
{
3
3
+
"CopilotC-Nvim/CopilotChat.nvim",
4
4
+
branch = "canary",
5
5
+
dependencies = {
6
6
+
{ "zbirenbaum/copilot.lua" }, -- or github/copilot.vim
7
7
+
{ "nvim-lua/plenary.nvim" }, -- for curl, log wrapper
8
8
+
},
9
9
+
lazy = false,
10
10
+
keys = function()
11
11
+
local select = require "CopilotChat.select"
12
12
+
local telescope = require "CopilotChat.integrations.telescope"
13
13
+
local actions = require "CopilotChat.actions"
14
14
+
15
15
+
return {
16
16
+
{
17
17
+
"<leader>ccq",
18
18
+
function()
19
19
+
local input = vim.fn.input "Quick Chat: "
20
20
+
if input ~= "" then require("CopilotChat").ask(input, { selection = select.buffer }) end
21
21
+
end,
22
22
+
desc = "CopilotChat - Quick chat",
23
23
+
},
24
24
+
{
25
25
+
"<leader>ccq",
26
26
+
function()
27
27
+
local input = vim.fn.input "Quick Chat: "
28
28
+
if input ~= "" then require("CopilotChat").ask(input, { selection = select.visual }) end
29
29
+
end,
30
30
+
desc = "CopilotChat - Quick chat",
31
31
+
mode = "v",
32
32
+
},
33
33
+
{
34
34
+
"<leader>cch",
35
35
+
function() telescope.pick(actions.help_actions(), { selection = select.buffer }) end,
36
36
+
desc = "CopilotChat - Help actions",
37
37
+
},
38
38
+
{
39
39
+
"<leader>cch",
40
40
+
function() telescope.pick(actions.help_actions(), { selection = select.visual }) end,
41
41
+
desc = "CopilotChat - Help actions",
42
42
+
mode = "v",
43
43
+
},
44
44
+
{
45
45
+
"<leader>ccp",
46
46
+
function() telescope.pick(actions.prompt_actions(), { selection = select.visual }) end,
47
47
+
desc = "CopilotChat - Prompt actions",
48
48
+
},
49
49
+
{
50
50
+
"<leader>ccp",
51
51
+
function() telescope.pick(actions.prompt_actions(), { selection = select.visual }) end,
52
52
+
desc = "CopilotChat - Prompt actions",
53
53
+
mode = "v",
54
54
+
},
55
55
+
}
56
56
+
end,
57
57
+
opts = {},
58
58
+
}
···
1
1
+
return {
2
2
+
"AstroNvim/astrocore",
3
3
+
lazy = false, -- disable lazy loading
4
4
+
priority = 10000, -- load AstroCore first
5
5
+
options = {
6
6
+
opt = {
7
7
+
-- set configuration options as described below
8
8
+
relativenumber = false, -- sets vim.opt.relativenumber
9
9
+
},
10
10
+
},
11
11
+
}
···
1
1
+
return {
2
2
+
"gitsigns.nvim",
3
3
+
opts = function(_, opts)
4
4
+
opts.current_line_blame = true
5
5
+
return opts
6
6
+
end,
7
7
+
}
···
1
1
+
return {
2
2
+
{
3
3
+
"ziontee113/icon-picker.nvim",
4
4
+
init = function() require("icon-picker").setup { disable_legacy_commands = true } end,
5
5
+
},
6
6
+
}
···
1
1
+
-- disable building since it's optional
2
2
+
return { "L3MON4D3/LuaSnip", build = "true" }
3
3
+
···
1
1
+
function open_or_create_file(tfilename)
2
2
+
-- complete filepath from the file where this is called
3
3
+
local parent = vim.fn.expand("%:p:h")
4
4
+
local newfilepath = parent .. "/" .. vim.fn.expand(tfilename)
5
5
+
6
6
+
if vim.fn.filereadable(newfilepath) ~= 1 then
7
7
+
-- create parent directory
8
8
+
vim.fn.system("mkdir -p " .. vim.fn.shellescape(parent))
9
9
+
vim.fn.system("touch " .. vim.fn.shellescape(newfilepath))
10
10
+
end
11
11
+
vim.cmd(":e " .. newfilepath)
12
12
+
end
13
13
+
14
14
+
return {
15
15
+
"AstroNvim/astrocore",
16
16
+
---@type AstroCoreOpts
17
17
+
opts = {
18
18
+
-- Mapping data with "desc" stored directly by vim.keymap.set().
19
19
+
--
20
20
+
-- Please use this mappings table to set keyboard mapping since this is the
21
21
+
-- lower level configuration and more robust one. (which-key will
22
22
+
-- automatically pick-up stored data by this setting.)
23
23
+
mappings = {
24
24
+
-- first key is the mode
25
25
+
n = {
26
26
+
-- tables with the `name` key will be registered with which-key if it's installed
27
27
+
-- this is useful for naming menus
28
28
+
["<leader>b"] = { name = "Buffers" },
29
29
+
-- quick save
30
30
+
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
31
31
+
32
32
+
-- Switch between tabs
33
33
+
["<S-Tab>"] = { ":bprev<CR>" },
34
34
+
["<Tab>"] = { ":bnext<CR>" },
35
35
+
36
36
+
-- Don't error if file doesn't exist
37
37
+
["gf"] = {
38
38
+
function()
39
39
+
open_or_create_file(vim.fn.expand("<cfile>"))
40
40
+
end,
41
41
+
desc = "Create file",
42
42
+
},
43
43
+
["<leader>*"] = {
44
44
+
function()
45
45
+
require("telescope.builtin").grep_string()
46
46
+
end,
47
47
+
desc = "Find for word under cursor",
48
48
+
},
49
49
+
["<leader><leader>"] = {
50
50
+
function()
51
51
+
require("telescope.builtin").find_files()
52
52
+
end,
53
53
+
desc = "Find files",
54
54
+
},
55
55
+
},
56
56
+
t = {
57
57
+
-- setting a mapping to false will disable it
58
58
+
-- ["<esc>"] = false,
59
59
+
},
60
60
+
c = {
61
61
+
-- setting a mapping to false will disable it
62
62
+
["w!!"] = { "w !sudo tee > /dev/null %", desc = "Write as sudo" },
63
63
+
},
64
64
+
},
65
65
+
},
66
66
+
}
···
1
1
+
-- customize mason plugins
2
2
+
local suggested_packages = {}
3
3
+
4
4
+
local disable_auto_install = function(_, opts)
5
5
+
local core = require("astrocore")
6
6
+
local data_dir = vim.fn.stdpath("data")
7
7
+
core.list_insert_unique(suggested_packages, opts.ensure_installed or {})
8
8
+
local f = io.open(data_dir .. "/suggested-pkgs.json", "w")
9
9
+
f:write(vim.fn.json_encode(suggested_packages))
10
10
+
f:close()
11
11
+
12
12
+
opts.ensure_installed = {}
13
13
+
end
14
14
+
15
15
+
return {
16
16
+
-- use mason-lspconfig to configure LSP installations
17
17
+
{
18
18
+
"williamboman/mason-lspconfig.nvim",
19
19
+
-- overrides `require("mason-lspconfig").setup(...)`
20
20
+
opts = disable_auto_install,
21
21
+
},
22
22
+
-- use mason-null-ls to configure Formatters/Linter installation for null-ls sources
23
23
+
{
24
24
+
"jay-babu/mason-null-ls.nvim",
25
25
+
-- overrides `require("mason-null-ls").setup(...)`
26
26
+
opts = disable_auto_install,
27
27
+
},
28
28
+
{
29
29
+
"jay-babu/mason-nvim-dap.nvim",
30
30
+
-- overrides `require("mason-nvim-dap").setup(...)`
31
31
+
opts = disable_auto_install,
32
32
+
},
33
33
+
}
···
1
1
+
return {
2
2
+
"nvim-neo-tree/neo-tree.nvim",
3
3
+
opts = {
4
4
+
follow_current_file = true,
5
5
+
},
6
6
+
}
···
1
1
+
return {
2
2
+
"nvimtools/none-ls.nvim",
3
3
+
opts = function(_, config)
4
4
+
-- config variable is the default configuration table for the setup function call
5
5
+
local null_ls = require("null-ls")
6
6
+
7
7
+
-- Check supported formatters and linters
8
8
+
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting
9
9
+
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
10
10
+
config.sources = {
11
11
+
-- Set a formatter
12
12
+
null_ls.builtins.formatting.stylua,
13
13
+
14
14
+
-- html/css/js/ts/json/yaml/xml/markdown
15
15
+
null_ls.builtins.formatting.prettier,
16
16
+
17
17
+
-- go
18
18
+
null_ls.builtins.formatting.gofumpt,
19
19
+
null_ls.builtins.formatting.goimports,
20
20
+
null_ls.builtins.diagnostics.golangci_lint,
21
21
+
null_ls.builtins.code_actions.impl,
22
22
+
23
23
+
-- nix
24
24
+
null_ls.builtins.formatting.nixfmt,
25
25
+
26
26
+
-- c/c++
27
27
+
null_ls.builtins.formatting.clang_format,
28
28
+
29
29
+
-- bash
30
30
+
null_ls.builtins.formatting.shfmt.with({
31
31
+
args = { "-i", "2" },
32
32
+
}),
33
33
+
}
34
34
+
return config -- return final config table
35
35
+
end,
36
36
+
}
···
1
1
+
return {
2
2
+
{
3
3
+
"lewis6991/spaceless.nvim",
4
4
+
init = function() require("spaceless").setup() end,
5
5
+
},
6
6
+
}
···
1
1
+
local nvim_data_dir = vim.fn.stdpath('data')
2
2
+
local telescope_dir = nvim_data_dir .. "/lazy/telescope-fzf-native.nvim"
3
3
+
local build = "mkdir -p " .. telescope_dir .. "/build && ln -sf " .. nvim_data_dir .. "/lib/libfzf.so " .. telescope_dir .. "/build/libfzf.so"
4
4
+
-- override make command build since we provide the shared library with home-manager already
5
5
+
return {
6
6
+
"nvim-telescope/telescope-fzf-native.nvim",
7
7
+
build = build,
8
8
+
}
···
1
1
+
local nvim_data_dir = vim.fn.stdpath("data")
2
2
+
local command = "ln -sf " .. nvim_data_dir .. "/site/parser/*.so " .. nvim_data_dir .. "/lazy/nvim-treesitter/parser"
3
3
+
4
4
+
return {
5
5
+
"nvim-treesitter/nvim-treesitter",
6
6
+
build = command,
7
7
+
opts = function(_, opts)
8
8
+
vim.fn.system(command)
9
9
+
end,
10
10
+
}