]> localhost Git - nvim.git/commitdiff
stuff
authorJansen <[email protected]>
Thu, 27 Mar 2025 23:09:42 +0000 (19:09 -0400)
committerJansen <[email protected]>
Thu, 27 Mar 2025 23:09:42 +0000 (19:09 -0400)
colors/codeclocks.lua
init.lua
lazy-lock.json
lua/keybindings.lua [new file with mode: 0644]
lua/plugins.lua [new file with mode: 0644]

index 2c984eeef45c0cbf088bf02c33a22839e47db10e..9147cb3e197482f598d5d520cc86566a980880d3 100644 (file)
@@ -52,9 +52,9 @@ end
 
 -- Groups
 local base = {
-  Normal      = { fg = c.fg2, bg = c.bg0 },
-  NormalNC    = { fg = c.fg2, bg = c.bg0 },
-  NormalSB    = { fg = c.fg2, bg = c.bg0 },
+  Normal      = { fg = c.fg2, bg = "NONE" },
+  NormalNC    = { fg = c.fg2, bg = "NONE" },
+  NormalSB    = { fg = c.fg2, bg = "NONE" },
 
   -- Line Number
   LineNr       = { fg = c.fg0 },
@@ -74,7 +74,7 @@ local base = {
   ErrorMsg   = { fg = c.dark_brown4 },
 
   -- Status Line
-  StatusLine   = { bg = c.bg2, fg = c.fg2 },
+  StatusLine   = { bg = c.bg1, fg = c.fg2 },
   StatusLineNC = { bg = c.bg1, fg = c.fg0 },
   WinBar       = "StatusLine",
   WinBarNC     = "StatusLineNC",
@@ -105,7 +105,7 @@ local base = {
   -- ETC
   EndOfBuffer = { fg = c.dark_brown1 },
   ColorColumn = { bg = c.bg1 },
-  Directory   = { fg = c.fg2 },
+  Directory   = { fg = c.dark_brown2 },
 
   MatchParen = { bg = c.bg2, fg = c.fg0, bold = true },
 
index 08fc8fb623aa1f5a94571a127fe54a0abe36a808..59b0b13fc3939b86352aa7e2ce2a9574b57f84c4 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -1,7 +1,7 @@
--- General =====================================================================
-vim.opt.syntax      = 'on'
-vim.opt.colorcolumn = '81'
-vim.opt.clipboard   = 'unnamedplus'
+-- General ============================================================================================================
+vim.opt.syntax         = 'on'
+vim.opt.colorcolumn    = '120'
+vim.opt.clipboard      = 'unnamedplus'
 
 vim.opt.tabstop        = 2
 vim.opt.softtabstop    = 2
@@ -10,340 +10,32 @@ vim.opt.expandtab      = true
 vim.opt.number         = true
 vim.opt.relativenumber = true
 
-vim.opt.foldmethod = "manual"
-vim.opt.foldenable = true
+vim.opt.foldmethod     = "manual"
+vim.opt.foldenable     = true
 
-vim.opt.cursorline = true
+vim.opt.cursorline     = true
+vim.opt.showmode       = false
+vim.opt.fillchars      = {eob = " "}
 
-local tab_next = true
-
--- Neovide =====================================================================
-local font_family = "0xProto Nerd Font Mono"
-local font_size = 14
-local min_font_size = 4
-local max_font_size = 40
-
-local function font()
-  return font_family .. ":h" .. font_size
-end
-
-if vim.g.neovide then
-  vim.g.neovide_hide_mouse_when_typing = true
-
-  vim.g.neovide_padding_left = 10
-  vim.g.neovide_padding_right = 10
-
-  vim.o.guifont = font()
-  vim.opt.linespace = 0
-
-  vim.cmd [[cd ~]]
-end
-
--- Lazy NVIM ===================================================================
-local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
----@diagnostic disable-next-line: undefined-field
-if not (vim.uv or 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({
-  { 'MeanderingProgrammer/render-markdown.nvim', opts = {} },
-  { "ibhagwan/fzf-lua"  },
-  {
-      "kawre/leetcode.nvim",
-      build = ":TSUpdate html", -- if you have `nvim-treesitter` installed
-      dependencies = {
-          "nvim-telescope/telescope.nvim",
-          "nvim-lua/plenary.nvim",
-          "MunifTanjim/nui.nvim",
-      },
-      opts = {
-        arg = "leet",
-        lang = "rust",
-      },
-  },
-  {
-    "NeogitOrg/neogit",
-    dependencies = {
-      "nvim-lua/plenary.nvim",
-      "sindrets/diffview.nvim",
-      "ibhagwan/fzf-lua",
-    },
-    config = true
-  },
-  {
-    "nvim-treesitter/nvim-treesitter",
-    config = function()
-      require("nvim-treesitter.configs").setup({
-        ensure_installed = {
-          "asm",     "bash",       "c",
-          "comment", "cpp",        "css",
-          "csv",     "gitignore",  "glsl",
-          "go",      "html",       "ini",
-          "java",    "javascript", "json",
-          "lua",     "make",       "python",
-          "rust",    "tmux",       "toml",
-          "tsx",     "typescript", "yaml",
-          "zig",
-        },
-        highlight = {
-          enable = true,
-          disable = { "help", "vimdoc" },
-        },
-        indent = {
-          enable = true,
-          disable = { "help", "vimdoc" },
-        },
-      })
-      vim.treesitter.language.register("html", "handlebars")
-    end
-  },
-  {
-    "williamboman/mason.nvim",
-    lazy = false,
-    config = function()
-      require("mason").setup({ max_concurrent_installers = 10 })
-    end
-  },
-  {
-    "neovim/nvim-lspconfig",
-    dependencies = { "williamboman/mason-lspconfig.nvim", },
-    config = function()
-      local manual = {
-        "deno_ls",
-        "lua_ls",
-        "ts_ls",
-      }
-      local automatic = {
-        "clangd",
-        "gopls",
-        "zls",
-      }
-
-      -- Install LSPs
-      local ensure_installed = {}
-      for k,v in pairs(manual)    do ensure_installed[k] = v end
-      for k,v in pairs(automatic) do ensure_installed[k] = v end
-      require('mason-lspconfig').setup({ ensure_installed = ensure_installed })
-
-      -- LSP =========================================================================
-      local function lsp_keymaps_on_attach(_, bufnr)
-        local bufopts = { noremap = true, silent = true, buffer = bufnr }
-
-        -- Open in a new tab
-        local function n(cmd) return "<cmd>lua " .. cmd .. "()<CR>" end
-        local function ns(cmd)
-          return "<cmd>split | wincmd j | lua " .. cmd .. "()<CR>"
-        end
-        local function nv(cmd)
-          return "<cmd>vsplit | wincmd l | lua " .. cmd .. "()<CR>"
-        end
-        local function nt(cmd)
-          tab_next = true
-          return "<cmd>tab split | lua " .. cmd .. "()<CR>"
-        end
-
-        local function init_g_cmd(key, command)
-          vim.keymap.set('n', '<leader>'  .. key, n(command),  bufopts)
-          vim.keymap.set('n', '<leader>s' .. key, ns(command), bufopts)
-          vim.keymap.set('n', '<leader>v' .. key, nv(command), bufopts)
-          vim.keymap.set('n', '<leader>t' .. key, nt(command), bufopts)
-        end
-
-        init_g_cmd('gD', "vim.lsp.buf.declaration")
-        init_g_cmd('gd', "vim.lsp.buf.definition")
-        init_g_cmd('gi', "vim.lsp.buf.implementation")
-        init_g_cmd('gf', "vim.lsp.buf.type_definition")
-        vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references, bufopts)
-
-        vim.keymap.set('n', '<leader>kd', vim.diagnostic.open_float,   bufopts)
-        vim.keymap.set('n', '<leader>kk', vim.lsp.buf.signature_help,  bufopts)
-        vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename,          bufopts)
-        vim.keymap.set('n', '<leader>ka', vim.lsp.buf.code_action,     bufopts)
-        vim.keymap.set('n', '<leader>F', function()
-          vim.lsp.buf.format { async = true }
-        end, bufopts)
-      end
-
-      local lspconfig = require("lspconfig")
-      -- Automatic setup
-      for i in pairs(automatic) do
-        lspconfig[automatic[i]].setup { on_attach = lsp_keymaps_on_attach }
-      end
-      lspconfig['dartls'].setup { on_attach = lsp_keymaps_on_attach }
-
-      -- Manual setup
-      vim.g.zig_fmt_autosave = 0
-
-      lspconfig['rust_analyzer'].setup { on_attach = lsp_keymaps_on_attach }
-
-      lspconfig.lua_ls.setup {
-        on_attach = lsp_keymaps_on_attach,
-        settings = {
-          Lua = {
-            diagnostics = {
-              globals = { 'vim', 'require' },
-            },
-            workspace = { library = vim.api.nvim_get_runtime_file("", true) },
-            telemetry = { enable = false, },
-          },
-        },
-      }
-
-      lspconfig.denols.setup {
-        on_attach = lsp_keymaps_on_attach,
-        root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"),
-      }
-
-      lspconfig.ts_ls.setup {
-        on_attach = lsp_keymaps_on_attach,
-        root_dir = lspconfig.util.root_pattern("package.json"),
-        single_file_support = false
-      }
-    end
-  },
-})
+require('plugins')
+require('keybindings').setup()
 
 vim.cmd.colorscheme('codeclocks')
 
--- Autocmd =====================================================================
+-- Autocmd ============================================================================================================
 vim.api.nvim_create_autocmd("BufRead", {
-    pattern = "*",  -- Apply to all files
-    callback = function()
-        if vim.fn.haslocaldir() == 1 then
-            vim.cmd("silent! loadview")
-        end
-    end,
+  pattern = "*", -- Apply to all files
+  callback = function()
+    if vim.fn.haslocaldir() == 1 then
+      vim.cmd("silent! loadview")
+    end
+  end,
 })
 
--- CustomCommands ==============================================================
+-- CustomCommands =====================================================================================================
 local function edit_config()
   vim.cmd [[cd ~/.config/nvim]]
   vim.cmd [[e init.lua]]
 end
 vim.api.nvim_create_user_command('Econfig', edit_config, {})
 
--- KeyBindings =================================================================
-vim.g.mapleader = vim.keycode' '
-
--- Neovide
-if vim.g.neovide then
-  vim.keymap.set('n', '<leader>ni', function()
-    vim.system({"neovide"}, {detach = true})
-  end)
-  vim.keymap.set('n', '<leader>-', function()
-    font_size = font_size-vim.v.count1
-    if font_size < min_font_size then font_size = min_font_size end
-    vim.o.guifont = font()
-  end)
-  vim.keymap.set('n', '<leader>=', function()
-    font_size = font_size+vim.v.count1
-    if font_size > max_font_size then font_size = max_font_size end
-    vim.o.guifont = font()
-  end)
-end
-
--- Utils
-vim.keymap.set('n', '<leader>H', function() vim.cmd [[nohl]] end)
-vim.keymap.set('n', '<leader>`', function() vim.cmd [[Neogit]] end)
-
-vim.keymap.set('n', '<leader>[', function()
-  if (vim.api.nvim_get_option_value("number", {})) then
-    vim.api.nvim_set_option_value("number", false, {})
-    vim.api.nvim_set_option_value("relativenumber", false, {})
-  else
-    vim.api.nvim_set_option_value("number", true, {})
-    vim.api.nvim_set_option_value("relativenumber", true, {})
-  end
-end)
-
--- Find (fzf)
-vim.keymap.set('n', '<leader>ff',  function() vim.cmd [[FzfLua files]] end)
-vim.keymap.set('n', '<leader>ft',  function()
-  vim.cmd [[FzfLua grep_visual]]
-end)
-vim.keymap.set('n', '<leader>fm',  function() vim.cmd [[FzfLua marks]] end)
-
--- Buffers/Windows (inplace)
-local function open_term()
-  vim.cmd [[term]]
-  vim.cmd [[startinsert]]
-end
-
-vim.keymap.set('n', '<leader>e',  function() vim.cmd [[Explore]] end)
-vim.keymap.set('n', '<leader>c',  function() vim.cmd [[quit]] end)
-vim.keymap.set('n', '<leader>T',  open_term)
-
--- Buffers/Windows (horizontal)
-vim.keymap.set('n', '<leader>se', function() vim.cmd [[Hexplore]] end)
-vim.keymap.set('n', '<leader>ss', function()
-  vim.cmd [[split]]
-  vim.cmd [[wincmd j]]
-end)
-vim.keymap.set('n', '<leader>sT',  function()
-  vim.cmd [[split]]
-  vim.cmd [[wincmd j]]
-  open_term()
-end)
-
--- Buffers/Windows (vertical)
-vim.keymap.set('n', '<leader>ve', function() vim.cmd [[Vexplore!]] end)
-vim.keymap.set('n', '<leader>vs', function()
-  vim.cmd [[vsplit]]
-  vim.cmd [[wincmd l]]
-end)
-vim.keymap.set('n', '<leader>vT',  function()
-  vim.cmd [[vsplit]]
-  vim.cmd [[wincmd l]]
-  open_term()
-end)
-
--- Tabs
-local function open_texplore()
-  tab_next = true
-  vim.cmd [[Texplore]]
-end
-local function open_tterm()
-  tab_next = true
-  vim.cmd [[tabnew]]
-  vim.cmd [[term]]
-  vim.cmd [[startinsert]]
-end
-local function next_tab()
-  tab_next = true
-  vim.cmd [[tabn]]
-end
-local function prev_tab()
-  tab_next = false
-  vim.cmd [[tabp]]
-end
-local function new_tab()
-  tab_next = true
-  vim.cmd [[tabnew]]
-end
-
-local function last_tab() if tab_next then prev_tab() else next_tab() end end
-
-local function close_tab()
-  local total_tabs = #vim.api.nvim_list_tabpages()
-  if total_tabs > 1 then
-    tab_next = true
-    vim.cmd [[tabc]]
-  end
-end
-vim.keymap.set('n', '<leader>te', open_texplore)
-vim.keymap.set('n', '<leader>tn', next_tab)
-vim.keymap.set('n', '<leader>tp', prev_tab)
-vim.keymap.set('n', '<leader>tt', last_tab)
-vim.keymap.set('n', '<leader>tT', open_tterm)
-vim.keymap.set('n', '<leader>tc', close_tab)
-vim.keymap.set('n', '<leader>tN', new_tab)
-
index f0570d3603feeecb791a078720abd91e07d10fac..b16515f0e6e8dd62c2552c262e3270c04015ec1b 100644 (file)
@@ -1,14 +1,17 @@
 {
   "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
   "fzf-lua": { "branch": "main", "commit": "2a7eb32871a131e24021dd1756865e475fe7e274" },
-  "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
+  "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
   "leetcode.nvim": { "branch": "master", "commit": "db7e1cd6b9191b34b4c1f2f96e4e3949cde9f951" },
+  "lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" },
   "mason-lspconfig.nvim": { "branch": "main", "commit": "43894adcf10bb1190c2184bd7c1750e8ea2b3dce" },
   "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
   "neogit": { "branch": "master", "commit": "89d13fb9898619774d359a3900959181d60dd02f" },
+  "no-neck-pain.nvim": { "branch": "main", "commit": "53c8ef094c86e8897be2dcce0259d35914f6cdc0" },
   "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
   "nvim-lspconfig": { "branch": "master", "commit": "f012c1b176f0e3c71f40eb309bdec0316689462e" },
   "nvim-treesitter": { "branch": "master", "commit": "37427012d1c77c544356bfff0c9acc88fd3256bc" },
+  "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" },
   "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
   "render-markdown.nvim": { "branch": "main", "commit": "7f0143e9adf7140c8e3fa33a5bdf193d7a8f0429" },
   "telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" }
diff --git a/lua/keybindings.lua b/lua/keybindings.lua
new file mode 100644 (file)
index 0000000..d2dda4f
--- /dev/null
@@ -0,0 +1,90 @@
+local P = {}
+
+P.setup = function()
+  vim.g.mapleader = vim.keycode ' '
+
+  -- Utils
+  vim.keymap.set('n', '<leader>H', function() vim.cmd [[nohl]] end)
+  vim.keymap.set('n', '<leader>`', function() vim.cmd [[Neogit]] end)
+
+  vim.keymap.set('n', '<leader>[', function()
+    if (vim.api.nvim_get_option_value("number", {})) then
+      vim.api.nvim_set_option_value("number", false, {})
+      vim.api.nvim_set_option_value("relativenumber", false, {})
+    else
+      vim.api.nvim_set_option_value("number", true, {})
+      vim.api.nvim_set_option_value("relativenumber", true, {})
+    end
+  end)
+
+  -- Find (fzf)
+  vim.keymap.set('n', '<leader>ff', function() vim.cmd [[FzfLua files]] end)
+  vim.keymap.set('n', '<leader>ft', function() vim.cmd [[FzfLua grep_visual]] end)
+  vim.keymap.set('n', '<leader>fm', function() vim.cmd [[FzfLua marks]] end)
+
+  -- Buffers/Windows (inplace)
+  local function open_term()
+    vim.cmd [[term]]
+    vim.cmd [[startinsert]]
+  end
+
+  vim.keymap.set('n', '<leader>e', function() vim.cmd [[Explore]] end)
+  vim.keymap.set('n', '<leader>c', function() vim.cmd [[quit]] end)
+  vim.keymap.set('n', '<leader>T', open_term)
+
+  -- Buffers/Windows (horizontal)
+  vim.keymap.set('n', '<leader>se', function() vim.cmd [[Hexplore]] end)
+  vim.keymap.set('n', '<leader>ss', function()
+    vim.cmd [[split]]
+    vim.cmd [[wincmd j]]
+  end)
+  vim.keymap.set('n', '<leader>sT', function()
+    vim.cmd [[split]]
+    vim.cmd [[wincmd j]]
+    open_term()
+  end)
+
+  -- Buffers/Windows (vertical)
+  vim.keymap.set('n', '<leader>ve', function() vim.cmd [[Vexplore!]] end)
+  vim.keymap.set('n', '<leader>vs', function()
+    vim.cmd [[vsplit]]
+    vim.cmd [[wincmd l]]
+  end)
+  vim.keymap.set('n', '<leader>vT', function()
+    vim.cmd [[vsplit]]
+    vim.cmd [[wincmd l]]
+    open_term()
+  end)
+
+  -- Tabs
+  local function open_texplore()
+    vim.cmd [[Texplore]]
+  end
+  local function open_tterm()
+    vim.cmd [[tabnew]]
+    vim.cmd [[term]]
+    vim.cmd [[startinsert]]
+  end
+  local function next_tab()
+    vim.cmd [[tabn]]
+  end
+  local function prev_tab()
+    vim.cmd [[tabp]]
+  end
+  local function new_tab()
+    vim.cmd [[tabnew]]
+  end
+
+  local function close_tab()
+    local total_tabs = #vim.api.nvim_list_tabpages()
+    if total_tabs > 1 then vim.cmd [[tabc]] end
+  end
+  vim.keymap.set('n', '<leader>te', open_texplore)
+  vim.keymap.set('n', '<leader>tn', next_tab)
+  vim.keymap.set('n', '<leader>tp', prev_tab)
+  vim.keymap.set('n', '<leader>tT', open_tterm)
+  vim.keymap.set('n', '<leader>tc', close_tab)
+  vim.keymap.set('n', '<leader>tN', new_tab)
+end
+
+return P
diff --git a/lua/plugins.lua b/lua/plugins.lua
new file mode 100644 (file)
index 0000000..552539d
--- /dev/null
@@ -0,0 +1,200 @@
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+
+---@diagnostic disable-next-line: undefined-field
+if not (vim.uv or 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({
+  { "ibhagwan/fzf-lua" },
+  { "shortcuts/no-neck-pain.nvim", version = "*" },
+  { 'MeanderingProgrammer/render-markdown.nvim', opts = {} },
+  {
+    'nvim-lualine/lualine.nvim',
+    dependencies = { 'nvim-tree/nvim-web-devicons' },
+    config = function()
+      require('lualine').setup({
+        options = {
+          theme = "iceberg_dark"
+        }
+      })
+    end
+  },
+  {
+    "kawre/leetcode.nvim",
+    build = ":TSUpdate html",
+    dependencies = {
+      "nvim-telescope/telescope.nvim",
+      "nvim-lua/plenary.nvim",
+      "MunifTanjim/nui.nvim",
+    },
+    opts = {
+      arg = "leet",
+      lang = "rust",
+    },
+  },
+  {
+    "NeogitOrg/neogit",
+    dependencies = {
+      "nvim-lua/plenary.nvim",
+      "sindrets/diffview.nvim",
+      "ibhagwan/fzf-lua",
+    },
+    config = true
+  },
+  {
+    "nvim-treesitter/nvim-treesitter",
+    config = function()
+      require("nvim-treesitter.configs").setup({
+        modules = {},
+        auto_install = true,
+        sync_install = false,
+        ignore_install = {},
+        ensure_installed = {
+          "asm", "bash", "c",
+          "comment", "cpp", "css",
+          "csv", "gitignore", "glsl",
+          "go", "html", "ini",
+          "java", "javascript", "json",
+          "lua", "make", "python",
+          "rust", "tmux", "toml",
+          "tsx", "typescript", "yaml",
+          "zig",
+        },
+        highlight = {
+          enable = true,
+          disable = { "help", "vimdoc" },
+        },
+        indent = {
+          enable = true,
+          disable = { "help", "vimdoc" },
+        },
+      })
+      vim.treesitter.language.register("html", "handlebars")
+
+      local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
+      parser_config.crystal = {
+        install_info = {
+          url = "/home/jj/.local/opt/tree-sitter-crystal",
+          files = { "src/parser.c", "src/scanner.c" },
+          branch = "main",
+        },
+        filetype = "cr",
+      }
+    end
+  },
+  {
+    "williamboman/mason.nvim",
+    lazy = false,
+    config = function()
+      require("mason").setup({ max_concurrent_installers = 10 })
+    end
+  },
+  {
+    "neovim/nvim-lspconfig",
+    dependencies = { "williamboman/mason-lspconfig.nvim", },
+    config = function()
+      local manual = {
+        "deno_ls",
+        "lua_ls",
+        "ts_ls",
+      }
+      local automatic = {
+        "clangd",
+        "gopls",
+        "zls",
+      }
+
+      -- Install LSPs
+      local ensure_installed = {}
+      for k, v in pairs(manual) do ensure_installed[k] = v end
+      for k, v in pairs(automatic) do ensure_installed[k] = v end
+      require('mason-lspconfig').setup({
+        ensure_installed = ensure_installed,
+        automatic_installation = false,
+      })
+
+      -- LSP =========================================================================
+      local function lsp_keymaps_on_attach(_, bufnr)
+        local bufopts = { noremap = true, silent = true, buffer = bufnr }
+
+        -- Open in a new tab
+        local function n(cmd) return "<cmd>lua " .. cmd .. "()<CR>" end
+        local function ns(cmd)
+          return "<cmd>split | wincmd j | lua " .. cmd .. "()<CR>"
+        end
+        local function nv(cmd)
+          return "<cmd>vsplit | wincmd l | lua " .. cmd .. "()<CR>"
+        end
+        local function nt(cmd)
+          return "<cmd>tab split | lua " .. cmd .. "()<CR>"
+        end
+
+        local function init_g_cmd(key, command)
+          vim.keymap.set('n', '<leader>' .. key, n(command), bufopts)
+          vim.keymap.set('n', '<leader>s' .. key, ns(command), bufopts)
+          vim.keymap.set('n', '<leader>v' .. key, nv(command), bufopts)
+          vim.keymap.set('n', '<leader>t' .. key, nt(command), bufopts)
+        end
+
+        init_g_cmd('gD', "vim.lsp.buf.declaration")
+        init_g_cmd('gd', "vim.lsp.buf.definition")
+        init_g_cmd('gi', "vim.lsp.buf.implementation")
+        init_g_cmd('gf', "vim.lsp.buf.type_definition")
+        vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references, bufopts)
+
+        vim.keymap.set('n', '<leader>kd', vim.diagnostic.open_float, bufopts)
+        vim.keymap.set('n', '<leader>kk', vim.lsp.buf.signature_help, bufopts)
+        vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
+        vim.keymap.set('n', '<leader>ka', vim.lsp.buf.code_action, bufopts)
+        vim.keymap.set('n', '<leader>F', function()
+          vim.lsp.buf.format { async = true }
+        end, bufopts)
+      end
+
+      local lspconfig = require("lspconfig")
+      -- Automatic setup
+      for i in pairs(automatic) do
+        lspconfig[automatic[i]].setup { on_attach = lsp_keymaps_on_attach }
+      end
+      lspconfig['dartls'].setup { on_attach = lsp_keymaps_on_attach }
+
+      -- Manual setup
+      vim.g.zig_fmt_autosave = 0
+
+      lspconfig['rust_analyzer'].setup { on_attach = lsp_keymaps_on_attach }
+
+      lspconfig.lua_ls.setup {
+        on_attach = lsp_keymaps_on_attach,
+        settings = {
+          Lua = {
+            diagnostics = {
+              globals = { 'vim', 'require' },
+            },
+            workspace = { library = vim.api.nvim_get_runtime_file("", true) },
+            telemetry = { enable = false, },
+          },
+        },
+      }
+
+      lspconfig.denols.setup {
+        on_attach = lsp_keymaps_on_attach,
+        root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"),
+      }
+
+      lspconfig.ts_ls.setup {
+        on_attach = lsp_keymaps_on_attach,
+        root_dir = lspconfig.util.root_pattern("package.json"),
+        single_file_support = false
+      }
+    end
+  },
+})