wrap plugin
This commit is contained in:
@@ -1,8 +1 @@
|
||||
local o = vim.opt_local
|
||||
|
||||
o.wrap = true
|
||||
o.linebreak = true
|
||||
o.breakindent = true
|
||||
o.textwidth = 0
|
||||
o.colorcolumn = ""
|
||||
o.formatoptions:remove({ "t" })
|
||||
require("romanzy.custom.wrap").toggle(true)
|
||||
|
||||
1
nvim/.config/nvim/after/ftplugin/text.lua
Normal file
1
nvim/.config/nvim/after/ftplugin/text.lua
Normal file
@@ -0,0 +1 @@
|
||||
require("romanzy.custom.wrap").toggle(true)
|
||||
1
nvim/.config/nvim/after/ftplugin/txt.lua
Normal file
1
nvim/.config/nvim/after/ftplugin/txt.lua
Normal file
@@ -0,0 +1 @@
|
||||
require("romanzy.custom.wrap").toggle(true)
|
||||
1
nvim/.config/nvim/after/ftplugin/typst.lua
Normal file
1
nvim/.config/nvim/after/ftplugin/typst.lua
Normal file
@@ -0,0 +1 @@
|
||||
require("romanzy.custom.wrap").toggle(true)
|
||||
@@ -16,6 +16,9 @@ function M.render()
|
||||
return table.concat(parts)
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
_G.RomanzyTabline = M.render
|
||||
vim.opt.tabline = "%!v:lua.RomanzyTabline()"
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
17
nvim/.config/nvim/lua/romanzy/custom/wrap.lua
Normal file
17
nvim/.config/nvim/lua/romanzy/custom/wrap.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
local M = {}
|
||||
|
||||
--- Toggle wrapping, or force it to the provided state.
|
||||
--- @param enabled? boolean
|
||||
function M.toggle(enabled)
|
||||
if enabled == nil then
|
||||
enabled = not vim.wo.wrap
|
||||
end
|
||||
|
||||
vim.wo.wrap = enabled
|
||||
vim.wo.linebreak = enabled
|
||||
vim.wo.breakindent = enabled
|
||||
vim.bo.textwidth = enabled and 80 or 0
|
||||
vim.bo.wrapmargin = 0
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -26,12 +26,7 @@ map("n", "<leader>fg", telescope_picker("live_grep"), { desc = "live grep" })
|
||||
map("n", "<leader>fb", telescope_picker("buffers"), { desc = "find buffers" })
|
||||
map("n", "<leader>fh", telescope_picker("help_tags"), { desc = "help tags" })
|
||||
map("n", "<leader>lg", "<Cmd>LazyGit<CR>", { desc = "open lazygit" })
|
||||
map("n", "<leader>tw", function()
|
||||
local wrap = not vim.wo.wrap
|
||||
vim.wo.wrap = wrap
|
||||
vim.wo.linebreak = wrap
|
||||
vim.wo.breakindent = wrap
|
||||
end, { desc = "toggle soft wrap" })
|
||||
map("n", "<leader>tw", require("romanzy.custom.wrap").toggle, { desc = "toggle soft wrap" })
|
||||
|
||||
map("n", "<leader>sv", "<Cmd>vs<CR>", { desc = "split vertical" })
|
||||
map("n", "<leader>sh", "<Cmd>sp<CR>", { desc = "split horizontal" })
|
||||
|
||||
@@ -12,7 +12,6 @@ o.textwidth = 80 -- Wraps inserted text after 80 columns when formatting
|
||||
o.scrolloff = 8 -- Keeps context lines visible around the cursor.
|
||||
o.signcolumn = "yes" -- Always reserves space for signs in the gutter.
|
||||
o.colorcolumn = "+1" -- Highlights the preferred maximum line width.
|
||||
o.wrap = false -- Prevents long lines from wrapping on screen.
|
||||
o.list = true -- Displays whitespace characters using listchars.
|
||||
o.listchars = {
|
||||
tab = "» ",
|
||||
@@ -35,7 +34,6 @@ o.pumheight = 8 -- Limits the compl
|
||||
o.updatetime = 50 -- Reduces idle delay for swap and CursorHold events.
|
||||
o.spelllang = { "en_us" } -- Uses US English for spell checking.
|
||||
o.shell = "bash" -- Runs shell commands through bash.
|
||||
o.tabline = "%!v:lua.RomanzyTabline()" -- Shows native tabs with custom labels.
|
||||
|
||||
-- Only show the invisible characters inside the code editing buffers
|
||||
vim.cmd([[autocmd BufWinEnter * if &buftype != '' | setlocal nolist | endif]])
|
||||
|
||||
@@ -7,6 +7,4 @@ require("romanzy.plugins.nvim-treesitter")
|
||||
require("romanzy.plugins.conform")
|
||||
require("romanzy.plugins.lsp")
|
||||
require("romanzy.plugins.codamheader")
|
||||
|
||||
-- custom "plugins"
|
||||
require("romanzy.custom.tabline")
|
||||
require("romanzy.plugins.romanzy")
|
||||
|
||||
2
nvim/.config/nvim/lua/romanzy/plugins/romanzy.lua
Normal file
2
nvim/.config/nvim/lua/romanzy/plugins/romanzy.lua
Normal file
@@ -0,0 +1,2 @@
|
||||
require("romanzy.custom.tabline").setup()
|
||||
require("romanzy.custom.wrap").toggle(false)
|
||||
Reference in New Issue
Block a user