feat: general overhaul and additional tweaks
This commit is contained in:
parent
cc27fdbb64
commit
629d642952
@ -48,8 +48,9 @@ require('packer').startup(function()
|
||||
use 'mfussenegger/nvim-dap' -- Debugger Adapter Protocol
|
||||
use 'rcarriga/nvim-dap-ui' -- UI for DAP
|
||||
use 'nvim-neotest/nvim-nio' -- for nvim-dap-ui
|
||||
use 'phha/zenburn.nvim' -- zenburn coloursheme
|
||||
use '~/projekte/zenburn.nvim' -- zenburn coloursheme
|
||||
use 'rmagatti/auto-session' -- session management
|
||||
use 'gbprod/substitute.nvim' -- substitue objects with yanked register without copying into register
|
||||
end)
|
||||
|
||||
-- General Editor Settings
|
||||
@ -67,6 +68,7 @@ opt.completeopt = 'menuone,noinsert,noselect'
|
||||
|
||||
map('n', '<Space>w', '<cmd>w<cr>', { noremap = true })
|
||||
map('n', '<Space>q', '<cmd>wq<cr>', { noremap = true })
|
||||
map('n', '<Space>Q', '<cmd>wqa<cr>', { noremap = true })
|
||||
map('n', '<Space><Esc>', '<cmd>let @/ = ""<cr>', { noremap = true })
|
||||
|
||||
-- fix interpreting C-I as Tab
|
||||
@ -93,6 +95,36 @@ autocmd({ 'BufNewFile', 'BufRead' }, {
|
||||
|
||||
vim.cmd("au BufRead *.yaml,*.yml if search('hosts:\\|tasks:\\|ansible.builtin', 'nw') | set ft=yaml.ansible | endif")
|
||||
|
||||
autocmd("FileType", {
|
||||
desc = "Close some file types with q",
|
||||
pattern = {
|
||||
"help",
|
||||
"lspinfo",
|
||||
"notify",
|
||||
"qf",
|
||||
"query",
|
||||
"checkhealth",
|
||||
},
|
||||
callback = function(event)
|
||||
vim.bo[event.buf].buflisted = false
|
||||
buf_map(event.buf,
|
||||
'n',
|
||||
'q',
|
||||
'<cmd>close<cr>',
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
end,
|
||||
})
|
||||
|
||||
autocmd({ "VimResized" }, {
|
||||
desc = "Resize splits if window got resized",
|
||||
callback = function()
|
||||
local current_tab = vim.fn.tabpagenr()
|
||||
vim.cmd("tabdo wincmd =")
|
||||
vim.cmd("tabnext " .. current_tab)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Spellcheck
|
||||
_G.enable_spell = function(lang)
|
||||
vim.bo.spelllang = lang
|
||||
@ -151,7 +183,8 @@ end
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
local servers = { 'rust_analyzer', 'texlab', 'pyright', 'tsserver', 'ccls', 'html', 'yamlls', 'ansiblels', 'hls', 'cssls', 'eslint' }
|
||||
local servers = { 'rust_analyzer', 'texlab', 'pyright', 'ts_ls', 'ccls', 'html', 'yamlls', 'ansiblels', 'hls', 'cssls',
|
||||
'eslint' }
|
||||
for _, server in ipairs(servers) do
|
||||
lsp[server].setup {
|
||||
on_attach = on_attach,
|
||||
@ -196,9 +229,6 @@ lsp.lua_ls.setup {
|
||||
},
|
||||
}
|
||||
|
||||
-- Autopairs
|
||||
require 'nvim-autopairs'.setup {}
|
||||
|
||||
-- Snippets
|
||||
local ls = require('luasnip')
|
||||
local types = require('luasnip.util.types')
|
||||
@ -290,13 +320,21 @@ require('nvim-treesitter.configs').setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
autotag = {
|
||||
enable = true,
|
||||
filetypes = { 'html', 'htmldjango', 'xml', 'javascript', 'typescript', 'javascriptreact', 'typescriptreact', 'svelte', 'vue' }
|
||||
}
|
||||
}
|
||||
|
||||
-- Treesitter Autotag
|
||||
require('nvim-ts-autotag').setup({
|
||||
opts = {
|
||||
enable_close = true,
|
||||
enable_rename = true,
|
||||
enable_close_on_slash = false
|
||||
}
|
||||
})
|
||||
|
||||
-- Autopairs
|
||||
require 'nvim-autopairs'.setup {}
|
||||
|
||||
-- Telescope
|
||||
map('n', '<Leader>ff', '<cmd>lua require("telescope.builtin").find_files()<cr>', { noremap = true })
|
||||
map('n', '<leader>fg', '<cmd>lua require("telescope.builtin").live_grep()<cr>', { noremap = true })
|
||||
@ -311,7 +349,7 @@ require('mkdnflow').setup({
|
||||
},
|
||||
mappings = {
|
||||
MkdnEnter = { { 'i', 'n', 'v' }, '<CR>' },
|
||||
MkdnCreateLinkFromClipboard = {{'n', 'v'}, '<leader>l'},
|
||||
MkdnCreateLinkFromClipboard = { { 'n', 'v' }, '<leader>l' },
|
||||
},
|
||||
perspective = {
|
||||
priority = 'current',
|
||||
@ -328,6 +366,18 @@ require('mkdnflow').setup({
|
||||
}
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<leader>wd', function()
|
||||
local date_string = os.date("%Y-%m-%d")
|
||||
local path = '/home/max/dokumente/wiki/todos/' .. date_string .. '.md'
|
||||
|
||||
vim.cmd.tabedit(path)
|
||||
if vim.fn.getfsize(path) < 1 then
|
||||
vim.api.nvim_put({ "# Todo - " .. date_string, "- [ ] " }, 'c', false, true)
|
||||
end
|
||||
vim.cmd.write()
|
||||
end, { noremap = true })
|
||||
|
||||
|
||||
autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
desc = 'Set note taking settings for nvim in wiki directory',
|
||||
pattern = { '*/dokumente/wiki/**' },
|
||||
@ -383,21 +433,23 @@ vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- Colorizer
|
||||
require('colorizer').setup({
|
||||
'*';
|
||||
'*',
|
||||
}, {
|
||||
RGB = true; -- #RGB hex codes
|
||||
RRGGBB = true; -- #RRGGBB hex codes
|
||||
names = false; -- "Name" codes like Blue
|
||||
RRGGBBAA = true; -- #RRGGBBAA hex codes
|
||||
rgb_fn = true; -- CSS rgb() and rgba() functions
|
||||
hsl_fn = true; -- CSS hsl() and hsla() functions
|
||||
css = false; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = false; -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
mode = 'background'; -- Set the display mode.
|
||||
RGB = true, -- #RGB hex codes
|
||||
RRGGBB = true, -- #RRGGBB hex codes
|
||||
names = false, -- "Name" codes like Blue
|
||||
RRGGBBAA = true, -- #RRGGBBAA hex codes
|
||||
rgb_fn = true, -- CSS rgb() and rgba() functions
|
||||
hsl_fn = true, -- CSS hsl() and hsla() functions
|
||||
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
mode = 'background', -- Set the display mode.
|
||||
})
|
||||
|
||||
-- Leap
|
||||
require('leap').add_default_mappings()
|
||||
vim.keymap.set({ 'n', 'x', 'o' }, 'ö', '<Plug>(leap-forward)')
|
||||
vim.keymap.set({ 'n', 'x', 'o' }, 'Ö', '<Plug>(leap-backward)')
|
||||
vim.keymap.set({ 'n', 'x', 'o' }, 'gö', '<Plug>(leap-from-window)')
|
||||
|
||||
-- Debugger Adapter Protocol
|
||||
local dap = require('dap')
|
||||
@ -443,4 +495,11 @@ require("auto-session").setup {
|
||||
log_level = "error"
|
||||
}
|
||||
|
||||
-- opt.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal"
|
||||
opt.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,terminal,localoptions"
|
||||
|
||||
-- Substitute
|
||||
require("substitute").setup()
|
||||
vim.keymap.set('n', 's', require('substitute').operator, { noremap = true })
|
||||
vim.keymap.set('n', 'ss', require('substitute').line, { noremap = true })
|
||||
vim.keymap.set('n', 'S', require('substitute').eol, { noremap = true })
|
||||
vim.keymap.set('x', 's', require('substitute').visual, { noremap = true })
|
||||
|
Loading…
Reference in New Issue
Block a user