Initial commit

This commit is contained in:
Techno Duck 2024-01-27 03:35:27 -05:00
commit 0e1834288c
Signed by: technoduck
GPG key ID: 0418ACC82FFA9D04
21 changed files with 602 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
lazy-lock.json

3
README.md Normal file
View file

@ -0,0 +1,3 @@
# NVIM config with [lazy](https://github.com/folke/lazy.nvim) plugin manager.
I swear this is not (100%) stolen.

1
init.lua Normal file
View file

@ -0,0 +1 @@
require('technoduck')

5
lua/.luarc.json Normal file
View file

@ -0,0 +1,5 @@
{
"diagnostics.globals": [
"trouble"
]
}

27
lua/technoduck/init.lua Normal file
View file

@ -0,0 +1,27 @@
require("technoduck.set")
require("technoduck.remap")
require("technoduck.lazy_config")
local augroup = vim.api.nvim_create_augroup
local defaultgroup = augroup('default', {})
local autocmd = vim.api.nvim_create_autocmd
autocmd('LspAttach', {
group = defaultgroup,
callback = function(ev)
local opts = { buffer = ev.buff }
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vcf", function() vim.lsp.buf.format({ async = true }) end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.code_references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.code_rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
end
})
vim.g.netrw_browse_split = 0
vim.g.netrw_winsize = 25

View file

@ -0,0 +1,65 @@
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",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = "technoduck.lazy_plugins",
change_detection = { notify = false }
})
--[[
{
use {
'VonHeikemen/lsp-zero.nvim',
branch = 'v2.x',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'}, -- Required
{'williamboman/mason.nvim'}, -- Optional
{'williamboman/mason-lspconfig.nvim'}, -- Optional
{'hrsh7th/cmp-buffer'},
{'hrsh7th/cmp-path'},
{'hrsh7th/cmp-cmdline'},
-- Autocompletion
{'hrsh7th/nvim-cmp'}, -- Required
{'hrsh7th/cmp-nvim-lsp'}, -- Required
{'hrsh7th/cmp-nvim-lsp-signature-help'},
{'L3MON4D3/LuaSnip',
run = "make install_jsregexp",
requires = { 'rafamadriz/friendly-snippets' }}, -- Required
{'saadparwaiz1/cmp_luasnip'},
{ 'dcampos/nvim-snippy'},
{ 'dcampos/cmp-snippy'},
}
}
use {'simrat39/rust-tools.nvim'}
use { 'nvim-lua/lsp-status.nvim' }
use 'nvim-tree/nvim-web-devicons'
use {
'nvim-lualine/lualine.nvim',
requires = { 'nvim-tree/nvim-web-devicons', opt = true }
}
}
)
--]]

View file

@ -0,0 +1,15 @@
return {
"catppuccin/nvim",
{'folke/tokyonight.nvim',
config = function()
function ColorMyPencils(color)
color = color or "tokyonight"
vim.cmd.colorscheme(color)
--vim.api.nvim_set_hl(0,"Normal", {bg = "none"})
--vim.api.nvim_set_hl(0,"NormalFloat", {bg = "none"})
end
ColorMyPencils("tokyonight-night")
end}
}

View file

@ -0,0 +1,6 @@
return {
'tpope/vim-fugitive',
config = function()
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
end
}

View file

@ -0,0 +1,23 @@
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():append() end)
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-t>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-n>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-s>", function() harpoon:list():select(4) end)
-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set("n", "<C-S-P>", function() harpoon:list():prev() end)
vim.keymap.set("n", "<C-S-N>", function() harpoon:list():next() end)
end
}

View file

@ -0,0 +1,16 @@
return {
{'nvim-lua/plenary.nvim',
name = "plenary" },
'Shougo/context_filetype.vim',
{
'windwp/nvim-autopairs',
config = function()
require("nvim-autopairs").setup {}
end
},
'nvim-treesitter/playground',
'mbbill/undotree',
}

View file

@ -0,0 +1,161 @@
return {
'neovim/nvim-lspconfig',
dependencies = {
'williamboman/mason-lspconfig.nvim',
"williamboman/mason.nvim",
'neovim/nvim-lspconfig',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
'micangl/cmp-vimtex',
'hrsh7th/nvim-cmp',
'windwp/nvim-autopairs',
{
'L3MON4D3/LuaSnip',
build = "make install_jsregexp",
dependencies = {
'rafamadriz/friendly-snippets'
},
},
'j-hui/fidget.nvim',
},
config = function()
require('fidget').setup({})
require("nvim-autopairs").setup({})
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = {
'clangd',
'lua_ls',
'rust_analyzer',
'jedi_language_server',
'texlab',
},
handlers = {
function(server_name)
local cmp_nvim_lsp = require("cmp_nvim_lsp")
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
cmp_nvim_lsp.default_capabilities())
require("lspconfig")[server_name].setup {
capabilities = capabilities
}
require("lspconfig").lua_ls.setup({
settings = {
Lua = {
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' },
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME
}
}
}
}
})
end,
}
})
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local cmp = require('cmp')
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local luasnip = require('luasnip')
-- require("luasnip.loaders.from_vscode").lazy_load()
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
local cmp_select = { behaviour = cmp.SelectBehavior.Insert }
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),
['<CR>'] = cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace, }),
['<C-Space>'] = cmp.mapping.complete(),
['<C-u>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
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 = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vimtex' },
{ name = 'luasnip' }, -- For luasnip users.
}, {
{ name = 'buffer' },
})
})
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
vim.diagnostic.config({
update_in_insert = true,
float = {
focusable = false,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
}
})
end
}

View file

@ -0,0 +1,97 @@
return {
{'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons',lazy=true},
config = function()
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
--component_separators = { left = '', right = ''},
--section_separators = { left = '', right = ''},
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {"require'lsp-status'.status()",'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {"require'lsp-status'.status()", 'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}
end
},
-- Webicons config
--
{'nvim-web-devicons',
config = function()
require('nvim-web-devicons').setup {
-- your personnal icons can go here (to override)
-- you can specify color or cterm_color instead of specifying both of them
-- DevIcon will be appended to `name`
override = {
zsh = {
icon = "",
color = "#428850",
cterm_color = "65",
name = "Zsh"
}
};
-- globally enable different highlight colors per icon (default to true)
-- if set to false all icons will have the default icon's color
color_icons = true;
-- globally enable default icons (default to false)
-- will get overriden by `get_icons` option
default = true;
-- globally enable "strict" selection of icons - icon will be looked up in
-- different tables, first by filename, and if not found by extension; this
-- prevents cases when file doesn't have any extension but still gets some icon
-- because its name happened to match some extension (default to false)
strict = true;
-- same as `override` but specifically for overrides by filename
-- takes effect when `strict` is true
override_by_filename = {
[".gitignore"] = {
icon = "",
color = "#f1502f",
name = "Gitignore"
}
};
-- same as `override` but specifically for overrides by extension
-- takes effect when `strict` is true
override_by_extension = {
["log"] = {
icon = "",
color = "#81e043",
name = "Log"
}
};
}
end},
}

View file

@ -0,0 +1,15 @@
return {
"danymat/neogen",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"L3MON4D3/LuaSnip",
},
config = function ()
local neogen = require("neogen")
neogen.setup({
snippet_engine = "luasnip"
})
vim.keymap.set("n", "<leader>nf", function() neogen.generate({type = "func"}) end)
vim.keymap.set("n", "<leader>nc", function() neogen.generate({type = "class"}) end)
end,
}

View file

@ -0,0 +1,16 @@
return {
'L3MON4D3/LuaSnip',
build = "make install_jsregexp",
dependencies = {
'rafamadriz/friendly-snippets'
},
config = function ()
ls = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip").filetype_extend("python", { "pydoc" })
require("luasnip").filetype_extend("rust", { "rustdoc" })
require("luasnip").filetype_extend("c", { "cdoc" })
require("luasnip").filetype_extend("cpp", { "cppdoc" })
end
}

View file

@ -0,0 +1,16 @@
return {
'nvim-telescope/telescope.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'BurntSushi/ripgrep',},
config = function()
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>ps', function()
builtin.grep_string({search = vim.fn.input("Grep > ")});
end)
end
}

View file

@ -0,0 +1,25 @@
return {
'nvim-treesitter/nvim-treesitter',
--build = ":TSUpdate",
config = function()
require('nvim-treesitter.configs').setup({
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = {"javascript","typescript","python","rust","c", "lua", "vim", "vimdoc", "query","doxygen" },
-- 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 = {
enable = true,
additional_vim_regex_highlighting = false,
},
})
end}

View file

@ -0,0 +1,16 @@
return {
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local trouble = require("trouble")
vim.keymap.set("n","<leader>tt", function ()
trouble.toggle()
end)
vim.keymap.set("n","]d", function ()
trouble.next({skip_groups = true, jump = true})
end)
vim.keymap.set("n","[d", function ()
trouble.previous({skip_groups = true, jump = true})
end)
end
}

View file

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

View file

@ -0,0 +1,7 @@
return {
'lervag/vimtex',
config = function()
vim.g.vimtex_view_method = 'zathura'
vim.conceallevel="0"
vim.g.tex_conceal="0"
end }

48
lua/technoduck/remap.lua Normal file
View file

@ -0,0 +1,48 @@
vim.g.mapleader = ","
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("n", "<leader>tt", vim.cmd.terminal)
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "NzzzV")
vim.keymap.set("x", "<leader>p", "\"_dP")
vim.keymap.set("n", "<leader>f", function()
vim.lsp.buf.format()
end)
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
vim.keymap.set("n","<leader>x","<cmd>!chmod +x %<CR>", {silent = true})
--local ls = require('luasnip')
--vim.keymap.set({"i"}, "<C-K>", function() ls.expand() end, {silent = true})
--vim.keymap.set({"i", "s"}, "<C-L>", function() ls.jump( 1) end, {silent = true})
--vim.keymap.set({"i", "s"}, "<C-J>", 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})
vim.cmd('cnoreabbrev W! w!')
vim.cmd('cnoreabbrev Q! q!')
vim.cmd('cnoreabbrev Qall! qall!')
vim.cmd('cnoreabbrev Wq wq')
vim.cmd('cnoreabbrev Wa wa')
vim.cmd('cnoreabbrev wQ wq')
vim.cmd('cnoreabbrev WQ wq')
vim.cmd('cnoreabbrev W w')
vim.cmd('cnoreabbrev Q q')
vim.cmd('cnoreabbrev Qall qall')

33
lua/technoduck/set.lua Normal file
View file

@ -0,0 +1,33 @@
--vim.opt.guicursor = ""
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.clipboard = "unnamedplus,unnamed"
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.updatetime = 50
--vim.opt.colorcolumn = "100"