Overseer, conform, splitkeep, formatting, smoothscroll

- Add overseer.nvim
- Add conform.nvim
- Set splitkeep, remove stabilize.nvim
- Set smoothscroll when nightly is available
- Set exrc
- Make formatting more consistent
main
Amanda Graven 2023-11-30 15:43:20 +01:00
parent bca7124e96
commit 882edc9709
1 changed files with 81 additions and 58 deletions

View File

@ -35,6 +35,7 @@ o.scrolloff = 5 -- Margin between cursor and screen top/bottom
o.showmatch = true -- Highlight matching brackets
o.splitright = true -- Open new windows below
o.splitbelow = true -- Open new windows to the right
o.splitkeep = 'screen' -- Keep window position when creating splits
o.title = true -- Set title of terminal window
o.updatetime = 300 -- Write swap file every 300 ms (supposedly reduces delays)
o.foldlevel = 99 -- Keep all folds open
@ -54,6 +55,10 @@ opt.fillchars = { -- Characters to fill certain types of empty space
foldclose=''
}
opt.diffopt:append({'indent-heuristic', 'algorithm:histogram'})
if fn.has('nvim-0.10') then
o.smoothscroll = true -- Scroll by screen lines instead of physical lines
opt.display:append('lastline')
end
o.tabstop = 4 -- A physical tab is 4 characters wide
o.shiftwidth = 4 -- A unit of indentention is 4 levels wide
@ -62,8 +67,11 @@ o.textwidth = 0 -- Comments lines should wrap at 100 chars
o.laststatus = 3 -- Use one global status bar
-- Set <Leader> key
g.mapleader = ' '
g.maplocalleader = '\\'
vim.cmd 'filetype plugin indent on'
o.exrc = true -- Load .nvim.lua .nvimrc and .exrc files
-- Enable persistent undo
if fn.has('persistent_undo') then
o.undodir = fn.stdpath('data') .. '/undo'
@ -282,6 +290,16 @@ require'packer'.startup(function(use)
-- Editing --
use 'LunarWatcher/auto-pairs'
use 'ojroques/nvim-bufdel'
use {'stevearc/conform.nvim', config = function()
require'conform'.setup {}
vim.api.nvim_create_user_command(
'Conform',
function()
require'conform'.format()
end,
{}
)
end}
--use 'yuttie/comfortable-motion.vim'
use {'jbyuki/instant.nvim', config = function ()
vim.g.instant_username = 'agraven'
@ -350,7 +368,7 @@ require'packer'.startup(function(use)
-- UI elements --
use 'vim-airline/vim-airline'
use 'vim-airline/vim-airline-themes'
use 'romgrk/barbar.nvim'
use {'taketwo/barbar.nvim', branch = 'schedule-wrap'}
use {'luckasRanarison/clear-action.nvim', config = function()
require'clear-action'.setup {
signs = { enable = false },
@ -530,7 +548,7 @@ require'packer'.startup(function(use)
},
}
end}
use {'j-hui/fidget.nvim', branch = 'legacy'}
use {'j-hui/fidget.nvim', config = function() require'fidget'.setup() end}
use 'tpope/vim-fugitive'
use 'tpope/vim-rhubarb'
use 'shumphrey/fugitive-gitlab.vim'
@ -576,8 +594,11 @@ require'packer'.startup(function(use)
vim.notify = require'notify'
require'telescope'.load_extension('notify')
end}
use {'luukvbaal/stabilize.nvim', config = function()
require'stabilize'.setup()
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" })
end}
use 'mhinz/vim-startify'
use {'nvim-telescope/telescope.nvim', after = 'which-key.nvim', config = function()
@ -624,11 +645,15 @@ require'packer'.startup(function(use)
["<Space>"] = {'<Cmd>Telescope<CR>', 'List pickers'},
f = {'<Cmd>Telescope find_files<CR>', 'Files'},
F = {'<Cmd>Telescope file_browser<CR>', 'File browser'},
['<C-f>'] = {function ()
vim.ui.input({ completion = 'dir' }, function (input)
telescope.builtin.find_files { search_dirs = {input} }
['<C-f>'] = {
function()
vim.ui.input(
{ completion = 'dir' },
function(input) telescope.builtin.find_files { search_dirs = {input} }
end)
end, 'Files in subdirectory'},
end,
'Files in subdirectory'
},
d = {'<Cmd>Telescope find_files find_command=fd,--type,d,-I<CR>', 'Directories'},
r = {'<Cmd>Telescope oldfiles<CR>', 'Recent files'},
g = {'<Cmd>Telescope live_grep<CR>', 'Grep'},
@ -932,6 +957,7 @@ au('LspAttach', {
callback = function(event)
local bufnr = event.buf
local client = vim.lsp.get_client_by_id(event.data.client_id)
if not client then return end
local function code_action()
local ok, clear_action = pcall(require, 'clear-action')
if ok then
@ -947,7 +973,7 @@ au('LspAttach', {
i = {'<Cmd>Telescope lsp_implementations<CR>', 'Implementation'},
a = {code_action, 'Code action'},
r = {vim.lsp.buf.rename, 'Rename'},
h = {function() vim.lsp.inlay_hint(0, nil) end, 'Inlay hints'},
h = {function() vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled()) end, 'Inlay hints'},
l = {vim.lsp.codelens.refresh, 'Show codelenses'},
L = {vim.lsp.codelens.run, 'Run codelens'},
t = {'<Cmd>Telescope lsp_type_definitions<CR>', 'Type definition'},
@ -983,9 +1009,14 @@ au('LspAttach', {
}, {buffer = bufnr, mode = 'i'})
vim.bo.tagfunc = 'v:lua.vim.lsp.tagfunc'
if pcall(require, 'conform') == true then
vim.bo.formatexpr = "v:lua.require'conform'.formatexpr()"
end
if client.server_capabilities.documentSymbolProvider then
require'nvim-navic'.attach(client, bufnr)
end
end
})
-- Enable language servers
@ -1140,24 +1171,16 @@ require'rust-tools'.setup {
loadOutDirsFromCheck = true,
},
checkOnSave = true,
-- Use cargo lints for error checking if available, otherwise fall back to regular clippy
check = (function()
if vim.fn.executable('cargo-lints') then
return {
overrideCommand = {"cargo", "lints", "clippy", "--workspace", "--message-format=json", "--all-targets"}
}
else
return {
-- Error checking settings
check = {
-- Use clippy for error checking
command = "clippy",
-- Also run checks for tests
allTargets = true,
}
end
end)(),
},
diagnostics = {
-- Disable diagnostics with false positives
disabled = {'unresolved-import'};
disabled = {'unresolved-import'},
},
procMacro = {
-- Enable proc macro support