fix zoom notification, gitsigns keymaps, address deprecations

This commit is contained in:
Amanda Graven 2023-03-17 10:09:09 +01:00
parent 076da2f31e
commit 3346555da3
No known key found for this signature in database
GPG key ID: 79A68E63058F3BA1

View file

@ -82,11 +82,14 @@ local function zoom(delta)
size = size + delta
local guifont = fn.substitute(o.guifont, [[:h\([^:]*\)]], ':h' .. size, '')
o.guifont = guifont
zoom_notification = vim.notify('Changing font size to ' .. size, vim.log.levels.INFO, {
local properties = {
title = 'Font size',
replace = zoom_notification,
hide_from_history = true,
})
}
if zoom_notification ~= nil then
properties.replace = zoom_notification
end
zoom_notification = vim.notify('Changing font size to ' .. size, vim.log.levels.INFO, properties)
end
local function zoom_in()
@ -223,6 +226,9 @@ require'packer'.startup(function(use)
}
}
end}
use {'navarasu/onedark.nvim', config = function()
require'onedark'.setup {}
end}
-- Filetype plugins --
use 'rhysd/vim-crystal'
@ -408,6 +414,7 @@ require'packer'.startup(function(use)
require'diffview'.setup {
enhanced_diff_hl = true,
}
vim.opt.fillchars:append({diff = ' '})
end}
use {'stevearc/dressing.nvim', config = function()
vim.cmd'highlight link FloatTitle TelescopeBorder'
@ -532,7 +539,9 @@ require'packer'.startup(function(use)
use 'nvim-lua/plenary.nvim'
use 'ryanoasis/vim-devicons'
use 'kyazdani42/nvim-web-devicons'
use 'antoinemadec/FixCursorHold.nvim'
if not vim.fn.has('nvim-0.8') then
use 'antoinemadec/FixCursorHold.nvim'
end
use 'lewis6991/impatient.nvim' -- speeds up load times
-- Finish bootstrap if we just cloned
@ -601,12 +610,44 @@ require'fidget'.setup {}
---- fugitive ----
require'which-key'.register {['<Leader>g'] = {'<Cmd>vert Git<CR>', 'Git information'}}
vim.keymap.set('n', '<Leader>g', '<Cmd>vert Git<CR>', {desc = 'Git information'})
---- gitsigns ----
require'gitsigns'.setup {}
require'gitsigns'.setup {
on_attach = function ()
local gitsigns = require'gitsigns'
vim.keymap.set('n', ']h', gitsigns.next_hunk, {desc = 'Next hunk'})
vim.keymap.set('n', '[h', gitsigns.prev_hunk, {desc = 'Previous hunk'})
--- Prompt interactively for global comparison base
local function change_base()
require'gitsigns.cli'
vim.ui.input({
prompt = 'Revision to compare to',
completion = "customlist,v:lua.require'gitsigns.cli'.complete",
}, function (revision)
if not revision then return end
gitsigns.change_base(revision, true)
end)
end
require'which-key'.register {
['<Leader>h'] = {
name = '+gitsigns',
s = {gitsigns.stage_hunk, 'Stage hunk'},
S = {gitsigns.stage_buffer, 'Stage buffer'},
u = {gitsigns.unstage_hunk, 'Unstage hunk'},
U = {gitsigns.unstage_buffer, 'Unstage buffer'},
v = {gitsigns.select_hunk, 'Visual select hunk'},
d = {gitsigns.toggle_deleted, 'Toggle deleted lines'},
w = {gitsigns.toggle_word_diff, 'Toggle word diffs'},
b = {':Gitsigns change_base ', 'Change diff base'},
B = {gitsigns.reset_base, 'Reset diff base'},
}
}
end
}
---- goyo ----
g.goyo_height = '95%'
@ -729,7 +770,7 @@ local default = {
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua')
require'lspconfig'.sumneko_lua.setup {
require'lspconfig'.lua_ls.setup {
capabilities = capabilities,
on_attach = on_attach,
settings = {
@ -921,18 +962,16 @@ require('nvim-tree').setup {
},
},
},
-- Open on startup
open_on_setup = true,
-- Match tree cwd to vim's cwd
update_cwd = true,
}
vim.cmd'highlight NvimTreeOpenedFile guifg=NONE gui=italic'
vim.cmd'highlight NvimTreeOpenedFile guifg=NONE guibg=NONE gui=italic'
au('ColorScheme', {
desc = 'Change NvimTreeOpenedFile highlight',
command = 'highlight NvimTreeOpenedFile guifg=NONE gui=italic'
command = 'highlight NvimTreeOpenedFile guifg=NONE guibg=NONE gui=italic'
})
require'which-key'.register{['<Leader>t'] = {'<Cmd>NvimTreeFindFileToggle<CR>', 'Nvim Tree'}}
vim.keymap.set('n', '<Leader>t', '<Cmd>NvimTreeFindFileToggle<CR>', {desc = 'Nvim Tree'})
---- treesitter ----