fix zoom notification, gitsigns keymaps, address deprecations
This commit is contained in:
parent
076da2f31e
commit
3346555da3
61
init.lua
61
init.lua
|
@ -82,11 +82,14 @@ local function zoom(delta)
|
||||||
size = size + delta
|
size = size + delta
|
||||||
local guifont = fn.substitute(o.guifont, [[:h\([^:]*\)]], ':h' .. size, '')
|
local guifont = fn.substitute(o.guifont, [[:h\([^:]*\)]], ':h' .. size, '')
|
||||||
o.guifont = guifont
|
o.guifont = guifont
|
||||||
zoom_notification = vim.notify('Changing font size to ' .. size, vim.log.levels.INFO, {
|
local properties = {
|
||||||
title = 'Font size',
|
title = 'Font size',
|
||||||
replace = zoom_notification,
|
|
||||||
hide_from_history = true,
|
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
|
end
|
||||||
|
|
||||||
local function zoom_in()
|
local function zoom_in()
|
||||||
|
@ -223,6 +226,9 @@ require'packer'.startup(function(use)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end}
|
end}
|
||||||
|
use {'navarasu/onedark.nvim', config = function()
|
||||||
|
require'onedark'.setup {}
|
||||||
|
end}
|
||||||
|
|
||||||
-- Filetype plugins --
|
-- Filetype plugins --
|
||||||
use 'rhysd/vim-crystal'
|
use 'rhysd/vim-crystal'
|
||||||
|
@ -408,6 +414,7 @@ require'packer'.startup(function(use)
|
||||||
require'diffview'.setup {
|
require'diffview'.setup {
|
||||||
enhanced_diff_hl = true,
|
enhanced_diff_hl = true,
|
||||||
}
|
}
|
||||||
|
vim.opt.fillchars:append({diff = ' '})
|
||||||
end}
|
end}
|
||||||
use {'stevearc/dressing.nvim', config = function()
|
use {'stevearc/dressing.nvim', config = function()
|
||||||
vim.cmd'highlight link FloatTitle TelescopeBorder'
|
vim.cmd'highlight link FloatTitle TelescopeBorder'
|
||||||
|
@ -532,7 +539,9 @@ require'packer'.startup(function(use)
|
||||||
use 'nvim-lua/plenary.nvim'
|
use 'nvim-lua/plenary.nvim'
|
||||||
use 'ryanoasis/vim-devicons'
|
use 'ryanoasis/vim-devicons'
|
||||||
use 'kyazdani42/nvim-web-devicons'
|
use 'kyazdani42/nvim-web-devicons'
|
||||||
|
if not vim.fn.has('nvim-0.8') then
|
||||||
use 'antoinemadec/FixCursorHold.nvim'
|
use 'antoinemadec/FixCursorHold.nvim'
|
||||||
|
end
|
||||||
use 'lewis6991/impatient.nvim' -- speeds up load times
|
use 'lewis6991/impatient.nvim' -- speeds up load times
|
||||||
|
|
||||||
-- Finish bootstrap if we just cloned
|
-- Finish bootstrap if we just cloned
|
||||||
|
@ -601,12 +610,44 @@ require'fidget'.setup {}
|
||||||
|
|
||||||
|
|
||||||
---- fugitive ----
|
---- 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 ----
|
---- 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 ----
|
---- goyo ----
|
||||||
g.goyo_height = '95%'
|
g.goyo_height = '95%'
|
||||||
|
@ -729,7 +770,7 @@ local default = {
|
||||||
local runtime_path = vim.split(package.path, ';')
|
local runtime_path = vim.split(package.path, ';')
|
||||||
table.insert(runtime_path, 'lua/?.lua')
|
table.insert(runtime_path, 'lua/?.lua')
|
||||||
table.insert(runtime_path, 'lua/?/init.lua')
|
table.insert(runtime_path, 'lua/?/init.lua')
|
||||||
require'lspconfig'.sumneko_lua.setup {
|
require'lspconfig'.lua_ls.setup {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
settings = {
|
settings = {
|
||||||
|
@ -921,18 +962,16 @@ require('nvim-tree').setup {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- Open on startup
|
|
||||||
open_on_setup = true,
|
|
||||||
-- Match tree cwd to vim's cwd
|
-- Match tree cwd to vim's cwd
|
||||||
update_cwd = true,
|
update_cwd = true,
|
||||||
}
|
}
|
||||||
vim.cmd'highlight NvimTreeOpenedFile guifg=NONE gui=italic'
|
vim.cmd'highlight NvimTreeOpenedFile guifg=NONE guibg=NONE gui=italic'
|
||||||
au('ColorScheme', {
|
au('ColorScheme', {
|
||||||
desc = 'Change NvimTreeOpenedFile highlight',
|
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 ----
|
---- treesitter ----
|
||||||
|
|
Loading…
Reference in a new issue