Removed the need for my own augroup helper
This commit is contained in:
parent
7c77d3a8dd
commit
c610d1ce1a
|
@ -1 +1,2 @@
|
||||||
vim.cmd("syntax hkf")
|
vim.cmd("syntax hkf")
|
||||||
|
vim.api.nvim_buf_set_option(0, "commentstring", "-- %s")
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
local M = {}
|
|
||||||
|
|
||||||
function M.augroup(name, inside)
|
|
||||||
vim.cmd('augroup ' .. name)
|
|
||||||
vim.cmd('autocmd!')
|
|
||||||
inside()
|
|
||||||
vim.cmd('augroup END')
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.autocmd(event, glob, action)
|
|
||||||
vim.cmd('autocmd ' .. event .. ' ' .. glob .. ' ' .. action)
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
|
@ -2,14 +2,6 @@ local M = {}
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
vim.o.foldmethod = "marker"
|
vim.o.foldmethod = "marker"
|
||||||
|
|
||||||
-- vim.cmd([[
|
|
||||||
-- augroup remember_folds
|
|
||||||
-- autocmd!
|
|
||||||
-- autocmd BufWinLeave *.* if &ft !=# 'help' | mkview | endif
|
|
||||||
-- autocmd BufWinEnter *.* if &ft !=# 'help' | silent! loadview | endif
|
|
||||||
-- augroup END
|
|
||||||
-- ]])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
local A = require("my.helpers.augroup")
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
local extraCommentStrings = { lean = "/- %s -/", bkf = "-- %s" }
|
|
||||||
|
|
||||||
-- Update comments for certain languages
|
|
||||||
function M.setCommentString(extension, commentString)
|
|
||||||
A.augroup('set-commentstring-' .. extension, function()
|
|
||||||
local action =
|
|
||||||
':lua vim.api.nvim_buf_set_option(0, "commentstring", "' ..
|
|
||||||
commentString .. '")'
|
|
||||||
|
|
||||||
A.autocmd('BufEnter', '*.' .. extension, action)
|
|
||||||
A.autocmd('BufFilePost', '*.' .. extension, action)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
require('nvim_comment').setup()
|
|
||||||
|
|
||||||
for lang, commentString in pairs(extraCommentStrings) do
|
|
||||||
M.setCommentString(lang, commentString)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
|
@ -4,6 +4,7 @@ local M = {}
|
||||||
function M.setup()
|
function M.setup()
|
||||||
require('nvim-autopairs').setup()
|
require('nvim-autopairs').setup()
|
||||||
require "gitlinker".setup()
|
require "gitlinker".setup()
|
||||||
|
require('nvim_comment').setup()
|
||||||
|
|
||||||
vscode.unless(function()
|
vscode.unless(function()
|
||||||
require("presence"):setup({})
|
require("presence"):setup({})
|
||||||
|
@ -20,7 +21,6 @@ function M.setup()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
require("my.plugins.neogit").setup()
|
require("my.plugins.neogit").setup()
|
||||||
require("my.plugins.comment").setup()
|
|
||||||
require("my.plugins.telescope").setup()
|
require("my.plugins.telescope").setup()
|
||||||
|
|
||||||
-- require("my.plugins.idris").setup()
|
-- require("my.plugins.idris").setup()
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
local A = require("my.helpers.augroup")
|
|
||||||
local arpeggio = require("my.plugins.arpeggio")
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
local extraBrackets = {
|
|
||||||
lean = { { "⟨", "⟩" } }, -- lean
|
|
||||||
all = {
|
|
||||||
-- {"(", ")"}, {"[", "]"}, {"'", "'"}, {'"', '"'}, {"{", "}"}, {"`", "`"}
|
|
||||||
} -- more general stuff
|
|
||||||
}
|
|
||||||
|
|
||||||
function M.createBracketCommand(lhs, rhs, isGlobal, opts)
|
|
||||||
local suffix = ""
|
|
||||||
if isGlobal then suffix = "!" end
|
|
||||||
|
|
||||||
return ":Brackets" .. suffix .. " " .. lhs .. " " .. rhs .. " " ..
|
|
||||||
(opts or "")
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.createBracket(lhs, rhs, isGlobal, opts)
|
|
||||||
vim.cmd(M.createBracketCommand(lhs, rhs, isGlobal, opts))
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.setup()
|
|
||||||
|
|
||||||
if arpeggio == nil then return end
|
|
||||||
|
|
||||||
vim.g.marker_define_jump_mappings = 0 -- disable automatic binding of marker jumping (conflicts with tmux-vim-navigator)
|
|
||||||
|
|
||||||
arpeggio.chord("nv", "sj", '<Plug>MarkersJumpF')
|
|
||||||
arpeggio.chord("nv", "sk", '<Plug>MarkersJumpB')
|
|
||||||
arpeggio.chord("nv", "mi", '<Plug>MarkersMark')
|
|
||||||
arpeggio.chord("nv", "ml", '<Plug>MarkersCloseAllAndJumpToLast')
|
|
||||||
arpeggio.chord("nv", "mo", '<Plug>MarkersJumpOutside')
|
|
||||||
|
|
||||||
for key, brackets in pairs(extraBrackets) do
|
|
||||||
A.augroup('custom-brackets' .. key, function()
|
|
||||||
for _, v in ipairs(brackets) do
|
|
||||||
local action = M.createBracketCommand(v[1], v[2], 0, v[3] or "")
|
|
||||||
local glob = '*.' .. key
|
|
||||||
|
|
||||||
if key == "all" then
|
|
||||||
-- The all key just matches everything
|
|
||||||
glob = "*"
|
|
||||||
end
|
|
||||||
|
|
||||||
A.autocmd('BufEnter', glob, action)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
|
@ -1,7 +1,6 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local function map(buf, mode, lhs, rhs, opts)
|
local function map(buf, mode, lhs, rhs, opts)
|
||||||
|
|
||||||
local options = { noremap = true, silent = true }
|
local options = { noremap = true, silent = true }
|
||||||
if opts then options = vim.tbl_extend('force', options, opts) end
|
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||||
vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options)
|
vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options)
|
||||||
|
@ -11,14 +10,14 @@ function M.on_attach(client, bufnr)
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
|
|
||||||
if client.server_capabilities.documentFormattingProvider then
|
if client.server_capabilities.documentFormattingProvider then
|
||||||
print("Initializing formatter...")
|
print("Initializing formatter...")
|
||||||
vim.cmd([[
|
|
||||||
augroup LspFormatting
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
autocmd! * <buffer>
|
group = vim.api.nvim_create_augroup("LspFormatting", {}),
|
||||||
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
|
callback = vim.lsp.buf.formatting_sync
|
||||||
augroup END
|
})
|
||||||
]])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
print("Setting up keybinds...")
|
print("Setting up keybinds...")
|
||||||
|
|
Loading…
Reference in a new issue