Formatting, remove outdated plugins, add dadbod-ui

This commit is contained in:
Amanda Graven 2024-01-05 09:06:34 +01:00
parent 882edc9709
commit 36f68c6ab1

157
init.lua
View file

@ -1,8 +1,5 @@
-- Do fast startup if we can
do
local ok, _ = pcall(require, 'impatient')
if not ok then vim.notify('impatient unavailable') end
end
-- Enable experimental faster module loader
vim.loader.enable()
---- Built in settings ----
-- Create a convenient aliases
@ -15,12 +12,13 @@ local opt = vim.opt
local workman = false
-- Set font
o.guifont = 'Iosevka Term Slab,Iosevka:h10'
o.guifont = 'IosevkaTermSlab Nerd Font,IosevkaTerm Nerd Font,Iosevka Term Slab,Iosevka:h10:#e-subpixelantialias'
vim.g.neovide_floating_z_height = 1
if fn.hostname() == 'tappy' then
g.neovide_refresh_rate = 144
end
opt.guicursor:append('a:blinkon1000') -- Blink cursor once a second for all modes
opt.guicursor:append('a:blinkon1000-blinkoff1000-blinkwait1000') -- Blink cursor once a second for all modes
o.mouse = 'a' -- Enable mouse input
o.termguicolors = true -- Enable 24bit terminal colors
g.neovide_confirm_quit = 1 -- Confirm closing neovide window when changes are unsaved
@ -30,6 +28,9 @@ o.clipboard = 'unnamedplus' -- Use system clipboard by default
o.hidden = true -- Allow buffers to not be attached to a window
o.linebreak = true -- Enable word-wrapping at the end of visual lines
o.breakindent = true -- preserve indentention on lines continuing from a wrap
opt.breakindentopt = {
sbr = true -- Line break character should appear before virtual indentention
}
o.hlsearch = true -- Highlight search results
o.scrolloff = 5 -- Margin between cursor and screen top/bottom
o.showmatch = true -- Highlight matching brackets
@ -50,9 +51,9 @@ opt.listchars = { -- Symbols for whitespace chars when 'list' is ena
opt.fillchars = { -- Characters to fill certain types of empty space with
diff = ' ',
fold = ' ',
foldopen= '',
foldsep=' ',
foldclose=''
foldopen = '',
foldsep = ' ',
foldclose = ''
}
opt.diffopt:append({'indent-heuristic', 'algorithm:histogram'})
if fn.has('nvim-0.10') then
@ -103,6 +104,9 @@ function _G.zoom(delta)
local properties = {
title = 'Font size',
hide_from_history = true,
on_close = function()
zoom_notification = nil
end
}
if zoom_notification ~= nil then
properties.replace = zoom_notification.id
@ -148,7 +152,7 @@ do
which_key.register { ['<C-l>'] = {function()
local ok, notify = pcall(require, 'notify')
if ok then
notify.dismiss{}
notify.dismiss {}
end
vim.lsp.buf.clear_references()
vim.cmd('nohlsearch|diffupdate|normal! <C-l>')
@ -277,7 +281,6 @@ require'packer'.startup(function(use)
-- Filetype plugins --
use 'rhysd/vim-crystal'
use 'editorconfig/editorconfig-vim'
use 'bakpakin/fennel.vim'
use 'mboughaba/i3config.vim'
use 'plasticboy/vim-markdown'
@ -285,23 +288,32 @@ require'packer'.startup(function(use)
use 'lifepillar/pgsql.vim'
use 'ajouellette/sway-vim-syntax'
use 'cespare/vim-toml'
use 'rust-lang/rust.vim'
-- Editing --
use 'LunarWatcher/auto-pairs'
use 'ojroques/nvim-bufdel'
use {'stevearc/conform.nvim', config = function()
require'conform'.setup {}
require'conform'.setup {
format_on_save = {
lsp_fallback = true,
filter = function(client)
return client.name == 'rust-analyzer'
end
}
}
vim.api.nvim_create_user_command(
'Conform',
function()
require'conform'.format()
require'conform'.format {
lsp_fallback = true,
}
end,
{}
{
desc = 'Format buffer',
}
)
end}
--use 'yuttie/comfortable-motion.vim'
use {'jbyuki/instant.nvim', config = function ()
use {'jbyuki/instant.nvim', config = function()
vim.g.instant_username = 'agraven'
end}
use {'mizlan/iswap.nvim', config = function()
@ -309,7 +321,7 @@ require'packer'.startup(function(use)
require'which-key'.register{['<Leader>s'] = {'<Cmd>ISwapWith<CR>','Swap'}}
end}
use 'bfredl/nvim-luadev' -- lua scratchpad
use {'windwp/nvim-projectconfig', config = function ()
use {'windwp/nvim-projectconfig', config = function()
require'nvim-projectconfig'.setup {
-- Load project configuration when changing directory
autocmd = true,
@ -317,10 +329,8 @@ require'packer'.startup(function(use)
end}
use 'tpope/vim-repeat'
use 'tpope/vim-sleuth'
-- spellsitter: syntax aware spellchecking
use {'lewis6991/spellsitter.nvim', config = function() require'spellsitter'.setup() end}
use 'tpope/vim-surround'
use {'vim-test/vim-test', config = function ()
use {'vim-test/vim-test', config = function()
vim.g['test#neovim#term_position'] = 'vert'
vim.g['test#strategy'] = 'neovim'
end}
@ -349,7 +359,7 @@ require'packer'.startup(function(use)
use 'mfussenegger/nvim-jdtls'
use 'simrat39/rust-tools.nvim'
use 'pmizio/typescript-tools.nvim'
use {'nvimtools/none-ls.nvim', requires = {'nvim-lua/plenary.nvim'}, config = function ()
use {'nvimtools/none-ls.nvim', requires = {'nvim-lua/plenary.nvim'}, config = function()
local null_ls = require'null-ls'
null_ls.setup {
sources = {
@ -359,7 +369,7 @@ require'packer'.startup(function(use)
}
end}
use 'SmiteshP/nvim-navic'
use {'utilyre/barbecue.nvim', config = function ()
use {'utilyre/barbecue.nvim', config = function()
require'barbecue'.setup {
show_modified = true,
}
@ -368,10 +378,14 @@ require'packer'.startup(function(use)
-- UI elements --
use 'vim-airline/vim-airline'
use 'vim-airline/vim-airline-themes'
use {'taketwo/barbar.nvim', branch = 'schedule-wrap'}
use 'romgrk/barbar.nvim'
use {'luckasRanarison/clear-action.nvim', config = function()
require'clear-action'.setup {
signs = { enable = false },
signs = {
enable = true,
combine = true,
show_count = false,
},
popup = { enable = true },
}
end}
@ -379,9 +393,23 @@ require'packer'.startup(function(use)
vim.g.bookmark_no_default_key_mappings = 1
vim.g.bookmark_save_per_working_dir = 1
end}
use {'kristijanhusak/vim-dadbod-ui', requires = {'tpope/vim-dadbod', 'kristijanhusak/vim-dadbod-completion'}, config = function()
vim.g.db_ui_use_nerd_fonts = 1
vim.g.db_ui_auto_execute_table_helpers = 1
vim.g.db_ui_win_position = 'right'
vim.o.previewheight = 40
vim.api.nvim_create_autocmd('FileType', {
group = 'luarc',
pattern = {'sql','mysql','plsql'},
callback = function()
require('cmp').setup.buffer({ sources = {{ name = 'vim-dadbod-completion' }} })
end,
desc = 'SQL dadbod completion',
})
end}
use {'mfussenegger/nvim-dap', config = function()
local dap = require'dap'
vim.fn.sign_define('DapBreakpoint', {text='', texthl='DiagnosticError'})
vim.fn.sign_define('DapBreakpoint', {text = '', texthl = 'DiagnosticError'})
dap.adapters.codelldb = {
type = 'server',
port = '${port}',
@ -533,7 +561,7 @@ require'packer'.startup(function(use)
enhanced_diff_hl = true,
}
end}
use {'stevearc/dressing.nvim', config = function()
use {'stevearc/dressing.nvim', after = 'telescope.nvim', config = function()
vim.cmd'highlight link FloatTitle TelescopeBorder'
require'dressing'.setup {
input = {
@ -587,7 +615,7 @@ require'packer'.startup(function(use)
},
}
end}
use {'rcarriga/nvim-notify', after = 'telescope.nvim', config = function ()
use {'rcarriga/nvim-notify', after = 'telescope.nvim', config = function()
require'notify'.setup {
stages = 'fade'
}
@ -596,9 +624,18 @@ require'packer'.startup(function(use)
end}
use {'stevearc/overseer.nvim', after = 'nvim-dap', config = function()
require'overseer'.setup()
vim.keymap.set('n', '<Leader>rr', '<Cmd>OverseerToggle right<CR>', { desc = "Open" })
vim.keymap.set('n', '<Leader>rn', '<Cmd>OverseerRun<CR>', { desc = "New task" })
vim.keymap.set('n', '<Leader>rc', '<Cmd>OverseerRunCmd<CR>', { desc = "Run shell command" })
require'which-key'.register {
['<Leader>r'] = {
name = 'Overseer (run tasks)',
r = {'<Cmd>OverseerToggle right<CR>', 'Open' },
R = {'<Cmd>OverseerToggle bottom<CR>', 'Open (bottom)' },
n = {'<Cmd>OverseerRun<CR>', 'New task' },
c = {'<Cmd>OverseerRunCmd<CR>', 'Run shell command' },
l = {'<Cmd>OverseerLoadBundle!<CR>', 'Load task list'},
L = {'<Cmd>OverseerLoadBundle<CR>', 'Load and start task list'},
s = {'<Cmd>OverseerSaveBundle<CR>', 'Save task list'}
}
}
end}
use 'mhinz/vim-startify'
use {'nvim-telescope/telescope.nvim', after = 'which-key.nvim', config = function()
@ -649,8 +686,8 @@ require'packer'.startup(function(use)
function()
vim.ui.input(
{ completion = 'dir' },
function(input) telescope.builtin.find_files { search_dirs = {input} }
end)
function(input) telescope.builtin.find_files { search_dirs = {input} } end
)
end,
'Files in subdirectory'
},
@ -689,7 +726,7 @@ require'packer'.startup(function(use)
require'telescope'.load_extension('ui-select')
end}
use {'nvim-telescope/telescope-dap.nvim', after = 'telescope.nvim', config = function()
require'telescope'.load_extension'dap'
require'telescope'.load_extension('dap')
end}
use {'debugloop/telescope-undo.nvim', after = 'telescope.nvim', config = function()
require'telescope'.load_extension('undo')
@ -703,17 +740,13 @@ require'packer'.startup(function(use)
}
end}
use 'kyazdani42/nvim-tree.lua'
use 'simrat39/symbols-outline.nvim'
use 'hedyhli/outline.nvim'
use {'folke/which-key.nvim', config = function() require'which-key'.setup() end}
-- Utility and libraries
use 'nvim-lua/plenary.nvim'
use 'ryanoasis/vim-devicons'
use 'kyazdani42/nvim-web-devicons'
if not vim.fn.has('nvim-0.8') then
use 'antoinemadec/FixCursorHold.nvim'
end
use 'lewis6991/impatient.nvim' -- speeds up load times
use {'ellisonleao/dotenv.nvim', config = function()
require'dotenv'.setup {
enable_on_load = false,
@ -772,19 +805,29 @@ require'which-key'.register {
['<A-b>'] = {'<Cmd>BufferPick<CR>', 'Pick buffer'},
['<A-p>'] = {'<Cmd>BufferPin<CR>', 'Pin buffer'},
['<A-d>'] = {'<Cmd>BufferClose<CR>', 'Delete buffer'},
['<A-x>'] = {'<Cmd>BufferPickDelete<CR>', 'Delete picked buffer'},
['<A-<>'] = {'<Cmd>BufferMovePrevious<CR>', 'Move buffer left'},
['<A->>'] = {'<Cmd>BufferMoveNext<CR>', 'Move buffer right'},
}
require'which-key'.register {
['<Leader>b'] = {
name = 'Buffers',
[','] = { '<Cmd>BufferPrevious<CR>', 'Next buffer'},
['.'] = { '<Cmd>BufferNext<CR>', 'Previous buffer'},
b = {'<Cmd>BufferPick<CR>', 'Pick buffer'},
p = {'<Cmd>BufferPin<CR>', 'Pin buffer'},
d = {'<Cmd>BufferClose<CR>', 'Delete buffer'},
x = {'<Cmd>BufferPickDelete<CR>', 'Delete picked buffer'},
h = {'<Cmd>BufferMovePrevious<CR>', 'Move buffer left'},
l = {'<Cmd>BufferMoveNext<CR>', 'Move buffer right'},
}
}
---- devicons ----
require'nvim-web-devicons'.setup { default = true }
---- editorconfig ----
g.EditorConfig_exclude_patterns = {'fugitive://.*'}
---- fidget ----
require'fidget'.setup {}
@ -828,6 +871,8 @@ require'gitsigns'.setup {
L = {gitsigns.toggle_current_line_blame, 'Toggle line blame'},
b = {':Gitsigns change_base ', 'Change diff base'},
B = {gitsigns.reset_base, 'Reset diff base'},
p = {gitsigns.preview_hunk_inline, 'Preview hunk'},
P = {gitsigns.preview_hunk, 'Preview hunk popup'},
}
}
end
@ -903,7 +948,7 @@ cmp.setup {
-- Complete common substring
['<C-l>'] = cmp.mapping(cmp.mapping.complete_common_string(), {'i', 'c'}),
-- Complete
['<C-Space>'] = cmp.mapping(cmp.mapping.complete{}, {'i', 'c'}),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete {}, {'i', 'c'}),
-- Confirm
['<CR>'] = cmp.mapping(cmp.mapping.confirm { select = false }, {'i', 'c'}),
},
@ -960,7 +1005,7 @@ au('LspAttach', {
if not client then return end
local function code_action()
local ok, clear_action = pcall(require, 'clear-action')
if ok then
if ok and client.name ~= 'jdtls' then
clear_action.code_action()
else
vim.lsp.buf.code_action()
@ -1144,7 +1189,6 @@ g.rustfmt_emit_files = 1
-- Use nigtly rustfmt for unstable settings
g.rustfmt_command = 'rustup run nightly rustfmt'
-- use cargo-lints if available
---- rust-tools ----
require'rust-tools'.setup {
tools = {
@ -1186,6 +1230,9 @@ require'rust-tools'.setup {
-- Enable proc macro support
enable = true,
},
rustfmt = {
extraArgs = { '+nightly' }
},
},
},
},
@ -1210,17 +1257,15 @@ g.startify_lists = {
---- symbols-outline ----
require'symbols-outline'.setup {
-- Don't display preview automatically
auto_preview = false,
-- Don't highlight the hovered item
highlight_hovered_item = true,
-- Width should be in colums, not percent
require'outline'.setup {
outline_window = {
-- Use absolute number of columns instead of percentage for sizing
relative_width = false,
-- width of the symbols window
-- Window should be 30 columns wide
width = 30,
},
}
require'which-key'.register({['<Leader>o'] = {'<Cmd>SymbolsOutline<CR>', 'Symbols outline'}})
require'which-key'.register({['<Leader>o'] = {'<Cmd>Outline<CR>', 'Symbols outline'}})
---- tree ----
@ -1246,6 +1291,8 @@ require('nvim-tree').setup {
git = {
-- Don't hide .gitignore'd files by default
ignore = false,
-- Extend timeout
timeout = 5000,
},
-- Reload the tree when its window is focused
reload_on_bufenter = true,