minor updates to neovim

This commit is contained in:
Solomon Laing 2023-10-04 16:16:44 +10:30
parent cbbb629cd5
commit ccda49b8dc
5 changed files with 1 additions and 103 deletions

View File

@ -92,15 +92,5 @@ autocmd BufWritePre *.[ch] %s/\%$/\r/e
autocmd BufWritePre * cal cursor(currPos[1], currPos[2]) autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
]]) ]])
-- Recompile and restart Xmonad on save of config file for Xmonad or Xmobar
vim.cmd(
[[autocmd BufWritePost ~/.xmonad/xmonad.hs,~/.config/xmobar/xmobar-main.hs,~/.config/xmobar/xmobar-sub.hs,~/.config/xmobar/xmobar-single.hs !xmonad --recompile && xmonad --restart]]
)
-- Run custom textclear command when exiting a .tex file (cleanup files) -- Run custom textclear command when exiting a .tex file (cleanup files)
vim.cmd([[autocmd VimLeave *.tex !texclear %]]) vim.cmd([[autocmd VimLeave *.tex !texclear %]])
-- Run install when editing my scripts
vim.cmd([[
autocmd BufWritePost ~/repos/inks-scripts/scripts/** !~/repos/inks-scripts/install
]])

View File

@ -52,10 +52,3 @@ map("i", "jk", "<ESC>", opts)
-- Indenting -- Indenting
map("v", "<", "<gv", opts) map("v", "<", "<gv", opts)
map("v", ">", ">gv", opts) map("v", ">", ">gv", opts)
-- Move text up and down
map("v", "<C-j>", ":m .+1<CR>==<ESC>V", opts)
map("v", "<C-k>", ":m .-2<CR>==<ESC>V", opts)
-- Don't have a terminal implemented yet but when I do...
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })

View File

@ -56,6 +56,3 @@ end
vim.cmd("set whichwrap+=<,>,[,],h,l") vim.cmd("set whichwrap+=<,>,[,],h,l")
vim.cmd("set colorcolumn=80") vim.cmd("set colorcolumn=80")
vim.cmd([[set iskeyword+=-]]) vim.cmd([[set iskeyword+=-]])
-- fix markdown indentation settings
vim.g.markdown_recommended_style = 0

View File

@ -1,71 +0,0 @@
return {
{
"echasnovski/mini.starter",
enabled = false,
version = false, -- wait till new 0.7.0 release to put it back on semver
event = "VimEnter",
config = function()
local logo = table.concat({
"██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z",
"██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z",
"██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z",
"██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z",
"███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║",
"╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝",
}, "\n")
local pad = string.rep(" ", 22)
local new_section = function(name, action, section)
return { name = name, action = action, section = pad .. section }
end
local starter = require("mini.starter")
--stylua: ignore
local config = {
evaluate_single = true,
header = logo,
items = {
new_section("Find file", "Telescope find_files", "Telescope"),
new_section("Recent files", "Telescope oldfiles", "Telescope"),
new_section("Grep text", "Telescope live_grep", "Telescope"),
new_section("init.lua", "e $MYVIMRC", "Config"),
new_section("Lazy", "Lazy", "Config"),
new_section("New file", "ene | startinsert", "Built-in"),
new_section("Quit", "qa", "Built-in"),
},
content_hooks = {
starter.gen_hook.adding_bullet(pad .. "", false),
starter.gen_hook.aligning("center", "center"),
},
}
-- close Lazy and re-open when starter is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "MiniStarterOpened",
callback = function()
require("lazy").show()
end,
})
end
starter.setup(config)
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted",
callback = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
local pad_footer = string.rep(" ", 8)
MiniStarter.config.footer = pad_footer
.. "⚡ Neovim loaded "
.. stats.count
.. " plugins in "
.. ms
.. "ms"
pcall(MiniStarter.refresh)
end,
})
end,
},
}

View File

@ -26,7 +26,7 @@ function M.get_root()
---@type string[] ---@type string[]
local roots = {} local roots = {}
if path then if path then
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do
local workspace = client.config.workspace_folders local workspace = client.config.workspace_folders
local paths = workspace local paths = workspace
and vim.tbl_map(function(ws) and vim.tbl_map(function(ws)
@ -82,17 +82,6 @@ function M.toggle(option, silent, values)
end end
end end
-- FIXME: create a togglable termiminal
-- Opens a floating terminal (interactive by default)
---@param cmd? string[]|string
---@param opts? LazyCmdOptions|{interactive?:boolean}
function M.float_term(cmd, opts)
opts = vim.tbl_deep_extend("force", {
size = { width = 0.9, height = 0.9 },
}, opts or {})
require("lazy.util").float_term(cmd, opts)
end
local enabled = true local enabled = true
function M.toggle_diagnostics() function M.toggle_diagnostics()
enabled = not enabled enabled = not enabled