More lua globals, ZD mapping

This commit is contained in:
Amanda Graven 2023-11-10 17:00:41 +01:00
parent a4f624b8f0
commit 4990d80291

View file

@ -87,7 +87,7 @@ local zoom_notification = nil
--- "Zoom" by changing gui font size --- "Zoom" by changing gui font size
--- @param delta integer --- @param delta integer
local function zoom(delta) function _G.zoom(delta)
local size = fn.substitute(o.guifont, [[^.*:h\([^:]*\).*$]], [[\1]], '') local size = fn.substitute(o.guifont, [[^.*:h\([^:]*\).*$]], [[\1]], '')
size = size + delta size = size + delta
local guifont = fn.substitute(o.guifont, [[:h\([^:]*\)]], ':h' .. size, '') local guifont = fn.substitute(o.guifont, [[:h\([^:]*\)]], ':h' .. size, '')
@ -134,6 +134,7 @@ do
}, },
['<Leader>c'] = {'<Cmd>vert te<CR>', 'Terminal (vsplit)'}, ['<Leader>c'] = {'<Cmd>vert te<CR>', 'Terminal (vsplit)'},
['<Leader>C'] = {'<Cmd>tab te<CR>', 'Terminal (tab)'}, ['<Leader>C'] = {'<Cmd>tab te<CR>', 'Terminal (tab)'},
['ZD'] = {'<Cmd>bdelete<CR>', 'Delete buffer'},
} }
which_key.register { ['<C-l>'] = {function () which_key.register { ['<C-l>'] = {function ()
@ -145,9 +146,6 @@ do
vim.cmd('nohlsearch|diffupdate|normal! <C-l>') vim.cmd('nohlsearch|diffupdate|normal! <C-l>')
end, 'Clear'} } end, 'Clear'} }
which_key.register { ['+'] = {zoom_in, "Zoom in"} }
which_key.register { ['-'] = {zoom_out, "Zoom out"} }
if workman then if workman then
which_key.register { which_key.register {
j = {'n', 'Next search match'}, j = {'n', 'Next search match'},
@ -545,7 +543,7 @@ require'packer'.startup(function(use)
-- figure out how to ensure java-test and java-debug-adapter -- figure out how to ensure java-test and java-debug-adapter
} }
end} end}
use {'TimUntersberger/neogit', config = function () use {'NeogitOrg/neogit', config = function ()
require'neogit'.setup { require'neogit'.setup {
disable_context_highlighting = true, disable_context_highlighting = true,
integrations = { integrations = {
@ -657,10 +655,11 @@ require'packer'.startup(function(use)
use {'debugloop/telescope-undo.nvim', after = 'telescope.nvim', config = function() use {'debugloop/telescope-undo.nvim', after = 'telescope.nvim', config = function()
require'telescope'.load_extension('undo') require'telescope'.load_extension('undo')
end} end}
use {'nvim-neotest/neotest', requires = {'rcasia/neotest-java'}, config = function() use {'nvim-neotest/neotest', requires = {'rcasia/neotest-java', 'nvim-neotest/neotest-vim-test'}, config = function()
require'neotest'.setup { require'neotest'.setup {
adapters = { adapters = {
require'neotest-java' {} require'neotest-java' {},
require'neotest-vim-test' {},
} }
} }
end} end}
@ -722,9 +721,10 @@ vim.cmd [[
---- autopairs ---- ---- autopairs ----
vim.g.AutoPairsMultilineClose = 0 vim.g.AutoPairsMultilineClose = 0
vim.g.AutoPairsMapCR = 0 -- temp workaround
vim.g.AutoPairsMapBS = 1 vim.g.AutoPairsMapBS = 1
vim.g.AutoPairsCompatibleMaps = 1 vim.g.AutoPairsCompatibleMaps = 1
vim.g.AutoPairsShortcutToggleMultilineClose = ''
---- barbar ---- ---- barbar ----
require'which-key'.register { require'which-key'.register {
@ -1001,6 +1001,9 @@ au('FileType', {
callback = function () callback = function ()
local ok, jdtls = pcall(require, 'jdtls') local ok, jdtls = pcall(require, 'jdtls')
if not ok then return end if not ok then return end
jdtls.tests = require'jdtls.tests'
jdtls.dap = require'jdtls.dap'
_G.jdt = jdtls
local path = vim.fn.stdpath('data') .. '/mason/packages/jdtls' local path = vim.fn.stdpath('data') .. '/mason/packages/jdtls'
local root_dir = jdtls.setup.find_root({'.git', 'mvnw', 'gradlew'}) local root_dir = jdtls.setup.find_root({'.git', 'mvnw', 'gradlew'})
@ -1046,7 +1049,6 @@ au('FileType', {
on_attach = function (client, bufnr) on_attach = function (client, bufnr)
on_attach(client, bufnr) on_attach(client, bufnr)
jdtls.setup_dap() jdtls.setup_dap()
jdtls.setup.add_commands()
end, end,
} }
@ -1176,7 +1178,7 @@ require'symbols-outline'.setup {
-- Don't display preview automatically -- Don't display preview automatically
auto_preview = false, auto_preview = false,
-- Don't highlight the hovered item -- Don't highlight the hovered item
highlight_hovered_item = false, highlight_hovered_item = true,
-- Width should be in colums, not percent -- Width should be in colums, not percent
relative_width = false, relative_width = false,
-- width of the symbols window -- width of the symbols window
@ -1261,6 +1263,7 @@ vim.keymap.set('n', '<Leader>t', '<Cmd>NvimTreeFindFile<CR>', {desc = 'Nvim Tree
---- treesitter ---- ---- treesitter ----
---@diagnostic disable-next-line: missing-fields
require'nvim-treesitter.configs'.setup { require'nvim-treesitter.configs'.setup {
-- Configure the nvim-ts-autotag plugin -- Configure the nvim-ts-autotag plugin
autotag = { autotag = {