diff --git a/conf/lvim.lua b/conf/lvim.lua index 60d6e6c..526439b 100644 --- a/conf/lvim.lua +++ b/conf/lvim.lua @@ -1,12 +1,15 @@ ---[[ +--[[-- +File : /home/jeff/.config/lvim/config.lua +Author : Jeff Lance +Date : 03.08.2023 16:16:54 +Last Modified Date: 03.08.2023 16:16:54 +Last Modified By : Jeff Lance + +--- + lvim is the global options object -Linters should be -filled in as strings with either -a global executable or a path to -an executable -]] --- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT +--]]-- @@ -56,12 +59,62 @@ lvim.builtin.which_key.mappings["d"] = lvim.builtin.which_key.mappings[";"] lvim.builtin.which_key.mappings["G"] = lvim.builtin.which_key.mappings["g"] lvim.builtin.which_key.mappings["g"] = {} +lvim.builtin.which_key.mappings["H"] = { + name = "+Header", + H = { "AddHeader" , "Add header to the file" }, + h = { "AddMinHeader" , "Add minimal header to the file" }, + lg = { "AddGNULicense", "Add GPLv3 License" }, + lm = { "AddMITLicense", "Add MIT License" }, +} + lvim.builtin.which_key.mappings["Lv"] = lvim.builtin.which_key.mappings["L"] lvim.builtin.which_key.mappings["Ll"] = lvim.builtin.which_key.mappings["l"] lvim.builtin.which_key.mappings["L"] = { name = "LSP, Lunar" } lvim.builtin.which_key.mappings["l"] = {} +lvim.builtin.which_key.mappings["l"] = { + name = "LaTeX", + m = { "VimtexContextMenu", "Open Context Menu" }, + u = { "VimtexCountLetters", "Count Letters" }, + w = { "VimtexCountWords", "Count Words" }, + d = { "VimtexDocPackage", "Open Doc for package" }, + e = { "VimtexErrors", "Look at the errors" }, + s = { "VimtexStatus", "Look at the status" }, + a = { "VimtexToggleMain", "Toggle Main" }, + v = { "VimtexView", "View pdf" }, + i = { "VimtexInfo", "Vimtex Info" }, + l = { + name = "Clean", + l = { "VimtexClean", "Clean Project" }, + c = { "VimtexClean", "Clean Cache" }, + }, + c = { + name = "Compile", + c = { "VimtexCompile", "Compile Project" }, + o = { + "VimtexCompileOutput", + "Compile Project and Show Output", + }, + s = { "VimtexCompileSS", "Compile project super fast" }, + e = { "VimtexCompileSelected", "Compile Selected" }, + }, + r = { + name = "Reload", + r = { "VimtexReload", "Reload" }, + s = { "VimtexReloadState", "Reload State" }, + }, + o = { + name = "Stop", + p = { "VimtexStop", "Stop" }, + a = { "VimtexStopAll", "Stop All" }, + }, + t = { + name = "TOC", + o = { "VimtexTocOpen", "Open TOC" }, + t = { "VimtexTocToggle", "Toggle TOC" }, + }, +} lvim.builtin.which_key.mappings["o"] = { "Telescope find_files", "Open a file" } @@ -76,6 +129,7 @@ lvim.builtin.which_key.mappings["r"] = { "Telescope oldfiles", "Open re lvim.builtin.which_key.mappings["z"] = { name = "+Zettel", c = { "lua require('neuron/cmd').new_edit('/home/jeff/Notes/')", "Create new note" }, + i = { "lua require'neuron'.goto_index()", "Goto notes index"}, z = { "lua require'neuron/telescope'.find_zettels()", "Find notes" }, Z = { "lua require'neuron/telescope'.find_zettels {insert = true}", "Insert the found note ID" }, b = { "lua require'neuron/telescope'.find_backlinks()", "Backlinks of the current note" }, @@ -107,12 +161,18 @@ lvim.builtin.terminal.active = true lvim.builtin.nvimtree.setup.view.side = "left" lvim.builtin.nvimtree.setup.renderer.icons.show.git = false + + +-- Treesitter settings +-- + -- if you don't want all the parsers change this to a table of the ones you want lvim.builtin.treesitter.ensure_installed = { "bash", "c", "javascript", "json", + "latex", "lua", "python", "typescript", @@ -128,81 +188,68 @@ lvim.builtin.treesitter.highlight.enable = true --- generic LSP settings +-- Generic LSP settings -- --- -- make sure server will always be installed even if the server is in skipped_servers list --- lvim.lsp.installer.setup.ensure_installed = { --- "sumneko_lua", --- "jsonls", --- } --- -- change UI setting of `LspInstallInfo` --- -- see --- lvim.lsp.installer.setup.ui.check_outdated_servers_on_open = false --- lvim.lsp.installer.setup.ui.border = "rounded" --- lvim.lsp.installer.setup.ui.keymaps = { --- uninstall_server = "d", --- toggle_server_expand = "o", --- } +vim.diagnostic.config({ virtual_text = true }) --- ---@usage disable automatic installation of servers --- lvim.lsp.installer.setup.automatic_installation = false +-- setup LSP +local capabilities = require("lvim.lsp").common_capabilities() +require("lvim.lsp.manager").setup("texlab", { + on_attach = require("lvim.lsp").common_on_attach, + on_init = require("lvim.lsp").common_on_init, + capabilities = capabilities, +}) --- ---configure a server manually. !!Requires `:LvimCacheReset` to take effect!! --- ---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))` --- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) --- local opts = {} -- check the lspconfig documentation for a list of all possible options --- require("lvim.lsp.manager").setup("pyright", opts) --- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!! --- ---`:LvimInfo` lists which server(s) are skipped for the current filetype --- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) --- return server ~= "emmet_ls" --- end, lvim.lsp.automatic_configuration.skipped_servers) --- -- you can set a custom on_attach function that will be used for all the language servers --- -- See --- lvim.lsp.on_attach_callback = function(client, bufnr) --- local function buf_set_option(...) --- vim.api.nvim_buf_set_option(bufnr, ...) --- end --- --Enable completion triggered by --- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") --- end +-- Setup formatters and linters +-- --- -- set a formatter, this will override the language server formatting capabilities (if it exists) --- local formatters = require "lvim.lsp.null-ls.formatters" --- formatters.setup { --- { command = "black", filetypes = { "python" } }, --- { command = "isort", filetypes = { "python" } }, --- { --- -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration --- command = "prettier", --- ---@usage arguments to pass to the formatter --- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}` --- extra_args = { "--print-with", "100" }, --- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports. --- filetypes = { "typescript", "typescriptreact" }, --- }, --- } +-- formatters +local formatters = require("lvim.lsp.null-ls.formatters") +formatters.setup({ + { name = "black" }, + { command = "latexindent", filetypes = { "tex" } }, +}) --- -- set additional linters --- local linters = require "lvim.lsp.null-ls.linters" --- linters.setup { --- { command = "flake8", filetypes = { "python" } }, --- { --- -- each linter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration --- command = "shellcheck", --- ---@usage arguments to pass to the formatter --- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}` --- extra_args = { "--severity", "warning" }, --- }, --- { --- command = "codespell", --- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports. --- filetypes = { "javascript", "python" }, --- }, --- } +lvim.format_on_save.enabled = true +lvim.format_on_save.pattern = { "*.py", "*.tex" } + +-- linters +local linters = require("lvim.lsp.null-ls.linters") +linters.setup({ + { command = "flake8", filetypes = { "python" } }, + { command = "chktex", filetypes = { "tex" } }, +}) + + + +-- Python management setup +-- + +-- -- setup debug adapter +-- lvim.builtin.dap.active = true +-- local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/") +-- pcall(function() +-- require("dap-python").setup(mason_path .. "packages/debugpy/venv/bin/python") +-- end) + +-- -- setup testing +-- require("neotest").setup({ +-- adapters = { +-- require("neotest-python")({ +-- -- Extra arguments for nvim-dap configuration +-- -- See https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for values +-- dap = { +-- justMyCode = false, +-- console = "integratedTerminal", +-- }, +-- args = { "--log-level", "DEBUG", "--quiet" }, +-- runner = "pytest", +-- }) +-- } +-- }) @@ -210,6 +257,19 @@ lvim.builtin.treesitter.highlight.enable = true -- lvim.plugins = { + -- addheader + { + 'alpertuna/vim-header', + config = function () + vim.cmd ([[ + let g:header_field_author = 'Jeff Lance' + let g:header_field_author_email = 'email@jefflance.me' + let g:header_auto_update_header = 1 + let g:header_field_filename_path = 1 + let g:header_field_timestamp_format = '%d.%m.%Y %H:%M:%S' + ]]) + end, + }, -- asyncrun { "skywind3000/asyncrun.vim", @@ -263,7 +323,7 @@ lvim.plugins = { -- markdown previewer { 'iamcco/markdown-preview.nvim', - run = "cd app && npm install", + build = "cd app && npm install", ft = "markdown", config = function() vim.g.mkdp_auto_start = 1 @@ -364,14 +424,14 @@ lvim.plugins = { vim.g.suda_smart_edit = 1 end, }, - -- telescope-project - { - "nvim-telescope/telescope-project.nvim", - event = "BufWinEnter", - setup = function() - vim.cmd [[packadd telescope.nvim]] - end, - }, + ---- telescope-project + --{ + -- "nvim-telescope/telescope-project.nvim", + -- event = "BufWinEnter", + -- setup = function() + -- vim.cmd [[packadd telescope.nvim]] + -- end, + --}, -- trouble { 'folke/trouble.nvim', @@ -384,18 +444,57 @@ lvim.plugins = { -- vim-surround { 'tpope/vim-surround', - config = function() + config = function () vim.o.timeoutlen = 500 - end - -- make sure to change the value of `timeoutlen` if it's not triggering correctly, see https://github.com/tpope/vim-surround/issues/117 - -- setup = function() - -- vim.o.timeoutlen = 500 - -- end + end, }, + -- LaTeX management needed plugins + { + "lervag/vimtex", + config = function () + vim.g.vimtex_view_method = "zathura" + vim.g.vimtex_quickfix_enabled = 0 + end, + }, + { + "kdheepak/cmp-latex-symbols" + }, + { + "KeitaNakamura/tex-conceal.vim" + }, + { + -- "SirVer/ultisnips" + }, + -- Python management needed plugins + { + "ChristianChiarulli/swenv.nvim" + }, + { + "stevearc/dressing.nvim" + }, + -- { + -- "mfussenegger/nvim-dap-python" + -- }, + -- { + -- "nvim-neotest/neotest" + -- }, + -- { + -- "nvim-neotest/neotest-python" + -- }, } +-- Telescope plugins load +-- + +lvim.builtin.telescope.on_config_done = function(telescope) + -- pcall(telescope.load_extension, "telescope-project") + -- any other extensions loading +end + + + -- Autocommands (https://neovim.io/doc/user/autocmd.html) -- @@ -443,3 +542,12 @@ vim.api.nvim_create_autocmd("FileType", { require("nvim-treesitter.highlight").attach(0, "bash") end, }) + +-- latex cmp +vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("LaTeXGroup", { clear = true }), + pattern = "tex", + callback = function() + require("user.cmp") + end, +})