nvim: cosmetic changes for consistency
This commit is contained in:
parent
7e9255780e
commit
0d6c6912cd
@ -20,18 +20,16 @@ require('my/net')
|
||||
|
||||
-- reload config file after writing
|
||||
vim.api.nvim_create_augroup('config_init', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufWritePost' },
|
||||
{
|
||||
group = 'config_init',
|
||||
pattern = {
|
||||
vim.fn.stdpath('config') .. '/lua/my/*.lua',
|
||||
vim.fn.stdpath('config') .. '/init.lua'
|
||||
},
|
||||
callback = function()
|
||||
-- exclude plugins.lua, because it is sourced in another autocmd
|
||||
if not vim.api.nvim_buf_get_name(0):match('plugins.lua$') then
|
||||
vim.cmd([[source <afile>]])
|
||||
end
|
||||
vim.api.nvim_create_autocmd({ 'BufWritePost' }, {
|
||||
group = 'config_init',
|
||||
pattern = {
|
||||
vim.fn.stdpath('config') .. '/lua/my/*.lua',
|
||||
vim.fn.stdpath('config') .. '/init.lua'
|
||||
},
|
||||
callback = function()
|
||||
-- exclude plugins.lua, because it is sourced in another autocmd
|
||||
if not vim.api.nvim_buf_get_name(0):match('plugins.lua$') then
|
||||
vim.cmd([[source <afile>]])
|
||||
end
|
||||
})
|
||||
end
|
||||
})
|
||||
|
@ -17,7 +17,7 @@ require('Comment').setup({
|
||||
eol = '<Leader>cA',
|
||||
},
|
||||
pre_hook = function(ctx)
|
||||
local comment_utils = require "Comment.utils"
|
||||
local comment_utils = require('Comment.utils')
|
||||
local context_utils = require('ts_context_commentstring.utils')
|
||||
local context_internal = require('ts_context_commentstring.internal')
|
||||
|
||||
@ -30,8 +30,8 @@ require('Comment').setup({
|
||||
end
|
||||
|
||||
return context_internal.calculate_commentstring {
|
||||
key = ctx.ctype == comment_utils.ctype.line and "__default" or
|
||||
"__multiline",
|
||||
key = ctx.ctype == comment_utils.ctype.line and '__default' or
|
||||
'__multiline',
|
||||
location = location,
|
||||
}
|
||||
end
|
||||
@ -49,24 +49,20 @@ map('n', '<Leader>gg', neogit.open, 'Open Neogit')
|
||||
|
||||
-- start git commits in insert mode
|
||||
vim.api.nvim_create_augroup('config_coding', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'FileType' },
|
||||
{
|
||||
group = 'config_coding',
|
||||
pattern = { 'gitcommit', 'gitrebase' },
|
||||
command = [[startinsert | 1]]
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'FileType' }, {
|
||||
group = 'config_coding',
|
||||
pattern = { 'gitcommit', 'gitrebase' },
|
||||
command = [[startinsert | 1]]
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'FileType' },
|
||||
{
|
||||
group = 'config_coding',
|
||||
pattern = { 'Neogit*' },
|
||||
command = [[set nolist]]
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'FileType' }, {
|
||||
group = 'config_coding',
|
||||
pattern = { 'Neogit*' },
|
||||
command = [[set nolist]]
|
||||
})
|
||||
|
||||
|
||||
require("luasnip.loaders.from_lua").load({
|
||||
require('luasnip.loaders.from_lua').load({
|
||||
paths = vim.fn.stdpath('config') .. '/snippets'
|
||||
})
|
||||
|
||||
@ -79,7 +75,7 @@ require('gitsigns').setup({
|
||||
end
|
||||
})
|
||||
|
||||
require("project_nvim").setup({
|
||||
require('project_nvim').setup({
|
||||
patterns = require('my.functions').project_root_markers,
|
||||
show_hidden = true
|
||||
})
|
||||
|
@ -16,14 +16,12 @@ require('orgmode').setup {}
|
||||
require('orgmode').setup_ts_grammar()
|
||||
|
||||
vim.api.nvim_create_augroup('config_fileformats', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufEnter' },
|
||||
{
|
||||
group = 'config_fileformats',
|
||||
pattern = { '*.org' },
|
||||
callback = function()
|
||||
-- allow to hide stuff, like links
|
||||
vim.opt_local.conceallevel = 2
|
||||
vim.opt_local.concealcursor = 'nc'
|
||||
end
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
|
||||
group = 'config_fileformats',
|
||||
pattern = { '*.org' },
|
||||
callback = function()
|
||||
-- allow to hide stuff, like links
|
||||
vim.opt_local.conceallevel = 2
|
||||
vim.opt_local.concealcursor = 'nc'
|
||||
end
|
||||
})
|
||||
|
@ -14,17 +14,14 @@ function M.remove_trailing_whitespace()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_augroup('config_functions', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufWritePre' },
|
||||
{
|
||||
group = 'config_functions',
|
||||
pattern = {
|
||||
'*.lua', '*.cpp', '*.hpp',
|
||||
'*.conf', '*.cfg', '*.ini', '*.adoc'
|
||||
},
|
||||
callback = M.remove_trailing_whitespace
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
|
||||
group = 'config_functions',
|
||||
pattern = {
|
||||
'*.lua', '*.cpp', '*.hpp',
|
||||
'*.conf', '*.cfg', '*.ini', '*.adoc'
|
||||
},
|
||||
callback = M.remove_trailing_whitespace
|
||||
})
|
||||
|
||||
-- Insert or update a modeline at the bottom of the buffer
|
||||
function M.insert_modeline()
|
||||
|
@ -74,7 +74,7 @@ end
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(
|
||||
vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, {
|
||||
border = 'rounded',
|
||||
width = 60,
|
||||
@ -171,6 +171,6 @@ if vim.fn.executable('vscode-json-language-server') > 0 then
|
||||
})
|
||||
end
|
||||
|
||||
require("lsp-format").setup({
|
||||
require('lsp-format').setup({
|
||||
sync = true -- seems to be needed to not interfere with Neogit
|
||||
})
|
||||
|
@ -24,20 +24,18 @@ if vim.g.started_by_firenvim then
|
||||
|
||||
local fv_fileprefix = vim.env['XDG_RUNTIME_DIR'] .. '/firenvim/'
|
||||
vim.api.nvim_create_augroup('firenvim', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufEnter' },
|
||||
{
|
||||
group = 'firenvim',
|
||||
pattern = {
|
||||
fv_fileprefix .. 'schlomp\\.space_*',
|
||||
fv_fileprefix .. 'codeberg\\.org_*',
|
||||
fv_fileprefix .. 'gitlab\\.com_*',
|
||||
fv_fileprefix .. 'github\\.com_*',
|
||||
fv_fileprefix .. 'very\\.tastytea\\.de_*',
|
||||
fv_fileprefix .. 'bookwyrm\\.social_*',
|
||||
fv_fileprefix .. 'openlibrary\\.org_*',
|
||||
fv_fileprefix .. 'bugs\\.gentoo\\.org_*',
|
||||
},
|
||||
command = [[set filetype=markdown | set tw=0]]
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
|
||||
group = 'firenvim',
|
||||
pattern = {
|
||||
fv_fileprefix .. 'schlomp\\.space_*',
|
||||
fv_fileprefix .. 'codeberg\\.org_*',
|
||||
fv_fileprefix .. 'gitlab\\.com_*',
|
||||
fv_fileprefix .. 'github\\.com_*',
|
||||
fv_fileprefix .. 'very\\.tastytea\\.de_*',
|
||||
fv_fileprefix .. 'bookwyrm\\.social_*',
|
||||
fv_fileprefix .. 'openlibrary\\.org_*',
|
||||
fv_fileprefix .. 'bugs\\.gentoo\\.org_*',
|
||||
},
|
||||
command = [[set filetype=markdown | set tw=0]]
|
||||
})
|
||||
end
|
||||
|
@ -133,27 +133,18 @@ end)
|
||||
|
||||
-- source file, install and compile plugins when this file is written
|
||||
vim.api.nvim_create_augroup('config_plugins', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufWritePost' },
|
||||
{
|
||||
group = 'config_plugins',
|
||||
pattern = { vim.fn.stdpath('config') .. '/lua/my/plugins.lua' },
|
||||
command = [[source <afile> | PackerInstall]]
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'User' },
|
||||
{
|
||||
group = 'config_plugins',
|
||||
pattern = 'PackerComplete',
|
||||
command = [[PackerCompile]]
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'User' },
|
||||
{
|
||||
group = 'config_plugins',
|
||||
pattern = 'PackerCompileDone',
|
||||
command = [[echo 'plugins compiled']]
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd({ 'BufWritePost' }, {
|
||||
group = 'config_plugins',
|
||||
pattern = { vim.fn.stdpath('config') .. '/lua/my/plugins.lua' },
|
||||
command = [[source <afile> | PackerInstall]]
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'User' }, {
|
||||
group = 'config_plugins',
|
||||
pattern = 'PackerComplete',
|
||||
command = [[PackerCompile]]
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'User' }, {
|
||||
group = 'config_plugins',
|
||||
pattern = 'PackerCompileDone',
|
||||
command = [[echo 'plugins compiled']]
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user