Initial commit

This commit is contained in:
2024-06-14 20:14:11 +10:00
commit 9125fe9e3b
20 changed files with 529 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
return {
"catppuccin/nvim",
config = function()
vim.cmd('colorscheme catppuccin-mocha')
end,
}

View File

@@ -0,0 +1,44 @@
return {
"tpope/vim-fugitive",
config = function()
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
local Haelnorr_Fugitive = vim.api.nvim_create_augroup("Haelnorr_Fugitive", {})
local autocmd = vim.api.nvim_create_autocmd
autocmd("BufWinEnter", {
group = Haelnorr_Fugitive,
pattern = "*",
callback = function()
if vim.bo.ft ~= "fugitive" then
return
end
local bufnr = vim.api.nvim_get_current_buf()
local opts = {buffer = bufnr, remap = false}
vim.keymap.set("n", "<leader>s", function()
vim.cmd.Git('add -A')
end, opts)
vim.keymap.set("n", "<leader>c", function()
vim.cmd.Git('commit')
end, opts)
vim.keymap.set("n", "<leader>p", function()
vim.cmd.Git('push')
end, opts)
-- rebase always
vim.keymap.set("n", "<leader>P", function()
vim.cmd.Git({'pull', '--rebase'})
end, opts)
-- NOTE: It allows me to easily set the branch i am pushing and any tracking
-- needed if i did not set the branch up correctly
vim.keymap.set("n", "<leader>t", ":Git push -u origin ", opts);
end,
})
vim.keymap.set("n", "gu", "<cmd>diffget //2<CR>")
vim.keymap.set("n", "gh", "<cmd>diffget //3<CR>")
end
}

View File

@@ -0,0 +1,20 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local harpoon = require("harpoon")
harpoon:setup()
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
vim.keymap.set("n", "<A-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<A-h>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<A-j>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<A-k>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<A-l>", function() harpoon:list():select(4) end)
vim.keymap.set("n", "<leader><A-h>", function() harpoon:list():replace_at(1) end)
vim.keymap.set("n", "<leader><A-j>", function() harpoon:list():replace_at(2) end)
vim.keymap.set("n", "<leader><A-k>", function() harpoon:list():replace_at(3) end)
vim.keymap.set("n", "<leader><A-l>", function() harpoon:list():replace_at(4) end)
end
}

View File

@@ -0,0 +1,9 @@
return {
{
"nvim-lua/plenary.nvim",
name = "plenary"
},
"eandrju/cellular-automaton.nvim",
}

104
lua/haelnorr/lazy/lsp.lua Normal file
View File

@@ -0,0 +1,104 @@
return {
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/nvim-cmp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"j-hui/fidget.nvim",
},
config = function()
local cmp = require('cmp')
local cmp_lsp = require("cmp_nvim_lsp")
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
cmp_lsp.default_capabilities())
require("fidget").setup({})
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
"ansiblels",
"astro",
"bashls",
"css_variables",
"cssls",
"cssmodules_ls",
"custom_elements_ls",
"docker_compose_language_service",
"dockerls",
"html",
"jsonls",
"pyright",
"tailwindcss",
"tsserver",
},
handlers = {
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup {
capabilities = capabilities
}
end,
["lua_ls"] = function()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup {
capabilities = capabilities,
settings = {
Lua = {
runtime = { version = "Lua 5.1" },
diagnostics = {
globals = { "vim", "it", "describe", "before_each", "after_each" },
}
}
}
}
end,
}
})
local cmp_select = { behavior = cmp.SelectBehavior.Select }
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, -- For luasnip users.
}, {
{ name = 'buffer' },
})
})
vim.diagnostic.config({
-- update_in_insert = true,
float = {
focusable = false,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
})
end
}

View File

@@ -0,0 +1,29 @@
return {
{
"L3MON4D3/LuaSnip",
-- follow latest release.
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
-- install jsregexp (optional!).
build = "make install_jsregexp",
dependencies = { "rafamadriz/friendly-snippets" },
config = function()
local ls = require("luasnip")
ls.filetype_extend("javascript", { "jsdoc" })
--- TODO: What is expand?
vim.keymap.set({"i"}, "<C-s>e", function() ls.expand() end, {silent = true})
vim.keymap.set({"i", "s"}, "<C-s>;", function() ls.jump(1) end, {silent = true})
vim.keymap.set({"i", "s"}, "<C-s>,", function() ls.jump(-1) end, {silent = true})
vim.keymap.set({"i", "s"}, "<C-E>", function()
if ls.choice_active() then
ls.change_choice(1)
end
end, {silent = true})
end,
}
}

View File

@@ -0,0 +1,30 @@
return {
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
dependencies = {
"nvim-lua/plenary.nvim"
},
config = function()
require('telescope').setup({})
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>pws', function()
local word = vim.fn.expand("<cword>")
builtin.grep_string({ search = word })
end)
vim.keymap.set('n', '<leader>pWs', function()
local word = vim.fn.expand("<cWORD>")
builtin.grep_string({ search = word })
end)
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
end
}

View File

@@ -0,0 +1,17 @@
return {
"christoomey/vim-tmux-navigator",
cmd = {
"TmuxNavigateLeft",
"TmuxNavigateDown",
"TmuxNavigateUp",
"TmuxNavigateRight",
"TmuxNavigatePrevious",
},
keys = {
{ "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" },
{ "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" },
{ "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" },
{ "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" },
{ "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" },
},
}

View File

@@ -0,0 +1,46 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all"
ensure_installed = {
"vimdoc", "javascript", "typescript", "c", "lua", "rust",
"jsdoc", "bash",
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally
auto_install = true,
indent = {
enable = true
},
highlight = {
-- `false` will disable the whole extension
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on "syntax" being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = { "markdown" },
},
})
local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs()
treesitter_parser_config.templ = {
install_info = {
url = "https://github.com/vrischmann/tree-sitter-templ.git",
files = {"src/parser.c", "src/scanner.c"},
branch = "master",
},
}
end
}

View File

@@ -0,0 +1,23 @@
return {
{
"folke/trouble.nvim",
config = function()
require("trouble").setup({
icons = false,
})
vim.keymap.set("n", "<leader>tt", function()
require("trouble").toggle()
end)
vim.keymap.set("n", "[t", function()
require("trouble").next({skip_groups = true, jump = true});
end)
vim.keymap.set("n", "]t", function()
require("trouble").previous({skip_groups = true, jump = true});
end)
end
},
}

View File

@@ -0,0 +1,9 @@
return {
"mbbill/undotree",
config = function()
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
end
}

View File

@@ -0,0 +1,10 @@
return {
"theprimeagen/vim-be-good",
dependencies = {
"nvim-lua/plenary.nvim"
},
config = function()
end
}

View File

@@ -0,0 +1,34 @@
return {
"folke/zen-mode.nvim",
config = function()
vim.keymap.set("n", "<leader>zz", function()
require("zen-mode").setup {
window = {
width = 90,
options = { }
},
}
require("zen-mode").toggle()
vim.wo.wrap = false
vim.wo.number = true
vim.wo.rnu = true
end)
vim.keymap.set("n", "<leader>zZ", function()
require("zen-mode").setup {
window = {
width = 80,
options = { }
},
}
require("zen-mode").toggle()
vim.wo.wrap = false
vim.wo.number = false
vim.wo.rnu = false
vim.opt.colorcolumn = "0"
end)
end
}