Update nvim and add new languages

This commit is contained in:
ItaloBorrelli 2025-08-13 17:14:06 -07:00
parent 3902f3e598
commit a43e2f2126
11 changed files with 143 additions and 61 deletions

View File

@ -4,12 +4,13 @@ vim.g.maplocalleader = "\\"
-- Initialize lazy.nvim
require("config.lazy")
-- vim.cmd([[
-- augroup jdtls_lsp
-- autocmd!
-- autocmd FileType java lua require'jdtls.jdtls_setup'.setup()
-- augroup end
-- ]])
vim.cmd([[
augroup jdtls_lsp
autocmd!
autocmd FileType java lua require'jdtls.jdtls_setup'.setup()
augroup end
]])
-- Source other configuration files
require("keybindings")

View File

@ -15,3 +15,6 @@ map("n", "<leader>l", "<C-w>l", opts)
opts.desc = "Save session, write all buffers and quit"
map("n", "<leader>qqq", ':lua require("auto-session").SaveSession()<CR>:wqa<CR>', opts)
opts.desc = "Visual copy"
map("v", "<C-c>", '"*y', opts)

View File

@ -7,6 +7,9 @@ return {
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
opts = {
window = { position = "current" },
},
config = function()
require("neo-tree").setup({
filesystem = {
@ -19,23 +22,44 @@ return {
})
local keymap = vim.keymap
keymap.set("n", "<leader>e", function()
require("neo-tree.command").execute({
position = "left",
focus = "true",
})
end, { desc = "Focus (Neotree)", noremap = true, silent = true })
keymap.set("n", "<leader>ee", function()
require("neo-tree.command").execute({
position = "left",
focus = "true",
})
end, { desc = "Focus (Neotree)", noremap = true, silent = true })
keymap.set("n", "<leader>qe", function()
require("neo-tree.command").execute({
position = "left",
action = "close",
focus = "true",
})
end, { desc = "Close (Neotree)", noremap = true, silent = true })
keymap.set("n", "|", "<cmd>Neotree reveal<cr>", { desc = "", noremap = true, silent = true })
keymap.set(
"n",
"<leader>ee",
"<cmd>Neotree focus<CR>",
{ desc = "Open and focus Neotree", noremap = true, silent = true }
"gd",
"<cmd>Neotree float reveal_file=<cfile> reveal_force_cwd<cr>",
{ desc = "", noremap = true, silent = true }
)
keymap.set(
"n",
"<leader>e",
"<cmd>Neotree toggle<CR>",
{ desc = "Toggle Neotree", noremap = true, silent = true }
"<leader>eb",
"<cmd>Neotree toggle show buffers right<cr>",
{ desc = "Show buffers (Neotree)", noremap = true, silent = true }
)
keymap.set(
"n",
"<leader>eq",
"<cmd>Neotree close<CR>",
{ desc = "Close Neotree", noremap = true, silent = true }
"<leader>gs",
"<cmd>Neotree float git_status<cr>",
{ desc = "Show git status (Neotree)", noremap = true, silent = true }
)
end,
},

View File

@ -11,7 +11,7 @@ return {
local telescope = require("telescope")
local trouble_telescope = require("trouble.sources.telescope")
local actions = require("telescope.actions")
local open_with_trouble = require("trouble.sources.telescope").open
local open_with_trouble = trouble_telescope.open
-- Use this to add more results without clearing the trouble list
local add_to_trouble = require("trouble.sources.telescope").add
@ -22,7 +22,9 @@ return {
i = {
["<C-k>"] = actions.move_selection_previous,
["<C-j>"] = actions.move_selection_next,
["<C-t>"] = trouble_telescope.open,
["<PageUp>"] = actions.preview_scrolling_up,
["<PageDown>"] = actions.preview_scrolling_down,
["<C-t>"] = open_with_trouble,
},
n = { ["<C-t>"] = open_with_trouble },
},
@ -33,8 +35,14 @@ return {
-- Set keymaps to load pickers
local keymap = vim.keymap
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd (Telescope)" })
keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files (Telescope)" })
keymap.set(
"n",
"<leader>fr",
"<cmd>Telescope oldfiles cwd_only=true<cr>",
{ desc = "Fuzzy find recent files (Telescope)" }
)
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd (Telescope)" })
keymap.set("v", "fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd (Telescope)" })
keymap.set(
"n",
"<leader>fc",

View File

@ -33,6 +33,8 @@ return {
conform.setup({
formatters_by_ft = {
groovy = { "npm-groovy-lint" },
haskell = { "fourmolu" },
javascript = { decide_js_formatter() },
javascriptreact = { decide_js_formatter() },
json = { decide_json_formatter() },
@ -41,16 +43,25 @@ return {
nginx = { "nginxfmt" },
python = { "isort", "black" },
sh = { "shfmt" },
sql = { "sql_formatter" },
typescript = { decide_js_formatter() },
typescriptreact = { decide_js_formatter() },
yaml = { "yamlfix" },
yaml = { "yamlfmt" },
xml = { "xmlformatter" },
["*"] = { "codespell" },
},
formatters = {
sql_formatter = {
prepend_args = { "-c", '{"functionCase": "upper", "keywordCase": "upper"}', "-l", "postgresql" },
},
},
default_format_opts = {
lsp_format = "fallback",
},
format_on_save = {
sh = true,
lua = true,
nginx = true,
yaml = true,

View File

@ -13,7 +13,7 @@ return {
local function decide_linter()
local cwd = vim.fn.getcwd()
if file_exists(cwd .. "/biome.json") then
return "biome"
return "biomejs"
else
return "eslint_d"
end
@ -22,14 +22,13 @@ return {
local lint = require("lint")
lint.linters_by_ft = {
javascript = { "eslint_d" },
javascriptreact = { "eslint_d" },
javascript = { decide_linter() },
javascriptreact = { decide_linter() },
markdown = { "markdownlint" },
python = { "flake8" },
sh = { "shellcheck" },
typescript = { "eslint_d" },
typescriptreact = { "eslint_d" },
yaml = { "yamllint" },
typescript = { decide_linter() },
typescriptreact = { decide_linter() },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })

View File

@ -5,19 +5,31 @@ return {
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"bash",
"css",
"dockerfile",
"gitcommit",
"gitignore",
"groovy",
"html",
"javascript",
"json",
"kotlin",
"lua",
"make",
"matlab",
"nginx",
"pug",
"python",
"regex",
"scss",
"sql",
"ssh_config",
"typescript",
"vim",
"vimdoc",
"vue",
"xml",
"yaml",
},
modules = {},

View File

@ -17,16 +17,25 @@ return {
})
require("mason-lspconfig").setup({
automatic_enable = {
exclude = {
"jdtls",
},
},
ensure_installed = {
"bashls",
"cssls",
"dockerls",
"emmet_ls",
"eslint",
"groovyls",
"html",
"jdtls",
"jsonls",
"kotlin_lsp",
"lemminx",
"lua_ls",
"postgres_lsp",
"pylsp",
"ts_ls",
"vimls",
@ -45,18 +54,21 @@ return {
"eslint_d",
"firefox-debug-adapter",
"flake8",
"fourmolu",
"isort",
"java-debug-adapter",
"jq",
"markdownlint",
"matlab-language-server",
"mdformat",
"nginx-config-formatter",
"npm-groovy-lint",
"prettier",
"shellcheck",
"shfmt",
"stylua",
"yamlfix",
"yamllint",
"xmlformatter",
"yamlfmt",
},
})
end,

View File

@ -29,15 +29,15 @@ zinit ice depth=1; zinit light romkatv/powerlevel10k
###############
# FZF
zinit ice from="gh-r" as="command" bpick="*linux_amd64*"
zinit ice from"gh-r" as"command" bpick"*linux_amd64*"
zinit light junegunn/fzf
# FZF BYNARY AND TMUX HELPER SCRIPT
zinit ice lucid wait'0c' as="command" id-as="junegunn/fzf-tmux" pick="bin/fzf-tmux"
zinit ice lucid wait"0c" as"command" id-as"junegunn/fzf-tmux" pick"bin/fzf-tmux"
zinit light junegunn/fzf
# BIND MULTIPLE WIDGETS USING FZF
zinit ice lucid wait'0c' multisrc"shell/{completion,key-bindings}.zsh" id-as="junegunn/fzf_completions" pick="/dev/null"
zinit ice lucid wait"0c" multisrc"shell/{completion,key-bindings}.zsh" id-as"junegunn/fzf_completions" pick"/dev/null"
zinit light junegunn/fzf
# FZF-TAB
@ -46,22 +46,23 @@ zinit light Aloxaf/fzf-tab
# AUTOSUGGESTIONS, TRIGGER PRECMD HOOK UPON LOAD
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
zinit ice wait="0a" lucid atload="_zsh_autosuggest_start"
zinit ice wait"0a" lucid atload"_zsh_autosuggest_start"
zinit light zsh-users/zsh-autosuggestions
#
# # ENHANCED
# zinit ice wait="0b" lucid
# zinit light b4b4r07/enhanced
# export ENHANCD_FILTER=fzf:fzy:peco
# ENHANCD
zinit ice wait="0b" lucid
zinit light b4b4r07/enhancd
export ENHANCD_FILTER=fzf:fzy:peco
#SYNTAX HIGHLIGHTING
zinit ice wait"0c" lucid atinit"zpcompinit;zpcdreplay"
zinit light zdharma-continuum/fast-syntax-highlighting
# ZOXIDE
zinit ice wait="0" lucid from="gh-r" as="program" pick="zoxide-*/zoxide -> zoxide" cp="zoxide-*/completions/_zoxide -> _zoxide" atclone="./zoxide init zsh > init.zsh" atpull="%atclone" src="init.zsh"
zinit ice wait"0" lucid from"gh-r" as"program" pick"zoxide-*/zoxide -> zoxide" cp"zoxide-*/completions/_zoxide -> _zoxide" atclone"./zoxide init zsh > init.zsh" atpull"%atclone" src"init.zsh"
zinit light ajeetdsouza/zoxide
# TAB COMPLETIONS
zinit ice wait="0b" lucid blockf
zinit light zsh-users/zsh-completions
# zinit ice wait="0b" lucid blockf
# zinit light zsh-users/zsh-completions
# SYNTAX HIGHLIGHTING
zinit ice wait="0c" lucid atinit="zpcompinit;zpcdreplay"
zinit light zdharma-continuum/fast-syntax-highlighting

3
.zshrc
View File

@ -54,3 +54,6 @@ alias python="python3"
[[ ! -f ~/.localrc.zsh ]] || source ~/.localrc.zsh
eval $(thefuck --alias)
[ -f /opt/miniconda3/etc/profile.d/conda.sh ] && source /opt/miniconda3/etc/profile.d/conda.sh

View File

@ -15,7 +15,7 @@ zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# Disable the menu selection feature (automatically select the first match)
zstyle ':completion:*' menu no
zstyle ':completion:*' menu select
# Customize the prompt shown when scrolling through completions
# - `%SScrolling active: current selection at %p%s`: Shows a message indicating that scrolling is active and the current selection.
@ -23,7 +23,7 @@ zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %
# Format descriptions in completion lists
# - `[%d]`: Wrap descriptions in square brackets.
zstyle ':completion:*:descriptions' format '[%d]'
zstyle ':completion:*:descriptions' format '[%d]'
# Specify the command to use for completing process names
# - `ps -au$USER`: List processes for the current user.
@ -42,22 +42,30 @@ zstyle ":completion:*:git-checkout:*" sort false
# Apply LS_COLORS to completion lists for colored output
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' menu select
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*:options' description 'yes'
zstyle ':completion:*:options' auto-description '%d'
zstyle ':completion:*:corrections' format '%U%F{red}-- %d (errors: %e) --%f%u'
zstyle ':completion:*:descriptions' format '%U%F{yellow}-- %d --%f%u'
zstyle ':completion:*:messages' format '%F{purple} -- %d --%f'
zstyle ':completion:*:warnings' format '%F{red} -- no matches found --%f'
# Configure fzf-tab behavior
# Use the input string as the query string for _zlua completions
zstyle ':fzf-tab:complete:_zlua:*' query-string input
# Customize the kill command completion with fzf-tab
# - `extra-opts`: Additional options for fzf, including a preview window showing the command of the selected process.
zstyle ':fzf-tab:complete:kill:argument-rest' extra-opts --preview=$extract'ps --pid=$in[(w)1] -o cmd --no-headers -w -w' --preview-window=down:3:wrap
# Customize the cd command completion with fzf-tab
# - `fzf-preview`: Show a preview of directories using `eza` (a modern replacement for `ls`).
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
# Customize the z command completion with fzf-tab
# - `fzf-preview`: Show a preview of directories using `eza`.
zstyle ':fzf-tab:complete:z:*' fzf-preview 'eza -1 --color=always $realpath'
# Use default fzf options for fzf-tab
zstyle ':fzf-tab:*' use-fzf-default-opts yes
#
# # Use the input string as the query string for _zlua completions
# zstyle ':fzf-tab:complete:_zlua:*' query-string input
#
# # Customize the kill command completion with fzf-tab
# # - `extra-opts`: Additional options for fzf, including a preview window showing the command of the selected process.
# zstyle ':fzf-tab:complete:kill:argument-rest' extra-opts --preview=$extract'ps --pid=$in[(w)1] -o cmd --no-headers -w -w' --preview-window=down:3:wrap
#
# # Customize the cd command completion with fzf-tab
# # - `fzf-preview`: Show a preview of directories using `eza` (a modern replacement for `ls`).
# zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
#
# # Customize the z command completion with fzf-tab
# # - `fzf-preview`: Show a preview of directories using `eza`.
# zstyle ':fzf-tab:complete:z:*' fzf-preview 'eza -1 --color=always $realpath'
#
# # Use default fzf options for fzf-tab
# zstyle ':fzf-tab:*' use-fzf-default-opts yes