-- --- -- @author jianqun.me -- @updated 2025-07-17 -- --- vim.cmd("colorscheme habamax") vim.cmd("filetype indent off") -- --- -- Options -- --- vim.opt.cdhome = true vim.opt.clipboard = "" vim.opt.confirm = true vim.opt.cursorline = true vim.opt.expandtab = true vim.opt.foldcolumn = "auto" vim.opt.guicursor = { "n-v-c-sm-t:block-Cursor", "i-ci-ve:ver10-Cursor", "r-cr-o:hor5-Cursor", "a:blinkon0" } vim.opt.ignorecase = true vim.opt.list = true vim.opt.listchars = { tab = "··▸", lead = "·", trail = "·" } vim.opt.matchpairs = { "(:)", "[:]", "{:}", "<:>" } vim.opt.modeline = false vim.opt.mouse = "" vim.opt.mousemodel = "extend" vim.opt.number = true vim.opt.relativenumber = true vim.opt.shadafile = "NONE" vim.opt.shiftwidth = 0 vim.opt.showmatch = true vim.opt.showtabline = 2 vim.opt.smartcase = true vim.opt.splitbelow = true vim.opt.splitright = true vim.opt.statuscolumn = "%(%C%s%=%l│ %)" vim.opt.statusline = "%!v:lua.MyStatusLine()" vim.opt.switchbuf = "usetab" vim.opt.tabline = "%!v:lua.MyTabLine()" vim.opt.tabstop = 2 vim.opt.termguicolors = true vim.opt.timeoutlen = 200 vim.opt.title = true vim.opt.titlestring = table.concat({ "%{bufname('%')==''?'Untitled':fnamemodify(bufname('%'),':t')}", "%( [%H%W%{&modified?',+':''}%R]%) - Nvim" }, "") if vim.env.TERM == "linux" then vim.opt.cursorline = false vim.opt.guicursor = "" vim.opt.list = false vim.opt.termguicolors = false vim.opt.title = false end -- --- -- MyStatusLine -- --- function MyStatusLine() local modemap = { ["n"] = "[NORMAL] ", ["niI"] = "[(insert)] ", ["niR"] = "[(replace)] ", ["niV"] = "[(vreplace)] ", ["nt"] = "[(terminal)] ", ["ntT"] = "[(terminal)] ", ["v"] = "[VISUAL] ", ["vs"] = "[VISUAL] ", ["V"] = "[VISUAL LINE] ", ["Vs"] = "[VISUAL LINE] ", ["\22"] = "[VISUAL BLOCK] ", ["\22s"] = "[VISUAL BLOCK] ", ["s"] = "[SELECT] ", ["S"] = "[SELECT LINE] ", ["\19"] = "[SELECT BLOCK] ", ["i"] = "[INSERT] ", ["ic"] = "[INSERT] ", ["R"] = "[REPLACE] ", ["Rc"] = "[REPLACE] ", ["Rv"] = "[VREPLACE] ", ["Rvc"] = "[VREPLACE] ", ["c"] = "[CMDLINE] ", ["ct"] = "[CMDLINE] ", ["cr"] = "[CMDLINE] ", ["t"] = "[TERMINAL] " } return (modemap[vim.fn.mode(1)] or "") .. table.concat({ "%<", "%{bufname('%')==''?'Untitled':bufname('%')}", "%( [%H%W%{&modified?',+':''}%R]%)", "%= %l,%c%V %p%%", "%( [%{toupper(&fenc!=''?&fenc:&enc)},%{toupper(&ff)}%(,%Y%)]%)" }, "") end -- --- -- MyTabLine -- --- function MyTabLine() local tabline = "" for tabnr = 1, vim.fn.tabpagenr("$") do if tabnr == vim.fn.tabpagenr() then tabline = tabline .. "%#TabLineSel#" else tabline = tabline .. "%#TabLine#" end tabline = tabline .. "%" .. tabnr .. "T" local buflist = vim.fn.tabpagebuflist(tabnr) local bufname = vim.fn.bufname(buflist[vim.fn.tabpagewinnr(tabnr)]) if bufname ~= "" then bufname = vim.fn.pathshorten(bufname) else bufname = "Untitled" end local hasmodified = false for _, bufnr in ipairs(buflist) do if vim.fn.getbufvar(bufnr, "&modified") == 1 then hasmodified = true break end end local wincount = vim.fn.tabpagewinnr(tabnr, "$") local label = "" if wincount > 1 then label = label .. wincount end if hasmodified then label = label .. "+" end if label ~= "" then label = label .. " " end tabline = tabline .. " " .. label .. bufname .. " " end tabline = tabline .. "%#TabLineFill#%T" .. "%<" return tabline end -- --- -- AutocmdGroup -- --- vim.api.nvim_create_augroup("init.lua", { clear = true }) -- --- -- SyntaxComplete -- --- vim.api.nvim_create_autocmd("Filetype", { group = "init.lua", callback = function() if vim.bo.omnifunc == "" then vim.bo.omnifunc = "syntaxcomplete#Complete" end end }) -- --- -- Clipboard -- --- vim.g.clipboard = { name = "disabled", copy = { ["+"] = function() end, ["*"] = function() end }, paste = { ["+"] = function() return { {}, "" } end, ["*"] = function() return { {}, "" } end } } vim.api.nvim_create_autocmd("TextYankPost", { group = "init.lua", callback = function() local clipboard = vim.fn.getreg('"') if vim.v.event.operator == "y" then require("vim.ui.clipboard.osc52").copy()(vim.split(clipboard, "\n")) end end }) -- --- -- Mappings -- --- vim.keymap.set({ "n", "x" }, "", ":") vim.keymap.set({ "n", "v" }, "", "") vim.keymap.set({ "n", "v" }, "", "") vim.keymap.set({ "i", "c" }, "", "") vim.keymap.set({ "i", "c" }, "", "") vim.keymap.set({ "i", "c" }, "", "") vim.keymap.set({ "i", "c" }, "", "") vim.keymap.set("v", "", ":m '>+1gv", { silent = true }) vim.keymap.set("v", "", ":m '<-2gv", { silent = true }) local scrollwheelkeys = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" } for _, scrollwheel in ipairs(scrollwheelkeys) do vim.keymap.set({ "", "!" }, scrollwheel, "") end