From d127d84df837b1578ad991023138a34ab66ff503 Mon Sep 17 00:00:00 2001 From: jakobst1n Date: Mon, 30 Mar 2026 09:20:26 +0200 Subject: Upgrade to nvim 0.12, update config to use new features --- Common/nvim/lua/plugins.lua | 154 +++++++++++--------------------------------- 1 file changed, 36 insertions(+), 118 deletions(-) (limited to 'Common/nvim/lua/plugins.lua') diff --git a/Common/nvim/lua/plugins.lua b/Common/nvim/lua/plugins.lua index 2ad775f..04b474e 100755 --- a/Common/nvim/lua/plugins.lua +++ b/Common/nvim/lua/plugins.lua @@ -1,119 +1,37 @@ --- Autoinstall packer -local fn = vim.fn -local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' -if fn.empty(fn.glob(install_path)) > 0 then - packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) -end - --- Autocompile packer -vim.cmd([[ - augroup packer_user_config - autocmd! - autocmd BufWritePost plugins.lua source | PackerCompile - augroup end -]]) - -return require('packer').startup(function(use) - -- Packer itself :) - use 'wbthomason/packer.nvim' - - use 'tpope/vim-fugitive' - use { - 'junegunn/fzf.vim', - requires = { 'junegunn/fzf', 'kyazdani42/nvim-web-devicons' }, - config = function() - vim.cmd [[ - let g:fzf_layout = { 'down': '40%' } - - autocmd! FileType fzf - autocmd FileType fzf set laststatus=0 noshowmode noruler - \| autocmd BufLeave set laststatus=2 showmode ruler - - let g:fzf_colors = - \ { 'fg': ['fg', 'Normal'], - \ 'bg': ['bg', 'Normal'], - \ 'hl': ['fg', 'Comment'], - \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], - \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], - \ 'hl+': ['fg', 'Statement'], - \ 'info': ['fg', 'PreProc'], - \ 'border': ['fg', 'Ignore'], - \ 'prompt': ['fg', 'Conditional'], - \ 'pointer': ['fg', 'Exception'], - \ 'marker': ['fg', 'Keyword'], - \ 'spinner': ['fg', 'Label'], - \ 'header': ['fg', 'Comment'] } - ]] - vim.api.nvim_set_keymap("n", ";", ":Files", { noremap = true, silent = true }) - vim.api.nvim_set_keymap("n", ";", ":Rg", { noremap = true, silent = true }) - vim.api.nvim_set_keymap("n", ";", ":Lines", { noremap = true, silent = true }) - end, - } - - -- Lsp things - use { - 'williamboman/mason.nvim', - 'williamboman/mason-lspconfig.nvim', - 'neovim/nvim-lspconfig' , - } - - -- vim-dadbob (run sql directly) - use { - 'tpope/vim-dadbod', - config = function() - vim.cmd [[ - xnoremap (DBExe) db#op_exec() - nnoremap (DBExe) db#op_exec() - nnoremap (DBExeLine) db#op_exec() . '_' - - xmap db (DBExe) - nmap db (DBExe) - omap db (DBExe) - nmap dbb (DBExeLine) - - autocmd FileType dbout setlocal nofoldenable - ]] - end, - } - - -- VimWiki stuff - use { - 'vimwiki/vimwiki', - config = function () - vim.g.vimwiki_global_ext = 0 - vim.g.vimwiki_auto_header = 1 - vim.g.vimwiki_links_space_char = '_' - vim.g.vimwiki_url_maxsave = 0 - vim.g.vimwiki_auto_chdir = 1 - end, - } - use { - 'mattn/calendar-vim', - config = function() - vim.g.calendar_monday = 1 - vim.g.calendar_weeknm = 5 - vim.api.nvim_create_autocmd("QuitPre", { - callback = function() - local invalid_win = {} - local wins = vim.api.nvim_list_wins() - for _, w in ipairs(wins) do - local bufname = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(w)) - if bufname:match("__Calendar") ~= nil then - table.insert(invalid_win, w) - end - end - if #invalid_win == #wins - 1 then - for _, w in ipairs(invalid_win) do vim.api.nvim_win_close(w, true) end - end - end - }) - end - } - - -- Automatically set up your configuration after cloning packer.nvim - -- Put this at the end after all plugins - if packer_bootstrap then - require('packer').sync() - end -end) +vim.pack.add({ + 'https://github.com/tpope/vim-fugitive', + 'https://github.com/tpope/vim-dadbod', + -- Fzf + 'https://github.com/junegunn/fzf', + 'https://github.com/junegunn/fzf.vim', + -- LSP + 'https://github.com/neovim/nvim-lspconfig', + 'https://github.com/mason-org/mason.nvim', + 'https://github.com/mason-org/mason-lspconfig.nvim' +}) + +-- Fzf setup +vim.cmd [[ + autocmd! FileType fzf + autocmd FileType fzf set laststatus=0 noshowmode noruler + \| autocmd BufLeave set laststatus=2 showmode ruler +]] +vim.g.fzf_layout = { down = "40%" } +vim.api.nvim_set_keymap("n", ";", ":Files", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", ";", ":Rg", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", ";", ":Lines", { noremap = true, silent = true }) + +-- Vim-dadbod setup +vim.cmd [[ +xnoremap (DBExe) db#op_exec() +nnoremap (DBExe) db#op_exec() +nnoremap (DBExeLine) db#op_exec() . '_' + +xmap db (DBExe) +nmap db (DBExe) +omap db (DBExe) +nmap dbb (DBExeLine) + +autocmd FileType dbout setlocal nofoldenable +]] -- cgit v1.2.3