diff --git a/.gitignore b/.gitignore index e033bc6..0402cc7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ lazy-lock.json +spell/ diff --git a/lua/znvim/autocmds.lua b/lua/znvim/autocmds.lua index 759d6af..44c0149 100644 --- a/lua/znvim/autocmds.lua +++ b/lua/znvim/autocmds.lua @@ -4,14 +4,34 @@ vim.api.nvim_create_autocmd("TextYankPost", { -- highlight yanked characters end }) +-- resize splits if window got resized +vim.api.nvim_create_autocmd({ "VimResized" }, { + callback = function() + vim.cmd("tabdo wincmd =") + end, +}) + + vim.api.nvim_create_autocmd("FileType", { -- close some filetypes with pattern = { "help", "man", "notify", + "lspinfo", + "startuptime", + "tsplayground", }, callback = function(event) vim.bo[event.buf].buflisted = false vim.keymap.set("n", "q", "quit", { buffer = event.buf, silent = true }) end, }) + + +vim.api.nvim_create_autocmd("FileType", { -- text formats + pattern = { "gitcommit", "markdown", "norg", }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.spell = true + end, +}) diff --git a/lua/znvim/plugins/cmp.lua b/lua/znvim/plugins/cmp.lua index 5d3b24f..fd1d85f 100644 --- a/lua/znvim/plugins/cmp.lua +++ b/lua/znvim/plugins/cmp.lua @@ -8,6 +8,8 @@ return { "https://github.com/hrsh7th/cmp-cmdline", "https://github.com/hrsh7th/cmp-nvim-lsp", "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help", + -- "https://github.com/hrsh7th/cmp-nvim-lua", + -- "https://github.com/saadparwaiz1/cmp_luasnip", }, event = { "InsertEnter", "CmdlineEnter", "BufReadPost" }, config = function() @@ -26,9 +28,16 @@ return { { name = "path" }, { name = "nvim_lsp" }, { name = 'nvim_lsp_signature_help' }, + -- { name = "nvim_lua" }, + -- { name = "luasnip" }, { name = "lazydev" }, { name = "neorg" }, }), + -- snippet = { + -- expand = function(args) + -- require("luasnip").lsp_expand(args.body) + -- end, + -- }, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), @@ -41,6 +50,8 @@ return { buffer = "[buf]", path = "[path]", cmdline = "[cmd]", + nvim_lsp = "[LSP]", + -- luasnip = "[snip]", })[entry.source.name] or entry.source.name return item end, diff --git a/lua/znvim/plugins/init.lua b/lua/znvim/plugins/init.lua index c8a4509..c563ca2 100644 --- a/lua/znvim/plugins/init.lua +++ b/lua/znvim/plugins/init.lua @@ -1,4 +1,5 @@ return { + { -- display undo tree for a file "https://github.com/mbbill/undotree", cmd = "UndotreeToggle", @@ -6,6 +7,7 @@ return { { "ut", "UndotreeToggle", desc = "undo tree" }, }, }, + { -- markview.nvim "https://github.com/OXY2DEV/markview.nvim", ft = 'markdown', @@ -49,7 +51,7 @@ return { command = {"zsh"} }, julia = { - command = {"julia", "--project", "--threads", "4"}, + command = {"julia", "--project"}, }, }, repl_open_cmd = "vertical botright 80 split", -- require("iron").view.split.vertical.botright(100), diff --git a/lua/znvim/plugins/lsp.lua b/lua/znvim/plugins/lsp.lua index f19db21..159ed26 100644 --- a/lua/znvim/plugins/lsp.lua +++ b/lua/znvim/plugins/lsp.lua @@ -62,10 +62,10 @@ return { capabilities = capabilities, }) - lspconfig.typst_lsp.setup({ - on_attach = on_attach, - capabilities = capabilities, - }) + -- lspconfig.typst_lsp.setup({ + -- -- on_attach = on_attach, + -- -- capabilities = capabilities, + -- }) lspconfig.elixirls.setup({ cmd = { "/usr/lib/elixir-ls/language_server.sh" }, diff --git a/lua/znvim/plugins/neorg.lua b/lua/znvim/plugins/neorg.lua index ad2c2fd..5986283 100644 --- a/lua/znvim/plugins/neorg.lua +++ b/lua/znvim/plugins/neorg.lua @@ -1,10 +1,8 @@ return { "https://github.com/nvim-neorg/neorg", - lazy = true, - ft = "norg", - cmd = "Neorg", + lazy = false, + version = "*", dependencies = { - "https://github.com/nvim-lua/plenary.nvim", "https://github.com/nvim-neorg/neorg-telescope", }, opts = { @@ -15,24 +13,14 @@ return { icon_preset = "diamond", }, }, - ["core.integrations.telescope"] = {}, - ["core.keybinds"] = { - config = { - default_keybinds = true, - }, - }, - ["core.completion"] = { - config = { - engine = "nvim-cmp", - }, - }, + ["core.summary"] = {}, ["core.dirman"] = { config = { workspaces = { notatki = "~/n", }, default_workspace = "notatki", - index = "index.norg", + index = "skorowidz.norg", }, }, } diff --git a/lua/znvim/plugins/treesitter.lua b/lua/znvim/plugins/treesitter.lua index 481c3a2..a32e5e1 100644 --- a/lua/znvim/plugins/treesitter.lua +++ b/lua/znvim/plugins/treesitter.lua @@ -1,5 +1,4 @@ return { - { -- treesitter "https://github.com/nvim-treesitter/nvim-treesitter", build = ":TSUpdate", @@ -8,56 +7,12 @@ return { highlight = { enable = true, }, indent = { enable = true }, ensure_installed = { - "asm", "bash", - -- "bibtex", - -- "c", - -- "cmake", - -- "commonlisp", - -- "cpp", - -- "css", "scss", - -- "csv", - -- "cuda", - -- "d", - -- "devicetree", - -- "diff", - -- "dockerfile", - -- "erlang", - -- "elixir", - -- "heex", - -- "fennel", - -- "fortran", - -- "git_config", "git_rebase", "gitattributes", "gitcommit", "gitignore", - -- "haskell", - -- "html", - -- "http", - -- "javascript", - -- "json", "json5", - -- "julia", - -- "latex", - -- "llvm", - -- "lua", "luadoc", - -- "markdown", "markdown_inline", - -- "norg", - -- "objdump", - -- "passwd", - -- "python", - -- "regex", - -- "rst", - -- "rust", - -- "sql", - -- "ssh_config", - -- "systemverilog", - -- "tcl", - -- "toml", - -- "typst", - -- "verilog", - -- "vhdl", - -- "vim", - -- "vimdoc", - -- "xml", - -- "yaml", - }, + "c", + "lua", "luadoc", + "markdown", "markdown_inline", + "ssh_config", + }, incremental_selection = { enable = true, keymaps = { @@ -72,4 +27,68 @@ return { require("nvim-treesitter.configs").setup(opts) end }, + { + "https://gitlab.com/HiPhish/rainbow-delimiters.nvim", + event = "BufReadPost", + }, + { + "https://github.com/nvim-treesitter/nvim-treesitter-context", + event = "BufReadPost", + config = function () + require'treesitter-context'.setup{ + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + max_lines = 10, -- How many lines the window should span. Values <= 0 mean no limit. + trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries. + -- For all filetypes + -- Note that setting an entry here replaces all other patterns for this entry. + -- By setting the 'default' entry below, you can control which nodes you want to + -- appear in the context window. + default = { + 'class', + 'function', + 'method', + 'for', + 'while', + 'if', + 'switch', + 'case', + 'interface', + 'struct', + 'enum', + }, + -- Patterns for specific filetypes + -- If a pattern is missing, *open a PR* so everyone can benefit. + tex = { + 'chapter', + 'section', + 'subsection', + 'subsubsection', + }, + vhdl = { + 'process_statement', + 'architecture_body', + 'entity_declaration', + }, + markdown = { + 'section', + }, + json = { + 'pair', + }, + yaml = { + 'block_mapping_pair', + }, + }, + -- [!] The options below are exposed but shouldn't require your attention, + -- you can safely ignore them. + zindex = 20, -- The Z-index of the context window + mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + separator = nil, + } + end + }, }