nvim: statusline, prettier, other misc changes
This commit is contained in:
parent
4c2dcb4be1
commit
5e0e4b3b26
8 changed files with 196 additions and 18 deletions
|
@ -6,14 +6,14 @@ vim.cmd("highlight IndentBlanklineIndent3 ctermfg=13 cterm=nocombine")
|
|||
vim.cmd("highlight IndentBlanklineIndent4 ctermfg=12 cterm=nocombine")
|
||||
|
||||
vim.cmd("hi Normal ctermbg=NONE")
|
||||
vim.cmd("hi LineNr ctermfg=7")
|
||||
vim.cmd("hi LineNr ctermfg=7 ctermbg=NONE")
|
||||
vim.cmd("hi CursorLineNr ctermfg=1 ctermbg=0")
|
||||
vim.cmd("hi CursorLine cterm=NONE ctermfg=NONE ctermbg=0")
|
||||
vim.cmd("hi StatusLine ctermfg=5 ctermbg=8 cterm=NONE")
|
||||
vim.cmd("hi StatusLineNC ctermfg=7 ctermbg=0 cterm=NONE")
|
||||
vim.cmd("hi StatusLine ctermfg=5 ctermbg=NONE cterm=NONE")
|
||||
vim.cmd("hi StatusLineNC ctermfg=7 ctermbg=NONE cterm=NONE")
|
||||
vim.cmd("hi VertSplit ctermbg=0 ctermfg=0")
|
||||
vim.cmd("hi ExtraWhitespace ctermbg=1")
|
||||
vim.cmd("hi SignColumn ctermbg=8")
|
||||
vim.cmd("hi ColorColumn ctermbg=8 ctermfg=3")
|
||||
|
||||
vim.cmd("hi BufferCurrent ctermfg=5 ctermbg=NONE")
|
||||
vim.cmd("hi BufferCurrentIndex ctermfg=5 ctermbg=NONE")
|
||||
|
@ -36,7 +36,7 @@ vim.cmd("hi BufferOffset ctermfg=0 ctermbg=0")
|
|||
|
||||
vim.cmd("hi! link SignColumn LineNr")
|
||||
|
||||
vim.cmd("hi LspDiagnosticsDefaultHint ctermfg=6")
|
||||
vim.cmd("hi LspDiagnosticsDefaultError ctermfg=1")
|
||||
vim.cmd("hi LspDiagnosticsDefaultWarning ctermfg=3")
|
||||
vim.cmd("hi LspDiagnosticsDefaultInformation ctermfg=7")
|
||||
vim.cmd("hi DiagnosticHint ctermfg=6")
|
||||
vim.cmd("hi DiagnosticError ctermfg=1")
|
||||
vim.cmd("hi DiagnosticWarn ctermfg=3")
|
||||
vim.cmd("hi DiagnosticInfo ctermfg=7")
|
||||
|
|
109
common/nvim/after/plugin/lualine.lua
Normal file
109
common/nvim/after/plugin/lualine.lua
Normal file
|
@ -0,0 +1,109 @@
|
|||
local theme = require("lualine.themes.16color")
|
||||
theme.normal.a.bg = 7
|
||||
theme.visual.a.bg = 4
|
||||
theme.command = {
|
||||
a = {bg = 6},
|
||||
}
|
||||
theme.terminal = {
|
||||
a = {bg = 5},
|
||||
}
|
||||
theme.normal.c.bg = "none"
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = theme,
|
||||
section_separators = "",
|
||||
component_separators = "",
|
||||
disabled_filetypes = {
|
||||
statusline = {"NvimTree", "undotree", "diff"},
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
{
|
||||
"mode",
|
||||
color = {
|
||||
fg = 0,
|
||||
},
|
||||
fmt = function(str)
|
||||
return str:sub(1,3)
|
||||
end
|
||||
},
|
||||
},
|
||||
lualine_b = {
|
||||
{
|
||||
"branch",
|
||||
color = {
|
||||
bg = 5,
|
||||
fg = 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
"diff",
|
||||
diff_color = {
|
||||
added = {bg = 8, fg = 2},
|
||||
modified = {bg = 8, fg = 3},
|
||||
removed = {bg = 8, fg = 1},
|
||||
},
|
||||
},
|
||||
{
|
||||
"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},
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
"filename",
|
||||
color = {
|
||||
bg = "none",
|
||||
fg = 5,
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
{
|
||||
"location",
|
||||
color = {
|
||||
bg = 4,
|
||||
fg = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
{
|
||||
"encoding",
|
||||
color = {
|
||||
bg = 3,
|
||||
fg = 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
"fileformat",
|
||||
color = {
|
||||
bg = 3,
|
||||
fg = 0,
|
||||
},
|
||||
padding = {
|
||||
left = 0,
|
||||
right = 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_z = {
|
||||
{
|
||||
"filetype",
|
||||
color = {
|
||||
bg = 7,
|
||||
fg = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
1
common/nvim/after/plugin/presence.lua
Normal file
1
common/nvim/after/plugin/presence.lua
Normal file
|
@ -0,0 +1 @@
|
|||
vim.g.presence_buttons = false
|
51
common/nvim/after/plugin/prettier.lua
Normal file
51
common/nvim/after/plugin/prettier.lua
Normal file
|
@ -0,0 +1,51 @@
|
|||
local null_ls = require("null-ls")
|
||||
|
||||
local group = vim.api.nvim_create_augroup("lsp_format_on_save", { clear = false })
|
||||
local event = "BufWritePre" -- or "BufWritePost"
|
||||
local async = event == "BufWritePost"
|
||||
|
||||
null_ls.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.keymap.set("n", "<Leader>f", function()
|
||||
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
|
||||
end, { buffer = bufnr, desc = "[lsp] format" })
|
||||
|
||||
-- format on save
|
||||
vim.api.nvim_clear_autocmds({ buffer = bufnr, group = group })
|
||||
vim.api.nvim_create_autocmd(event, {
|
||||
buffer = bufnr,
|
||||
group = group,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr, async = async })
|
||||
end,
|
||||
desc = "[lsp] format on save",
|
||||
})
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/rangeFormatting") then
|
||||
vim.keymap.set("x", "<Leader>f", function()
|
||||
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
|
||||
end, { buffer = bufnr, desc = "[lsp] format" })
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local prettier = require("prettier")
|
||||
prettier.setup({
|
||||
bin = "prettier",
|
||||
filetypes = {
|
||||
"css",
|
||||
"graphql",
|
||||
"html",
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"json",
|
||||
"less",
|
||||
"markdown",
|
||||
"scss",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"yaml",
|
||||
},
|
||||
})
|
|
@ -1,6 +1,11 @@
|
|||
local telescope = require("telescope")
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
vimgrep_arguments = {"ag", "--vimgrep"},
|
||||
}
|
||||
})
|
||||
|
||||
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)
|
||||
vim.keymap.set('n', '<leader>ps', builtin.live_grep)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require'nvim-treesitter.configs'.setup({
|
||||
require("nvim-treesitter.configs").setup({
|
||||
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||
ensure_installed = { "javascript", "typescript", "rust", "c", "lua", "vim", "vimdoc", "query" },
|
||||
|
||||
|
@ -19,3 +19,4 @@ require'nvim-treesitter.configs'.setup({
|
|||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
})
|
||||
require("treesitter-context").setup()
|
||||
|
|
|
@ -16,7 +16,7 @@ return packer.startup(function(use)
|
|||
"nvim-treesitter/nvim-treesitter",
|
||||
{run = ":TSUpdate"}
|
||||
)
|
||||
use("theprimeagen/harpoon")
|
||||
use("nvim-treesitter/nvim-treesitter-context")
|
||||
use("mbbill/undotree")
|
||||
use("tpope/vim-fugitive")
|
||||
|
||||
|
@ -45,4 +45,19 @@ return packer.startup(function(use)
|
|||
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("nvim-lualine/lualine.nvim")
|
||||
|
||||
-- this is only here to shut up the message on startup
|
||||
require("barbar").setup({
|
||||
icons = {
|
||||
filetype = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
|
|
@ -4,7 +4,7 @@ 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", "<Tab>", "<Esc>")
|
||||
vim.keymap.set({"i", "v"}, "<Tab>", "<Esc>")
|
||||
vim.keymap.set("c", "<Tab>", "<C-c>")
|
||||
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
|
@ -25,10 +25,6 @@ vim.keymap.set({"n", "v"}, "<leader>d", "\"_d")
|
|||
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
|
||||
vim.keymap.set("n", "<leader>f", function()
|
||||
vim.lsp.buf.format()
|
||||
end)
|
||||
|
||||
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()
|
||||
|
|
Loading…
Reference in a new issue