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

@ -1,128 +1,128 @@
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
return
return
end
local actions = require "telescope.actions"
local icons = require "chris.icons"
local actions = require("telescope.actions")
local icons = require("chris.icons")
telescope.setup {
defaults = {
telescope.setup({
defaults = {
prompt_prefix = icons.ui.Telescope .. " > ",
selection_caret = "",
path_display = { "smart" },
prompt_prefix = icons.ui.Telescope .. " > ",
selection_caret = "",
path_display = { "smart" },
file_ignore_patterns = {
".git/",
"target/",
"docs/",
"vendor/*",
"%.lock",
"__pycache__/*",
"%.sqlite3",
"%.ipynb",
"node_modules/*",
"%.svg",
"%.otf",
"%.ttf",
"%.webp",
".dart_tool/",
".github/",
".gradle/",
".idea/",
".settings/",
".vscode/",
"__pycache__/",
"build/",
"env/",
"gradle/",
"node_modules/",
"%.pdb",
"%.dll",
"%.class",
"%.exe",
"%.cache",
"%.ico",
"%.pdf",
"%.dylib",
"%.jar",
"%.docx",
"%.met",
"smalljre_*/*",
".vale/",
"%.burp",
"%.mp4",
"%.mkv",
"%.rar",
"%.zip",
"%.7z",
"%.tar",
"%.bz2",
"%.epub",
"%.flac",
"%.tar.gz",
},
file_ignore_patterns = {
".git/",
"target/",
"docs/",
"vendor/*",
"%.lock",
"__pycache__/*",
"%.sqlite3",
"%.ipynb",
"node_modules/*",
"%.svg",
"%.otf",
"%.ttf",
"%.webp",
".dart_tool/",
".github/",
".gradle/",
".idea/",
".settings/",
".vscode/",
"__pycache__/",
"build/",
"env/",
"gradle/",
"node_modules/",
"%.pdb",
"%.dll",
"%.class",
"%.exe",
"%.cache",
"%.ico",
"%.pdf",
"%.dylib",
"%.jar",
"%.docx",
"%.met",
"smalljre_*/*",
".vale/",
"%.burp",
"%.mp4",
"%.mkv",
"%.rar",
"%.zip",
"%.7z",
"%.tar",
"%.bz2",
"%.epub",
"%.flac",
"%.tar.gz",
},
mappings = {
i = {
["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev,
mappings = {
i = {
["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-c>"] = actions.close,
["<C-c>"] = actions.close,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["<CR>"] = actions.select_default,
["<C-s>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<CR>"] = actions.select_default,
["<C-s>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<c-d>"] = require("telescope.actions").delete_buffer,
["<c-d>"] = require("telescope.actions").delete_buffer,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<C-l>"] = actions.complete_tag,
["<C-h>"] = actions.which_key, -- keys from pressing <C-h>
["<esc>"] = actions.close,
},
["<C-l>"] = actions.complete_tag,
["<C-h>"] = actions.which_key, -- keys from pressing <C-h>
["<esc>"] = actions.close,
},
n = {
["<esc>"] = actions.close,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
n = {
["<esc>"] = actions.close,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["j"] = actions.move_selection_next,
["k"] = actions.move_selection_previous,
["H"] = actions.move_to_top,
["M"] = actions.move_to_middle,
["L"] = actions.move_to_bottom,
["q"] = actions.close,
["dd"] = require("telescope.actions").delete_buffer,
["s"] = actions.select_horizontal,
["v"] = actions.select_vertical,
["t"] = actions.select_tab,
["j"] = actions.move_selection_next,
["k"] = actions.move_selection_previous,
["H"] = actions.move_to_top,
["M"] = actions.move_to_middle,
["L"] = actions.move_to_bottom,
["q"] = actions.close,
["dd"] = require("telescope.actions").delete_buffer,
["s"] = actions.select_horizontal,
["v"] = actions.select_vertical,
["t"] = actions.select_tab,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down,
["?"] = actions.which_key,
},
},
},
}
["?"] = actions.which_key,
},
},
},
})

View File

@ -3,114 +3,114 @@
-- or go here and upload the font file: https://mathew-kurian.github.io/CharacterMap/
-- find more here: https://www.nerdfonts.com/cheat-sheet
return {
kind = {
Text = "",
-- Method = "m",
Function = "",
-- Constructor = "",
Method = "",
-- Function = "",
Constructor = "",
Field = "",
-- Variable = "",
Variable = "",
Namespace = "",
Class = "",
Interface = "",
-- Module = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Key = "k",
-- Keyword = "",
Keyword = "",
-- Snippet = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
},
type = {
Array = "",
Number = "",
String = "",
Boolean = "",
Null = "",
Object = "",
},
documents = {
File = "",
Files = "",
Folder = "",
OpenFolder = "",
},
git = {
Add = "",
Mod = "",
Remove = "",
Ignore = "",
Rename = "",
Diff = "",
Repo = "",
Octoface = "",
},
ui = {
ArrowClosed = "",
ArrowOpen = "",
Lock = "",
Circle = "",
BigCircle = "",
BigUnfilledCircle = "",
Close = "",
NewFile = "",
Search = "",
Lightbulb = "",
Project = "",
Dashboard = "",
History = "",
Comment = "",
Bug = "",
Code = "",
Telescope = "",
Gear = "",
Package = "",
List = "",
SignIn = "",
SignOut = "",
Check = "",
Fire = "",
Note = "",
BookMark = "",
Pencil = "",
-- ChevronRight = "",
ChevronRight = ">",
Table = "",
Calendar = "",
CloudDownload = "",
},
diagnostics = {
Error = "",
Warning = "",
Information = "",
Question = "",
Hint = "",
},
misc = {
Robot = "",
Squirrel = "",
Tag = "",
Watch = "",
Smiley = "",
Package = "",
CircuitBoard = "",
},
kind = {
Text = "",
-- Method = "m",
Function = "",
-- Constructor = "",
Method = "",
-- Function = "",
Constructor = "",
Field = "",
-- Variable = "",
Variable = "",
Namespace = "",
Class = "",
Interface = "",
-- Module = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Key = "k",
-- Keyword = "",
Keyword = "",
-- Snippet = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
},
type = {
Array = "",
Number = "",
String = "",
Boolean = "",
Null = "",
Object = "",
},
documents = {
File = "",
Files = "",
Folder = "",
OpenFolder = "",
},
git = {
Add = "",
Mod = "",
Remove = "",
Ignore = "",
Rename = "",
Diff = "",
Repo = "",
Octoface = "",
},
ui = {
ArrowClosed = "",
ArrowOpen = "",
Lock = "",
Circle = "",
BigCircle = "",
BigUnfilledCircle = "",
Close = "",
NewFile = "",
Search = "",
Lightbulb = "",
Project = "",
Dashboard = "",
History = "",
Comment = "",
Bug = "",
Code = "",
Telescope = "",
Gear = "",
Package = "",
List = "",
SignIn = "",
SignOut = "",
Check = "",
Fire = "",
Note = "",
BookMark = "",
Pencil = "",
-- ChevronRight = "",
ChevronRight = ">",
Table = "",
Calendar = "",
CloudDownload = "",
},
diagnostics = {
Error = "",
Warning = "",
Information = "",
Question = "",
Hint = "",
},
misc = {
Robot = "",
Squirrel = "",
Tag = "",
Watch = "",
Smiley = "",
Package = "",
CircuitBoard = "",
},
}

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
vim.notify("Colorscheme " .. colorscheme .. " not found!")
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 = "" },
@ -18,19 +18,19 @@ return {
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
end
-- stylua: ignore start
map("n", "]h", gs.prev_hunk, "Next Hunk")
map("n", "[h", gs.next_hunk, "Prev Hunk")
map({ "n", "v" }, "<leader>ghs", ":Gitsigns stage_hunk<CR>", "Stage Hunk")
map({ "n", "v" }, "<leader>ghr", ":Gitsigns reset_hunk<CR>", "Reset Hunk")
map("n", "<leader>ghS", gs.stage_buffer, "Stage Buffer")
map("n", "<leader>ghu", gs.undo_stage_hunk, "Undo Stage Hunk")
map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer")
map("n", "<leader>ghp", gs.preview_hunk, "Preview Hunk")
map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
map("n", "<leader>ghd", gs.diffthis, "Diff This")
map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~")
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk")
-- stylua: ignore start
map("n", "]h", gs.prev_hunk, "Next Hunk")
map("n", "[h", gs.next_hunk, "Prev Hunk")
map({ "n", "v" }, "<leader>ghs", ":Gitsigns stage_hunk<CR>", "Stage Hunk")
map({ "n", "v" }, "<leader>ghr", ":Gitsigns reset_hunk<CR>", "Reset Hunk")
map("n", "<leader>ghS", gs.stage_buffer, "Stage Buffer")
map("n", "<leader>ghu", gs.undo_stage_hunk, "Undo Stage Hunk")
map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer")
map("n", "<leader>ghp", gs.preview_hunk, "Preview Hunk")
map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
map("n", "<leader>ghd", gs.diffthis, "Diff This")
map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~")
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk")
end,
},
},

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,32 +65,30 @@ return {
{ "<leader>bl", "<cmd>CybuNext<cr>", desc = "Next Buffer" },
{ "<leader>bh", "<cmd>CybuPrev<cr>", desc = "Prev Buffer" },
},
config = function()
require("cybu").setup({
position = {
relative_to = "win", -- win, editor, cursor
anchor = "topright", -- topleft, topcenter, topright,
-- centerleft, center, centerright,
-- bottomleft, bottomcenter, bottomright
-- vertical_offset = 10, -- vertical offset from anchor in lines
-- horizontal_offset = 0, -- vertical offset from anchor in columns
-- max_win_height = 5, -- height of cybu window in lines
-- max_win_width = 0.5, -- integer for absolute in columns
-- float for relative to win/editor width
opts = {
position = {
relative_to = "win", -- win, editor, cursor
anchor = "topright", -- topleft, topcenter, topright,
-- centerleft, center, centerright,
-- bottomleft, bottomcenter, bottomright
-- vertical_offset = 10, -- vertical offset from anchor in lines
-- horizontal_offset = 0, -- vertical offset from anchor in columns
-- max_win_height = 5, -- height of cybu window in lines
-- max_win_width = 0.5, -- integer for absolute in columns
-- float for relative to win/editor width
},
display_time = 1750, -- time the cybu window is displayed
style = {
separator = " ", -- string used as separator
prefix = "", -- string used as prefix for truncated paths
padding = 1, -- left & right padding in number of spaces
hide_buffer_id = true,
devicons = {
enabled = true, -- enable or disable web dev icons
colored = true, -- enable color for web dev icons
},
display_time = 1750, -- time the cybu window is displayed
style = {
separator = " ", -- string used as separator
prefix = "", -- string used as prefix for truncated paths
padding = 1, -- left & right padding in number of spaces
hide_buffer_id = true,
devicons = {
enabled = true, -- enable or disable web dev icons
colored = true, -- enable color for web dev icons
},
},
})
end,
},
},
},
{
"mbbill/undotree",

View File

@ -1,66 +1,46 @@
return {
{
"folke/which-key.nvim",
event = "BufEnter",
config = function()
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
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?
},
},
key_labels = {
-- override the label used to display some keys. It doesn't effect WK in any other way.
["<leader>"] = "SPC",
},
icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
separator = "", -- symbol used between a key and it's label
group = "+", -- symbol prepended to a group
},
popup_mappings = {
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,
-- },
-- 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
-- },
},
config = function(_, opts)
local whichkey = require("which-key")
whichkey.setup({
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
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.
["<leader>"] = "SPC",
},
icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
separator = "", -- symbol used between a key and it's label
group = "+", -- symbol prepended to a group
},
popup_mappings = {
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,
},
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" },
},
})
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" },