It just doesn't make sense, why would you choose to use tabs when you really get nothing out of them. I've heard arguments that everyone get's what they want in terms of formatting, but that doesn't really feel accurate because now I've got code looking messy depending on where it is you're looking at it on which really sucks. I'm going back to two space indentation and if a project really wants to use something else they can setup a formatter and/or .editorconfig file. If you read this rant, respectfully, what are you doing with your time.
95 lines
2.3 KiB
Lua
95 lines
2.3 KiB
Lua
-- make .h files default to c code
|
|
vim.filetype.add({ extension = { h = "c", }, })
|
|
|
|
-- numbers
|
|
vim.o.nu = true
|
|
vim.o.rnu = true
|
|
|
|
-- buffer
|
|
vim.o.lbr = true -- fix where line is wraped
|
|
vim.o.cul = true
|
|
vim.o.cc = "80"
|
|
|
|
-- indents + tabs
|
|
local tabwidth = 2
|
|
vim.o.et = true
|
|
vim.o.ts = tabwidth
|
|
vim.o.sw = tabwidth
|
|
vim.o.sts = -1
|
|
|
|
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
|
-- (yoinked from kickstart.nvim)
|
|
vim.schedule(function()
|
|
vim.o.cb = "unnamedplus" -- system clipboard
|
|
end)
|
|
|
|
-- file saving
|
|
vim.o.swf = false
|
|
vim.o.udf = true
|
|
|
|
-- searching
|
|
vim.o.ic = true
|
|
|
|
-- make windows look nice
|
|
vim.o.winborder = "solid"
|
|
|
|
-- wild menus
|
|
vim.o.ph = 20
|
|
vim.o.wic = true
|
|
vim.o.wop = "fuzzy,pum"
|
|
vim.o.wim = "noselect:lastused,full"
|
|
|
|
-- completion
|
|
vim.o.cpt = ".,w,b,u,d,i"
|
|
vim.o.cot = "menu,menuone,noinsert,fuzzy,popup"
|
|
vim.o.cia = "kind,abbr,menu"
|
|
-- waiting for https://github.com/neovim/neovim/pull/25541 to land
|
|
-- vim.o.completepopup = "border:"..vim.o.winborder
|
|
|
|
do -- statusline
|
|
---@return string out formatted status line
|
|
function _G.Status()
|
|
--- get the percentage through the file
|
|
---@return string out the formatted percentage
|
|
local function percentage()
|
|
local percent, line, lines
|
|
|
|
-- get the current and total # of lines
|
|
line = vim.api.nvim_win_get_cursor(0)[1]
|
|
lines = vim.api.nvim_buf_line_count(0)
|
|
|
|
-- calculate the percentage through the file
|
|
percent = math.floor((line / lines) * 100)
|
|
if percent == 0 or line == 1 then
|
|
return "Top"
|
|
elseif percent == 100 or line == lines then
|
|
return "Bot"
|
|
end
|
|
|
|
return percent.."%%"
|
|
end
|
|
|
|
-- this is my statusline:
|
|
--
|
|
-- opts.lua [+] λ1 163,61-60 88%
|
|
--
|
|
return table.concat {
|
|
"%t", -- file name
|
|
" %h", -- help buffer tag
|
|
"%m", -- modify tag
|
|
"%r", -- readonly flag
|
|
"%=", -- seperate left and right side
|
|
|
|
-- print out the number of lsp clients attached
|
|
"λ"..#vim.lsp.get_clients({ bufnr = 0 }), " ",
|
|
|
|
"%<", -- we can start truncating here (I want to keep the file name)
|
|
"%l,%c%V", -- line, column-virtual column
|
|
"%<", -- we can start truncating here
|
|
" "..percentage() -- percentage through the buffer
|
|
}
|
|
end
|
|
vim.o.stl = "%!v:lua.Status()"
|
|
vim.o.ls = 3
|
|
end
|