Add neovim config
This commit is contained in:
parent
62b4adfff4
commit
418a91a241
|
@ -3,6 +3,7 @@
|
|||
{
|
||||
imports = [
|
||||
(import ./modules/zsh/config.nix {inherit config pkgs;})
|
||||
(import ./modules/nvim/config.nix {inherit config pkgs;})
|
||||
];
|
||||
|
||||
home.stateVersion = "24.11";
|
||||
|
@ -15,13 +16,6 @@
|
|||
|
||||
programs.bash.enable = true;
|
||||
programs.home-manager.enable = true;
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
defaultEditor = true;
|
||||
};
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Thomas Avé";
|
||||
|
@ -31,9 +25,4 @@
|
|||
a = "add";
|
||||
};
|
||||
};
|
||||
|
||||
home.sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
];
|
||||
|
||||
home.file."${config.xdg.configHome}/nvim" = {
|
||||
source = ./files;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
defaultEditor = true;
|
||||
};
|
||||
home.sessionVariables = {
|
||||
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
|
||||
};
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
require('settings')
|
||||
require('mappings')
|
||||
|
||||
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)
|
||||
require("lazy").setup(require("plugins.catppuccin"))
|
||||
vim.opt.laststatus = 0
|
|
@ -0,0 +1,8 @@
|
|||
require('settings')
|
||||
require('lazy_config')
|
||||
require('mappings')
|
||||
require('teaching')
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", { pattern = "make", command = [[set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab]] })
|
||||
vim.api.nvim_create_autocmd("FileType", { pattern = "javascript", command = [[setlocal shiftwidth=2 softtabstop=2 expandtab]] })
|
||||
vim.api.nvim_create_autocmd("FileType", { pattern = "vue", command = [[setlocal shiftwidth=2 softtabstop=2 expandtab]] })
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "f4b4b980ce88d546aeb69d11463187c8f716a1a1" },
|
||||
"catppuccin": { "branch": "main", "commit": "a1439ad7c584efb3d0ce14ccb835967f030450fe" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp-snippy": { "branch": "master", "commit": "6e39210aa3a74e2bf6462f492eaf0d436cd2b7d3" },
|
||||
"copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
|
||||
"flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
|
||||
"formatter.nvim": { "branch": "master", "commit": "ad246d34ce7a32f752071ed81b09b94e6b127fad" },
|
||||
"gen.nvim": { "branch": "main", "commit": "87fbe811155b90eea58622614809705b966009ad" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "3f13f080434ac942b150679223d54f5ca91e0d52" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "273fdde8ac5e51f3a223ba70980e52bbc09d9f6f" },
|
||||
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
|
||||
"neogit": { "branch": "master", "commit": "98e6e855266282a3dd32e642ea14209b8787882a" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "aa5f4f4ee10b2688fb37fa46215672441d5cd5d9" },
|
||||
"nvim-neoclip.lua": { "branch": "main", "commit": "798cd0592a81c185465db3a091a0ff8a21af60fd" },
|
||||
"nvim-snippy": { "branch": "master", "commit": "1184a8734e998649f3bb9a5db9efd4543282050b" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "59e65d88db177ad1e6a8cffaafd4738420ad20b6" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "99d3e799b46f5c2a1fc0d7a42d7ab452de48c067" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "794bba734ec95eaff9bb82fbd112473be2087283" },
|
||||
"obsidian.nvim": { "branch": "main", "commit": "754d3410b907b5f5ae3c9f4ccf643ea945021341" },
|
||||
"oil.nvim": { "branch": "master", "commit": "bcfc0a2e01def5019aa14fac2fc6de20dedb6d3d" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" },
|
||||
"sqlite.lua": { "branch": "master", "commit": "d0ffd703b56d090d213b497ed4eb840495f14a11" },
|
||||
"telescope-fzy-native.nvim": { "branch": "master", "commit": "282f069504515eec762ab6d6c89903377252bf5b" },
|
||||
"telescope-undo.nvim": { "branch": "main", "commit": "95b61c01ea3a4c9e8747731148e905bbcf0ccaee" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "2d0d057791854decb2c9b6a0b52d43f3900dff40" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" },
|
||||
"tree-sitter-hyprlang": { "branch": "master", "commit": "e5da7d0aa44403153e0394d87d9edea4e5bd6609" },
|
||||
"tree-sitter-typst": { "branch": "master", "commit": "823309ed8b872dd33c7f350a3bab3d6e51436a5a" },
|
||||
"trim.nvim": { "branch": "master", "commit": "4fe47a46c02a58894ded8328ca81f6c214a892f5" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" },
|
||||
"vim-bracketed-paste": { "branch": "master", "commit": "ffa3bc10ab511a646f1b30bc9345f240c15394e9" },
|
||||
"vim-caddyfile": { "branch": "master", "commit": "24fe0720551883e407cb70ae1d7c03f162d1d5a0" },
|
||||
"vim-hypr-nav": { "branch": "main", "commit": "6ab4865a7eb5aad35305298815a4563c9d48556a" },
|
||||
"vim-rooter": { "branch": "master", "commit": "45e53f01e4e1c4a3ee20814de232162713aff578" },
|
||||
"vim-snippets": { "branch": "master", "commit": "393d980157b8149b3ff65a48bc4aae24dca9c846" },
|
||||
"vimtex": { "branch": "master", "commit": "a80934749c69cc6875b3c9b13ef59573a4824fb2" }
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
-- Install Lazy.nvim
|
||||
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)
|
||||
require("lazy").setup("plugins", {
|
||||
change_detection = {
|
||||
enabled = false,
|
||||
notify = false, -- get a notification when changes are found
|
||||
}
|
||||
})
|
|
@ -0,0 +1,68 @@
|
|||
local log = require("ltex_extra.src.log")
|
||||
|
||||
local M = {}
|
||||
|
||||
local default_opts = {
|
||||
load_langs = { "es-AR", "en-US" },
|
||||
init_check = true,
|
||||
}
|
||||
|
||||
M.opts = {}
|
||||
|
||||
local ltex_languages = {
|
||||
"en-GB",
|
||||
"nl-BE",
|
||||
"en-US",
|
||||
"fr",
|
||||
"auto",
|
||||
}
|
||||
|
||||
local register_user_cmds = function()
|
||||
vim.api.nvim_create_user_command("LtexSwitchLang", function()
|
||||
vim.ui.select(ltex_languages, {
|
||||
prompt = "Select language:",
|
||||
}, function(choice)
|
||||
require("ltex_extra.src.commands-lsp").switchLanguage(choice)
|
||||
end)
|
||||
end, { desc = "ltex_extra.nvim: Switch sever language" })
|
||||
end
|
||||
|
||||
M.setup = function(opts)
|
||||
log.trace("Merge options")
|
||||
M.opts = opts or default_opts
|
||||
for key, value in pairs(default_opts) do
|
||||
if not M.opts[key] then
|
||||
M.opts[key] = value
|
||||
end
|
||||
end
|
||||
|
||||
log.trace("Add commands to lsp")
|
||||
register_user_cmds()
|
||||
vim.lsp.commands['_ltex.addToDictionary'] = require("ltex_extra.src.commands-lsp").addToDictionary
|
||||
vim.lsp.commands['_ltex.hideFalsePositives'] = require("ltex_extra.src.commands-lsp").hideFalsePositives
|
||||
vim.lsp.commands['_ltex.disableRules'] = require("ltex_extra.src.commands-lsp").disableRules
|
||||
|
||||
log.trace("Inital load files")
|
||||
if opts.init_check == true then
|
||||
require("ltex_extra.src.commands-lsp").updateConfigFull(opts.load_langs)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
-- Dev notes:
|
||||
--
|
||||
-- Dummy functions for test vim.lsp.commands
|
||||
-- local dummy_calls = 0
|
||||
-- local dummy_cmd = function()
|
||||
-- print(dummy_calls)
|
||||
-- dummy_calls = dummy_calls + 1
|
||||
-- print(dummy_calls)
|
||||
-- end
|
||||
|
||||
-- Inspect function for arguments. Doesn't work after nvim 0.7.
|
||||
-- local orig_execute_command = vim.lsp.buf.execute_command
|
||||
-- vim.lsp.buf.execute_command = function (command)
|
||||
-- print(vim.inspect(command))
|
||||
-- orig_execute_command(command)
|
||||
-- end
|
|
@ -0,0 +1,139 @@
|
|||
local log = require("ltex_extra.src.log")
|
||||
|
||||
local inspect = require("ltex_extra.src.utils").inspect
|
||||
local writeFile = require("ltex_extra.src.utils").writeFile
|
||||
local loadFile = require("ltex_extra.src.utils").readFile
|
||||
|
||||
local types = {
|
||||
["dict"] = "dictionary",
|
||||
["dRules"] = "disabledRules",
|
||||
["hRules"] = "hiddenFalsePositives",
|
||||
["language"] = "language"
|
||||
}
|
||||
|
||||
local function catch_ltex()
|
||||
log.trace("catch_ltex")
|
||||
local buf_clients = vim.lsp.buf_get_clients()
|
||||
local client = nil
|
||||
for _, lsp in ipairs(buf_clients) do
|
||||
if lsp.name == "ltex" then client = lsp end
|
||||
end
|
||||
return client
|
||||
end
|
||||
|
||||
local function update_language(client, lang)
|
||||
log.trace("update_language")
|
||||
if not client.config.settings.ltex.language then
|
||||
client.config.settings.ltex.language = {}
|
||||
end
|
||||
client.config.settings.ltex.language = lang
|
||||
log.debug(vim.inspect(client.config.settings.ltex.language))
|
||||
return client.notify("workspace/didChangeConfiguration", client.config.settings)
|
||||
end
|
||||
|
||||
local function update_dictionary(client, lang)
|
||||
log.trace("update_dictionary")
|
||||
if not client.config.settings.ltex.dictionary then
|
||||
client.config.settings.ltex.dictionary = {}
|
||||
end
|
||||
client.config.settings.ltex.dictionary[lang] = loadFile(types.dict, lang)
|
||||
log.debug(inspect(client.config.settings.ltex.dictionary))
|
||||
return client.notify('workspace/didChangeConfiguration', client.config.settings)
|
||||
end
|
||||
|
||||
local function update_disabledRules(client, lang)
|
||||
log.trace("update_disabledRules")
|
||||
if not client.config.settings.ltex.disabledRules then
|
||||
client.config.settings.ltex.disabledRules = {}
|
||||
end
|
||||
client.config.settings.ltex.disabledRules[lang] = loadFile(types.dRules, lang)
|
||||
log.debug(inspect(client.config.settings.ltex.disabledRules))
|
||||
return client.notify('workspace/didChangeConfiguration', client.config.settings)
|
||||
end
|
||||
|
||||
local function update_hiddenFalsePositive(client, lang)
|
||||
log.trace("update_hiddenFalsePositive")
|
||||
if not client.config.settings.ltex.hiddenFalsePositives then
|
||||
client.config.settings.ltex.hiddenFalsePositives = {}
|
||||
end
|
||||
client.config.settings.ltex.hiddenFalsePositives[lang] = loadFile(types.hRules, lang)
|
||||
log.debug(inspect(client.config.settings.ltex.hiddenFalsePositives))
|
||||
return client.notify('workspace/didChangeConfiguration', client.config.settings)
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
M.updateConfig = function(configtype, lang)
|
||||
log.trace("updateConfig")
|
||||
local client = catch_ltex()
|
||||
if client then
|
||||
if configtype == types.dict then
|
||||
update_dictionary(client, lang)
|
||||
elseif configtype == types.dRules then
|
||||
update_disabledRules(client, lang)
|
||||
elseif configtype == types.hRules then
|
||||
update_hiddenFalsePositive(client, lang)
|
||||
elseif configtype == types.language then
|
||||
update_language(client, lang)
|
||||
else
|
||||
log.fmt_error("Config type unknown")
|
||||
return vim.notify("Config type unknown")
|
||||
end
|
||||
else
|
||||
log.fmt_error("Error catching ltex client")
|
||||
return vim.notify("Error catching ltex client")
|
||||
end
|
||||
end
|
||||
|
||||
M.updateConfigFull = function(langs)
|
||||
log.trace("updateConfigFull")
|
||||
langs = langs or package.loaded.ltex_extra.opts.load_langs
|
||||
for _, lang in pairs(langs) do
|
||||
log.fmt_trace("Loading %s", lang)
|
||||
M.updateConfig(types.dict, lang)
|
||||
M.updateConfig(types.dRules, lang)
|
||||
M.updateConfig(types.hRules, lang)
|
||||
end
|
||||
end
|
||||
|
||||
M.addToDictionary = function(command)
|
||||
log.trace("addToDictionary")
|
||||
local args = command.arguments[1].words
|
||||
for lang, words in pairs(args) do
|
||||
log.fmt_debug("Lang: %s Words: %s", inspect(lang), inspect(words))
|
||||
writeFile(types.dict, lang, words)
|
||||
M.updateConfig(types.dict, lang)
|
||||
end
|
||||
end
|
||||
|
||||
M.disableRules = function(command)
|
||||
log.trace("disableRules")
|
||||
local args = command.arguments[1].ruleIds
|
||||
for lang, rules in pairs(args) do
|
||||
log.fmt_debug("Lang: %s Rules: %s", inspect(lang), inspect(rules))
|
||||
writeFile(types.dRules, lang, rules)
|
||||
M.updateConfig(types.dRules, lang)
|
||||
end
|
||||
end
|
||||
|
||||
M.hideFalsePositives = function(command)
|
||||
log.trace("hideFalsePositives")
|
||||
local args = command.arguments[1].falsePositives
|
||||
for lang, rules in pairs(args) do
|
||||
log.fmt_debug("Lang: %s Rules: %s", inspect(lang), inspect(rules))
|
||||
writeFile(types.hRules, lang, rules)
|
||||
M.updateConfig(types.hRules, lang)
|
||||
end
|
||||
end
|
||||
|
||||
function M.switchLanguage(lang)
|
||||
log.trace("language")
|
||||
local client = catch_ltex()
|
||||
if client then
|
||||
M.updateConfig(types.language, lang)
|
||||
else
|
||||
return error("Error catching ltex client", 1)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,62 @@
|
|||
local debug = false
|
||||
|
||||
local log = {}
|
||||
|
||||
if debug then
|
||||
log = require("plenary.log").new {
|
||||
plugin = "ltex_extra",
|
||||
use_file = false,
|
||||
level = "trace"
|
||||
}
|
||||
else
|
||||
local dummy = function (...) return true end
|
||||
log.trace = dummy
|
||||
log.debug = dummy
|
||||
log.info = dummy
|
||||
log.warn = dummy
|
||||
log.error = dummy
|
||||
log.fatal = dummy
|
||||
log.fmt_trace = dummy
|
||||
log.fmt_debug = dummy
|
||||
log.fmt_info = dummy
|
||||
log.fmt_warn = dummy
|
||||
log.fmt_error = dummy
|
||||
log.fmt_fatal = dummy
|
||||
end
|
||||
|
||||
|
||||
-- local default_config = {
|
||||
-- -- Name of the plugin. Prepended to log messages
|
||||
-- plugin = "plenary",
|
||||
--
|
||||
-- -- Should print the output to neovim while running
|
||||
-- -- values: 'sync','async',false
|
||||
-- use_console = "async",
|
||||
--
|
||||
-- -- Should highlighting be used in console (using echohl)
|
||||
-- highlights = true,
|
||||
--
|
||||
-- -- Should write to a file
|
||||
-- use_file = true,
|
||||
--
|
||||
-- -- Should write to the quickfix list
|
||||
-- use_quickfix = false,
|
||||
--
|
||||
-- -- Any messages above this level will be logged.
|
||||
-- level = p_debug and "debug" or "info",
|
||||
--
|
||||
-- -- Level configuration
|
||||
-- modes = {
|
||||
-- { name = "trace", hl = "Comment" },
|
||||
-- { name = "debug", hl = "Comment" },
|
||||
-- { name = "info", hl = "None" },
|
||||
-- { name = "warn", hl = "WarningMsg" },
|
||||
-- { name = "error", hl = "ErrorMsg" },
|
||||
-- { name = "fatal", hl = "ErrorMsg" },
|
||||
-- },
|
||||
--
|
||||
-- -- Can limit the number of decimals displayed for floats
|
||||
-- float_precision = 0.01,
|
||||
-- }
|
||||
|
||||
return log
|
|
@ -0,0 +1,54 @@
|
|||
local M = {}
|
||||
|
||||
-- PRIVATE FUNCTIONS
|
||||
|
||||
M.file_exists = function(filename)
|
||||
local file = io.open(filename, "r")
|
||||
if file ~= nil then io.close(file) return true else return false end
|
||||
end
|
||||
|
||||
-- PUBLIC FUNCTIONS
|
||||
|
||||
M.writeFile = function(type, lang, lines)
|
||||
local filename = vim.fn.getenv("HOME") .. "/.config/nvim/spell/" .. table.concat({ "ltex", type, lang, "txt" }, ".")
|
||||
local file = io.open(filename, "a+")
|
||||
io.output(file)
|
||||
for _, line in ipairs(lines) do
|
||||
io.write(line .. "\n")
|
||||
end
|
||||
io.close(file)
|
||||
end
|
||||
|
||||
M.readFile = function(type, lang)
|
||||
local filename = vim.fn.getenv("HOME") .. "/.config/nvim/spell/" .. table.concat({ "ltex", type, lang, "txt" }, ".")
|
||||
local lines = {}
|
||||
if M.file_exists(filename) then
|
||||
local file = io.open(filename, "r")
|
||||
io.input(file)
|
||||
for line in io.lines(filename) do
|
||||
lines[#lines + 1] = line
|
||||
end
|
||||
io.close(file)
|
||||
end
|
||||
return lines
|
||||
end
|
||||
|
||||
M.loadFile = function(type, langs)
|
||||
local content = {}
|
||||
for _, lang in ipairs(langs) do
|
||||
content[lang] = M.readFile(type, lang)
|
||||
end
|
||||
return content
|
||||
end
|
||||
|
||||
M.inspect = function(args)
|
||||
local inspect = nil
|
||||
if vim then
|
||||
inspect = vim.inspect
|
||||
else
|
||||
inspect = require("inspect") -- from luarocks
|
||||
end
|
||||
return inspect(args)
|
||||
end
|
||||
|
||||
return M
|
|
@ -0,0 +1,41 @@
|
|||
local inspect = require("inspect")
|
||||
local lnsep = "=========="
|
||||
local function println(arg) print("\n" .. lnsep .. arg .. lnsep) end
|
||||
|
||||
local commands = require("test.commands")
|
||||
local addToDictionary = require("src.commands-lsp").addToDictionary
|
||||
local disableRules = require("src.commands-lsp").disableRules
|
||||
local hideFalsePositives = require("src.commands-lsp").hideFalsePositives
|
||||
|
||||
local inspect = require("src.utils").inspect
|
||||
local writeFile = require("src.utils").writeFile
|
||||
local readFile = require("src.utils").readFile
|
||||
|
||||
local load_file = require("src.utils").load_file
|
||||
local langs = {"es-AR", "en-US"}
|
||||
|
||||
-- Command Handler mockup.
|
||||
local function execute_command(command)
|
||||
println(command.command)
|
||||
print("command = " .. inspect(command))
|
||||
if command.command == '_ltex.addToDictionary' then
|
||||
addToDictionary(commands.dictionary)
|
||||
elseif command.command == '_ltex.disableRules' then
|
||||
disableRules(commands.disableRules)
|
||||
elseif command.command == '_ltex.hideFalsePositives' then
|
||||
hideFalsePositives(commands.hideFalsePositives)
|
||||
end
|
||||
end
|
||||
|
||||
execute_command(commands.dictionary)
|
||||
execute_command(commands.disableRules)
|
||||
execute_command(commands.hideFalsePositives)
|
||||
|
||||
println("Reading file")
|
||||
local dictionary = load_file("dictionary", langs)
|
||||
local disabledRules = load_file("disabledRules", langs)
|
||||
local hiddenFalsePositives = load_file("hiddenFalsePositives", langs)
|
||||
print(inspect({dictionary, disabledRules, hiddenFalsePositives}))
|
||||
|
||||
-- local dictionary_example = {["es-AR"] = {"Errorr"}, ["en-US"] = {"Errorr"}}
|
||||
-- print(M.inspect(dictionary_example))
|
|
@ -0,0 +1,38 @@
|
|||
-- Commands captured from LSP Code action.
|
||||
local commands = {}
|
||||
|
||||
commands.dictionary = {
|
||||
arguments = { {
|
||||
uri = "file:///home/leonardo/.config/nvim/lua/test/latex/main.tex",
|
||||
words = {
|
||||
["en-US"] = { "Error", "Warning" },
|
||||
}
|
||||
} },
|
||||
command = "_ltex.addToDictionary",
|
||||
title = "Add 'Errorr' to dictionary"
|
||||
}
|
||||
|
||||
commands.disableRules = {
|
||||
arguments = { {
|
||||
ruleIds = {
|
||||
["en-US"] = { "MORFOLOGIK_RULE_ES", "INCORRECT_SPACES" }
|
||||
},
|
||||
uri = "file:///home/leonardo/develop/ltex-lua/readme.md"
|
||||
} },
|
||||
command = "_ltex.disableRules",
|
||||
title = "Disable rule"
|
||||
}
|
||||
|
||||
commands.hideFalsePositives = {
|
||||
arguments = { {
|
||||
falsePositives = {
|
||||
["en-US"] = { '{"rule":"UPPERCASE_SENTENCE_START","sentence":"^\\\\Qerror with false positive.\\\\E$"}',
|
||||
'{"rule":"UPPERCASE_SENTENCE_START","sentence":"^\\\\Qerror with false positive.\\\\E$"}' }
|
||||
},
|
||||
uri = "file:///home/leonardo/develop/ltex-lua/readme.md"
|
||||
} },
|
||||
command = "_ltex.hideFalsePositives",
|
||||
title = "Hide false positive"
|
||||
}
|
||||
|
||||
return commands
|
|
@ -0,0 +1,9 @@
|
|||
@online{ltex,
|
||||
author = {Valentjn},
|
||||
keywords = {ltex},
|
||||
month = jun,
|
||||
publisher = {Github},
|
||||
title = {LTeX language server},
|
||||
url = {https://valentjn.github.io/ltex/settings.html},
|
||||
year = {2022}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
lang: es-AR
|
||||
---
|
||||
This is a misspelling.
|
||||
this sentences should beggining uppercase.
|
||||
This rules is going to be disabled.
|
||||
|
||||
Esto es un errorr.
|
||||
esta oración debe comenzar con mayúsculas.
|
||||
Esta regla sera desactivada.
|
|
@ -0,0 +1,16 @@
|
|||
\documentclass{article}
|
||||
% \usepackage[english]{babel}
|
||||
\usepackage[spanish]{babel}
|
||||
|
||||
\begin{document}
|
||||
|
||||
This is a missspell.
|
||||
this sentences should beggining uppercase.
|
||||
This rules is going to be disabled.
|
||||
|
||||
Esto es un errorr.
|
||||
esta oración debe comenzar con mayúsculas.
|
||||
Esta regla sera desactivada.
|
||||
|
||||
|
||||
\end{document}
|
|
@ -0,0 +1,42 @@
|
|||
vim.keymap.set("i", "jj", "<Esc>", {})
|
||||
vim.keymap.set("n", "j", "gj", {})
|
||||
vim.keymap.set("n", "k", "gk", {})
|
||||
vim.keymap.set("n", "<S-k>", "<Nop>", {})
|
||||
vim.keymap.set("t", "jj", "<C-\\><C-n>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<Backspace>", ":q<cr>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-Backspace>", ":q!<cr>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", ",;", ":", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-U>", "<C-O>", { noremap = true })
|
||||
vim.keymap.set("n", "<S-C-U>", "g;", { noremap = true })
|
||||
vim.keymap.set("n", "<S-C-I>", "g,", { noremap = true })
|
||||
vim.keymap.set("n", "<C-E>", "<C-U>zz", { noremap = true })
|
||||
vim.keymap.set("n", "<C-D>", "<C-D>zz", { noremap = true })
|
||||
vim.keymap.set("n", "<C-I>", "<C-I>", { noremap = true })
|
||||
vim.keymap.set("n", "n", "nzz", { noremap = true })
|
||||
vim.keymap.set("n", "N", "Nzz", { noremap = true })
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]], { noremap = true })
|
||||
vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
|
||||
vim.keymap.set({"n", "v"}, "<leader>Y", [["+Y]])
|
||||
vim.keymap.set("n", "<Tab>", "<Nop>", { noremap = true })
|
||||
vim.keymap.set("n", "<leader><space>", ":noh<cr>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "gn", ":n<cr>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<leader>d", function () require("trouble").toggle() end, { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "gi", ":ClangdSwitchSourceHeader<cr>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<leader>t", ":NvimTreeFindFileToggle<cr>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "-", function () require("oil").open() end, { desc = "Open parent directory" })
|
||||
vim.keymap.set("n", "<leader>-", function () require("oil").open() end, { desc = "Open parent directory" })
|
||||
vim.keymap.set("n", "<leader>g", function () require("neogit").open({kind="replace"}) end, { noremap = true, silent = true })
|
||||
vim.keymap.set("x", "<leader>a", "<C-A>", { noremap = true, silent = true })
|
||||
vim.keymap.set("x", "<leader>x", "<C-X>", { noremap = true, silent = true })
|
||||
vim.keymap.set("x", "<leader>ga", "g<C-A>", { noremap = true, silent = true })
|
||||
vim.keymap.set("x", "<leader>ga", "g<C-A>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<leader>s", ":sp<cr>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<leader>v", ":vs<cr>", { noremap = true, silent = true })
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- Backup in case hyprnav doesn't work
|
||||
vim.keymap.set("n", "<C-h>", ":wincmd h<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-j>", ":wincmd j<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-k>", ":wincmd k<CR>", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-l>", ":wincmd l<CR>", { noremap = true, silent = true })
|
|
@ -0,0 +1,43 @@
|
|||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
opts = {
|
||||
flavour = "mocha",
|
||||
integrations = {
|
||||
mason = true,
|
||||
lsp_trouble = true,
|
||||
},
|
||||
custom_highlights = function(colors)
|
||||
return {
|
||||
TelescopeNormal = { bg = "#191926"},
|
||||
TelescopeBorder = { bg = "#191926", fg = "#191926" },
|
||||
TelescopePromptBorder = { bg = "#191926", fg = "#191926" },
|
||||
TelescopeTitle = { fg = colors.blue },
|
||||
WinSeparator = { fg = "#023269" },
|
||||
FlashCursor = { bg = colors.red },
|
||||
}
|
||||
end,
|
||||
color_overrides = {
|
||||
mocha = {
|
||||
-- this 16 colors are changed to onedark
|
||||
base = "#11121D",
|
||||
text = "#abb2bf",
|
||||
rosewater = "#b6bdca",
|
||||
lavender = "#ed8897",
|
||||
red = "#e06c75",
|
||||
peach = "#d19a66",
|
||||
yellow = "#e5c07b",
|
||||
green = "#98c379",
|
||||
teal = "#56b6c2",
|
||||
blue = "#61afef",
|
||||
mauve = "#c678dd",
|
||||
flamingo = "#be5046",
|
||||
pink="#ef9f76"
|
||||
}
|
||||
}
|
||||
},
|
||||
config = function (_, opts)
|
||||
require("catppuccin").setup(opts)
|
||||
vim.cmd("colorscheme catppuccin")
|
||||
end
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
"David-Kunz/gen.nvim",
|
||||
opts = {
|
||||
model = "mistral", -- The default model to use.
|
||||
host = "localhost", -- The host running the Ollama service.
|
||||
port = "11434", -- The port on which the Ollama service is listening.
|
||||
display_mode = "float", -- The display mode. Can be "float" or "split".
|
||||
show_prompt = false, -- Shows the Prompt submitted to Ollama.
|
||||
show_model = false, -- Displays which model you are using at the beginning of your chat session.
|
||||
quit_map = "q", -- set keymap for quit
|
||||
no_auto_close = false, -- Never closes the window automatically.
|
||||
command = function(options)
|
||||
return "curl --silent --no-buffer -X POST http://" .. options.host .. ":" .. options.port .. "/api/chat -d $body"
|
||||
end,
|
||||
-- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped).
|
||||
-- This can also be a command string.
|
||||
-- The executed command must return a JSON object with { response, context }
|
||||
-- (context property is optional).
|
||||
-- list_models = '<omitted lua function>', -- Retrieves a list of model names
|
||||
debug = false -- Prints errors and the command which is run.
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
suggestion = {
|
||||
auto_trigger = true,
|
||||
auto_refresh = true,
|
||||
keymap = {
|
||||
accept = "<leader><Tab>",
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
markdown = true,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
"folke/flash.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
highlight = {backdrop=false},
|
||||
modes = {char = {highlight = {backdrop = false}}, search = {enabled = false}},
|
||||
prompt = {enabled = false}
|
||||
},
|
||||
keys = {{"s", mode = {"n","x","o"}, function() require("flash").jump() end}}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
'mhartington/formatter.nvim',
|
||||
config = function ()
|
||||
require("formatter").setup({
|
||||
filetype = {
|
||||
lua = {
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
},
|
||||
python = {
|
||||
require("formatter.filetypes.python").black,
|
||||
},
|
||||
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
'ConradIrwin/vim-bracketed-paste',
|
||||
'airblade/vim-rooter',
|
||||
'nuchs/vim-hypr-nav',
|
||||
'isobit/vim-caddyfile',
|
||||
'debugloop/telescope-undo.nvim',
|
||||
{'windwp/nvim-autopairs', event = "InsertEnter", opts = {}},
|
||||
{'NeogitOrg/neogit', dependencies = {"nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim", "sindrets/diffview.nvim"}, config = true, lazy = true},
|
||||
{'akinsho/bufferline.nvim', version = "*", dependencies = 'nvim-tree/nvim-web-devicons'},
|
||||
{'lervag/vimtex', ft='latex'},
|
||||
{'numToStr/Comment.nvim', config = function () require('Comment').setup() end},
|
||||
{ "folke/todo-comments.nvim", dependencies = { "nvim-lua/plenary.nvim" }, opts = {} }
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
local function getWords()
|
||||
return tostring(vim.fn.wordcount().words) .. " Words"
|
||||
end
|
||||
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons', opt = true },
|
||||
opts = {
|
||||
options = {
|
||||
theme = 'nightfly',
|
||||
globalstatus = true
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'filesize', getWords},
|
||||
lualine_z = {'branch'},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {},
|
||||
lualine_y = {'filesize'},
|
||||
lualine_z = {'branch'},
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
dependencies = {
|
||||
{'williamboman/mason.nvim', opts = {
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓"
|
||||
}
|
||||
}
|
||||
}},
|
||||
'neovim/nvim-lspconfig'
|
||||
},
|
||||
opts = {
|
||||
ensure_installed = { "pyright", "texlab", "clangd", "bashls", "cmake", "jsonls", "tsserver", "vuels", "dockerls", "vimls", "html", "yamlls", "cssls", "lua_ls", "ltex", "gopls", "rust_analyzer", "jdtls", "emmet_ls", "ruff_lsp", "csharp_ls", "typst_lsp" },
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
return {
|
||||
"AckslD/nvim-neoclip.lua",
|
||||
dependencies = {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
{'kkharji/sqlite.lua', module = 'sqlite'},
|
||||
},
|
||||
opts = {
|
||||
continuous_sync = true,
|
||||
enable_persistent_history = true,
|
||||
keys = {
|
||||
telescope = {
|
||||
i = {
|
||||
paste = "<cr>",
|
||||
paste_behind = "<S-cr>",
|
||||
},
|
||||
n = {
|
||||
paste = "<cr>",
|
||||
paste_behind = "<S-cr>",
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
keys = {
|
||||
{'<leader>c', '<cmd>Telescope neoclip<cr>'},
|
||||
},
|
||||
}
|
|
@ -0,0 +1,278 @@
|
|||
local function select_next(fallback)
|
||||
if require("cmp").visible() then
|
||||
if require'snippy'.can_expand_or_advance() then
|
||||
require("cmp").select_next_item({ behavior = require("cmp").SelectBehavior.Select })
|
||||
else
|
||||
require("cmp").select_next_item({ behavior = require("cmp").SelectBehavior.Insert })
|
||||
end
|
||||
elseif require'snippy'.can_expand_or_advance() then
|
||||
require'snippy'.expand_or_advance()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
|
||||
local function select_previous(fallback)
|
||||
if require("cmp").visible() then
|
||||
if require'snippy'.can_expand_or_advance() then
|
||||
require("cmp").select_prev_item({ behavior = require("cmp").SelectBehavior.Select })
|
||||
else
|
||||
require("cmp").select_prev_item({ behavior = require("cmp").SelectBehavior.Insert })
|
||||
end
|
||||
elseif require'snippy'.can_jump(-1) then
|
||||
require'snippy'.previous()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
'honza/vim-snippets',
|
||||
'dcampos/cmp-snippy',
|
||||
'neovim/nvim-lspconfig',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
{'dcampos/nvim-snippy', opts = {
|
||||
mappings = {
|
||||
is = {
|
||||
['<leader><Tab>'] = 'expand_or_advance',
|
||||
['<leader><S-Tab>'] = 'previous',
|
||||
},
|
||||
},
|
||||
}},
|
||||
},
|
||||
keys = {
|
||||
{"<leader>n", vim.diagnostic.goto_next},
|
||||
{"<leader>p", vim.diagnostic.goto_prev},
|
||||
{"<leader>f", vim.lsp.buf.code_action},
|
||||
{"gd", vim.lsp.buf.definition},
|
||||
{"gr", vim.lsp.buf.references},
|
||||
{"<space>", vim.lsp.buf.hover},
|
||||
{"<leader>rn", vim.lsp.buf.rename},
|
||||
},
|
||||
lazy = false,
|
||||
config = function ()
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
snippet = { expand = function(args) require('snippy').expand_snippet(args.body) end },
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<Tab>"] = cmp.mapping(select_next, { "i", "s" }),
|
||||
["<C-J>"] = cmp.mapping(select_next, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(select_previous, { "i", "s" }),
|
||||
["<C-K>"] = cmp.mapping(select_previous, { "i", "s" }),
|
||||
}),
|
||||
sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'path' }, { name = 'snippy' }, }, { { name = 'buffer' } })
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline('/', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
local cmp_completion = require('nvim-autopairs.completion.cmp')
|
||||
cmp.event:on('confirm_done',cmp_completion.on_confirm_done())
|
||||
|
||||
-- Setup lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
require('lspconfig').pyright.setup {
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
typeCheckingMode = "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require('lspconfig').texlab.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').clangd.setup {
|
||||
capabilities = capabilities,
|
||||
-- root_dir = function()
|
||||
-- return require('lspconfig').util.root_pattern({'.clang-format', 'build/', 'compile_flags.txt'})
|
||||
-- end,
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--background-index",
|
||||
"--clang-tidy",
|
||||
"-j=8",
|
||||
"--clang-tidy-checks=*",
|
||||
"--all-scopes-completion",
|
||||
"--completion-style=bundled",
|
||||
"--cross-file-rename",
|
||||
"--completion-style=detailed",
|
||||
"--header-insertion-decorators",
|
||||
"--header-insertion=iwyu",
|
||||
"--pch-storage=memory"
|
||||
}
|
||||
}
|
||||
|
||||
require('lspconfig').bashls.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').csharp_ls.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').typst_lsp.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').cmake.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').jsonls.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').tsserver.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').kotlin_language_server.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').vuels.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').dockerls.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').vimls.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').html.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').emmet_ls.setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { "css", "eruby", "html", "javascript", "javascriptreact", "less", "sass", "scss", "svelte", "pug", "typescriptreact", "vue" },
|
||||
init_options = {
|
||||
html = {
|
||||
options = {
|
||||
["bem.enabled"] = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
require('lspconfig').yamlls.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').cssls.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').jdtls.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').rust_analyzer.setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require('lspconfig').gopls.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').ruff_lsp.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require('lspconfig').lua_ls.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim', 'use', 'awesome', 'client', 'root'},
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = {
|
||||
['/usr/share/nvim/runtime/lua'] = true,
|
||||
['/usr/share/nvim/runtime/lua/lsp'] = true,
|
||||
['/usr/share/awesome/lib'] = true
|
||||
}
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local filetypes = { "bibtex", "gitcommit", "markdown", "org", "tex", "restructuredtext", "rsweave", "latex", "quarto", "rmd", "context", "html", "xhtml", "typst", "mail" }
|
||||
require('lspconfig').ltex.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = function(_, _)
|
||||
require("ltex_extra").setup{
|
||||
load_langs = {"nl-BE", "en-US", "en-GB"},
|
||||
init_check = true,
|
||||
}
|
||||
end,
|
||||
settings = {
|
||||
ltex = {
|
||||
enabled = filetypes,
|
||||
language = "en-GB"
|
||||
},
|
||||
},
|
||||
filetypes = filetypes
|
||||
}
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false
|
||||
})
|
||||
|
||||
-- Show line diagnostics automatically in hover window
|
||||
vim.cmd("autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})")
|
||||
end,
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
return {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
dependencies = {'nvim-tree/nvim-web-devicons'},
|
||||
tag = 'nightly',
|
||||
opts = {
|
||||
sort_by = "case_sensitive",
|
||||
sync_root_with_cwd = true,
|
||||
update_focused_file = {
|
||||
update_root = true,
|
||||
},
|
||||
view = {
|
||||
adaptive_size = true,
|
||||
mappings = {
|
||||
list = {
|
||||
{key = "cd", action = "cd"},
|
||||
{key = "<backspace>", action = "close"},
|
||||
}
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = true,
|
||||
},
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
local function handle_enter()
|
||||
local util = require("obsidian.util")
|
||||
if util.cursor_on_markdown_link(nil, nil, true) then
|
||||
vim.cmd("ObsidianFollowLink")
|
||||
else
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
if string.match(line, "^%s*- %[[x ]%].*") then
|
||||
util.toggle_checkbox()
|
||||
else
|
||||
vim.cmd("normal! viw:'<,'>ObsidianLink")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
"epwalsh/obsidian.nvim",
|
||||
version = "*", -- recommended, use latest release instead of latest commit
|
||||
lazy = false,
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function(_, opts)
|
||||
local notes_path = (os.getenv "HOME") .. "/Workspace/Notes"
|
||||
if vim.fn.isdirectory(notes_path) == 0 then
|
||||
return
|
||||
end
|
||||
local scan = require("plenary.scandir").scan_dir(notes_path, {add_dirs = true, depth = 1 })
|
||||
local found = false
|
||||
for _, v in ipairs(scan) do
|
||||
local subdir = v:match("([^/]+)$")
|
||||
found = true
|
||||
if vim.fn.isdirectory(notes_path .. "/" .. subdir .. "/.obsidian") == 1 then
|
||||
table.insert(opts.workspaces, {
|
||||
name = subdir,
|
||||
path = notes_path .. "/" .. subdir,
|
||||
overrides = {
|
||||
daily_notes = {
|
||||
folder = "Daily",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
if found then
|
||||
require("obsidian").setup(opts)
|
||||
end
|
||||
end,
|
||||
opts = {
|
||||
workspaces = {},
|
||||
note_id_func = function(title) return title end,
|
||||
daily_notes = {
|
||||
folder = "."
|
||||
},
|
||||
disable_frontmatter = true,
|
||||
ui = {
|
||||
hl_groups = {
|
||||
ObsidianRefText = { fg = "#61afef" },
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
keys = {
|
||||
{"<cr>", handle_enter, ft = "markdown" },
|
||||
{"<cr>", "<cmd>ObsidianLink<cr>", ft = "markdown", mode = "v"},
|
||||
{"<leader>rn", "<cmd>ObsidianRename<cr>", ft = "markdown" },
|
||||
{"<leader>l", "i- [ ] ", ft = "markdown"},
|
||||
{"<leader>o", "o- [ ] ", ft = "markdown"},
|
||||
{"<leader>l", "- [ ] ", ft = "markdown", mode = "i" },
|
||||
{"<leader>jt", "<cmd>ObsidianToday<cr>"},
|
||||
{"<leader>jy", "<cmd>ObsidianYesterday<cr>"},
|
||||
{"<leader>ju", "<cmd>ObsidianTomorrow<cr>"},
|
||||
{"<tab>", ":set nohlsearch<cr>/\\[[^\\[\\]]*\\]([^()]*)<cr>:let @/ = \"\"<cr>:set hlsearch<cr>", ft = "markdown", silent = true },
|
||||
},
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
local function save_dir()
|
||||
local dir = require("oil").get_current_dir()
|
||||
if dir ~= nil then
|
||||
local f = io.open("/tmp/oil_dir", "w")
|
||||
if f then
|
||||
f:write(dir)
|
||||
f:close()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
'stevearc/oil.nvim',
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" }, lazy = true,
|
||||
opts = {
|
||||
default_file_explorer = true,
|
||||
keymaps = {
|
||||
["g?"] = "actions.show_help",
|
||||
["<CR>"] = function() require("oil").select({}, save_dir) end,
|
||||
["<leader>v"] = "actions.select_vsplit",
|
||||
["<leader>s"] = "actions.select_split",
|
||||
["<leader>p"] = "actions.preview",
|
||||
["<backspace>"] = function() vim.cmd("q!") end,
|
||||
["<leader>r"] = "actions.refresh",
|
||||
["-"] = function() require("oil").open(); save_dir() end,
|
||||
["_"] = "actions.open_cwd",
|
||||
["`"] = "actions.cd",
|
||||
["~"] = "actions.tcd",
|
||||
["g."] = "actions.toggle_hidden",
|
||||
},
|
||||
use_default_keymaps = false,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-telescope/telescope-fzy-native.nvim',
|
||||
},
|
||||
opts = {
|
||||
defaults = {
|
||||
file_ignore_patterns = {
|
||||
".cache/.*",
|
||||
"node_modules/.*",
|
||||
".git/.*",
|
||||
"Venv/.*",
|
||||
"venv/.*",
|
||||
"wandb/.*",
|
||||
"Resources/.*",
|
||||
"build/.*"
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
["jj"] = require("telescope.actions").close,
|
||||
["<C-j>"] = require("telescope.actions").move_selection_next,
|
||||
["<C-k>"] = require("telescope.actions").move_selection_previous,
|
||||
},
|
||||
},
|
||||
file_sorter = require'telescope.sorters'.get_fzy_sorter,
|
||||
generic_sorter = require'telescope.sorters'.get_fzy_sorter,
|
||||
},
|
||||
extensions = {
|
||||
undo = {
|
||||
side_by_side = false,
|
||||
layout_strategy = "vertical",
|
||||
use_delta = true,
|
||||
layout_config = {
|
||||
preview_height = 0.5,
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
["<cr>"] = require("telescope-undo.actions").restore,
|
||||
["<S-y>"] = require("telescope-undo.actions").yank_additions,
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
},
|
||||
fzy_native = {
|
||||
override_generic_sorter = false,
|
||||
override_file_sorter = true,
|
||||
}
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>u", require("telescope").extensions.undo.undo},
|
||||
{ "<C-Space>", require("telescope.builtin").oldfiles},
|
||||
{ "<C-f>", function () require"telescope.builtin".live_grep({ path_display = { 'smart' }, }) end},
|
||||
{ "<C-p>", function () -- git files
|
||||
local opts = require('telescope.themes').get_ivy({})
|
||||
opts["show_untracked"] = true
|
||||
opts["layout_config"] = {height=0.2}
|
||||
if not pcall(require"telescope.builtin".git_files, opts) then
|
||||
require"telescope.builtin".find_files(opts)
|
||||
end
|
||||
end},
|
||||
{ "<C-o>", function () -- project files
|
||||
local opts = require('telescope.themes').get_ivy({})
|
||||
opts["layout_config"] = {height=0.2}
|
||||
require"telescope.builtin".find_files(opts)
|
||||
end},
|
||||
{ "<C-S-o>", function () -- buffer files
|
||||
local opts = require('telescope.themes').get_ivy({})
|
||||
opts["layout_config"] = {height=0.2}
|
||||
require"telescope.builtin".buffers(opts)
|
||||
end},
|
||||
{ "<C-S-f>", function () -- fuzzy search
|
||||
require"telescope.builtin".grep_string({
|
||||
path_display = { 'smart' },
|
||||
only_sort_text = true,
|
||||
word_match = "-w",
|
||||
search = '',
|
||||
})
|
||||
end},
|
||||
},
|
||||
config = function (_, opts)
|
||||
local telescope = require("telescope")
|
||||
telescope.setup(opts)
|
||||
telescope.load_extension("undo")
|
||||
telescope.load_extension('fzy_native')
|
||||
end
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
dependencies = {
|
||||
"https://github.com/TheZoq2/tree-sitter-typst",
|
||||
"luckasRanarison/tree-sitter-hyprlang"
|
||||
},
|
||||
build = ":TSUpdate",
|
||||
opts = {
|
||||
ensure_installed = { "cpp", "c", "lua", "vim", "dockerfile", "python", "java", "cmake", "diff", "gitcommit", "html", "css", "javascript", "json", "rust", "sql", "yaml", "markdown", "markdown_inline", "nix" },
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
disable = function(lang, buf) -- Disable if file size is too big
|
||||
if lang == "ini" or lang == "markdown" then
|
||||
return true
|
||||
end
|
||||
local max_filesize = 2000 * 1024 -- 2MB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
},
|
||||
},
|
||||
config = function (_, opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
|
||||
require'nvim-treesitter.install'.prefer_git = true
|
||||
parser_config.typst = {
|
||||
install_info = {
|
||||
url = "https://github.com/frozolotl/tree-sitter-typst.git", -- local path or git repo
|
||||
files = {"src/parser.c", "src/scanner.cc"},
|
||||
},
|
||||
filetype = "typst", -- if filetype does not match the parser name
|
||||
}
|
||||
vim.filetype.add({
|
||||
pattern = { [".*.typ"] = "typst" },
|
||||
})
|
||||
end
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
'cappyzawa/trim.nvim',
|
||||
opts = { ft_blocklist= {"markdown", "vimwiki"}, patterns = { [[%s/\s\+$//e]], [[%s/\($\n\s*\)\+\%$//]], [[%s/\%^\n\+//]], },}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
'folke/trouble.nvim',
|
||||
dependencies = {"nvim-tree/nvim-web-devicons"},
|
||||
opts = {
|
||||
action_keys = {
|
||||
close = {"q", "<Esc>"},
|
||||
jump = {"<cr>"},
|
||||
toggle_fold = {"<tab>"},
|
||||
}
|
||||
},
|
||||
lazy = true
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
vim.opt.autoindent = true
|
||||
vim.opt.background = "dark"
|
||||
vim.opt.backspace = {"indent", "eol", "start"}
|
||||
vim.opt.encoding = "utf-8"
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.hidden = true
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.laststatus = 2
|
||||
vim.opt.lbr = true
|
||||
vim.opt.modelines = 0
|
||||
vim.opt.mouse = "a"
|
||||
vim.opt.compatible = false
|
||||
vim.opt.modeline = false
|
||||
vim.opt.number = true
|
||||
vim.opt.numberwidth = 4
|
||||
vim.opt.scrolloff = 5
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.sidescrolloff = 10
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.splitright = true
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.ttimeoutlen = 50
|
||||
vim.opt.undofile = true
|
||||
vim.opt.undolevels = 1000
|
||||
vim.opt.undoreload = 10000
|
||||
vim.opt.wildmenu = true
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.wildmode = {"longest", "list"}
|
||||
vim.g.mapleader = ","
|
||||
vim.g.python_highlight_all = 1
|
||||
vim.wo.signcolumn = "yes"
|
||||
vim.wo.relativenumber = true
|
||||
vim.g.rooter_patterns = {".git", "Makefile", "CMakeLists.txt", "build/", "meson.build"}
|
||||
vim.g.rooter_silent_chdir = 1
|
||||
vim.opt.shada = "!,'2000,f1,<50,s10,h"
|
||||
vim.o.updatetime = 250
|
||||
vim.opt.conceallevel = 2
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldlevel = 0
|
||||
vim.opt.foldexpr = "getline(v:lnum)=~'^X-ExtEditorR'?1:0"
|
||||
|
||||
-- Vimtex
|
||||
vim.g.tex_flavor = 'latex'
|
|
@ -0,0 +1,55 @@
|
|||
local teaching = {}
|
||||
|
||||
local function ends_with(path, extension)
|
||||
return string.sub(path, -#extension) == extension
|
||||
end
|
||||
|
||||
local function should_load(path)
|
||||
local ignore = {
|
||||
[1] = "rapidjson",
|
||||
[2] = "json.hpp",
|
||||
[3] = "build",
|
||||
[4] = "third-party",
|
||||
[5] = "sfml/",
|
||||
[5] = "SFML/",
|
||||
[6] = "TinyXML"
|
||||
}
|
||||
local match = {
|
||||
[1] = ".hpp",
|
||||
[2] = ".h",
|
||||
[3] = ".cpp",
|
||||
[4] = ".c",
|
||||
}
|
||||
for _, pattern in ipairs(ignore) do
|
||||
if string.find(path, pattern, 0, true) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
for _, pattern in ipairs(match) do
|
||||
if ends_with(path, pattern) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function teaching.load()
|
||||
require("trouble").open()
|
||||
require("nvim-tree").open()
|
||||
local scan = require("plenary.scandir").scan_dir('.')
|
||||
local cwd = vim.fn.getcwd()
|
||||
for _, v in ipairs(scan) do
|
||||
local filename = vim.fs.normalize(v)
|
||||
if should_load(v) then
|
||||
vim.api.nvim_set_current_dir(cwd)
|
||||
local buf_id = vim.fn.bufadd(filename)
|
||||
vim.api.nvim_set_current_buf(buf_id)
|
||||
vim.api.nvim_buf_set_option(buf_id, "buflisted", true)
|
||||
end
|
||||
end
|
||||
vim.api.nvim_set_current_dir(cwd)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("AP", teaching.load, {})
|
||||
|
||||
return teaching
|
|
@ -0,0 +1 @@
|
|||
std="lua51+vim"
|
|
@ -0,0 +1,7 @@
|
|||
snippet frontmatter
|
||||
---
|
||||
id: ${1:id}
|
||||
aliases:
|
||||
- ${2:alias}
|
||||
tags: [${3:tag1}]
|
||||
---
|
|
@ -0,0 +1,9 @@
|
|||
logits
|
||||
OpenSwarm
|
||||
Lumentis
|
||||
stochasticity
|
||||
Feywild
|
||||
closeby
|
||||
ECML
|
||||
theshold-based
|
||||
distill
|
|
@ -0,0 +1,2 @@
|
|||
scaler
|
||||
stochasticity
|
|
@ -0,0 +1,2 @@
|
|||
[vim]
|
||||
any = true
|
|
@ -23,12 +23,9 @@
|
|||
PYTHONDONTWRITEBYTECODE = "1";
|
||||
GOPATH = "${config.xdg.dataHome}/go";
|
||||
};
|
||||
home.file = {
|
||||
"${config.xdg.configHome}/zsh/keys.zsh".source = files/keys.zsh;
|
||||
"${config.xdg.configHome}/zsh/term.zsh".source = files/term.zsh;
|
||||
"${config.xdg.configHome}/zsh/p10k.zsh".source = files/p10k.zsh;
|
||||
"${config.xdg.configHome}/zsh/completion.zsh".source = files/completion.zsh;
|
||||
"${config.xdg.configHome}/zsh/waypipe.zsh".source = files/waypipe.zsh;
|
||||
home.file."${config.xdg.configHome}/zsh" = {
|
||||
source = ./files;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
programs.command-not-found.enable = true;
|
||||
|
@ -48,7 +45,6 @@
|
|||
initExtraFirst = ''
|
||||
source ${config.xdg.configHome}/zsh/p10k.zsh
|
||||
function zvm_after_init() {
|
||||
source ${config.xdg.configHome}/zsh/keys.zsh
|
||||
source ${config.xdg.configHome}/zsh/term.zsh
|
||||
source ${config.xdg.configHome}/zsh/completion.zsh
|
||||
source ${config.xdg.configHome}/zsh/waypipe.zsh
|
||||
|
@ -56,6 +52,7 @@
|
|||
source "$(fzf-share)/key-bindings.zsh"
|
||||
source "$(fzf-share)/completion.zsh"
|
||||
fi
|
||||
source ${config.xdg.configHome}/zsh/keys.zsh
|
||||
}
|
||||
'';
|
||||
|
||||
|
|
Loading…
Reference in New Issue