Skip to content

Instantly share code, notes, and snippets.

@AlbertoBarrago
Created November 17, 2025 13:53
Show Gist options
  • Select an option

  • Save AlbertoBarrago/baead4db957404828e7167b4612f6437 to your computer and use it in GitHub Desktop.

Select an option

Save AlbertoBarrago/baead4db957404828e7167b4612f6437 to your computer and use it in GitHub Desktop.
Nvim Config
-- ==============================
-- Load Lazy.nvim Plugin Manager
-- ==============================
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git", "clone", "--filter=blob:none", "--branch=stable",
"https://github.com/folke/lazy.nvim.git", lazypath
})
end
vim.opt.rtp:prepend(lazypath)
-- ==============================
-- Plugin Setup (Lazy.nvim)
-- ==============================
require("lazy").setup({
"folke/tokyonight.nvim",
"nvim-treesitter/nvim-treesitter",
"neovim/nvim-lspconfig",
"williamboman/mason.nvim",
"williamboman/mason-lspconfig",
{
"ms-jpq/coq_nvim",
branch = "coq",
dependencies = {
{ "ms-jpq/coq.artifacts", branch = "artifacts" },
{ "ms-jpq/coq.thirdparty", branch = "3p" }
}
},
"mfussenegger/nvim-dap",
"nvim-tree/nvim-tree.lua",
"nvim-tree/nvim-web-devicons",
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("telescope").setup({
defaults = {
path_display = { "truncate" },
file_ignore_patterns = { "node_modules", ".git" },
}
})
end
},
"doctorfree/cheatsheet.nvim",
"tpope/vim-fugitive",
"lewis6991/gitsigns.nvim",
"kdheepak/lazygit.nvim",
})
-- ==============================
-- Mason & LSP Setup
-- ==============================
vim.defer_fn(function()
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = { "pyright", "jdtls", "dockerls" },
automatic_installation = true,
})
end, 100)
local coq = require("coq")
require("lspconfig").pyright.setup(coq.lsp_ensure_capabilities({}))
require("lspconfig").jdtls.setup(coq.lsp_ensure_capabilities({}))
require("lspconfig").dockerls.setup(coq.lsp_ensure_capabilities({}))
require("lspconfig").ts_ls.setup(coq.lsp_ensure_capabilities({}))
vim.cmd("autocmd FileType markdown setlocal omnifunc=coq#complete")
-- ==============================
-- General Neovim Settings
-- ==============================
vim.opt.number = true
vim.opt.relativenumber = true
vim.g.have_nerd_font = true
vim.opt.mouse = "a"
vim.opt.showmode = false
vim.schedule(function() vim.opt.clipboard = "unnamedplus" end)
vim.opt.breakindent = true
vim.opt.undofile = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.signcolumn = "yes"
vim.opt.updatetime = 250
vim.opt.timeoutlen = 300
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.list = true
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "" }
vim.opt.inccommand = "split"
vim.opt.cursorline = true
vim.opt.scrolloff = 10
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- ==============================
-- Keybindings
-- ==============================
local builtin = require("telescope.builtin")
-- function to detect Git root
local function project_root()
local git_root = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
if vim.v.shell_error == 0 and git_root ~= "" then
return git_root
end
return vim.fn.getcwd()
end
-- Leader keymaps with git root
vim.keymap.set("n", "<leader>f", function()
builtin.find_files({ cwd = project_root() })
end)
vim.keymap.set("n", "<leader>g", function()
builtin.live_grep({ cwd = project_root() })
end)
vim.keymap.set("n", "<leader>b", builtin.buffers, {})
vim.keymap.set("n", "<leader>h", builtin.help_tags, {})
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>")
vim.keymap.set("n", "<leader>gs", ":G<CR>")
vim.keymap.set("n", "<leader>gb", ":Git blame<CR>")
vim.keymap.set("n", "<leader>gd", ":Gdiffsplit<CR>")
vim.keymap.set("n", "<leader>gl", ":LazyGit<CR>")
vim.keymap.set("n", "<leader>gp", ":Git push<CR>")
vim.keymap.set("n", "<leader>gP", ":Git pull<CR>")
-- ==============================
-- NvimTree Setup
-- ==============================
require("nvim-tree").setup({
view = { width = 30, side = "left" },
renderer = { icons = { show = { git = true, file = true, folder = true } } },
})
-- ==============================
-- Gitsigns Setup
-- ==============================
require("gitsigns").setup({
signs = { add = { "+" }, change = { "~" }, delete = { "_" },
topdelete = { "" }, changedelete = { "~" } },
current_line_blame = true,
sign_priority = 6,
update_debounce = 200,
})
-- ==============================
-- COQ Settings
-- ==============================
vim.g.coq_settings = { auto_start = true, keymap = { recommended = true } }
-- ==============================
-- Lazygit Integration
-- ==============================
vim.g.lazygit_floating_window_winblend = 0
vim.g.lazygit_floating_window_scaling_factor = 1.0
vim.g.lazygit_floating_window_border_chars = { "","","","","","","","" }
vim.g.lazygit_use_neovim_remote = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment