Merge branch 'master' into home

Conflicts:
	lua/commands.lua
This commit is contained in:
Michael Peters 2022-11-23 18:49:45 -08:00
commit 65d16b0062
7 changed files with 104 additions and 12 deletions

View File

@ -7,3 +7,14 @@ vim.api.nvim_create_user_command('IPDB', 'norm oimport ipdb; ipdb.set_trace() #
-- Format the document
vim.api.nvim_create_user_command('Format', 'lua vim.lsp.buf.format()', {})
local function gitblame_toggle_summary()
local normal = '<author> • <date>'
local with_summary = '<summary> • <author> • <date>'
if vim.g.gitblame_message_template == normal then
vim.g.gitblame_message_template = with_summary
else
vim.g.gitblame_message_template = normal
end
end
vim.api.nvim_create_user_command('GitBlameToggleSummary', gitblame_toggle_summary, {})

View File

@ -14,6 +14,7 @@ function M.config()
dashboard.button("w", "Find Word", ":Telescope live_grep<cr>"),
dashboard.button("o", "Recent Files", ":Telescope oldfiles<cr>"),
dashboard.button("e", "Open Tree", ":NvimTreeToggle<cr>"),
dashboard.button("s", "Load Session", ":SessionManager load_current_dir_session<cr>"),
dashboard.button("q", "Quit", ":qa<cr>"),
}

View File

@ -135,6 +135,17 @@ function M.config()
-- pip install pyright
lspconfig.pyright.setup {
on_attach = on_attach,
-- settings = {
-- https://github.com/microsoft/pyright/blob/main/docs/settings.md
-- python = {
-- autoSearchPaths = true,
-- autoImportCompletion = true,
-- diagnosticMode = 'openFilesOnly', -- workspace | openFilesOnly
-- useLibraryCodeForTypes = true,
-- typeCheckingMode = '...' -- off | basic | strict
-- venvPath = '...'
-- }
-- }
}
-- vscode-json-language-server

View File

@ -75,16 +75,17 @@ function M.config()
},
{ -- file name
"filename",
path = 1,
icon="",
color = { fg = scolors.filename, gui = "bold" },
padding = { left = 1, right = 1 },
},
{ -- git branch
"branch",
icon = "",
color = { fg = scolors.branch, gui = "bold" },
padding = { left = 1, right = 1 },
},
-- { -- git branch
-- "branch",
-- icon = "",
-- color = { fg = scolors.branch, gui = "bold" },
-- padding = { left = 1, right = 1 },
-- },
{ -- filetype
"filetype",
colored = false,
@ -117,7 +118,11 @@ function M.config()
},
lualine_x = {
{ -- git blame
gitblame.get_current_blame_text,
function ()
local blame_text = gitblame.get_current_blame_text()
blame_text = blame_text:gsub("Not Committed Yet", "not committed")
return blame_text
end,
color = { fg = scolors.fg_wash },
cond = gitblame.is_blame_text_available,
padding = { left = 0, right = 1 },
@ -153,6 +158,7 @@ function M.config()
lualine_a = {
{ -- file name
"filename",
path = 1,
icon="",
color = { fg = scolors.filename, gui = "bold" },
padding = { left = 1, right = 1 },

View File

@ -0,0 +1,44 @@
local M = {}
function M.config()
local status_ok, session_manager = pcall(require, "session_manager")
if not status_ok then
return
end
local sm_config = require'session_manager.config'
local function get_branch_name()
local handle = io.popen("git branch --show-current 2>/dev/null")
if (handle == nil) then
return nil
end
local branch = handle:read("l")
handle:close()
if (branch == nil) then
return nil
end
branch = branch:gsub("/", "--")
return branch
end
-- this plugin saves sessions for the working directory automatically
session_manager.setup({
autoload_mode = sm_config.AutoloadMode.Disabled, -- do not auto-load the last session at startup
session_filename_to_dir = function(filename)
local filename_without_extra = filename:sub(0, filename:find("=="))
return sm_config.delimited_session_filename_to_dir(filename_without_extra)
end,
dir_to_session_filename = function(dir)
local filename = sm_config.dir_to_delimited_session_filename(dir)
local branch = get_branch_name()
if branch ~= nil then
return filename .. "==" .. branch
else
return filename
end
end,
})
end
return M

View File

@ -36,6 +36,10 @@ map("n", "[b", "<cmd>BufferLineMovePrev<CR>", opts)
map("n", "<leader>w", "<cmd>Bdelete<CR>", opts) -- don't close if unsaved
map("n", "<leader>c", "<cmd>Bdelete!<CR>", opts) -- close it no matter what B)
-- Navigate Git Signs
map("n", "]g", "<cmd>Gitsigns next_hunk<CR>", opts)
map("n", "[g", "<cmd>Gitsigns prev_hunk<CR>", opts)
-- Toggle Diagnostics
map("n", "<leader>de", "<cmd>lua vim.diagnostic.enable()<cr>", opts)
map("n", "<leader>dd", "<cmd>lua vim.diagnostic.disable()<cr>", opts)
@ -67,7 +71,9 @@ map("n", "<leader>la", "<cmd>Lspsaga code_action<CR>", opts)
map("n", "<C-u>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>", opts)
map("n", "<C-d>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>", opts)
map("n", "<leader>b", "<cmd>GitBlameToggle<CR>", opts)
-- Custom "toggle summary" function for blame
-- jkkj is a hack to refresh the git blame message since it doesn't update till the line changes
map("n", "<leader>s", "<cmd>GitBlameToggleSummary<CR>jkkj", opts)
-- LSP (see configs/lsp-installer.lua)
-- disable K in visual mode

View File

@ -34,7 +34,11 @@ packer.startup {
--
-- Colorscheme (See autocommands.lua)
use { 'lunarvim/darkplus.nvim' }
use {
'lunarvim/darkplus.nvim',
commit = 'f20cba5d690bc34398a3a8372ee7bbbc7b6609fa',
-- tag = 'neovim-0.7', -- this has imperfect comment highlights
}
--[[ use { '~/builds/darkplus.nvim' } ]]
-- Buffer Line
@ -73,6 +77,18 @@ packer.startup {
use { 'nvim-telescope/telescope.nvim', config = function() require'configs.telescope'.config() end }
-- use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
-- Sessions
-- use {
-- 'Shatur/neovim-session-manager',
-- commit = '4005dac93f5cd1257792259ef4df6af0e3afc213',
-- config = function() require'configs.session-manager'.config() end
-- }
-- custom build of the above plugin
use {
'~/builds/neovim-session-manager',
config = function() require'configs.session-manager'.config() end
}
--
-- Treesitter
--
@ -178,9 +194,6 @@ packer.startup {
-- Formatting for python (:call Black())
use { 'averms/black-nvim', run = ':UpdateRemotePlugins' }
-- Toggle checkboxes w/ <leader>we, delete w/ <leader>wx
use { 'gerardbm/vim-md-checkbox' }
end,
config = {
display = {