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 -- Initialize lazy.nvim
require("config.lazy") require("config.lazy")
-- vim.cmd([[
-- augroup jdtls_lsp vim.cmd([[
-- autocmd! augroup jdtls_lsp
-- autocmd FileType java lua require'jdtls.jdtls_setup'.setup() autocmd!
-- augroup end autocmd FileType java lua require'jdtls.jdtls_setup'.setup()
-- ]]) augroup end
]])
-- Source other configuration files -- Source other configuration files
require("keybindings") 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" opts.desc = "Save session, write all buffers and quit"
map("n", "<leader>qqq", ':lua require("auto-session").SaveSession()<CR>:wqa<CR>', opts) 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", "nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
}, },
opts = {
window = { position = "current" },
},
config = function() config = function()
require("neo-tree").setup({ require("neo-tree").setup({
filesystem = { filesystem = {
@ -19,23 +22,44 @@ return {
}) })
local keymap = vim.keymap 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( keymap.set(
"n", "n",
"<leader>ee", "gd",
"<cmd>Neotree focus<CR>", "<cmd>Neotree float reveal_file=<cfile> reveal_force_cwd<cr>",
{ desc = "Open and focus Neotree", noremap = true, silent = true } { desc = "", noremap = true, silent = true }
) )
keymap.set( keymap.set(
"n", "n",
"<leader>e", "<leader>eb",
"<cmd>Neotree toggle<CR>", "<cmd>Neotree toggle show buffers right<cr>",
{ desc = "Toggle Neotree", noremap = true, silent = true } { desc = "Show buffers (Neotree)", noremap = true, silent = true }
) )
keymap.set( keymap.set(
"n", "n",
"<leader>eq", "<leader>gs",
"<cmd>Neotree close<CR>", "<cmd>Neotree float git_status<cr>",
{ desc = "Close Neotree", noremap = true, silent = true } { desc = "Show git status (Neotree)", noremap = true, silent = true }
) )
end, end,
}, },

View File

@ -11,7 +11,7 @@ return {
local telescope = require("telescope") local telescope = require("telescope")
local trouble_telescope = require("trouble.sources.telescope") local trouble_telescope = require("trouble.sources.telescope")
local actions = require("telescope.actions") 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 -- Use this to add more results without clearing the trouble list
local add_to_trouble = require("trouble.sources.telescope").add local add_to_trouble = require("trouble.sources.telescope").add
@ -22,7 +22,9 @@ return {
i = { i = {
["<C-k>"] = actions.move_selection_previous, ["<C-k>"] = actions.move_selection_previous,
["<C-j>"] = actions.move_selection_next, ["<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 }, n = { ["<C-t>"] = open_with_trouble },
}, },
@ -33,8 +35,14 @@ return {
-- Set keymaps to load pickers -- Set keymaps to load pickers
local keymap = vim.keymap 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>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("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( keymap.set(
"n", "n",
"<leader>fc", "<leader>fc",

View File

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

View File

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

View File

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

View File

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

View File

@ -29,15 +29,15 @@ zinit ice depth=1; zinit light romkatv/powerlevel10k
############### ###############
# FZF # 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 zinit light junegunn/fzf
# FZF BYNARY AND TMUX HELPER SCRIPT # 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 zinit light junegunn/fzf
# BIND MULTIPLE WIDGETS USING 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 zinit light junegunn/fzf
# FZF-TAB # FZF-TAB
@ -46,22 +46,23 @@ zinit light Aloxaf/fzf-tab
# AUTOSUGGESTIONS, TRIGGER PRECMD HOOK UPON LOAD # AUTOSUGGESTIONS, TRIGGER PRECMD HOOK UPON LOAD
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20 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 zinit light zsh-users/zsh-autosuggestions
#
# # ENHANCED
# zinit ice wait="0b" lucid
# zinit light b4b4r07/enhanced
# export ENHANCD_FILTER=fzf:fzy:peco
# ENHANCD #SYNTAX HIGHLIGHTING
zinit ice wait="0b" lucid zinit ice wait"0c" lucid atinit"zpcompinit;zpcdreplay"
zinit light b4b4r07/enhancd zinit light zdharma-continuum/fast-syntax-highlighting
export ENHANCD_FILTER=fzf:fzy:peco
# ZOXIDE # 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 zinit light ajeetdsouza/zoxide
# TAB COMPLETIONS # TAB COMPLETIONS
zinit ice wait="0b" lucid blockf # zinit ice wait="0b" lucid blockf
zinit light zsh-users/zsh-completions # 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 [[ ! -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}' zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# Disable the menu selection feature (automatically select the first match) # 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 # 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. # - `%SScrolling active: current selection at %p%s`: Shows a message indicating that scrolling is active and the current selection.
@ -42,22 +42,30 @@ zstyle ":completion:*:git-checkout:*" sort false
# Apply LS_COLORS to completion lists for colored output # Apply LS_COLORS to completion lists for colored output
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} 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 # Configure fzf-tab behavior
#
# Use the input string as the query string for _zlua completions # # Use the input string as the query string for _zlua completions
zstyle ':fzf-tab:complete:_zlua:*' query-string input # zstyle ':fzf-tab:complete:_zlua:*' query-string input
#
# Customize the kill command completion with fzf-tab # # 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. # # - `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 # 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 # # Customize the cd command completion with fzf-tab
# - `fzf-preview`: Show a preview of directories using `eza` (a modern replacement for `ls`). # # - `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' # zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
#
# Customize the z command completion with fzf-tab # # Customize the z command completion with fzf-tab
# - `fzf-preview`: Show a preview of directories using `eza`. # # - `fzf-preview`: Show a preview of directories using `eza`.
zstyle ':fzf-tab:complete:z:*' fzf-preview 'eza -1 --color=always $realpath' # zstyle ':fzf-tab:complete:z:*' fzf-preview 'eza -1 --color=always $realpath'
#
# Use default fzf options for fzf-tab # # Use default fzf options for fzf-tab
zstyle ':fzf-tab:*' use-fzf-default-opts yes # zstyle ':fzf-tab:*' use-fzf-default-opts yes