From 219cbfebffa3d90f5750b12006a5c8c9b57e0b62 Mon Sep 17 00:00:00 2001
From: talha <->
Date: Tue, 22 Jul 2025 14:35:04 +0500
Subject: Updated config with some ergonomic changes and html snippets
---
after/ftplugin/cpp.lua | 2 +-
after/ftplugin/html.lua | 71 +++++++++++++++++++++++++++++++++++++++++++++---
after/ftplugin/netrw.lua | 3 ++
colors/nofrils-acme.vim | 12 ++++----
init.lua | 29 +++++++++++++++++---
5 files changed, 103 insertions(+), 14 deletions(-)
diff --git a/after/ftplugin/cpp.lua b/after/ftplugin/cpp.lua
index c933d5b..f3bcf24 100644
--- a/after/ftplugin/cpp.lua
+++ b/after/ftplugin/cpp.lua
@@ -1 +1 @@
-vim.opt.cinoptions = 'l1'
+vim.opt.cinoptions = 'l1(0'
diff --git a/after/ftplugin/html.lua b/after/ftplugin/html.lua
index e3ff637..3a318c8 100644
--- a/after/ftplugin/html.lua
+++ b/after/ftplugin/html.lua
@@ -4,19 +4,48 @@ function Snippets(snipType, value)
if snipType == "comment" then
snippet = [[]]
elseif snipType == "tag" then
- snippet = string.format("<%s> %s>", value, value)
+ snippet = string.format("<%s>%s>", value, value)
+ elseif snipType == "linebreak" then
+ snippet = [[]]
+ elseif snipType == "hrline" then
+ snippet = [[
]]
+ elseif snipType == "link" then
+ snippet = string.format([[%s]],
+ value["url"], value["label"]
+ )
+ elseif snipType == "pieces" then
+ if value == "document" then
+ snippet = [[
+
+
+
+
+
+
+
+
+
+ ]]
+ elseif value == "paper" then
+ snippet = [[
+
+ ]]
+ end
end
return snippet
end
function JumpInTag()
- vim.cmd("normal! f>w")
+ vim.cmd("normal! f>l")
end
-- keymaps to insert snippets
vim.keymap.set('i', "", function()
WriteText(Snippets("comment"))
- jumpInTag()
end, {noremap=true})
vim.keymap.set('i', "", function()
@@ -26,12 +55,46 @@ end, {noremap=true})
vim.keymap.set('i', "", function()
WriteText(Snippets("tag", "b"))
- vim.cmd("normal! f>w")
JumpInTag()
end, {noremap=true})
+vim.keymap.set('i', "", function()
+ WriteText(Snippets("linebreak"))
+end, {noremap=true})
+
+vim.keymap.set('i', "", function()
+ WriteText(Snippets("hrline"))
+end, {noremap=true})
+
vim.keymap.set('i', "", function()
inp = vim.fn.input("Tag: ", "", "file")
WriteText(Snippets("tag", inp))
JumpInTag()
end, {remap=true})
+
+vim.keymap.set('i', "", function()
+ url = vim.fn.input("URL: ", "", "file")
+ label = vim.fn.input("label: ", "", "file")
+ value = {}
+ value.url = url
+ value.label = label
+ WriteText(
+ Snippets("link", value)
+ )
+ JumpInTag()
+end, {remap=true})
+
+vim.keymap.set('i', "", function()
+ dt = os.date("%Y/%m/%d")
+ WriteText(dt)
+end)
+
+vim.keymap.set('i', "", function()
+ name = vim.fn.input("name: ", "", "file")
+ WriteLines(
+ StrSplit(Snippets("pieces", name), '\n')
+ )
+end)
+
+
+
diff --git a/after/ftplugin/netrw.lua b/after/ftplugin/netrw.lua
index 50d4181..3036211 100644
--- a/after/ftplugin/netrw.lua
+++ b/after/ftplugin/netrw.lua
@@ -1,3 +1,6 @@
+vim.opt.number = true
+vim.opt.relativenumber = true
+
vim.keymap.set('n', "h", "NetrwBrowseUpDir", { buffer = true})
vim.keymap.set('n', "l", "NetrwLocalBrowseCheck", { buffer = true})
diff --git a/colors/nofrils-acme.vim b/colors/nofrils-acme.vim
index a31f1cd..d720c08 100644
--- a/colors/nofrils-acme.vim
+++ b/colors/nofrils-acme.vim
@@ -36,7 +36,7 @@ hi NonText term=NONE cterm=NONE ctermfg=136 ctermbg=NONE gui=NONE guifg=#af8700
hi SignColumn term=NONE cterm=NONE ctermfg=240 ctermbg=bg gui=NONE guifg=#585858 guibg=bg
hi SpecialComment term=NONE cterm=NONE ctermfg=136 ctermbg=NONE gui=NONE guifg=#af8700 guibg=NONE
hi SpecialKey term=NONE cterm=NONE ctermfg=240 ctermbg=bg gui=NONE guifg=#585858 guibg=bg
-hi StatusLineNC term=NONE cterm=NONE ctermfg=fg ctermbg=195 gui=NONE guifg=fg guibg=#d7ffff
+hi StatusLine term=NONE cterm=NONE ctermfg=fg ctermbg=195 gui=NONE guifg=fg guibg=#d7ffff
hi VertSplit term=NONE cterm=NONE ctermfg=fg ctermbg=195 gui=NONE guifg=fg guibg=#d7ffff
" Highlight
@@ -55,7 +55,7 @@ hi ModeMsg term=NONE cterm=NONE ctermfg=53 ctermbg=NONE gui=NONE guifg=#5f005f g
hi MoreMsg term=NONE cterm=NONE ctermfg=53 ctermbg=NONE gui=NONE guifg=#5f005f guibg=NONE
hi PmenuSel term=NONE cterm=NONE ctermfg=fg ctermbg=13 gui=NONE guifg=fg guibg=#ff00ff
hi Question term=NONE cterm=NONE ctermfg=53 ctermbg=NONE gui=NONE guifg=#5f005f guibg=NONE
-hi StatusLine term=NONE cterm=NONE ctermbg=183 ctermfg=fg gui=NONE guifg=white guibg=#000000
+hi StatusLineNC term=NONE cterm=NONE ctermbg=183 ctermfg=fg gui=NONE guifg=white guibg=#000000
hi Todo term=NONE cterm=NONE ctermfg=2 ctermbg=NONE gui=NONE guifg=#008000 guibg=NONE
hi WarningMsg term=NONE cterm=NONE ctermfg=9 ctermbg=white gui=NONE guifg=#ff5555 guibg=white
hi WildMenu term=NONE cterm=NONE ctermbg=fg ctermfg=183 gui=NONE guifg=#000000 guibg=white
@@ -66,7 +66,11 @@ hi VisualNOS term=underline cterm=underline ctermfg=fg ctermbg=222 gui=underline
hi PmenuSbar term=reverse cterm=reverse ctermfg=NONE ctermbg=NONE gui=reverse guifg=NONE guibg=NONE
hi Pmenu term=reverse cterm=reverse ctermfg=NONE ctermbg=NONE gui=reverse guifg=NONE guibg=NONE
hi PmenuThumb term=reverse cterm=reverse ctermfg=NONE ctermbg=NONE gui=reverse guifg=NONE guibg=NONE
-hi TabLineSel term=reverse cterm=reverse ctermfg=NONE ctermbg=NONE gui=reverse guifg=NONE guibg=NONE
+
+" Tabs
+hi TabLine term=reverse cterm=reverse ctermfg=NONE ctermbg=NONE gui=reverse guifg=NONE guibg=NONE
+hi TabLineSel term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE gui=NONE guifg=NONE guibg=NONE
+hi TabLineFill term=NONE cterm=NONE ctermfg=fg ctermbg=136 gui=NONE guifg=fg guibg=#af8700
" Diff
hi DiffAdd term=NONE cterm=NONE ctermfg=2 ctermbg=NONE gui=NONE guifg=#008000 guibg=NONE
@@ -83,8 +87,6 @@ hi SpellRare term=underline cterm=underline ctermfg=5 ctermbg=NONE gui=underline
" Vim Features
hi Menu term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE gui=NONE guifg=NONE guibg=NONE
hi Scrollbar term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE gui=NONE guifg=NONE guibg=NONE
-hi TabLineFill term=NONE cterm=NONE ctermfg=fg ctermbg=136 gui=NONE guifg=fg guibg=#af8700
-hi TabLine term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE gui=NONE guifg=NONE guibg=NONE
hi Tooltip term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE gui=NONE guifg=NONE guibg=NONE
" Syntax Highsepiaing (or lack there of)
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', "", "")
-- @block: c-list navigation
vim.keymap.set("n", "", function() SafeCListNav(1) end)
vim.keymap.set("n", "", function() SafeCListNav(-1) end)
-vim.keymap.set("n", "", vim.cmd.cw)
+vim.keymap.set("n", "", 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
--
cgit v1.2.3