refactor config

This commit is contained in:
Alexander Navarro 2023-02-13 01:53:52 -03:00
commit 4f0e213f4a
155 changed files with 13983 additions and 0 deletions

View file

@ -0,0 +1,3 @@
return {
colorscheme = "catppuccin",
}

View file

@ -0,0 +1,3 @@
return {
"rust_analyzer",
}

View file

@ -0,0 +1,123 @@
return {
n = {
["<C-t>"] = { "<cmd>ToggleTerm<cr>", desc = "Toggle terminal" },
["<leader>fn"] = false,
["<leader>fo"] = false,
["<leader>fh"] = false,
["<leader>fb"] = false,
["<F10>"] = false,
["<F11>"] = false,
["<F12>"] = false,
["<F1>"] = {
function()
require("dap").terminate()
end,
desc = "Debugger: Stop",
}, -- S-F1
["<F2>"] = {
function()
require("dap").restart_frame()
end,
desc = "Debugger: Restart",
},
["<F3>"] = {
function()
require("dap").step_out()
end,
desc = "Debugger: Step Out",
},
["<F4>"] = {
function()
require("dap").step_into()
end,
desc = "Debugger: Step Into",
},
["<F5>"] = {
function()
require("dap").step_over()
end,
desc = "Debugger: Step Over",
},
["<F6>"] = {
function()
require("dap").continue()
end,
desc = "Debugger: Start",
},
["<F7>"] = {
function()
require("dap").toggle_breakpoint()
end,
desc = "Debugger: Toggle Breakpoint",
},
["<leader>fp"] = {
function()
require("telescope").extensions.projects.projects()
end,
desc = "Search project",
},
["<leader>lj"] = {
function()
vim.diagnostic.goto_next()
end,
desc = "Go to next diagnostic",
},
["<leader>lk"] = {
function()
vim.diagnostic.goto_prev()
end,
desc = "Go to prev diagnostic",
},
["<leader>Ch"] = {
function()
require("nvim-comment-frame").add_comment()
end,
desc = "Add a comment frame",
},
["<leader>CH"] = {
function()
require("nvim-comment-frame").add_multiline_comment()
end,
desc = "Add a multiline comment frame",
},
["<leader>Cd"] = {
function()
require("neogen").generate()
end,
desc = "Generate comment docstring",
},
["<leader>ft"] = {
"<cmd>TodoTrouble<CR>",
desc = "Search TODOS",
},
["<leader>r"] = {
":s/",
desc = "Search and replace",
},
["<leader>R"] = {
":%s/",
desc = "Search and replace in whole file",
},
},
v = {
["<leader>r"] = {
":s/",
desc = "Search and replace",
},
["p"] = {
"pgvy",
desc = "Paste and re yank text",
},
},
t = {
["<C-t>"] = { "<cmd>ToggleTerm<cr>", desc = "Toggle terminal" },
},
}

View file

@ -0,0 +1,22 @@
return {
firefox = function(source_name)
local dap = require("dap")
dap.adapters.firefox = {
type = "executable",
command = "node",
args = { os.getenv("HOME") .. "/.local/share/nvim/mason/bin/firefox-debug-adapter" },
}
dap.configurations.javascriptreact = {
{
name = "Debug with Firefox",
type = "firefox",
request = "launch",
reAttach = true,
url = "http://localhost:3000",
webRoot = "${workspaceFolder}",
firefoxExecutable = "/usr/bin/firefox-developer-edition",
},
}
end,
}

View file

@ -0,0 +1,11 @@
return {
g = {
catppuccin_flavour = "macchiato",
},
opt = {
number = true,
relativenumber = true,
-- spelllang = "en_us,es_cl",
},
}

View file

@ -0,0 +1,31 @@
local alpha_button = astronvim.alpha_button
return {
layout = {
{ type = "padding", val = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) }) },
{
type = "text",
val = astronvim.user_plugin_opts("header", {
" ████ ███ █████ █████ ",
" ░░███ ░░░ ░░███ ░░███ ",
" ██████ ░███ ██████ ████ ███████ ░███ █████",
" ░░░░░███ ░███ ███░░███░░███ ███░░███ ░███░░███ ",
" ███████ ░███ ░███████ ░███ ░███ ░███ ░██████░ ",
" ███░░███ ░███ ░███░░░ ░███ ░███ ░███ ░███░░███ ",
"░░████████ █████░░██████ █████░░████████ ████ █████",
" ░░░░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░░░░ ░░░░ ░░░░░ ",
}, false),
opts = { position = "center", hl = "DashboardHeader" },
},
{ type = "padding", val = 5 },
{
type = "group",
val = {
alpha_button("LDR f p", " Recent Project "),
alpha_button("LDR f f", " Find File "),
alpha_button("LDR o", "פּ File Explorer "),
alpha_button("LDR m a", " Bookmarks "),
},
opts = { spacing = 1 },
},
},
}

View file

@ -0,0 +1,72 @@
local catppuccin = require("catppuccin")
-- configure it
catppuccin.setup({
transparent_background = true,
term_colors = false,
styles = {
comments = { "italic" },
conditionals = { "italic" },
loops = { "italic" },
functions = { "italic" },
keywords = { "italic" },
strings = { "italic" },
variables = { "italic" },
numbers = {},
booleans = {},
properties = {},
types = {},
operators = {},
},
integrations = {
treesitter = true,
native_lsp = {
enabled = true,
virtual_text = {
errors = { "italic" },
hints = { "italic" },
warnings = { "italic" },
information = { "italic" },
},
underlines = {
errors = { "underline" },
hints = { "underline" },
warnings = { "underline" },
information = { "underline" },
},
},
lsp_trouble = true,
cmp = true,
lsp_saga = true,
gitgutter = false,
gitsigns = true,
telescope = true,
nvimtree = {
enabled = true,
show_root = true,
transparent_panel = true,
},
indent_blankline = { enabled = true, colored_indent_levels = true },
neotree = {
enabled = false,
show_root = true,
transparent_panel = false,
},
dap = { enabled = false, enable_ui = false },
which_key = true,
dashboard = true,
neogit = false,
vim_sneak = false,
fern = false,
barbar = true,
bufferline = true,
markdown = true,
lightspeed = false,
ts_rainbow = true,
hop = false,
notify = true,
telekasten = true,
symbols_outline = true,
mini = false,
},
})

View file

@ -0,0 +1,74 @@
require("harpoon").setup({
global_settings = {
-- sets the marks upon calling `toggle` on the ui, instead of require `:w`.
save_on_toggle = true,
-- saves the harpoon file upon every change. disabling is unrecommended.
save_on_change = true,
-- sets harpoon to run the command immediately as it's passed to the terminal when calling `sendCommand`.
enter_on_sendcmd = true,
-- closes any tmux windows harpoon that harpoon creates when you close Neovim.
tmux_autoclose_windows = false,
-- filetypes that you want to prevent from adding to the harpoon list menu.
excluded_filetypes = { "harpoon" },
-- set marks specific to each git branch inside git repository
mark_branch = false,
},
projects = {
-- Yes $HOME works
["$HOME/personal/vim-with-me/server"] = {
term = {
cmds = {
"./env && npx ts-node src/index.ts",
},
},
},
},
})
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
local tmux = require("harpoon.tmux")
local telescope = require("telescope")
local command_prompt = "Enter command: "
telescope.load_extension("harpoon")
local function map(key, func, desc)
vim.keymap.set("n", "<leader><leader>" .. key, func, { desc = desc })
end
map("n", mark.add_file, "Add mark")
map("t", ui.toggle_quick_menu, "Toogle UI")
map("j", function()
ui.nav_file(1)
end, "Navigate to file 1")
map("k", function()
ui.nav_file(2)
end, "Navigate to file 2")
map("l", function()
ui.nav_file(3)
end, "Navigate to file 3")
map("ñ", function()
ui.nav_file(4)
end, "Navigate to file 4")
map("g", function()
local input = vim.fn.input(command_prompt)
tmux.sendCommand("{next}", input)
end, "Send command to tmux pane 1")
map("G", function()
tmux.sendCommand("{next}", "\3")
end, "Send command to tmux pane 1")
map("T", "<CMD>Telescope harpoon marks<CR>", "Open marks in telescope")

View file

@ -0,0 +1,86 @@
return {
["/nvim-neo-tree/neo-tree.nvim"] = { disable = true },
["rcarriga/nvim-notify"] = { disable = true },
["catppuccin/nvim"] = {
as = "catppuccin",
config = function()
require("user.plugins.catppuccin")
end,
},
["nvim-treesitter/nvim-treesitter-context"] = {
config = function()
require("treesitter-context").setup()
end,
},
["ahmedkhalf/project.nvim"] = {
config = function()
require("user.plugins.project")
end,
},
["kyazdani42/nvim-tree.lua"] = {
config = function()
require("user.plugins.nvim-tree")
end,
},
["kylechui/nvim-surround"] = {
tag = "*", -- Use for stability; omit to use `main` branch for the latest features
config = function()
require("nvim-surround").setup()
end,
},
["s1n7ax/nvim-comment-frame"] = {
requires = {
{ "nvim-treesitter" },
},
config = function()
require("nvim-comment-frame").setup({
disable_default_keymap = true,
})
end,
},
["danymat/neogen"] = {
config = function()
require("neogen").setup({ snippet_engine = "luasnip" })
end,
requires = "nvim-treesitter/nvim-treesitter",
tag = "*", -- stable releases
},
["folke/todo-comments.nvim"] = {
requires = "nvim-lua/plenary.nvim",
config = function()
require("todo-comments").setup({})
end,
},
["folke/trouble.nvim"] = {
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("user.plugins.trouble")
end,
},
["anuvyklack/pretty-fold.nvim"] = {
config = function()
require("user.plugins.pretty-fold")
end,
},
["simrat39/rust-tools.nvim"] = {
after = "mason-lspconfig.nvim", -- make sure to load after mason-lspconfig
config = function()
require("rust-tools").setup({
server = astronvim.lsp.server_settings("rust_analyzer"), -- get the server settings and built in capabilities/on_attach
})
end,
},
["ThePrimeagen/harpoon"] = {
config = function()
require("user.plugins.harpoon")
end,
},
}

View file

@ -0,0 +1,15 @@
return {
ensure_installed = {
"bashls",
"cssls",
"dockerls",
"emmet_ls",
"html",
"pyright",
"rust_analyzer",
"sqlls",
"sumneko_lua",
"tsserver",
"yamlls",
},
}

View file

@ -0,0 +1,19 @@
return {
ensure_installed = {
"blade_formatter",
"blue",
"eslint_d",
"fixjson",
"gitlint",
"intelephense",
"luacheck",
"markdownlint",
"php-cs-fixer",
"prettierd",
"shellcheck",
"shfmt",
"sql-formatter",
"stylua",
"yamlint",
},
}

View file

@ -0,0 +1,9 @@
return function(config)
local null_ls = require("null-ls")
config.sources = {
null_ls.builtins.formatting.prettierd.with({
disabled_filetypes = { "markdown" },
}),
}
return config
end

View file

@ -0,0 +1,46 @@
local tree = require("nvim-tree")
local tree_cb = require("nvim-tree.config").nvim_tree_callback
tree.setup({
hijack_unnamed_buffer_when_opening = true,
disable_netrw = true,
hijack_netrw = true,
hijack_cursor = true, -- cursor at the start of filename
sync_root_with_cwd = true,
respect_buf_cwd = true,
update_focused_file = {
enable = true, -- focus curren file
update_root = true,
},
actions = { open_file = { quit_on_open = true } },
renderer = {
full_name = true, -- show remaining name in floating text
group_empty = true, -- group empty folders
add_trailing = true, -- Trailing slash to folders
highlight_opened_files = "all",
highlight_git = true,
},
view = {
centralize_selection = true, -- center current file on enter
width = 30, -- N° of columns or %
mappings = {
custom_only = false,
-- list of mappings to set on the tree manually
list = {
{ key = { "l", "<CR>", "o", "<2-LeftMouse>" }, action = "edit" },
-- {key = {"L", "<2-RightMouse>", "<C-]>"}, action = "cd"},
{ key = "s", action = "vsplit" },
{ key = "v", action = "split" },
{ key = "t", action = "tabnew" },
{ key = { "h", "<BS>" }, action = "close_node" },
{ key = "i", action = "toggle_dotfiles" },
{ key = "I", action = "toggle_ignored" },
{ key = { "<C-l>", "<C-CR>" }, cb = tree_cb("system_open") },
},
},
},
})
-- bindings
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>", { desc = "Toggle file tree", silent = true })
vim.keymap.set("n", "<C-e>", ":NvimTreeToggle<CR>", { desc = "Toggle file tree", silent = true })

View file

@ -0,0 +1,39 @@
require("pretty-fold").setup({
sections = {
left = {
"+",
function()
return string.rep("-", vim.v.foldlevel)
end,
" ",
"content",
" ",
"number_of_folded_lines",
" ",
function()
return string.rep("-", vim.v.foldlevel)
end,
"+",
},
},
fill_char = " ",
-- Possible values:
-- "delete" : Delete all comment signs from the fold string.
-- "spaces" : Replace all comment signs with equal number of spaces.
-- false : Do nothing with comment signs.
process_comment_signs = "delete",
-- List of patterns that will be removed from content foldtext section.
stop_words = {
"@brief%s*", -- (for C++) Remove '@brief' and all spaces after.
},
matchup_patterns = {
{ "{", "}" },
{ "%(", ")" }, -- % to escape lua pattern char
{ "%[", "]" }, -- % to escape lua pattern char
},
ft_ignore = { "neorg" },
})

View file

@ -0,0 +1,44 @@
require("project_nvim").setup({
-- Manual mode doesn't automatically change your root directory, so you have
-- the option to manually do so using `:ProjectRoot` command.
manual_mode = false,
-- Methods of detecting the root directory. **"lsp"** uses the native neovim
-- lsp, while **"pattern"** uses vim-rooter like glob pattern matching. Here
-- order matters: if one is not detected, the other is used as fallback. You
-- can also delete or rearangne the detection methods.
detection_methods = { "lsp", "pattern" },
-- All the patterns used to detect root dir, when **"pattern"** is in
-- detection_methods
patterns = {
".git",
"_darcs",
".hg",
".bzr",
".svn",
"Makefile",
"package.json",
},
-- Table of lsp clients to ignore by name
-- eg: { "efm", ... }
ignore_lsp = {},
-- Don't calculate root dir on specific directories
-- Ex: { "~/.cargo/*", ... }
exclude_dirs = {},
-- Show hidden files in telescope
show_hidden = false,
-- When set to false, you will get a message when project.nvim changes your
-- directory.
silent_chdir = false,
-- Path where project.nvim will store the project history for use in
-- telescope
datapath = vim.fn.stdpath("data"),
})
require("telescope").load_extension("projects")

View file

@ -0,0 +1,15 @@
local telescope_actions = require("telescope.actions")
return {
defaults = {
mappings = {
i = {
["<C-j>"] = telescope_actions.move_selection_next,
["<C-k>"] = telescope_actions.move_selection_previous,
["<C-s>"] = telescope_actions.file_vsplit,
["<C-v>"] = telescope_actions.file_split,
["<ESC>"] = telescope_actions.close,
},
},
},
}

View file

@ -0,0 +1,3 @@
return {
ensure_installed = { "javascript", "typescript", "php", "python", "lua", "bash", "sql", "yaml", "json" },
}

View file

@ -0,0 +1,26 @@
require("trouble").setup({
mode = "document_diagnostics",
action_keys = { -- key mappings for actions in the trouble list
-- map to {} to remove a mapping, for example:
-- close = {},
close = "q", -- close the list
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
open_split = { "s" }, -- open buffer in new split
open_vsplit = { "v" }, -- open buffer in new vsplit
open_tab = { "t" }, -- open buffer in new tab
jump_close = { "o" }, -- jump to the diagnostic and close the list
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
toggle_preview = "P", -- toggle auto_preview
hover = "K", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
close_folds = { "zM", "zm" }, -- close all folds
open_folds = { "zR", "zr" }, -- open all folds
toggle_fold = { "zA", "za" }, -- toggle fold of current file
previous = "k", -- previous item
next = "j", -- next item
},
})
vim.keymap.set("n", "<leader>fd", "<cmd>TroubleToggle<cr>", { silent = true, desc = "Search diagnostics" })

View file

@ -0,0 +1,3 @@
return {
use_winbar = "always",
}

View file

@ -0,0 +1,35 @@
return function()
local function alpha_on_bye(cmd)
local bufs = vim.fn.getbufinfo({ buflisted = true })
vim.cmd(cmd)
if require("core.utils").is_available("alpha-nvim") and not bufs[2] then
require("alpha").start(true)
end
end
vim.keymap.del("n", "<leader>C")
if require("core.utils").is_available("bufdelete.nvim") then
vim.keymap.set("n", "<leader>C", function()
alpha_on_bye("Bdelete!")
end, { desc = "Close buffer" })
else
vim.keymap.set("n", "<leader>C", function()
alpha_on_bye("bdelete!")
end, { desc = "Close buffer" })
end
vim.api.nvim_create_autocmd({
"BufEnter",
"BufAdd",
"BufNew",
"BufNewFile",
"BufWinEnter",
}, {
group = vim.api.nvim_create_augroup("TS_FOLD_WORKAROUND", {}),
callback = function()
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
end,
})
end

View file

@ -0,0 +1,8 @@
return {
n = {
["<leader>"] = {
["C"] = { name = "Comment Stuff" },
["<leader>"] = { name = "Harpoon" },
},
},
}