CURSED NVIM DSL

This commit is contained in:
chayleaf 2023-03-15 16:41:44 +07:00
parent a53cd961f6
commit 035933f8b2
13 changed files with 10545 additions and 350 deletions

View file

@ -0,0 +1,45 @@
diff --git a/Ghidra/Processors/x86/data/languages/x86gcc.cspec b/Ghidra/Processors/x86/data/languages/x86gcc.cspec
index 17448cf9..b115b957 100644
--- a/Ghidra/Processors/x86/data/languages/x86gcc.cspec
+++ b/Ghidra/Processors/x86/data/languages/x86gcc.cspec
@@ -286,6 +286,40 @@
<register name="EAX"/>
</killedbycall>
</prototype>
+ <prototype name="__stdcall" extrapop="unknown" stackshift="4">
+ <input>
+ <pentry minsize="1" maxsize="500" align="4">
+ <addr offset="4" space="stack"/>
+ </pentry>
+ </input>
+ <output killedbycall="true">
+ <pentry minsize="4" maxsize="10" metatype="float" extension="float">
+ <register name="ST0"/>
+ </pentry>
+ <pentry minsize="1" maxsize="4">
+ <register name="EAX"/>
+ </pentry>
+ <pentry minsize="5" maxsize="8">
+ <addr space="join" piece1="EDX" piece2="EAX"/>
+ </pentry>
+ </output>
+ <unaffected>
+ <register name="ESP"/>
+ <register name="EBP"/>
+ <register name="ESI"/>
+ <register name="EDI"/>
+ <register name="EBX"/>
+ </unaffected>
+ <killedbycall>
+ <register name="ECX"/>
+ <register name="EDX"/>
+ <register name="ST0"/>
+ <register name="ST1"/>
+ </killedbycall>
+ <likelytrash>
+ <register name="EAX"/>
+ </likelytrash>
+ </prototype>
<resolveprototype name="__cdecl/__regparm">
<model name="__cdecl"/> <!-- The default case -->

View file

@ -0,0 +1,585 @@
{ config, pkgs, lib, ... }:
{
imports = [ ../options.nix ];
/*
VIM config backup:
syntax on
au FileType markdown set colorcolumn=73 textwidth=72
au FileType gitcommit set colorcolumn=73
highlight NormalFloat guibg=NONE
au BufReadPre * set foldmethod=syntax
au BufReadPost * folddoc foldopen!
autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
*/
programs.neovim = let
# a cursed DSL
identLines = lines: builtins.concatStringsSep "\n" (map (x: " ${x}") lines);
ident = code: identLines (lib.splitString "\n" code);
# probably not the best heuristics, but good enough to make the output readable
wrapSafe = s: (builtins.match "^[-\"a-zA-Z0-9_.()]*$" s) != null;
wrapExpr = s: if wrapSafe s then s else "(${s})";
keySafe = s: (builtins.match "^[a-zA-Z_][_a-zA-Z0-9]*$" s) != null;
wrapKey = scope: s: if keySafe s then s else "[${compileExpr scope s}]";
compileFunc' = argn: sc@{sname,scope}: id: func:
(if builtins.isFunction func
then
(compileFunc'
(argn + 1)
sc
id
(func (let
args = builtins.functionArgs func;
rawVar = var "${sname}_${id}_arg${builtins.toString (scope + argn)}";
in if args == {}
then rawVar
else builtins.mapAttrs (k: v: prop rawVar k) args
)))
else ''
function ${id}(${builtins.concatStringsSep ", " (builtins.genList (n: "${sname}_${id}_arg${builtins.toString (scope + n)}") argn)})
${ident (compileStmt {inherit sname;scope = scope + argn;} func)}
end'');
compileFunc = compileFunc' 0;
compileExpr = sc: func: (
if builtins.isString func then
if lib.hasInfix "\n" func then ''
[[
${ident func}
]]'' else "\"${lib.escape ["\\" "\""] func}\""
else if builtins.isInt func then builtins.toString func
else if builtins.isFloat func then builtins.toString func
else if builtins.isBool func then (if func then "true" else "false")
else if builtins.isNull func then "nil"
else if builtins.isPath func then compileExpr sc (builtins.toString func)
else if builtins.isFunction func then let
info = if builtins.functionArgs func == {} then (func "GET_INFO") else null; in
if builtins.isAttrs info && info?value
then info.value
else (compileFunc sc "" func)
else if builtins.isList func then ''
{
${ident (builtins.concatStringsSep "\n" (map (x: (compileExpr sc x) + ";" ) func))}
}''
else if builtins.isAttrs func && !(func?__kind) then ''
{
${ident (builtins.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "${wrapKey sc k} = ${compileExpr sc v};") func))}
}''
else if func.__kind == "var" then
"${func._name}"
else if func.__kind == "op2" then
builtins.concatStringsSep func.op (map (x: wrapExpr (compileExpr sc x)) func.args)
else if func.__kind == "defun" then
(compileFunc sc (if func?id then func.id else "") func.func)
else if func.__kind == "prop" then
"${wrapExpr (compileExpr sc func.expr)}.${func.name}"
else if func.__kind == "call" then
"${wrapExpr (compileExpr sc func.func)}(${builtins.concatStringsSep ", " (map (compileExpr sc) (if builtins.isList func.args then func.args else [func.args]))})"
else if func.__kind == "mcall" then
"${wrapExpr (compileExpr sc func.val)}:${func.name}(${builtins.concatStringsSep ", " (map (compileExpr sc) (if builtins.isList func.args then func.args else [func.args]))})"
else if func.__kind == "tableAttr" then
"${wrapExpr (compileExpr sc func.table)}[${compileExpr sc func.key}]"
else null
);
compileStmt = sc@{sname,scope}: func: (
if builtins.isList func then builtins.concatStringsSep "\n" (map (compileStmt sc) func)
else if builtins.isAttrs func && (func?__kind) then (
if func.__kind == "assign" then
"${compileExpr sc func.expr} = ${compileExpr sc func.val}"
else if func.__kind == "bind" then
"local ${func.name} = ${compileExpr sc func.val}"
else if func.__kind == "let" then ''
${builtins.concatStringsSep "\n" (lib.imap0 (n: val:
"local ${sname}_var${builtins.toString (scope + n)} = ${
compileExpr sc val
}") func.vals)}
${let vals = func.vals; origScope = scope; apply = { scope, func }: if scope == (origScope + (builtins.length vals)) then func else apply {
scope = scope + 1;
func = func (raw "${sname}_var${builtins.toString scope}");
}; in
compileStmt {inherit sname;scope = scope + (builtins.length func.vals);} (apply { inherit scope; inherit (func) func; })
}''
else if func.__kind == "letrec" then ''
${builtins.concatStringsSep "\n" (lib.imap0 (n: val:
"local ${sname}_var${builtins.toString (scope + n)} = ${
let vals = func.vals; origScope = scope; apply = { scope, func }: if scope == (origScope + (builtins.length vals)) then func else apply {
scope = scope + 1;
func = func (raw "${sname}_var${builtins.toString scope}");
}; in
compileExpr {inherit sname;scope = scope + (builtins.length func.vals);} (apply { inherit scope; func = val; })
}") func.vals)}
${let vals = func.vals; origScope = scope; apply = { scope, func }: if scope == (origScope + (builtins.length vals)) then func else apply {
scope = scope + 1;
func = func (raw "${sname}_var${builtins.toString scope}");
}; in
compileStmt {inherit sname;scope = scope + (builtins.length func.vals);} (apply { inherit scope; inherit (func) func; })
}''
else if func.__kind == "for" then let
varNames = builtins.genList (n: "${sname}_var${builtins.toString (scope + n)}") func.n;
scope' = { inherit sname; scope = scope + 1; };
in ''
for ${builtins.concatStringsSep "," varNames} in ${compileExpr scope' func.expr} do
${
let argn = func.n; origScope = scope; apply = { scope, func }: if scope == (origScope + argn) then func else apply {
scope = scope + 1;
func = func (raw "${sname}_var${builtins.toString scope}");
}; in
ident (compileStmt scope' (apply { inherit scope; func = func.body; }))
}
end''
else if func.__kind == "return" then
"return ${compileExpr sc func.expr}"
else if func.__kind == "if" then
(lib.removeSuffix "else" ((builtins.concatStringsSep "" (map
(cond: ''
if ${compileExpr sc (builtins.elemAt cond 0)} then
${ident (compileStmt sc (builtins.elemAt cond 1))}
else'')
func.conds))
+ (if func.fallback != null then "\n${ident (compileStmt sc func.fallback)}\n" else ""))) + "end"
else compileExpr sc func
) else compileExpr sc func
);
compile = sname: compileStmt {inherit sname;scope=1;};
var = name: { __kind = "var"; _name = name; };
raw = var;
prop = expr: name: { __kind = "prop"; inherit expr name; };
call = func: args: { __kind = "call"; inherit func args; };
mcall = val: name: args: { __kind = "mcall"; inherit val name args; };
setup = plugin: opts: call (prop plugin "setup") [ opts ];
require = name: call (var "require") [ name ];
set = expr: val: { __kind = "assign"; inherit expr val; };
op2 = op: args:
if builtins.isList args then { __kind = "op2"; inherit op args; }
else (secondArg: { __kind = "op2"; inherit op; args = [ args secondArg ]; })
;
eq = op2 "==";
# forin = n: expr: body: { __kind = "for"; inherit n expr body; };
# gt = op2 ">";
# ge = op2 ">=";
# ne = op2 "~=";
# and = op2 "and";
# or = op2 "or";
return = expr: { __kind = "return"; inherit expr; };
defun = func: { __kind = "defun"; inherit func; };
ifelse = conds: fallback: { __kind = "if"; inherit fallback; conds = if builtins.isList (builtins.elemAt conds 0) then conds else [conds]; };
# ifnoelse = conds: ifelse conds null;
tableAttr = table: key: { __kind = "tableAttr"; inherit table key; };
bind = vals: func: if builtins.isList vals then { __kind = "let"; inherit vals func; } else bind [ vals ] func;
bindrec = vals: func: if builtins.isList vals then { __kind = "letrec"; inherit vals func; } else bindrec [ vals ] func;
defs = pkgs.callPackage ./vim-opts.nix { inherit raw call; };
in with defs; let
# bind' = name: val: { __kind = "bind"; inherit name val; };
# vimfn = name: call (raw "vim.fn.${name}");
vimcmd = name: call (raw "vim.cmd.${name}");
keymapSetSingle = opts@{
mode,
lhs,
rhs,
noremap ? true,
silent ? true,
...
}: let
opts''' = opts // { inherit noremap silent; };
opts' = lib.filterAttrs (k: v:
k != "keys" && k != "mode" && k != "lhs" && k != "rhs" && k != "desc"
# defaults to false
&& ((k != "silent" && k != "noremap") || (builtins.isBool v && v))) opts''';
in vim.keymap.set [ mode lhs rhs opts' ];
keymapSetMulti = opts@{
keys,
mode,
noremap ? true,
silent ? true,
...
}: let
opts'' = opts // { inherit noremap silent; };
opts' = lib.filterAttrs (k: v:
k != "keys" && k != "lhs" && k != "rhs" && k != "desc"
# defaults to false
&& ((k != "silent" && k != "noremap") || (builtins.isBool v && v))) opts'';
in (lib.mapAttrsToList (k: {rhs, desc}: keymapSetSingle (opts' // {
lhs = k; inherit rhs;
})) keys) ++ [
(call (prop (require "which-key") "register") [(lib.mapAttrs (k: v: [v.rhs v.desc]) keys) opts'])
];
keymapSetN = args: keymapSetSingle (args // { mode = "n"; });
keymapSetV = args: keymapSetSingle (args // { mode = "v"; });
keymapSetNs = args: keymapSetMulti (args // { mode = "n"; });
kmSetNs = keys: keymapSetNs { inherit keys; };
in {
enable = true;
defaultEditor = true;
package = pkgs.neovim-unwrapped;
extraPackages = with pkgs; [
rust-analyzer
nodePackages_latest.bash-language-server shellcheck
nodePackages_latest.typescript-language-server
nodePackages_latest.svelte-language-server
clang-tools
nodePackages_latest.vscode-langservers-extracted
nil
marksman
taplo
(python3.withPackages (p: with p; [
python-lsp-server
pylsp-mypy
python-lsp-server.optional-dependencies.pyflakes
python-lsp-server.optional-dependencies.mccabe
python-lsp-server.optional-dependencies.pycodestyle
]))
];
# extraPython3Packages = pyPkgs: with pyPkgs; [
# ];
extraLuaConfig = (compile "main" [
(set vim.g.vimsyn_embed "l")
(vim.api.nvim_set_hl [ 0 "NormalFloat" {
bg = "NONE";
}])
(bind (vim.api.nvim_create_augroup [ "nvimrc" { clear = true; } ]) (group:
map (au: let au' = lib.filterAttrs (k: v: k != "event") au;
in vim.api.nvim_create_autocmd [ au.event ({
inherit group;
} // au') ]
) [
{ event = "FileType";
pattern = ["markdown" "gitcommit"];
callback = defun (set vim.o.colorcolumn 73); }
{ event = "FileType";
pattern = ["markdown"];
callback = defun (set vim.o.textwidth 72); }
{ event = "BufReadPre";
inherit group;
callback = defun (set vim.o.foldmethod "syntax"); }
{ event = "BufWinEnter";
inherit group;
callback = { buf, ... }:
(bind (vim.filetype.match { inherit buf; }) (filetype: [
(vimcmd "folddoc" [ "foldopen!" ])
(ifelse [(eq filetype "gitcommit") [
(vim.cmd {
cmd = "normal";
bang = true;
args = [ "gg" ];
})
]]
(vim.cmd {
cmd = "normal";
bang = true;
args = [ "g`\"" ];
})
)
])); }
])) # END
]);
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; map (x: if x?config && x?plugin then { type = "lua"; } // x else x) [
vim-svelte
# TODO remove on next nvim update (0.8.3/0.9)
vim-nix
{ plugin = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "vscode-nvim";
version = "2023-02-10";
src = pkgs.fetchFromGitHub {
owner = "Mofiqul";
repo = "vscode.nvim";
rev = "db9ee339b5556aa832ca58871fd18f9467a18520";
sha256 = "sha256-X2IgIjO5NNq7vJdl09hBY1TFqHlsfF1xfllKr4osILI=";
};
};
config = compile "vscode_nvim" (setup (require "vscode") {
transparent = true;
color_overrides = {
vscGray = "#745b5f";
vscViolet = "#${config.colors.magenta}";
vscBlue = "#6ddfd8";
vscDarkBlue = "#${config.colors.blue}";
vscGreen = "#${config.colors.green}";
vscBlueGreen = "#73bf88";
vscLightGreen = "#6acf6e";
vscRed = "#${config.colors.red}";
vscOrange = "#e89666";
vscLightRed = "#e64e4e";
vscYellowOrange = "#e8b166";
vscYellow = "#${config.colors.yellow}";
vscPink = "#cf83c4";
};
}); }
# ''; }
{ plugin = nvim-web-devicons;
config = compile "nvim_web_devicons" (setup (require "nvim-web-devicons") {}); }
{ plugin = nvim-tree-lua;
config = compile "nvim_tree_lua" [
(set vim.g.loaded_netrw 1)
(set vim.g.loaded_netrwPlugin 1)
(set vim.opt.termguicolors true)
(setup (require "nvim-tree") {}) # :help nvim-tree-setup
(keymapSetN {
lhs = "<C-N>";
rhs = prop (require "nvim-tree.api") "tree.toggle";
desc = "Toggle NvimTree";
})
]; }
vim-sleuth
luasnip
{ plugin = nvim-cmp;
config = let
border = (name: [
[ "" name ]
[ "" name ]
[ "" name ]
[ "" name ]
[ "" name ]
[ "" name ]
[ "" name ]
[ "" name ]
]);
in compile "nvim_cmp" [(bind (require "cmp") (cmp:
(setup cmp {
snippet = {
expand = args: (call (prop (require "luasnip") "lsp_expand") (prop args "body"));
};
view = { };
window = {
completion = {
border = border "CmpBorder";
winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None";
};
documentation = {
border = border "CmpDocBorder";
};
};
formatting = {
format = _: vim_item: [
(set
(prop vim_item "kind")
(string.format (let kind = prop vim_item "kind"; in [
"%s %s"
(tableAttr (require "lspkind") kind)
kind
])))
(return vim_item)
];
};
mapping = {
"<C-p>" = call (prop cmp "mapping.select_prev_item") [];
"<C-n>" = call (prop cmp "mapping.select_next_item") [];
"<C-space>" = call (prop cmp "mapping.complete") [];
"<C-e>" = call (prop cmp "mapping.close") [];
"<cr>" = call (prop cmp "mapping.confirm") {
behavior = prop cmp "ConfirmBehavior.Replace";
select = false;
};
"<tab>" = call (prop cmp "mapping") [(fallback:
(ifelse [
[(call (prop cmp "visible") [])
# then
(call (prop cmp "select_next_item") [])]
[(call (prop (require "luasnip") "expand_or_jumpable") [])
# then
(vim.api.nvim_feedkeys [
(vim.api.nvim_replace_termcodes [ "<Plug>luasnip-expand-or-jump" true true true ])
""
false
])
]]
# else
(call fallback [])
))
[ "i" "s" ]
];
"<S-tab>" = call (prop cmp "mapping") [(fallback:
(ifelse [
[(call (prop cmp "visible" ) [])
# then
(call (prop cmp "select_prev_item") [])]
[(call (prop (require "luasnip") "jumpable") [ (-1) ])
# then
(vim.api.nvim_feedkeys [
(vim.api.nvim_replace_termcodes [ "<Plug>luasnip-jump-prev" true true true ])
""
false
])
]]
# else
(call fallback [])
))
[ "i" "s" ]
];
};
sources = call (prop cmp "config.sources") [[
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
]];
})
))]; }
lspkind-nvim
cmp_luasnip
cmp-nvim-lsp
{ plugin = nvim-autopairs;
config = compile "nvim_autopairs" (bind (require "nvim-autopairs.completion.cmp") (cmp_autopairs: [
(setup (require "nvim-autopairs") {
disable_filetype = [ "TelescopePrompt" "vim" ];
})
(mcall (prop (require "cmp") "event") "on" [
"confirm_done"
(call (prop cmp_autopairs "on_confirm_done") [])
])
])); }
{ plugin = comment-nvim;
config = compile "comment_nvim" [
(setup (require "Comment") {})
(keymapSetN {
lhs = "<space>/";
rhs = (prop (require "Comment.api") "toggle.linewise.current");
desc = "Comment current line";
})
(keymapSetV {
lhs = "<space>/";
rhs = "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>";
desc = "Comment current line";
})
]; }
{ plugin = nvim-lspconfig;
config = compile "nvim_lspconfig" (let setupLsp = lsp: setup (prop (require "lspconfig") lsp); in [
# See `:help vim.diagnostic.*` for documentation on any of the below functions
(kmSetNs {
"<space>e" = {
rhs = vim.diagnostic.open_float;
desc = "Show diagnostics in a floating window.";
};
"[d" = {
rhs = vim.diagnostic.goto_prev;
desc = "Move to the previous diagnostic in the current buffer.";
};
"]d" = {
rhs = vim.diagnostic.goto_next;
desc = "Get the next diagnostic closest to the cursor position.";
};
"<space>q" = {
rhs = vim.diagnostic.setloclist;
desc = "Add buffer diagnostics to the location list.";
};
})
(bind [
# LET on_attach
(client: bufnr: ([
# Enable completion triggered by <c-x><c-o>
(vim.api.nvim_buf_set_option [ bufnr "omnifunc" "v:lua.vim.lsp.omnifunc" ])
# Mappings.
# See `:help vim.lsp.*` for documentation on any of the below functions
(kmSetNs {
"gD" = {
rhs = vim.lsp.buf.declaration;
desc = "Jumps to the declaration of the symbol under the cursor."; };
"gd" = {
rhs = vim.lsp.buf.definition;
desc = "Jumps to the definition of the symbol under the cursor."; };
"K" = {
rhs = vim.lsp.buf.hover;
desc = "Displays hover information about the symbol under the cursor in a floating window."; };
"gi" = {
rhs = vim.lsp.buf.implementation;
desc = "Lists all the implementations for the symbol under the cursor in the quickfix window."; };
"<C-h>" = {
rhs = vim.lsp.buf.signature_help;
desc = "Displays signature information about the symbol under the cursor in a floating window."; };
"<space>wa" = {
rhs = vim.lsp.buf.add_workspace_folder;
desc = "Add a folder to the workspace folders."; };
"<space>wr" = {
rhs = vim.lsp.buf.remove_workspace_folder;
desc = "Remove a folder from the workspace folders."; };
"<space>wl" = {
rhs = (defun (print [
(vim.inspect [(vim.lsp.buf.list_workspace_folders [])])
]));
desc = "List workspace folders."; };
"<space>D" = {
rhs = vim.lsp.buf.type_definition;
desc = "Jumps to the definition of the type of the symbol under the cursor."; };
"<space>rn" = {
rhs = vim.lsp.buf.rename;
desc = "Rename old_fname to new_fname"; };
"<space>ca" = {
rhs = vim.lsp.buf.code_action;
desc = "Selects a code action available at the current cursor position."; };
"gr" = {
rhs = vim.lsp.buf.references;
desc = "Lists all the references to the symbol under the cursor in the quickfix window."; };
"<space>f" = {
rhs = (defun (vim.lsp.buf.format {async = true;}));
desc = "Formats a buffer."; };
})
]))
# LET rust_settings
{ rust-analyzer = {
assist.emitMustUse = true;
cargo.buildScripts.enable = true;
check.command = "clippy";
procMacro.enable = true;
}; }
# LET capabilities
(vim.tbl_extend [
"keep"
(vim.lsp.protocol.make_client_capabilities [])
(call (prop (require "cmp_nvim_lsp") "default_capabilities") [])
])
# BEGIN
] (on_attach: rust_settings: capabilities: [
(bindrec
# LETREC on_attach_rust
(on_attach_rust: client: bufnr: [
(vim.api.nvim_create_user_command ["RustAndroid" (opts: [
(setupLsp "rust_analyzer" {
on_attach = on_attach_rust;
inherit capabilities;
settings = vim.tbl_deep_extend [
"keep"
{ rust-analyzer.cargo.target = "x86_64-linux-android"; }
rust_settings
];
})
]) {}])
(call on_attach [client bufnr])
])
# BEGIN
(let lsp = { name, settings ? {} }: setupLsp name {
inherit on_attach capabilities settings;
}; in (on_attach_rust: [
(vim.lsp.set_log_level "debug")
] ++ [
(map lsp [
# see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
{ name = "bashls"; }
{ name = "clangd"; }
# https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
{ name = "pylsp"; settings = {
pylsp.plugins.pylsp_mypy.enabled = true;
}; }
{ name = "svelte"; }
{ name = "html"; }
{ name = "cssls"; }
{ name = "tsserver"; }
{ name = "jsonls"; }
{ name = "nil_ls"; }
{ name = "taplo"; }
{ name = "marksman"; }
])
(setupLsp "rust_analyzer" {
on_attach = on_attach_rust;
settings = rust_settings;
inherit capabilities;
})
]))) # END
])) # END
]); }
{ plugin = which-key-nvim;
config = compile "which_key_nvim" [
(set vim.o.timeout true)
(set vim.o.timeoutlen 500)
(setup (require "which-key") {})
]; }
];
};
}

View file

@ -0,0 +1,39 @@
-- globals.lua
-- list all global variables
-- :enew|pu=execute('luafile /path/to/file.lua')
-- list vim vars
-- :new | put! =getcompletion('*', 'var')
-- list events
-- :new | put! =getcompletion('*', 'event')
-- list options
-- :new | put! =getcompletion('*', 'option')
local seen={}
function dump(t,i)
seen[t]=true
local s={}
local n=0
for k in pairs(t) do
n=n+1 s[n]=k
end
local p0 = "package.loaded."
local i1 = (i:sub(0, #p0) == p0) and i:sub(#p0+1) or i
local p1 = "package.preload."
local i2 = (i1:sub(0, #p1) == p1) and i1:sub(#p1+1) or i1
for k,v in ipairs(s) do
local v0=t[v]
if type(v0)=="table" and not seen[v0] then
dump(v0,i1..v..".")
elseif v ~= "vim._meta" and v ~= "vim._init_packages" and v ~= "table.clear" and v ~= "table.new" and type(v0) == "function" and i:sub(0, #p1) == p1 then
dump(v0(),i2..v..".")
elseif type(v0) == "function" then
print("function/"..debug.getinfo(v0).nparams.."/"..i..v)
elseif type(v0) ~= "table" then
print(type(v0).."/"..i..v)
end
end
end
dump(_G,"")

View file

@ -0,0 +1,128 @@
BufAdd
BufCreate
BufDelete
BufEnter
BufFilePost
BufFilePre
BufHidden
BufLeave
BufModifiedSet
BufNew
BufNewFile
BufRead
BufReadCmd
BufReadPost
BufReadPre
BufUnload
BufWinEnter
BufWinLeave
BufWipeout
BufWrite
BufWriteCmd
BufWritePost
BufWritePre
ChanInfo
ChanOpen
CmdUndefined
CmdWinEnter
CmdWinLeave
CmdlineChanged
CmdlineEnter
CmdlineLeave
ColorScheme
ColorSchemePre
CompleteChanged
CompleteDone
CompleteDonePre
CursorHold
CursorHoldI
CursorMoved
CursorMovedI
DiagnosticChanged
DiffUpdated
DirChanged
DirChangedPre
EncodingChanged
ExitPre
FileAppendCmd
FileAppendPost
FileAppendPre
FileChangedRO
FileChangedShell
FileChangedShellPost
FileEncoding
FileReadCmd
FileReadPost
FileReadPre
FileType
FileWriteCmd
FileWritePost
FileWritePre
FilterReadPost
FilterReadPre
FilterWritePost
FilterWritePre
FocusGained
FocusLost
FuncUndefined
GUIEnter
GUIFailed
InsertChange
InsertCharPre
InsertEnter
InsertLeave
InsertLeavePre
LspAttach
LspDetach
MenuPopup
ModeChanged
OptionSet
QuickFixCmdPost
QuickFixCmdPre
QuitPre
RecordingEnter
RecordingLeave
RemoteReply
SearchWrapped
SessionLoadPost
ShellCmdPost
ShellFilterPost
Signal
SourceCmd
SourcePost
SourcePre
SpellFileMissing
StdinReadPost
StdinReadPre
SwapExists
Syntax
TabClosed
TabEnter
TabLeave
TabNew
TabNewEntered
TermChanged
TermClose
TermEnter
TermLeave
TermOpen
TermResponse
TextChanged
TextChangedI
TextChangedP
TextYankPost
UIEnter
UILeave
User
VimEnter
VimLeave
VimLeavePre
VimResized
VimResume
VimSuspend
WinClosed
WinEnter
WinLeave
WinNew
WinScrolled

9161
home/common/nvim/vim-lua.txt Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,62 @@
{ lib, raw, call }: let defs = map (line:
if lib.hasPrefix "function/" line then let split = lib.splitString "/" (lib.removePrefix "function/" line); in {
type = "function";
arity = lib.toInt (builtins.elemAt split 0);
value = builtins.elemAt split 1;
} else if lib.hasPrefix "string/" line then {
type = "string";
value = lib.removePrefix "string/" line;
} else if lib.hasPrefix "boolean/" line then {
type = "boolean";
value = lib.removePrefix "boolean/" line;
} else if lib.hasPrefix "number/" line then {
type = "number";
value = lib.removePrefix "number/" line;
} else {
type = "ignore";
value = "____ignore.___ignore";
}) (lib.splitString "\n" (builtins.readFile ./vim-lua.txt));
process' = val: (
if val.type == "function" then (
#if val.arity == 0 then
args: if args == "GET_INFO" then val else call (raw val.value) args
#else if val.arity == 1 then (a: if a == "GET_INFO" then val else call (raw val.value) [a])
#else (a: if a == "GET_INFO" then val else call (raw val.value) a)
) else raw val.value
);
process = val: lib.setAttrByPath (lib.splitString "." val.value) (process' val);
processOpt = o: val: lib.setAttrByPath ["vim" o val] (raw "vim.${o}.${val}");
processVar = val:
if lib.hasPrefix "b:" val then lib.setAttrByPath ["vim" "b" (lib.removePrefix "b:" val)] (raw "vim.b.${val}")
else if lib.hasPrefix "v:" val then lib.setAttrByPath ["vim" "v" (lib.removePrefix "v:" val)] (raw "vim.v.${val}")
else if lib.hasPrefix "w:" val then lib.setAttrByPath ["vim" "w" (lib.removePrefix "w:" val)] (raw "vim.w.${val}")
else if lib.hasPrefix "t:" val then lib.setAttrByPath ["vim" "t" (lib.removePrefix "t:" val)] (raw "vim.t.${val}")
else if lib.hasPrefix "v:" val then lib.setAttrByPath ["vim" "v" (lib.removePrefix "v:" val)] (raw "vim.v.${val}")
else lib.setAttrByPath ["vim" "g" val] (raw "vim.g.${val}");
setPath = path: key: val: if builtins.isAttrs val
then (builtins.mapAttrs (setPath "${path}${key}.") val) // { __kind = "var"; _name = "${path}${key}"; }
else val;
opts = (lib.splitString "\n" (builtins.readFile ./vim-opts.txt));
vars = (lib.splitString "\n" (builtins.readFile ./vim-vars.txt));
zip = x: if x == [] then {} else lib.recursiveUpdate (zip (builtins.tail x)) (builtins.head x);
patch = builtins.mapAttrs (k: v: if k == "vim" then v // {
inspect = process' {
type = "function";
arity = 2;
value = "vim.inspect";
};
cmd = process' {
type = "function";
arity = 1;
value = "vim.cmd";
};
} else v);
in
patch (builtins.mapAttrs (setPath "")
(zip (
(map process defs)
++ (map process (map (x: x // {value = "vim" + (lib.removePrefix "vim.shared" x.value); }) (builtins.filter ({value,...}: lib.hasPrefix "vim.shared" value) defs)))
++ (map (processOpt "o") opts)
++ (map (processOpt "opt") opts)
++ (map processVar vars)
)))

View file

@ -0,0 +1,354 @@
all
aleph
arabic
arabicshape
allowrevins
ambiwidth
autochdir
autoindent
autoread
autowrite
autowriteall
background
backspace
backup
backupcopy
backupdir
backupext
backupskip
belloff
binary
bomb
breakat
breakindent
breakindentopt
bufhidden
buflisted
buftype
casemap
cdhome
cdpath
cedit
channel
charconvert
cindent
cinkeys
cinoptions
cinwords
cinscopedecls
clipboard
cmdheight
cmdwinheight
colorcolumn
columns
comments
commentstring
compatible
complete
concealcursor
conceallevel
completefunc
completeopt
confirm
copyindent
cpoptions
cscopepathcomp
cscopeprg
cscopequickfix
cscoperelative
cscopetag
cscopetagorder
cscopeverbose
cursorbind
cursorcolumn
cursorline
cursorlineopt
debug
define
delcombine
dictionary
diff
diffexpr
diffopt
digraph
directory
display
eadirection
edcompatible
emoji
encoding
endofline
equalalways
equalprg
errorbells
errorfile
errorformat
eventignore
expandtab
exrc
fileencoding
fileencodings
fileformat
fileformats
fileignorecase
filetype
fillchars
fixendofline
foldclose
foldcolumn
foldenable
foldexpr
foldignore
foldlevel
foldlevelstart
foldmarker
foldmethod
foldminlines
foldnestmax
foldopen
foldtext
formatexpr
formatoptions
formatlistpat
formatprg
fsync
gdefault
grepformat
grepprg
guicursor
guifont
guifontwide
helpfile
helpheight
helplang
hidden
highlight
history
hkmap
hkmapp
hlsearch
icon
iconstring
ignorecase
iminsert
imsearch
inccommand
include
includeexpr
incsearch
indentexpr
indentkeys
infercase
insertmode
isfname
isident
iskeyword
isprint
joinspaces
jumpoptions
keymap
keymodel
keywordprg
langmap
langmenu
langnoremap
langremap
laststatus
lazyredraw
linebreak
lines
linespace
lisp
lispwords
list
listchars
loadplugins
magic
makeef
makeencoding
makeprg
matchpairs
matchtime
maxcombine
maxfuncdepth
maxmapdepth
maxmempattern
menuitems
mkspellmem
modeline
modelineexpr
modelines
modifiable
modified
more
mouse
mousefocus
mousemodel
mousemoveevent
mousescroll
mousetime
nrformats
number
numberwidth
omnifunc
operatorfunc
packpath
paragraphs
paste
pastetoggle
patchexpr
patchmode
path
preserveindent
previewheight
previewwindow
printdevice
printencoding
printexpr
printfont
printheader
printmbcharset
printmbfont
printoptions
prompt
pumblend
pumheight
pumwidth
pyxversion
quickfixtextfunc
quoteescape
readonly
redrawdebug
redrawtime
regexpengine
relativenumber
remap
report
revins
rightleft
rightleftcmd
ruler
rulerformat
runtimepath
scroll
scrollback
scrollbind
scrolljump
scrolloff
scrollopt
sections
secure
selection
selectmode
sessionoptions
shada
shadafile
shell
shellcmdflag
shellpipe
shellquote
shellredir
shelltemp
shellxquote
shellxescape
shiftround
shiftwidth
shortmess
showbreak
showcmd
showfulltag
showmatch
showmode
showtabline
sidescroll
sidescrolloff
signcolumn
smartcase
smartindent
smarttab
softtabstop
spell
spellcapcheck
spellfile
spelllang
spellsuggest
spelloptions
splitbelow
splitright
startofline
statusline
suffixes
suffixesadd
swapfile
switchbuf
synmaxcol
syntax
tagfunc
tabline
tabpagemax
tabstop
tagbsearch
tagcase
taglength
tagrelative
tags
tagstack
termbidi
termguicolors
termpastefilter
terse
textwidth
thesaurus
thesaurusfunc
tildeop
timeout
timeoutlen
title
titlelen
titleold
titlestring
ttimeout
ttimeoutlen
ttyfast
undodir
undofile
undolevels
undoreload
updatecount
updatetime
varsofttabstop
vartabstop
verbose
verbosefile
viewdir
viewoptions
virtualedit
visualbell
warn
whichwrap
wildchar
wildcharm
wildignore
wildignorecase
wildmenu
wildmode
wildoptions
winaltkeys
winbar
winblend
winhighlight
window
winheight
winfixheight
winfixwidth
winminheight
winminwidth
winwidth
wrap
wrapmargin
wrapscan
write
writeany
writebackup
writedelay

View file

@ -0,0 +1,23 @@
import os, json
d = os.path.dirname(os.path.realpath(__file__))
j = lambda x: os.path.join(d, x)
x = open(j("vim-lua.txt"),'rt').read().split('\n')
y = open(j("vim-opts.txt"),'rt').read().split('\n')
a = {}
def add(w, k, v):
if w.get(k[0]) is None:
w[k[0]] = {}
if len(k) == 1:
w[k[0]] = v
else:
add(w[k[0]], k[1:], v)
for w in x:
if w:
if w.startswith('function/'):
t, ar, n = w.split('/')
add(a, {'type'})
else:
t, n = w.split('/')

View file

@ -0,0 +1,140 @@
NvimTreeRequired
NvimTreeSetup
b:autopairs_keymaps
b:changedtick
b:nvim-autopairs
colors_name
did_indent_on
did_load_filetypes
did_load_ftplugin
ft_ignore_pat
loaded_2html_plugin
loaded_clipboard_provider
loaded_cmp
loaded_devicons
loaded_gzip
loaded_man
loaded_matchit
loaded_matchparen
loaded_netrw
loaded_netrwPlugin
loaded_node_provider
loaded_python_provider
loaded_remote_plugins
loaded_shada_plugin
loaded_sleuth
loaded_spellfile_plugin
loaded_tarPlugin
loaded_tutor_mode_plugin
loaded_zipPlugin
lspconfig
lua_subversion
lua_version
markdown_fenced_languages
markdown_minlines
matchparen_insert_timeout
matchparen_timeout
nvim_web_devicons
python3_host_prog
ruby_host_prog
syntax_on
system_remote_plugins
v:_null_blob
v:_null_dict
v:_null_list
v:_null_string
v:argv
v:beval_bufnr
v:beval_col
v:beval_lnum
v:beval_text
v:beval_winid
v:beval_winnr
v:char
v:charconvert_from
v:charconvert_to
v:cmdarg
v:cmdbang
v:collate
v:completed_item
v:count
v:count1
v:ctype
v:dying
v:echospace
v:errmsg
v:errors
v:event
v:exception
v:exiting
v:false
v:fcs_choice
v:fcs_reason
v:fname
v:fname_diff
v:fname_in
v:fname_new
v:fname_out
v:folddashes
v:foldend
v:foldlevel
v:foldstart
v:hlsearch
v:insertmode
v:key
v:lang
v:lc_time
v:lnum
v:lua
v:mouse_col
v:mouse_lnum
v:mouse_win
v:mouse_winid
v:msgpack_types
v:null
v:numbermax
v:numbermin
v:numbersize
v:oldfiles
v:operator
v:option_command
v:option_new
v:option_old
v:option_oldglobal
v:option_oldlocal
v:option_type
v:prevcount
v:profiling
v:progname
v:progpath
v:register
v:scrollstart
v:searchforward
v:servername
v:shell_error
v:statusmsg
v:stderr
v:swapchoice
v:swapcommand
v:swapname
v:t_blob
v:t_bool
v:t_dict
v:t_float
v:t_func
v:t_list
v:t_number
v:t_string
v:termresponse
v:testing
v:this_session
v:throwpoint
v:true
v:val
v:version
v:vim_did_enter
v:warningmsg
v:windowid
vimsyn_embed
zipPlugin_ext

View file

@ -1,349 +0,0 @@
{ config, pkgs, ... }:
{
imports = [ ./options.nix ];
programs.neovim = {
enable = true;
defaultEditor = true;
package = pkgs.neovim-unwrapped;
extraPackages = with pkgs; [
rust-analyzer
nodePackages_latest.bash-language-server shellcheck
nodePackages_latest.typescript-language-server
nodePackages_latest.svelte-language-server
clang-tools
nodePackages_latest.vscode-langservers-extracted
nil
marksman
taplo
python3Packages.python-lsp-server
];
# extraPython3Packages = pyPkgs: with pyPkgs; [ python-lsp-server ];
extraConfig = ''
syntax on
au FileType markdown set colorcolumn=73 textwidth=72
au FileType gitcommit set colorcolumn=73
highlight NormalFloat guibg=NONE
au BufReadPre * set foldmethod=syntax
au BufReadPost * folddoc foldopen!
autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
'';
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins =
let lua = (s: ''
lua << EOF
${s}
EOF
'');
in with pkgs.vimPlugins; [
vim-svelte
# TODO remove on next nvim update (0.8.3/0.9)
vim-nix
{ plugin = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "vscode-nvim";
version = "2023-02-10";
src = pkgs.fetchFromGitHub {
owner = "Mofiqul";
repo = "vscode.nvim";
rev = "db9ee339b5556aa832ca58871fd18f9467a18520";
sha256 = "sha256-X2IgIjO5NNq7vJdl09hBY1TFqHlsfF1xfllKr4osILI=";
};
};
config = lua ''
require("vscode").setup({
transparent = true,
color_overrides = {
vscGray = "#745b5f",
vscViolet = "#${config.colors.magenta}",
vscBlue = "#6ddfd8",
vscDarkBlue = "#${config.colors.blue}",
vscGreen = "#${config.colors.green}",
vscBlueGreen = "#73bf88",
vscLightGreen = "#6acf6e",
vscRed = "#${config.colors.red}",
vscOrange = "#e89666",
vscLightRed = "#e64e4e",
vscYellowOrange = "#e8b166",
vscYellow = "#${config.colors.yellow}",
vscPink = "#cf83c4",
},
})
''; }
{ plugin = nvim-web-devicons;
config = lua ''
require'nvim-web-devicons'.setup {
}
''; }
{ plugin = nvim-tree-lua;
config = lua ''
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
require("nvim-tree").setup({
-- :help nvim-tree-setup
})
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<C-N>', require("nvim-tree.api").tree.toggle, opts)
require("which-key").register({['<C-n>'] = {
require("nvim-tree.api").tree.toggle, 'Toggle NvimTree'
}}, {mode='n', noremap=true, silent=true})
''; }
vim-sleuth
luasnip
{ plugin = nvim-cmp;
config = lua ''
local cmp = require('cmp')
local function border(hl_name)
return {
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
}
end
cmp.setup {
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
view = {
},
window = {
completion = {
border = border "CmpBorder",
winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None",
},
documentation = {
border = border "CmpDocBorder",
},
},
formatting = {
format = function(_, vim_item)
local icons = require("lspkind")
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
return vim_item
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<cr>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
['<tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
['<S-tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require('luasnip').jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
}),
}
''; }
lspkind-nvim
cmp_luasnip
cmp-nvim-lsp
{ plugin = nvim-autopairs;
config = lua ''
require('nvim-autopairs').setup({
disable_filetype = { "TelescopePrompt" , "vim" },
})
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
''; }
{ plugin = comment-nvim;
config = lua ''
require('Comment').setup()
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>/', require("Comment.api").toggle.linewise.current, opts)
vim.keymap.set('v', '<space>/', "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", opts)
require("which-key").register({['<space>/'] = {
require("Comment.api").toggle.linewise.current, 'Comment current line'
}}, {mode='n', noremap=true, silent=true})
require("which-key").register({['<space>/'] = {
"<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", 'Comment current line'
}}, {mode='v', noremap=true, silent=true})
''; }
{ plugin = nvim-lspconfig;
config = lua ''
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
require("which-key").register({
['<space>e'] = { vim.diagnostic.open_float, 'Show diagnostics in a floating window.' },
['[d'] = { vim.diagnostic.goto_prev, 'Move to the previous diagnostic in the current buffer.' },
[']d'] = { vim.diagnostic.goto_next, 'Get the next diagnostic closest to the cursor position.' },
['<space>q'] = { vim.diagnostic.setloclist, 'Add buffer diagnostics to the location list.' },
}, {mode='n', noremap=true, silent=true})
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<C-h>', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
require("which-key").register({
['gD'] = { vim.lsp.buf.declaration, 'Jumps to the declaration of the symbol under the cursor.' },
['gd'] = { vim.lsp.buf.definition, 'Jumps to the definition of the symbol under the cursor.' },
['K'] = { vim.lsp.buf.hover, 'Displays hover information about the symbol under the cursor in a floating window.' },
['gi'] = { vim.lsp.buf.implementation, 'Lists all the implementations for the symbol under the cursor in the quickfix window.' },
['<C-h>'] = { vim.lsp.buf.signature_help, 'Displays signature information about the symbol under the cursor in a floating window.' },
['<space>wa'] = { vim.lsp.buf.add_workspace_folder, 'Add a folder to the workspace folders.' },
['<space>wr'] = { vim.lsp.buf.remove_workspace_folder, 'Remove a folder from the workspace folders.' },
['<space>wl'] = { function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, 'List workspace folders.' },
['<space>D'] = { vim.lsp.buf.type_definition, 'Jumps to the definition of the type of the symbol under the cursor.' },
['<space>rn'] = { vim.lsp.buf.rename, 'Rename old_fname to new_fname' },
['<space>ca'] = { vim.lsp.buf.code_action, 'Selects a code action available at the current cursor position.' },
['gr'] = { vim.lsp.buf.references, 'Lists all the references to the symbol under the cursor in the quickfix window.' },
['<space>f'] = { function()
vim.lsp.buf.format { async = true }
end, 'Formats a buffer.' },
}, {mode='n', noremap=true, silent=true, buffer=bufnr})
end
local lsp_flags = {
-- This is the default in Nvim 0.7+
debounce_text_changes = 150,
}
local capabilities = vim.tbl_extend(
'keep',
vim.lsp.protocol.make_client_capabilities(),
require('cmp_nvim_lsp').default_capabilities()
);
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
require'lspconfig'.bashls.setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require'lspconfig'.clangd.setup{
-- usually requires compile_flags.json
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require'lspconfig'.pylsp.setup{
-- https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require'lspconfig'.svelte.setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require'lspconfig'.html.setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require'lspconfig'.cssls.setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require'lspconfig'.tsserver.setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require'lspconfig'.jsonls.setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require'lspconfig'.nil_ls.setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require'lspconfig'.taplo.setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require'lspconfig'.marksman.setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
require'lspconfig'.rust_analyzer.setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
-- Server-specific settings...
settings = {
["rust-analyzer"] = {}
}
}
''; }
{ plugin = which-key-nvim;
config = lua ''
vim.o.timeout = true
vim.o.timeoutlen = 500
require("which-key").setup { }
''; }
];
};
}

View file

@ -116,4 +116,7 @@
}]; }];
style = ./waybar.css; style = ./waybar.css;
}; };
home.packages = with pkgs; [
playerctl
];
} }

View file

@ -4,7 +4,7 @@
../common/general.nix ../common/general.nix
../common/firefox ../common/firefox
../common/i3-sway.nix ../common/i3-sway.nix
../common/vim.nix ../common/nvim
../common/helix.nix ../common/helix.nix
../common/kakoune.nix ../common/kakoune.nix
]; ];
@ -51,6 +51,9 @@
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "${proton-ge}"; STEAM_EXTRA_COMPAT_TOOLS_PATHS = "${proton-ge}";
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
(ghidra.overrideAttrs (old: {
patches = old.patches ++ [ ../common/ghidra-stdcall.patch ];
})) cutter
openrgb piper openrgb piper
steam-run steam steam-run steam
osu-lazer-bin taisei osu-lazer-bin taisei

View file

@ -274,6 +274,7 @@ in {
experimental-features = nix-command flakes experimental-features = nix-command flakes
''; '';
}; };
systemd.services.nix-daemon.serviceConfig.LimitSTACKSoft = "infinity";
documentation.dev.enable = true; documentation.dev.enable = true;