summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authortalha <->2025-07-22 14:35:04 +0500
committertalha <->2025-07-22 14:35:04 +0500
commit219cbfebffa3d90f5750b12006a5c8c9b57e0b62 (patch)
tree34547f0a6b2e40e2cdd1f0b8b8b607e170af371a /init.lua
parent4179cfdb4dc62f08013314a2c4eca06d0ed5a072 (diff)
Updated config with some ergonomic changes and html snippets
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua29
1 files changed, 25 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index 74f6466..e061d87 100644
--- a/init.lua
+++ b/init.lua
@@ -1,7 +1,11 @@
vim.opt.tabstop = 8
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
-vim.opt.expandtab = false
+vim.opt.expandtab = true
+
+vim.opt.autoindent = true
+vim.opt.cindent = true
+vim.opt.smartindent = false
vim.opt.number = true
vim.opt.relativenumber = true
@@ -17,7 +21,6 @@ vim.opt.termguicolors = true
vim.opt.cursorline = true
vim.opt.scrolloff = 8
vim.opt.updatetime = 50
-vim.opt.clipboard = "unnamedplus"
vim.opt.linebreak = false
vim.cmd[[let &showbreak = "> "]]
@@ -55,7 +58,7 @@ vim.keymap.set('i', "<C-l>", "<Del>")
-- @block: c-list navigation
vim.keymap.set("n", "<A-n>", function() SafeCListNav(1) end)
vim.keymap.set("n", "<A-p>", function() SafeCListNav(-1) end)
-vim.keymap.set("n", "<A-w>", vim.cmd.cw)
+vim.keymap.set("n", "<A-l>", vim.cmd.cw)
--[[
@block: tab navigation
@@ -86,7 +89,6 @@ vim.api.nvim_create_autocmd("TextYankPost", {
end,
})
--- @func: write lines using lua
function WriteText(toWrite)
if not toWrite then
return
@@ -95,3 +97,22 @@ function WriteText(toWrite)
vim.api.nvim_buf_set_text(0, posYX[1]-1, posYX[2], posYX[1]-1, posYX[2], { toWrite })
end
+function WriteLines(toWrite)
+ if not toWrite then
+ return
+ end
+ local posYX = vim.api.nvim_win_get_cursor(0)
+ print(posYX[0], posYX[1], posYX[2])
+ vim.api.nvim_buf_set_lines(0, posYX[1]-1, posYX[2], true, toWrite)
+end
+
+function StrSplit(inpstr, sep)
+ if not sep then
+ sep = "%s"
+ end
+ local str_list = {}
+ for str in string.gmatch(inpstr, "([^"..sep.."]+)") do
+ table.insert(str_list, str)
+ end
+ return str_list
+end