neovim 2: electric boogaloo
This commit is contained in:
11
nvim/.config/nvim/lua/vxclutch/compile.lua
Normal file
11
nvim/.config/nvim/lua/vxclutch/compile.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
"ej-shafran/compile-mode.nvim",
|
||||
branch = "nightly",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
config = function()
|
||||
---@type CompileModeOpts
|
||||
vim.g.compile_mode = {}
|
||||
end,
|
||||
}
|
||||
3
nvim/.config/nvim/lua/vxclutch/init.lua
Normal file
3
nvim/.config/nvim/lua/vxclutch/init.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
require("vxclutch.set")
|
||||
require("vxclutch.remap")
|
||||
require("vxclutch.lazy_init")
|
||||
32
nvim/.config/nvim/lua/vxclutch/lazy/appearance.lua
Normal file
32
nvim/.config/nvim/lua/vxclutch/lazy/appearance.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
requires = { "kyazdani42/nvim-web-devicons" },
|
||||
dependencies = {
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
},
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "ayu_mirage",
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {
|
||||
function()
|
||||
return "[" .. vim.bo.filetype .. "]"
|
||||
end,
|
||||
},
|
||||
},
|
||||
})
|
||||
require("colorizer").setup({
|
||||
"*",
|
||||
css = { rgb_fn = true },
|
||||
})
|
||||
end,
|
||||
}
|
||||
30
nvim/.config/nvim/lua/vxclutch/lazy/format.lua
Normal file
30
nvim/.config/nvim/lua/vxclutch/lazy/format.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
dependencies = {
|
||||
"tpope/vim-sleuth"
|
||||
},
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>f",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_fallback = true })
|
||||
end,
|
||||
mode = "",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
},
|
||||
},
|
||||
}
|
||||
12
nvim/.config/nvim/lua/vxclutch/lazy/gitsigns.lua
Normal file
12
nvim/.config/nvim/lua/vxclutch/lazy/gitsigns.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
},
|
||||
},
|
||||
}
|
||||
40
nvim/.config/nvim/lua/vxclutch/lazy/harpoon.lua
Normal file
40
nvim/.config/nvim/lua/vxclutch/lazy/harpoon.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
return {
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
local harpoon = require("harpoon")
|
||||
|
||||
-- REQUIRED
|
||||
harpoon:setup()
|
||||
-- REQUIRED
|
||||
|
||||
vim.keymap.set("n", "<leader>a", function()
|
||||
harpoon:list():add()
|
||||
end, { desc = "Append to harpoon" })
|
||||
vim.keymap.set("n", "<C-e>", function()
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end, { desc = "Quick Menu" })
|
||||
|
||||
vim.keymap.set("n", "<C-w>", function()
|
||||
harpoon:list():select(1)
|
||||
end, { desc = "Select First" })
|
||||
vim.keymap.set("n", "<C-t>", function()
|
||||
harpoon:list():select(2)
|
||||
end, { desc = "Select Second" })
|
||||
vim.keymap.set("n", "<C-n>", function()
|
||||
harpoon:list():select(3)
|
||||
end, { desc = "Select Third" })
|
||||
vim.keymap.set("n", "<C-s>", function()
|
||||
harpoon:list():select(4)
|
||||
end, { desc = "Select Fourth" })
|
||||
|
||||
-- Toggle previous & next buffers stored within Harpoon list
|
||||
vim.keymap.set("n", "<C-S-P>", function()
|
||||
harpoon:list():prev()
|
||||
end, { desc = "Select Previous" })
|
||||
vim.keymap.set("n", "<C-S-N>", function()
|
||||
harpoon:list():next()
|
||||
end, { desc = "Select Next" })
|
||||
end,
|
||||
}
|
||||
95
nvim/.config/nvim/lua/vxclutch/lazy/lsp.lua
Normal file
95
nvim/.config/nvim/lua/vxclutch/lazy/lsp.lua
Normal file
@@ -0,0 +1,95 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"stevearc/conform.nvim",
|
||||
"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()
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {},
|
||||
})
|
||||
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",
|
||||
"clangd",
|
||||
"gopls",
|
||||
},
|
||||
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 = { "bit", "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,
|
||||
}
|
||||
19
nvim/.config/nvim/lua/vxclutch/lazy/oil.lua
Normal file
19
nvim/.config/nvim/lua/vxclutch/lazy/oil.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
"stevearc/oil.nvim",
|
||||
opts = {},
|
||||
config = function()
|
||||
require("oil").setup({
|
||||
default_file_explorer = true,
|
||||
delete_to_trash = true,
|
||||
skip_confirm_for_simple_edits = true,
|
||||
view_options = {
|
||||
show_hidden = true,
|
||||
natural_order = true,
|
||||
is_always_hidden = function(name, _)
|
||||
return name == ".." or name == ".git"
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
}
|
||||
36
nvim/.config/nvim/lua/vxclutch/lazy/telescope.lua
Normal file
36
nvim/.config/nvim/lua/vxclutch/lazy/telescope.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
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>sf", 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)
|
||||
vim.keymap.set("n", "<leader>vh", builtin.help_tags, {})
|
||||
vim.keymap.set("n", "<leader><leader>", function()
|
||||
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
}))
|
||||
end, { desc = "[/] Fuzzily search in current buffer" })
|
||||
vim.keymap.set("n", "<leader>s/", function()
|
||||
builtin.live_grep({
|
||||
grep_open_files = true,
|
||||
prompt_title = "Live Grep in Open Files",
|
||||
})
|
||||
end, { desc = "[S]earch [/] in Open Files" })
|
||||
vim.keymap.set("n", "<leader>sn", function()
|
||||
builtin.find_files({ cwd = vim.fn.stdpath("config") })
|
||||
end, { desc = "[S]earch [N]eovim files" })
|
||||
end,
|
||||
}
|
||||
17
nvim/.config/nvim/lua/vxclutch/lazy_init.lua
Normal file
17
nvim/.config/nvim/lua/vxclutch/lazy_init.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
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 = "vxclutch.lazy",
|
||||
change_detection = { notify = false },
|
||||
})
|
||||
26
nvim/.config/nvim/lua/vxclutch/remap.lua
Normal file
26
nvim/.config/nvim/lua/vxclutch/remap.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
|
||||
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '>-2<CR>gv=gv")
|
||||
vim.keymap.set("n", "-", "<cmd>Oil<CR>", { noremap = true, silent = true, desc = "Open Oil" })
|
||||
|
||||
-- Compile
|
||||
vim.keymap.set("n", "<leader>cc", "<cmd>Compile<CR>", { noremap = true, silent = true, desc = "Compile" })
|
||||
vim.keymap.set("n", "<leader>rc", "<cmd>Recompile<CR>", { noremap = true, silent = true, desc = "Recompile" })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "compilation",
|
||||
callback = function()
|
||||
vim.keymap.set("n", "<C-c>", ":quit<CR>", { buffer = true })
|
||||
end,
|
||||
})
|
||||
|
||||
-- Disable arrow keys in normal mode
|
||||
vim.keymap.set("n", "<left>", '<cmd>echo "Use h to move!!"<CR>')
|
||||
vim.keymap.set("n", "<right>", '<cmd>echo "Use l to move!!"<CR>')
|
||||
vim.keymap.set("n", "<up>", '<cmd>echo "Use k to move!!"<CR>')
|
||||
vim.keymap.set("n", "<down>", '<cmd>echo "Use j to move!!"<CR>')
|
||||
-- Window Controls
|
||||
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
|
||||
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
|
||||
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
|
||||
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
|
||||
31
nvim/.config/nvim/lua/vxclutch/set.lua
Normal file
31
nvim/.config/nvim/lua/vxclutch/set.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
vim.opt.number = true
|
||||
vim.opt.mouse = "a"
|
||||
vim.opt.showmode = false
|
||||
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.inccommand = "split"
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.bo.softtabstop = 2
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.guicursor = ""
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.wrap = false
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.updatetime = 50
|
||||
vim.opt.colorcolumn = "127"
|
||||
29
nvim/.config/nvim/lua/vxclutch/telescope.lua
Normal file
29
nvim/.config/nvim/lua/vxclutch/telescope.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user