nvim: add gitsigns and cleanup config
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
-- Treesitter with `:TSUpdate`
|
-- Treesitter with `:TSUpdate`
|
||||||
-- LSP with `:LSPInstall`, log with `:LSPInfo`
|
-- LSP with `:LSPInstall`, log with `:LSPInfo`
|
||||||
|
|
||||||
-- Don't load this in plugins.lua
|
-- This must be loaded first
|
||||||
vim.cmd("set termguicolors")
|
vim.cmd("set termguicolors")
|
||||||
|
|
||||||
require 'plugins' -- Load plugins
|
require 'plugins' -- Load plugins
|
||||||
|
|||||||
@@ -72,4 +72,5 @@ local opts = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- actually setup rust-tools with the opts from above
|
||||||
require('rust-tools').setup(opts)
|
require('rust-tools').setup(opts)
|
||||||
|
|||||||
@@ -55,10 +55,12 @@ wk.register({
|
|||||||
|
|
||||||
-- git
|
-- git
|
||||||
map("n", "<leader>gs", "<cmd> Neogit<CR>", default_opts)
|
map("n", "<leader>gs", "<cmd> Neogit<CR>", default_opts)
|
||||||
|
map("n", "<leader>gb", "<cmd> Gitsigns toggle_current_line_blame<CR>", default_opts)
|
||||||
wk.register({
|
wk.register({
|
||||||
["<leader>"] = {
|
["<leader>"] = {
|
||||||
g = {
|
g = {
|
||||||
s = { "Status" },
|
s = { "Status" },
|
||||||
|
b = { "Blame line" },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -23,16 +23,8 @@ return require('packer').startup(function(use)
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Breadcrumbs (will be loaded into LuaLine)
|
|
||||||
use {
|
|
||||||
"SmiteshP/nvim-navic",
|
|
||||||
requires = "neovim/nvim-lspconfig",
|
|
||||||
config = function()
|
|
||||||
require 'nvim-navic'.setup({})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Icons
|
-- Icons
|
||||||
|
-- Load here, because otherwise icons won't show
|
||||||
use({
|
use({
|
||||||
"kyazdani42/nvim-web-devicons",
|
"kyazdani42/nvim-web-devicons",
|
||||||
config = function()
|
config = function()
|
||||||
@@ -49,21 +41,41 @@ return require('packer').startup(function(use)
|
|||||||
"kyazdani42/nvim-web-devicons",
|
"kyazdani42/nvim-web-devicons",
|
||||||
"arkav/lualine-lsp-progress", -- Show lsp loading progress
|
"arkav/lualine-lsp-progress", -- Show lsp loading progress
|
||||||
"SmiteshP/nvim-navic", -- Show breadcrumbs
|
"SmiteshP/nvim-navic", -- Show breadcrumbs
|
||||||
|
"neovim/nvim-lspconfig", -- for nvim-navic
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
|
-- startup breadcrumbs
|
||||||
|
require 'nvim-navic'.setup({})
|
||||||
|
|
||||||
|
-- used as mode-module
|
||||||
|
local mode_map = {
|
||||||
|
['n'] = 'N',
|
||||||
|
['v'] = 'V',
|
||||||
|
['i'] = 'I',
|
||||||
|
['V'] = 'VL',
|
||||||
|
[''] = "VB",
|
||||||
|
['s'] = "VB",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- actually load bar
|
||||||
require('lualine').setup({
|
require('lualine').setup({
|
||||||
options = {
|
options = {
|
||||||
|
-- lualine comes with 'everforest' theme
|
||||||
theme = 'everforest',
|
theme = 'everforest',
|
||||||
},
|
},
|
||||||
-- tabline = {
|
-- all sections from left to right
|
||||||
-- lualine_c = {
|
|
||||||
-- require('nvim-navic').get_location
|
|
||||||
-- }
|
|
||||||
-- },
|
|
||||||
sections = {
|
sections = {
|
||||||
|
lualine_a = {
|
||||||
|
function()
|
||||||
|
return mode_map[vim.api.nvim_get_mode().mode] or "__"
|
||||||
|
end
|
||||||
|
},
|
||||||
lualine_b = {
|
lualine_b = {
|
||||||
'branch',
|
'branch',
|
||||||
'diff',
|
},
|
||||||
|
lualine_c = { 'filename', require('nvim-navic').get_location },
|
||||||
|
lualine_x = {
|
||||||
|
'lsp_progress',
|
||||||
{
|
{
|
||||||
'diagnostics',
|
'diagnostics',
|
||||||
diagnostics_color = {
|
diagnostics_color = {
|
||||||
@@ -71,16 +83,15 @@ return require('packer').startup(function(use)
|
|||||||
info = { fg = "#479bc7" },
|
info = { fg = "#479bc7" },
|
||||||
hint = { fg = "darkcyan" }
|
hint = { fg = "darkcyan" }
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
lualine_c = { 'filename', require('nvim-navic').get_location },
|
|
||||||
lualine_x = { 'lsp_progress', 'encoding', 'fileformat', 'filetype' },
|
|
||||||
lualine_y = {
|
lualine_y = {
|
||||||
'progress',
|
'filetype',
|
||||||
|
'encoding',
|
||||||
|
'fileformat',
|
||||||
|
-- show wordcount in md and tex file
|
||||||
|
-- show precise count when selecting
|
||||||
function()
|
function()
|
||||||
-- show wordcount in md and tex file
|
|
||||||
-- show precise count when selecting
|
|
||||||
if vim.bo.filetype == "md" or vim.bo.filetype == "tex" then
|
if vim.bo.filetype == "md" or vim.bo.filetype == "tex" then
|
||||||
if vim.fn.wordcount().visual_words == 1 then
|
if vim.fn.wordcount().visual_words == 1 then
|
||||||
return tostring(vim.fn.wordcount().visual_words) .. " word"
|
return tostring(vim.fn.wordcount().visual_words) .. " word"
|
||||||
@@ -95,9 +106,10 @@ return require('packer').startup(function(use)
|
|||||||
end
|
end
|
||||||
},
|
},
|
||||||
lualine_z = {
|
lualine_z = {
|
||||||
|
'progress',
|
||||||
'location',
|
'location',
|
||||||
|
-- Show trailing whitespace
|
||||||
function()
|
function()
|
||||||
-- Show trailing whitespace
|
|
||||||
local space = vim.fn.search([[\s\+$]], 'nwc')
|
local space = vim.fn.search([[\s\+$]], 'nwc')
|
||||||
return space ~= 0 and "TW:" .. space or ""
|
return space ~= 0 and "TW:" .. space or ""
|
||||||
end
|
end
|
||||||
@@ -221,9 +233,7 @@ return require('packer').startup(function(use)
|
|||||||
-- which-key (Show key combos)
|
-- which-key (Show key combos)
|
||||||
use {
|
use {
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
config = function()
|
config = function() require("which-key").setup {} end
|
||||||
require("which-key").setup {}
|
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Align with `:Align <regex>`
|
-- Align with `:Align <regex>`
|
||||||
@@ -232,18 +242,14 @@ return require('packer').startup(function(use)
|
|||||||
-- Easily comment out stuff
|
-- Easily comment out stuff
|
||||||
use({
|
use({
|
||||||
"numToStr/Comment.nvim",
|
"numToStr/Comment.nvim",
|
||||||
config = function()
|
config = function() require('Comment').setup() end,
|
||||||
require('Comment').setup()
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Highlight TODOs
|
-- Highlight TODOs
|
||||||
use {
|
use {
|
||||||
"folke/todo-comments.nvim",
|
"folke/todo-comments.nvim",
|
||||||
requires = "nvim-lua/plenary.nvim",
|
requires = "nvim-lua/plenary.nvim",
|
||||||
config = function()
|
config = function() require("todo-comments").setup {} end
|
||||||
require("todo-comments").setup {}
|
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- git client
|
-- git client
|
||||||
@@ -261,7 +267,15 @@ return require('packer').startup(function(use)
|
|||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- show colors
|
-- git signs at left side (+ blame line)
|
||||||
|
use {
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
config = function()
|
||||||
|
require('gitsigns').setup()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
-- show color codes inline
|
||||||
use({
|
use({
|
||||||
"norcalli/nvim-colorizer.lua",
|
"norcalli/nvim-colorizer.lua",
|
||||||
config = function()
|
config = function()
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ input type:keyboard {
|
|||||||
wlrctl window list \
|
wlrctl window list \
|
||||||
| awk '{print $1}' \
|
| awk '{print $1}' \
|
||||||
| sed 's/://' \
|
| sed 's/://' \
|
||||||
| wofi --dmenu \
|
| wofi --dmenu -p "Switch window" \
|
||||||
| xargs -r wlrctl window focus
|
| xargs -r wlrctl window focus
|
||||||
|
|
||||||
# Screenshot
|
# Screenshot
|
||||||
|
|||||||
Reference in New Issue
Block a user