added jdtls, need to play with it some more to add missing keymaps and

dap (need to properly configure dap anyway)

remove nvim-tree
remove goyo and limelight commands and keymaps
This commit is contained in:
Fabian Schmidt
2024-08-13 11:49:16 +02:00
parent 11763243dc
commit 4f2c968b33
6 changed files with 176 additions and 25 deletions

View File

@@ -1,8 +1,5 @@
-- commands.lua
vim.cmd 'autocmd! User GoyoEnter Limelight'
vim.cmd 'autocmd! User GoyoLeave Limelight!'
vim.cmd 'autocmd BufRead,BufNewFile *.wiki,*.md,*.tex set wrap'
vim.cmd 'au BufRead,BufNewFile *.kdl set filetype=kdl'
@@ -10,3 +7,31 @@ vim.cmd 'au BufRead,BufNewFile *.kdl set filetype=kdl'
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
vim.cmd 'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
-- Array of file names indicating root directory. Modify to your liking.
local root_names = { '.git', 'Makefile' }
-- Cache to use for speed up (at cost of possibly outdated results)
local root_cache = {}
local set_root = function()
-- Get directory path to start search from
local path = vim.api.nvim_buf_get_name(0)
if path == '' then return end
path = vim.fs.dirname(path)
-- Try cache and resort to searching upward for root directory
local root = root_cache[path]
if root == nil then
local root_file = vim.fs.find(root_names, { path = path, upward = true })[1]
if root_file == nil then return end
root = vim.fs.dirname(root_file)
root_cache[path] = root
end
-- Set current directory
vim.fn.chdir(root)
end
local root_augroup = vim.api.nvim_create_augroup('MyAutoRoot', {})
vim.api.nvim_create_autocmd('BufEnter', { group = root_augroup, callback = set_root })