diff --git a/init.lua b/init.lua index c98b852..13f9997 100644 --- a/init.lua +++ b/init.lua @@ -39,10 +39,23 @@ vim.o.timeoutlen = 300 vim.o.splitright = true vim.o.splitbelow = true vim.o.inccommand = "split" -vim.o.scrolloff = 5 +vim.o.scrolloff = 1 + +vim.o.ts = 4 +vim.o.sw = 4 +vim.o.et = true + +vim.g.markdown_fenced_languages = { + "ts=typescript", +} vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) +vim.keymap.set("", "", ":vertical resize +2", { silent = true, desc = "Make tile bigger" }) +vim.keymap.set("", "", ":vertical resize -2", { silent = true, desc = "Make tile bigger" }) +vim.keymap.set("", "", ":resize +1", { silent = true, desc = "Make tile bigger" }) +vim.keymap.set("", "", ":resize -1", { silent = true, desc = "Make tile bigger" }) + -- Setup lazy.nvim require("lazy").setup({ spec = { @@ -376,6 +389,30 @@ require("lazy").setup({ capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities()) + local util = require("lspconfig.util") + + local function files_in_immediate_folder(patterns) + return function(start_path) + start_path = util.strip_archive_subpath(start_path) + for _, pattern in ipairs(patterns) do + for _, p in + ipairs( + vim.fn.glob( + util.path.join(util.path.escape_wildcards(start_path), pattern), + true, + true + ) + ) + do + if util.path.exists(p) then + return start_path + end + end + end + return nil + end + end + -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- @@ -414,8 +451,14 @@ require("lazy").setup({ }, }, denols = { - root_dir = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc"), + -- root_dir = files_in_immediate_folder({ "deno.jsonc", "deno.json" }), + root_dir = util.root_pattern("deno.jsonc", "deno.json"), + single_file_support = false, }, + -- ts_ls = { + -- root_dir = files_in_immediate_folder({ "package.json" }), + -- single_file_support = false, + -- }, } -- Ensure the servers and tools above are installed @@ -450,6 +493,7 @@ require("lazy").setup({ root_dir = (servers[server_name] or {}).root_dir, settings = (servers[server_name] or {}).settings, filetypes = (servers[server_name] or {}).filetypes, + single_file_support = (servers[server_name] or {}).single_file_support, }) end, }, @@ -491,11 +535,16 @@ require("lazy").setup({ end, formatters_by_ft = { lua = { "stylua" }, + c = { "clang-format" }, + cpp = { "clang-format" }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, + css = { "deno_fmt" }, + -- html = { "deno_fmt" }, + json = { "deno_fmt" }, }, }, }, @@ -636,6 +685,7 @@ require("lazy").setup({ configs.setup({ ensure_installed = { "c", + "cpp", "lua", "vim", "vimdoc", @@ -645,8 +695,12 @@ require("lazy").setup({ "markdown", "css", "typescript", + "json", "rust", }, + auto_install = true, + modules = {}, + ignore_install = {}, sync_install = false, highlight = { enable = true }, indent = { enable = false }, @@ -664,13 +718,47 @@ require("lazy").setup({ end, }, + { + "akinsho/toggleterm.nvim", + tag = "2.3.0", + config = function() + require("toggleterm").setup({ + open_mapping = [[]], + direction = "float", + float_opts = { + --border = "curved", -- 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open + border = "curved", + }, + }) + end, + }, + + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = { + options = { theme = "gruvbox" }, + }, + }, + + { + "ShinKage/idris2-nvim", + requires = { "neovim/nvim-lspconfig", "MunifTanjim/nui.nvim" }, + }, + + { + dir = "~/Workspace/slige/editors/vim/", + name = "slige", + }, + { dir = "/home/simone/Workspace/cjsongen/parse/vim", name = "cjsongen" }, + -- Plugins done }, -- Configure any other settings here. See the documentation for more details. -- colorscheme that will be used when installing plugins. install = { colorscheme = { "gruvbox" } }, -- automatically check for plugin updates - checker = { enabled = true }, + checker = { enabled = true, frequency = 60 * 60 * 24 * 7 }, }) vim.cmd([[colorscheme gruvbox]]) diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..a0b6690 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,31 @@ +{ + "LuaSnip": { "branch": "master", "commit": "eda5be8f0ce9816278671f0b578cdbb8b762c701" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "cmp-path": { "branch": "main", "commit": "e52e640b7befd8113b3350f46e8cfcfe98fcf730" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "4c9003aab62879612c50136649baa1b8ed36cfa1" }, + "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "gitsigns.nvim": { "branch": "main", "commit": "588264bee92993df92535b6742576f5655c91b1c" }, + "gruvbox.nvim": { "branch": "main", "commit": "58a2cda2e953a99e2f87c12b7fb4602da4e0709c" }, + "idris2-nvim": { "branch": "main", "commit": "e3d4242a525ec8f1e0846f47b9730035a046100f" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, + "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, + "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, + "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-lspconfig": { "branch": "master", "commit": "1cb30b1bafe5a63a5c6ac20dc39f83487df38855" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "toggleterm.nvim": { "branch": "main", "commit": "2a787c426ef00cb3488c11b14f5dcf892bbd0bda" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } +}