diff --git a/init.lua b/init.lua index aff5250e..c0ac69c6 100644 --- a/init.lua +++ b/init.lua @@ -99,7 +99,7 @@ do vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal - vim.g.have_nerd_font = false + vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` @@ -705,6 +705,30 @@ do stylua = {}, -- Used to format Lua code + -- Java language server (installed via Mason). + jdtls = {}, + + -- ty: Astral's Python type checker. Not yet shipped by nvim-lspconfig, so we + -- define the whole config here (ported from the old `lspconfig.configs.ty` + -- approach to the new `vim.lsp.config` API). Installed separately via uv, so + -- it is excluded from Mason below. + ty = { + cmd = { 'ty', 'server' }, + filetypes = { 'python' }, + root_markers = { 'pyproject.toml', 'ty.toml', '.git' }, + }, + + -- ruff: Python linter/formatter LSP. nvim-lspconfig ships the base `ruff` + -- config (cmd, etc.); this only overlays init_options. Installed separately + -- via uv, so it is excluded from Mason below. + ruff = { + init_options = { + settings = { + fixAll = true, + }, + }, + }, + -- Special Lua Config, as recommended by neovim help docs lua_ls = { on_init = function(client) @@ -758,6 +782,9 @@ do -- -- You can press `g?` for help in this menu. local ensure_installed = vim.tbl_keys(servers or {}) + -- ty and ruff are installed separately via uv (~/.local/bin), so exclude them + -- from Mason auto-install. + ensure_installed = vim.tbl_filter(function(name) return name ~= 'ty' and name ~= 'ruff' end, ensure_installed) vim.list_extend(ensure_installed, { -- You can add other tools here that you want Mason to install }) @@ -796,12 +823,12 @@ do }, -- You can also specify external formatters in here. formatters_by_ft = { - -- rust = { 'rustfmt' }, + lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- + 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 }, + javascript = { 'prettierd', 'prettier', stop_after_first = true }, + SQL = { 'sql-formatter' }, }, } @@ -904,7 +931,7 @@ do vim.pack.add { { src = gh 'nvim-treesitter/nvim-treesitter', version = 'main' } } -- Ensure basic parsers are installed - local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' } + local parsers = { 'bash', 'c', 'diff', 'html', 'latex', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' } require('nvim-treesitter').install(parsers) ---@param buf integer @@ -966,17 +993,17 @@ do -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug' - -- require 'kickstart.plugins.indent_line' - -- require 'kickstart.plugins.lint' - -- require 'kickstart.plugins.autopairs' - -- require 'kickstart.plugins.neo-tree' - -- require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps + require 'kickstart.plugins.debug' + require 'kickstart.plugins.indent_line' + require 'kickstart.plugins.lint' + require 'kickstart.plugins.autopairs' + require 'kickstart.plugins.neo-tree' + require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps -- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- require 'custom.plugins' + require 'custom.plugins' end -- The line beneath this is called `modeline`. See `:help modeline` diff --git a/lua/custom/plugins/nvim-java.lua b/lua/custom/plugins/nvim-java.lua new file mode 100644 index 00000000..c77d807e --- /dev/null +++ b/lua/custom/plugins/nvim-java.lua @@ -0,0 +1,7 @@ +-- nvim-java: Java IDE layer on top of jdtls. +-- https://github.com/nvim-java/nvim-java +-- +-- NOTE: This only installs the plugin (mirroring the user's original +-- `return { 'nvim-java/nvim-java' }` spec). It is NOT yet initialized, so jdtls +-- currently runs vanilla. Wiring (`require('java').setup()`) is finished later. +vim.pack.add { 'https://github.com/nvim-java/nvim-java' } diff --git a/lua/custom/plugins/vimtex.lua b/lua/custom/plugins/vimtex.lua new file mode 100644 index 00000000..5ad52dad --- /dev/null +++ b/lua/custom/plugins/vimtex.lua @@ -0,0 +1,27 @@ +-- VimTeX: LaTeX support (compile, view, errors) +-- https://github.com/lervag/vimtex +-- +-- Ported from the user's lazy.nvim spec (lazy = false) to this base's `vim.pack` +-- imperative style. VimTeX reads its `vim.g.vimtex_*` settings when it is sourced, +-- so we set them BEFORE `vim.pack.add` loads the plugin (the equivalent of the old +-- lazy `init` hook). + +-- Viewer settings (adjust based on your PDF viewer) +vim.g.vimtex_view_method = 'zathura' -- Use 'skim' on macOS, 'sumatra' on Windows, etc. + +-- Compiler settings +vim.g.vimtex_compiler_method = 'latexmk' -- Default compiler backend + +-- Optional: Disable some features if you don't need them +vim.g.vimtex_quickfix_enabled = 1 -- Enable quickfix window for errors +vim.g.vimtex_syntax_enabled = 1 -- Syntax highlighting (works with Tree-sitter too) + +-- Set TeX flavor (usually not needed, but good to know) +vim.g.tex_flavor = 'latex' + +vim.pack.add { 'https://github.com/lervag/vimtex' } + +-- LaTeX keymaps (which-key group label is defined in init.lua: `l` = [L]aTeX) +vim.keymap.set('n', 'll', 'VimtexCompile', { desc = 'Compile LaTeX' }) +vim.keymap.set('n', 'lv', 'VimtexView', { desc = 'View PDF' }) +vim.keymap.set('n', 'le', 'VimtexErrors', { desc = 'Show Errors' }) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index db5448c2..b7fd7bf0 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -42,6 +42,8 @@ require('mason-nvim-dap').setup { ensure_installed = { -- Update this to ensure that you have the debuggers for the langs you want 'delve', + 'java-debug-adapter', + 'java-test', }, } diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index d6305445..d757185f 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -4,7 +4,9 @@ vim.pack.add { 'https://github.com/mfussenegger/nvim-lint' } local lint = require 'lint' lint.linters_by_ft = { - markdown = { 'markdownlint' }, -- Make sure to install `markdownlint` via mason / npm + -- Only enable markdownlint if it is actually installed (it is not installed here), + -- otherwise nvim-lint errors on every markdown buffer. + markdown = vim.fn.executable 'markdownlint' == 1 and { 'markdownlint' } or {}, } -- To allow other plugins to add linters to require('lint').linters_by_ft,