my ripoff of LazyVim/ upgrade to lazy.nvim is complete... for now

This commit is contained in:
Solomon Laing 2023-01-11 22:26:46 +10:30
parent de19c7bc39
commit 1a984d2e0f
11 changed files with 322 additions and 350 deletions

View File

@ -3,10 +3,10 @@ if not status_ok then
return
end
local actions = require "telescope.actions"
local icons = require "chris.icons"
local actions = require("telescope.actions")
local icons = require("chris.icons")
telescope.setup {
telescope.setup({
defaults = {
prompt_prefix = icons.ui.Telescope .. " > ",
@ -125,4 +125,4 @@ telescope.setup {
},
},
},
}
})

View File

@ -2,8 +2,6 @@ local opts = { noremap = true, silent = true }
local map = vim.api.nvim_set_keymap
map("n", "<Space>", "", opts)
-- better up/down
map("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
map("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })

View File

@ -1,6 +1,3 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
local options = {
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- gives nvim access to clipboard

View File

@ -17,28 +17,23 @@ require("lazy").setup({
spec = "lazyvim.plugins",
defaults = { lazy = true, version = "*" },
checker = { enabled = true },
performance = {
rtp = {
disabled_plugins = {
"gzip",
"matchit",
"matchparen",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})
vim.keymap.set("n", "<leader>L", "<cmd>:Lazy<cr>")
-- map leader and register keymap for Lazy.
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.api.nvim_set_keymap("n", "<leader>L", "<cmd>:Lazy<cr>", { desc = "Lazy GUI" })
local colorscheme = "base16-gruvbox-dark-medium"
-- This might not be best, but it allows for easy resetting
ColorMe = function()
local colorscheme = "gruvbox-material"
local okay, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
local okay, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
if not okay then
if not okay then
vim.notify("Colorscheme " .. colorscheme .. " not found!")
vim.cmd("colorsheme habamax")
end
end
ColorMe()

View File

@ -29,8 +29,6 @@ return {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
-- fallback()
end
end, {
"i",
@ -39,8 +37,6 @@ return {
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
-- fallback()
end
end, {
"i",

View File

@ -2,7 +2,7 @@ return {
{
"lewis6991/gitsigns.nvim",
event = "BufReadPre",
opns = {
opts = {
signs = {
add = { text = "" },
change = { text = "" },

View File

@ -17,7 +17,7 @@ return {
for name, section in pairs(sections) do
local left = name:sub(9, 10) < "x"
for pos = 1, name ~= "lualine_z" and #section or #section - 1 do
table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
table.insert(section, pos * 2, { color = { fg = colors.white, bg = colors.white } })
end
for id, comp in ipairs(section) do
if type(comp) ~= "table" then
@ -66,13 +66,13 @@ return {
"diagnostics",
source = { "nvim" },
sections = { "error" },
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
-- diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
},
{
"diagnostics",
source = { "nvim" },
sections = { "warn" },
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
-- diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
},
{ "filename", file_status = false, path = 1 },
{ modified, color = { bg = colors.red } },
@ -106,7 +106,7 @@ return {
},
},
lualine_x = {},
-- lualine_y = { search_result, 'filetype' },
-- lualine_y = { search_result, "filetype" },
lualine_y = { "filetype " },
lualine_z = { "%l:%c", "%p%%/%L" },
}),

View File

@ -3,7 +3,7 @@ local util = require("lazyvim.functions")
return {
{
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
event = "VeryLazy",
keys = {
{ "<leader>/", util.telescope("live_grep"), desc = "Find in Files (Grep)" },
{ "<leader><space>", util.telescope("find_files"), desc = "Find Files (root dir)" },
@ -57,6 +57,12 @@ return {
selection_caret = "",
mappings = {
i = {
["<C-j>"] = function(...)
return require("telescope.actions").move_selection_next(...)
end,
["<C-k>"] = function(...)
require("telescope.actions").move_selection_previous(...)
end,
["<c-t>"] = function(...)
return require("trouble.providers.telescope").open_with_trouble(...)
end,

View File

@ -65,8 +65,7 @@ return {
{ "<leader>bl", "<cmd>CybuNext<cr>", desc = "Next Buffer" },
{ "<leader>bh", "<cmd>CybuPrev<cr>", desc = "Prev Buffer" },
},
config = function()
require("cybu").setup({
opts = {
position = {
relative_to = "win", -- win, editor, cursor
anchor = "topright", -- topleft, topcenter, topright,
@ -89,8 +88,7 @@ return {
colored = true, -- enable color for web dev icons
},
},
})
end,
},
},
{
"mbbill/undotree",

View File

@ -1,28 +1,15 @@
return {
{
"folke/which-key.nvim",
event = "BufEnter",
config = function()
local whichkey = require("which-key")
whichkey.setup({
event = "VeryLazy",
opts = {
plugins = {
marks = true, -- shows a list of your marks on ' and `
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
-- marks = true, -- shows a list of your marks on ' and `
-- registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
spelling = {
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
suggestions = 20, -- how many suggestions should be shown in the list?
},
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
-- No actual key bindings are created
presets = {
operators = true, -- adds help for operators like d, y, ... and registers them for motion / text object completion
motions = true, -- adds help for motions
text_objects = true, -- help for text objects triggered after entering an operator
windows = true, -- default bindings on <c-w>
nav = true, -- misc bindings to work with windows
z = true, -- bindings for folds, spelling and others prefixed with z
g = true, -- bindings for prefixed with g
},
},
key_labels = {
-- override the label used to display some keys. It doesn't effect WK in any other way.
@ -37,30 +24,23 @@ return {
scroll_down = "<C-d>", -- binding to scroll down inside the popup
scroll_up = "<C-u>", -- binding to scroll up inside the popup
},
window = {
border = "rounded", -- none, single, double, shadow
position = "bottom", -- bottom, top
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
winblend = 0,
-- window = {
-- border = "rounded", -- none, single, double, shadow
-- position = "bottom", -- bottom, top
-- margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
-- padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
-- winblend = 0,
-- },
-- layout = {
-- height = { min = 4, max = 25 }, -- min and max height of the columns
-- width = { min = 20, max = 50 }, -- min and max width of the columns
-- spacing = 3, -- spacing between columns
-- align = "center", -- align columns left, center or right
-- },
},
layout = {
height = { min = 4, max = 25 }, -- min and max height of the columns
width = { min = 20, max = 50 }, -- min and max width of the columns
spacing = 3, -- spacing between columns
align = "center", -- align columns left, center or right
},
ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
show_help = false, -- show help message on the command line when the popup is visible
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for key maps that start with a native binding
-- most people should not need to change this
i = { "j", "k" },
v = { "j", "k" },
},
})
config = function(_, opts)
local whichkey = require("which-key")
whichkey.setup(opts)
local leader_opts = {
mode = { "n", "v" }, -- NORMAL/VISUAL mode
@ -75,6 +55,8 @@ return {
mode = { "n", "v" },
["g"] = { name = "+goto" },
["m"] = { name = "+harpoon" },
["]"] = { name = "+next" },
["["] = { name = "+previous" },
})
local leader_mappings = {
@ -89,8 +71,8 @@ return {
N = { name = "+noice" },
o = { name = "+option" },
H = { "<cmd>split<cr>", "split" },
V = { "<cmd>vsplit<cr>", "vsplit" },
H = { "<cmd>split<cr>", "Split" },
V = { "<cmd>vsplit<cr>", "V Split" },
n = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
P = { "<cmd>!opout %<cr><cr>", "Preview Document" },
q = { '<cmd>lua require("lazyvim.functions").smart_quit()<CR>', "Quit" },