nvim: refactors and many new plugins

This commit is contained in:
Cynthia Foxwell 2023-06-12 22:24:08 -06:00
parent 5e0e4b3b26
commit e76fd2b7e3
14 changed files with 339 additions and 76 deletions

View file

@ -49,6 +49,8 @@ barbar.setup({
},
sidebar_filetypes = {
NvimTree = true,
undotree = {text = "undotree"},
undotree = true,
packer = true,
tsplayground = true,
},
})

View file

@ -1,4 +1,97 @@
vim.cmd("colorscheme lena")
vim.o.termguicolors = 1
vim.g.mode = "focus"
vim.cmd("colorscheme amora")
local function c(name)
return vim.g["amora#palette"][name]
end
local function h(scope, fg, bg, attr_list, special)
bg = bg or {"NONE", "NONE"}
attr_list = attr_list or {"NONE"}
local attrs = table.concat(attr_list, ",")
special = special or fg and fg or {"NONE", "NONE"}
local cmd = "highlight %s "
if fg then
cmd = cmd .. "guifg=%s ctermfg=%s "
end
cmd = cmd .. "guibg=%s ctermbg=%s "
cmd = cmd .. "gui=%s cterm=%s "
cmd = cmd .. "guisp=%s"
if fg then
cmd = cmd:format(scope, fg[1], fg[2], bg[1], bg[2], attrs, attrs, special[1])
else
cmd = cmd:format(scope, bg[1], bg[2], attrs, attrs, special[1])
end
vim.cmd(cmd)
end
vim.cmd("hi! link IndentBlanklineIndent1 AmoraYellow")
vim.cmd("hi! link IndentBlanklineIndent2 AmoraGreen")
vim.cmd("hi! link IndentBlanklineIndent3 AmoraPink")
vim.cmd("hi! link IndentBlanklineIndent4 AmoraPurple")
vim.cmd("hi! link IndentBlanklineChar NonText")
vim.cmd("hi! link IndentBlanklineSpaceChar NonText")
vim.cmd("hi! link IndentBlanklineSpaceCharBlankline NonText")
vim.cmd("hi! clear IndentBlanklineContextStart")
h("IndentBlanklineContextChar", c("selection"))
vim.cmd("hi! link SignColumn LineNr")
vim.cmd("hi! link Hlargs AmoraYellowItalic")
vim.cmd("hi! link Function AmoraCyan")
vim.cmd("hi! link Statement AmoraRed")
vim.cmd("hi! link Conditional AmoraRed")
vim.cmd("hi! link Repeat AmoraRed")
vim.cmd("hi! link Label AmoraRed")
vim.cmd("hi! link Keyword AmoraRed")
vim.cmd("hi! link Exception AmoraRed")
vim.cmd("hi! link Operator AmoraRed")
vim.cmd("hi! link javaScriptRegexpString AmoraYellow")
vim.cmd("hi! link CmpItemKindDefault AmoraPink")
vim.cmd("hi! link LspDiagnosticsDefaultWarning AmoraYellow")
vim.cmd("hi! link DiagnosticHint AmoraCyan")
vim.cmd("hi! link DiagnosticError AmoraRed")
vim.cmd("hi! link DiagnosticWarn AmoraYellow")
vim.cmd("hi! link DiagnosticInfo AmoraFg")
h("Normal", c("fg"), c("bg"))
h("NonText", c("bglighter"))
h("IncSearch", c("bg"), c("yellow"))
h("WarningMsg", c("bg"), c("yellow"))
h("ErrorMsg", c("fg"), c("red"))
h("ExtraWhitespace", nil, c("red"))
h("ColorColumn", c("yellow"), c("bglighter"))
h("MatchParen", c("selection"), nil, {"underline"})
h("BufferCurrent", c("pink"))
h("BufferCurrentIndex", c("pink"))
h("BufferCurrentMod", c("yellow"))
h("BufferCurrentSign", c("pink"))
h("BufferCurrentTarget", c("pink"))
h("BufferVisible", c("fg"))
h("BufferVisibleIndex", c("fg"))
h("BufferVisibleMod", c("selection"))
h("BufferVisibleSign", c("fg"))
h("BufferVisibleTarget", c("fg"))
h("BufferInactive", c("comment"), c("bgdark"))
h("BufferInactiveIndex", c("pink"), c("bgdark"))
h("BufferInactiveMod", c("comment"), c("bgdark"))
h("BufferInactiveSign", c("comment"), c("bgdark"))
h("BufferInactiveTarget", c("green"), c("bgdark"))
h("BufferTabpages", c("fg"), c("bgdark"))
h("BufferTabpageFill", c("fg"), c("bgdark"))
h("BufferOffset", c("bg"), c("bg"))
h("WilderAccent", c("pink"))
h("WilderSelectedAccent", c("fg"), c("selection"))
--[[vim.cmd("colorscheme lena")
vim.cmd("highlight IndentBlanklineIndent1 ctermfg=11 cterm=nocombine")
vim.cmd("highlight IndentBlanklineIndent2 ctermfg=10 cterm=nocombine")
@ -39,4 +132,4 @@ vim.cmd("hi! link SignColumn LineNr")
vim.cmd("hi DiagnosticHint ctermfg=6")
vim.cmd("hi DiagnosticError ctermfg=1")
vim.cmd("hi DiagnosticWarn ctermfg=3")
vim.cmd("hi DiagnosticInfo ctermfg=7")
vim.cmd("hi DiagnosticInfo ctermfg=7")--]]

View file

@ -1 +0,0 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)

View file

@ -56,3 +56,7 @@ lsp.setup()
vim.diagnostic.config({
virtual_text = true
})
require("lsp_signature").setup({
hint_prefix = "",
})

View file

@ -1,4 +1,4 @@
local theme = require("lualine.themes.16color")
--[[local theme = require("lualine.themes.16color")
theme.normal.a.bg = 7
theme.visual.a.bg = 4
theme.command = {
@ -7,8 +7,72 @@ theme.command = {
theme.terminal = {
a = {bg = 5},
}
theme.normal.c.bg = "none"
theme.normal.c.bg = "none"--]]
local function c(name)
return vim.g["amora#palette"][name][1]
end
local theme = {
normal = {
a = {
fg = c("bg"),
bg = c("fg"),
},
b = {
fg = c("fg"),
bg = c("bglighter"),
},
c = {
fg = c("fg"),
bg = c("bg"),
},
},
insert = {
a = {
fg = c("bg"),
bg = c("green"),
},
},
visual = {
a = {
fg = c("bg"),
bg = c("purple"),
},
},
replace = {
a = {
fg = c("bg"),
bg = c("red"),
},
},
command = {
a = {
fg = c("bg"),
bg = c("cyan"),
},
},
terminal = {
a = {
fg = c("bg"),
bg = c("pink"),
},
},
inactive = {
a = {
fg = c("fg"),
bg = c("bgdarker"),
},
b = {
fg = c("fg"),
bg = c("bgdarker"),
},
c = {
fg = c("fg"),
bg = c("bgdarker"),
},
},
}
require("lualine").setup({
options = {
icons_enabled = false,
@ -16,16 +80,13 @@ require("lualine").setup({
section_separators = "",
component_separators = "",
disabled_filetypes = {
statusline = {"NvimTree", "undotree", "diff"},
statusline = {"NvimTree", "undotree", "diff", "tsplayground", "packer"},
},
},
sections = {
lualine_a = {
{
"mode",
color = {
fg = 0,
},
fmt = function(str)
return str:sub(1,3)
end
@ -35,26 +96,47 @@ require("lualine").setup({
{
"branch",
color = {
bg = 5,
fg = 0,
bg = c("pink"),
fg = c("bgdarker"),
},
},
{
"diff",
diff_color = {
added = {bg = 8, fg = 2},
modified = {bg = 8, fg = 3},
removed = {bg = 8, fg = 1},
added = {
bg = c("bgdark"),
fg = c("green"),
},
modified = {
bg = c("bgdark"),
fg = c("yellow"),
},
removed = {
bg = c("bgdark"),
fg = c("red"),
},
},
},
{
"diagnostics",
sections = {"error", "warn", "info", "hint"},
diagnostics_color = {
error = {bg = 0, fg = 1},
warn = {bg = 0, fg = 3},
info = {bg = 0, fg = 7},
hint = {bg = 0, fg = 6},
error = {
bg = c("bgdark"),
fg = c("red"),
},
warn = {
bg = c("bgdark"),
fg = c("yellow"),
},
info = {
bg = c("bgdark"),
fg = c("fg"),
},
hint = {
bg = c("bgdark"),
fg = c("cyan"),
},
},
},
},
@ -62,8 +144,8 @@ require("lualine").setup({
{
"filename",
color = {
bg = "none",
fg = 5,
bg = c("bg"),
fg = c("pink"),
},
},
},
@ -71,8 +153,8 @@ require("lualine").setup({
{
"location",
color = {
bg = 4,
fg = 0,
bg = c("purple"),
fg = c("bg"),
},
},
},
@ -80,19 +162,19 @@ require("lualine").setup({
{
"encoding",
color = {
bg = 3,
fg = 0,
bg = c("yellow"),
fg = c("bg"),
},
padding = {
left = 1,
right = 0,
},
},
{
"fileformat",
color = {
bg = 3,
fg = 0,
},
padding = {
left = 0,
right = 1,
bg = c("yellow"),
fg = c("bg"),
},
},
},
@ -100,8 +182,8 @@ require("lualine").setup({
{
"filetype",
color = {
bg = 7,
fg = 0,
bg = c("fg"),
fg = c("bg"),
},
},
},

View file

@ -1 +0,0 @@
vim.g.presence_buttons = false

View file

@ -36,16 +36,10 @@ prettier.setup({
bin = "prettier",
filetypes = {
"css",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"less",
"markdown",
"scss",
"typescript",
"typescriptreact",
"yaml",
},
})

View file

@ -5,7 +5,7 @@ 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>ps', builtin.live_grep)
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", builtin.find_files)
vim.keymap.set("n", "<leader>fg", builtin.git_files)
vim.keymap.set("n", "<leader>fs", builtin.live_grep)

View file

@ -9,6 +9,7 @@ require("nvim-tree").setup({
enable = true,
},
icons = {
git_placement = "after",
symlink_arrow = " -> ",
show = {
file = false,
@ -24,8 +25,8 @@ require("nvim-tree").setup({
staged = "S",
unmerged = "M",
renamed = "R",
untracked = "+",
deleted = "-",
untracked = "A",
deleted = "D",
ignored = "I",
},
},

View file

@ -18,5 +18,11 @@ require("nvim-treesitter.configs").setup({
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
playground = {
enable = true,
},
})
require("treesitter-context").setup()
require("nvim-ts-autotag").setup()
require("hlargs").setup()

View file

@ -1 +0,0 @@
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)

View file

@ -1,4 +0,0 @@
vim.g.better_whitespace_enable = true
vim.g.strip_whitespace_on_save = true
vim.cmd("hi ExtraWhitespace ctermbg=9")

View file

@ -5,21 +5,22 @@ local packer = require("packer")
return packer.startup(function(use)
use("wbthomason/packer.nvim")
use({
"nvim-telescope/telescope.nvim",
tag = "0.1.1",
requires = {
{"nvim-lua/plenary.nvim"},
},
})
-- {{{ color scheme
use("owozsh/amora")
-- }}}
-- {{{ treesitter
use(
"nvim-treesitter/nvim-treesitter",
{run = ":TSUpdate"}
)
use("nvim-treesitter/playground")
use("nvim-treesitter/nvim-treesitter-context")
use("mbbill/undotree")
use("tpope/vim-fugitive")
use("windwp/nvim-ts-autotag")
use("m-demare/hlargs.nvim")
-- }}}
-- {{{ lsp
use({
"VonHeikemen/lsp-zero.nvim",
branch = "v2.x",
@ -40,17 +41,100 @@ return packer.startup(function(use)
{"L3MON4D3/LuaSnip"}, -- Required
},
})
use("lukas-reineke/indent-blankline.nvim")
use("romgrk/barbar.nvim")
use("ntpeters/vim-better-whitespace")
use("nvim-tree/nvim-tree.lua")
use("andweeb/presence.nvim")
use("jose-elias-alvarez/null-ls.nvim")
use("MunifTanjim/prettier.nvim")
use("ray-x/lsp_signature.nvim")
-- }}}
-- {{{ misc
use({
"tpope/vim-fugitive",
config = function()
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
end
})
use("lukas-reineke/indent-blankline.nvim")
use({
"ntpeters/vim-better-whitespace",
config = function()
vim.g.better_whitespace_enable = true
vim.g.strip_whitespace_on_save = true
end
})
use({
"andweeb/presence.nvim",
config = function()
vim.g.presence_buttons = false
end
})
use({
"NvChad/nvim-colorizer.lua",
config = function()
require("colorizer").setup()
end
})
use({
"yamatsum/nvim-cursorline",
config = function()
require("nvim-cursorline").setup({
cursorline = {
enable = false,
},
cursorword = {
enable = true,
},
})
end
})
use({
"sunjon/shade.nvim",
config = function()
require("shade").setup({
overlay_opacity = 25,
})
end
})
use({
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup()
end
})
use("jghauser/mkdir.nvim")
use({
"kylechui/nvim-surround",
config = function()
require("nvim-surround").setup()
end
})
-- }}}
-- {{{ ui
use({
"nvim-telescope/telescope.nvim",
tag = "0.1.1",
requires = {
{"nvim-lua/plenary.nvim"},
},
})
use({
"mbbill/undotree",
config = function()
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
end
})
use("romgrk/barbar.nvim")
use("nvim-tree/nvim-tree.lua")
use("nvim-lualine/lualine.nvim")
use({
"folke/which-key.nvim",
config = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
require("which-key").setup()
end
})
-- }}}
-- this is only here to shut up the message on startup
require("barbar").setup({

View file

@ -2,15 +2,18 @@ vim.g.mapleader = " "
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>")
vim.keymap.set("!", "<C-f>", "<C-i>")
vim.keymap.set("!", "<C-g>", "<C-d>")
vim.keymap.set({"i", "v"}, "<Tab>", "<Esc>")
vim.keymap.set("c", "<Tab>", "<C-c>")
vim.keymap.set("i", "<C-f>", "<C-i>", {silent = true})
vim.keymap.set("i", "<C-g>", "<C-d>", {silent = true})
vim.keymap.set({"i", "v"}, "<Tab>", "<Esc>", {remap = true})
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("v", "<S-Down>", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "<S-Up>", ":m '<-2<CR>gv=gv")
vim.keymap.set("v", "<S-Down>", ":m '>+1<CR>gv=gv", {silent = true})
vim.keymap.set("v", "<S-Up>", ":m '<-2<CR>gv=gv", {silent = true})
vim.keymap.set("i", "<S-Down>", "<Esc>:m+<CR>", {silent = true})
vim.keymap.set("i", "<S-Up>", "<Esc>:m-2<CR>", {silent = true})
vim.keymap.set("n", "<S-Down>", ":m+<CR>", {silent = true})
vim.keymap.set("n", "<S-Up>", ":m-2<CR>", {silent = true})
vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
@ -25,7 +28,8 @@ vim.keymap.set({"n", "v"}, "<leader>d", "\"_d")
vim.keymap.set("n", "Q", "<nop>")
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
vim.keymap.set("n", "<leader>s", [[:s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
vim.keymap.set("n", "<leader>S", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
vim.keymap.set("n", "<leader><leader>", function()
vim.cmd("so")