Merge branch 'main' of codeberg.org:aleidk/dots

This commit is contained in:
aleidk 2023-10-03 12:06:28 -03:00
commit aa9d186a5a
19 changed files with 341 additions and 245 deletions

View file

@ -14,8 +14,8 @@ import:
# Any items in the `env` entry below will be added as # Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables # environment variables. Some entries may override variables
# set by alacritty itself. # set by alacritty itself.
#env: env:
# TERM variable TERM: xterm-256color
# #
# This value is used to set the `$TERM` environment variable for # This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will # each instance of Alacritty. If it is not present, alacritty will

View file

@ -6,14 +6,14 @@ require("aleidk.options")
-- Install package manager https://github.com/folke/lazy.nvim -- Install package manager https://github.com/folke/lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ vim.fn.system({
"git", "git",
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release "--branch=stable", -- latest stable release
lazypath, lazypath,
}) })
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
@ -24,4 +24,3 @@ require("lazy").setup("aleidk.plugins")
require("aleidk.keymaps") require("aleidk.keymaps")
require("aleidk.autocmds") require("aleidk.autocmds")
require("aleidk.IDE")

View file

@ -1,44 +0,0 @@
-- nvim-cmp setup
local cmp = require("cmp")
local luasnip = require("luasnip")
luasnip.config.setup({})
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
},
})

View file

@ -1,3 +0,0 @@
require("aleidk.IDE.lsp")
require("aleidk.IDE.completion")
require("aleidk.IDE.null-ls")

View file

@ -1,92 +0,0 @@
-- LSP settings.
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
-- NOTE: Remember that lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself
-- many times.
--
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local nmap = function(keys, func, desc)
if desc then
desc = "LSP: " .. desc
end
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
end
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
nmap("gd", vim.lsp.buf.definition, "Go to definition")
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
nmap("gI", vim.lsp.buf.implementation, "Go to Implementation")
-- See `:help K` for why this keymap
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
-- Lesser used LSP functionality
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
nmap("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder")
nmap("<leader>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, "[W]orkspace [L]ist Folders")
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
vim.lsp.buf.format()
end, { desc = "Format current buffer with LSP" })
end
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
--
-- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself.
local servers = {
bashls = {},
cssls = {},
dockerls = {},
emmet_ls = {},
html = {},
pyright = {},
rust_analyzer = {},
sqlls = {},
tsserver = {},
yamlls = {},
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
}
-- Diagnostic keymaps
-- vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
-- vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
-- vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
-- vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
-- Ensure the servers above are installed
local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup({
ensure_installed = vim.tbl_keys(servers),
})
mason_lspconfig.setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup({
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
})
end,
})

View file

@ -1,38 +0,0 @@
-- Linter and formatter configuration
require("mason-null-ls").setup({
handlers = {}, -- this make mason-null-ls to auto setup handlers
ensure_installed = {
"blade_formatter",
"blue",
"eslint_d",
"fixjson",
"gitlint",
"intelephense",
"markdownlint",
"php-cs-fixer",
"prettierd",
"shellcheck",
"shfmt",
"sql-formatter",
"stylua",
"yamlint",
},
})
local null_ls = require("null-ls.builtins")
require("null-ls").setup({
sources = {
null_ls.formatting.prettierd.with({
disabled_filetypes = { "markdown" },
}),
null_ls.formatting.phpcsfixer.with({
extra_args = {
"--config",
"$HOME/.config/php-cs-fixer-conf.php",
},
}),
},
})

View file

@ -50,7 +50,7 @@ return {
Package = "", Package = "",
Property = "", Property = "",
Reference = "", Reference = "",
Snippet = " ", Snippet = " ",
String = "", String = "",
Struct = "", Struct = "",
Text = "", Text = "",

View file

@ -1,10 +1,21 @@
return { return { -- Change colors.none if not using a transparent background
"catppuccin/nvim", "catppuccin/nvim",
priority = 1000, priority = 1000,
lazy = false, lazy = false,
opts = { opts = {
flavour = "macchiato", flavour = "macchiato",
transparent_background = true, transparent_background = true,
integrations = {
fidget = true,
cmp = true,
},
custom_highlights = function(colors)
return {
Pmenu = { bg = colors.none, blend = 0 },
FloatBorder = { bg = colors.none },
CmpItemMenu = { fg = colors.text, bg = colors.none },
}
end,
}, },
config = function(_, opts) config = function(_, opts)

View file

@ -0,0 +1,72 @@
return {
"hrsh7th/nvim-cmp",
version = false, -- last release is way too old
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip",
},
opts = function()
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
local cmp = require("cmp")
local defaults = require("cmp.config.default")()
local window_opts = {
border = "rounded",
side_padding = 1,
winhighlight = "Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None",
}
return {
completion = {
completeopt = "menu,menuone,noinsert",
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-d>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<S-CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
}),
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(_, item)
local icons = require("aleidk.constants").icons.kinds
if icons[item.kind] then
item.kind = icons[item.kind] .. item.kind
end
return item
end,
},
window = {
completion = cmp.config.window.bordered(window_opts),
documentation = cmp.config.window.bordered(window_opts),
},
experimental = {
ghost_text = {
hl_group = "CmpGhostText",
},
},
sorting = defaults.sorting,
}
end,
}

View file

@ -0,0 +1,22 @@
return {
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
-- Conform will run multiple formatters sequentially
lua = { "stylua" },
python = { "black" },
-- Use a sub-list to run only the first available formatter
javascript = { { "prettierd", "prettier" } },
typescript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
typescriptreact = { { "prettierd", "prettier" } },
-- Use the "_" filetype to run formatters on filetypes that don't
-- have other formatters configured.
["_"] = { "trim_whitespace" },
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
},
}

View file

@ -8,23 +8,6 @@ return {
-- Detect tabstop and shiftwidth automatically -- Detect tabstop and shiftwidth automatically
"tpope/vim-sleuth", "tpope/vim-sleuth",
{
-- LSP Configuration & Plugins
"neovim/nvim-lspconfig",
dependencies = {
-- Automatically install LSPs to stdpath for neovim
{ "williamboman/mason.nvim", config = true },
"williamboman/mason-lspconfig.nvim",
-- Useful status updates for LSP
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ "j-hui/fidget.nvim", opts = {} },
-- Additional lua configuration, makes nvim stuff amazing!
{ "folke/neodev.nvim", opts = {} },
},
},
{ {
-- Autocompletion -- Autocompletion
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",

View file

@ -0,0 +1,19 @@
return {
"mfussenegger/nvim-lint",
event = "VeryLazy",
config = function()
require("lint").linters_by_ft = {
javascript = { "eslint_d" },
typescript = { "eslint_d" },
javascriptreact = { "eslint_d" },
typescriptreact = { "eslint_d" },
-- astro = { "eslint_d" },
}
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
require("lint").try_lint()
end,
})
end,
}

View file

@ -0,0 +1,119 @@
return {
-- LSP Configuration & Plugins
"neovim/nvim-lspconfig",
dependencies = {
-- Automatically install LSPs to stdpath for neovim
{ "williamboman/mason.nvim" },
"williamboman/mason-lspconfig.nvim",
-- Useful status updates for LSP
{
"j-hui/fidget.nvim",
tag = "legacy",
event = "LspAttach",
opts = {
window = {
blend = 0,
},
},
},
-- Additional lua configuration, makes nvim stuff amazing!
{ "folke/neodev.nvim", opts = {} },
},
config = function()
-- LSP settings.
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
-- NOTE: Remember that lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself
-- many times.
--
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local nmap = function(keys, func, desc)
if desc then
desc = "LSP: " .. desc
end
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
end
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
nmap("gd", vim.lsp.buf.definition, "Go to definition")
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
nmap("gI", vim.lsp.buf.implementation, "Go to Implementation")
-- See `:help K` for why this keymap
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
-- Lesser used LSP functionality
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
nmap("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder")
nmap("<leader>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, "[W]orkspace [L]ist Folders")
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
vim.lsp.buf.format()
end, { desc = "Format current buffer with LSP" })
end
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
--
-- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself.
local servers = {
bashls = {},
cssls = {},
dockerls = {},
emmet_ls = {},
html = {},
pyright = {},
rust_analyzer = {},
sqlls = {},
tsserver = {},
yamlls = {},
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
}
-- Diagnostic keymaps
-- vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
-- vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
-- vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
-- vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
-- Ensure the servers above are installed
local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup({
ensure_installed = vim.tbl_keys(servers),
})
mason_lspconfig.setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup({
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
})
end,
})
end,
}

View file

@ -0,0 +1,27 @@
return {
"L3MON4D3/LuaSnip",
dependencies = {
"rafamadriz/friendly-snippets",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
opts = {
history = true,
delete_check_events = "TextChanged",
},
-- stylua: ignore
keys = {
{
"<tab>",
function()
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
end,
expr = true,
silent = true,
mode = "i",
},
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
},
}

View file

@ -0,0 +1,9 @@
return {
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"typescript-language-server",
"eslint_d",
},
},
}

View file

@ -1,42 +1,44 @@
return { return {
"folke/noice.nvim", "folke/noice.nvim",
event = "VeryLazy", event = "VeryLazy",
dependencies = { dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
-- OPTIONAL: -- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view. -- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback -- If not available, we use `mini` as the fallback
"rcarriga/nvim-notify", { "rcarriga/nvim-notify", opts = {
}, background_colour = "#000000",
opts = { } },
lsp = { },
override = { opts = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true, lsp = {
["vim.lsp.util.stylize_markdown"] = true, override = {
["cmp.entry.get_documentation"] = true, ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
}, ["vim.lsp.util.stylize_markdown"] = true,
}, ["cmp.entry.get_documentation"] = true,
routes = { },
{ },
filter = { routes = {
event = "msg_show", {
any = { filter = {
{ find = "%d+L, %d+B" }, event = "msg_show",
{ find = "; after #%d+" }, any = {
{ find = "; before #%d+" }, { find = "%d+L, %d+B" },
}, { find = "; after #%d+" },
}, { find = "; before #%d+" },
view = "mini", },
}, },
}, view = "mini",
presets = { },
bottom_search = true, },
command_palette = true, presets = {
long_message_to_split = true, bottom_search = true,
inc_rename = true, command_palette = true,
}, long_message_to_split = true,
}, inc_rename = true,
},
},
-- stylua: ignore -- stylua: ignore
keys = { keys = {
{ {

View file

@ -50,6 +50,8 @@ bind n new-window -c "#{pane_current_path}"
bind h previous-window bind h previous-window
bind l next-window bind l next-window
# set -g status-right '#(bartib current | sed -n 3p | awk \'{print $NF}\')'
## Plugins ## Plugins
run -b '~/.tmux/plugins/tpm/tpm' run -b '~/.tmux/plugins/tpm/tpm'
@ -67,6 +69,12 @@ set -g @plugin 'tmux-plugins/tpm'
## Plugin Config ## Plugin Config
set -g @catppuccin_flavour 'macchiato' set -g @catppuccin_flavour 'macchiato'
set -g @catppuccin_window_tabs_enabled on # or off to disable window_tabs set -g @catppuccin_window_tabs_enabled on # or off to disable window_tabs
set -g @catppuccin_status_modules_right "directory session"
set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
TMUX_FZF_LAUNCH_KEY="w" TMUX_FZF_LAUNCH_KEY="w"
TMUX_FZF_OPTIONS="-p -w 80% -h 60% -m" TMUX_FZF_OPTIONS="-p -w 80% -h 60% -m"

View file

@ -1,2 +1,3 @@
atim/lazygit atim/lazygit
atim/starship atim/starship
the4runner/firefox-dev

View file

@ -21,3 +21,4 @@ tealdeer
tmux tmux
tree-sitter-cli tree-sitter-cli
zsh zsh
firefox-dev