kitchen sink...
just gonna put the changes that I can remember making here: - replace blink with native completion (omnifunc) - remove some unneeded plugins - add a misc function for making sure complex bindings don't cause flickering - remove some stale snippets - remove folding (I don't find myself folding that often)
This commit is contained in:
@ -1,84 +1,47 @@
|
||||
-- color stuff
|
||||
if vim.fn.has("termguicolors") then
|
||||
vim.opt.termguicolors = true
|
||||
end
|
||||
|
||||
-- make .h files default to c code
|
||||
vim.filetype.add({ extension = { h = "c", }, })
|
||||
|
||||
-- numbers
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.o.nu = true
|
||||
vim.o.rnu = true
|
||||
|
||||
-- buffer
|
||||
vim.opt.scrolloff = 5
|
||||
vim.opt.wrap = true -- wraping lines
|
||||
vim.opt.linebreak = true -- fix where line is wraped
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.colorcolumn = { 80 }
|
||||
vim.o.lbr = true -- fix where line is wraped
|
||||
vim.o.cul = true
|
||||
vim.o.cc = "80"
|
||||
|
||||
-- indents + tabs
|
||||
local tabwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.smarttab = true
|
||||
vim.opt.cindent = true
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.tabstop = tabwidth
|
||||
vim.opt.shiftwidth = tabwidth
|
||||
vim.opt.softtabstop = tabwidth
|
||||
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.opt.clipboard = "unnamedplus" -- system clipboard
|
||||
vim.o.cb = "unnamedplus" -- system clipboard
|
||||
end)
|
||||
|
||||
vim.opt.updatetime = 200
|
||||
|
||||
-- file saving
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.undofile = true
|
||||
vim.opt.confirm = true
|
||||
vim.o.swf = false
|
||||
vim.o.udf = true
|
||||
|
||||
-- searching
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.wrapscan = true
|
||||
vim.opt.showmatch = true
|
||||
vim.opt.incsearch = true
|
||||
vim.o.ic = true
|
||||
|
||||
-- wild menus
|
||||
vim.opt.wildoptions = "pum"
|
||||
vim.opt.pumblend = 3
|
||||
vim.opt.pumheight = 20
|
||||
vim.o.ph = 20
|
||||
vim.o.wic = true
|
||||
vim.o.wop = "fuzzy,pum,tagfile"
|
||||
|
||||
vim.opt.wildignorecase = true
|
||||
vim.opt.wildignore = "*.o"
|
||||
-- completion
|
||||
vim.o.cot = "menu,menuone,noinsert,fuzzy,popup"
|
||||
vim.o.cia = "kind,abbr,menu"
|
||||
|
||||
-- netrw
|
||||
vim.g.netrw_banner = 0
|
||||
vim.g.netrw_winsize = 30
|
||||
vim.g.netrw_liststyle = 1
|
||||
vim.g.netrw_sizestyle = "H"
|
||||
vim.g.netrw_hide = 1
|
||||
|
||||
-- border (this doesn't actually do anything within vim, I'm just setting it
|
||||
-- here so it's easy to find)
|
||||
vim.g.border_style = "solid"
|
||||
|
||||
do -- folding
|
||||
vim.opt.foldmethod = "syntax"
|
||||
vim.opt.foldlevelstart = 99
|
||||
vim.opt.foldlevel = 99
|
||||
vim.opt.foldenable = true
|
||||
vim.o.fillchars = "fold: ,eob: "
|
||||
|
||||
vim.opt.foldtext = "v:lua.core.folding()"
|
||||
end
|
||||
-- make windows look nice
|
||||
vim.o.winborder = "solid"
|
||||
|
||||
do -- statusline
|
||||
local last_bufnr, i = 1, 1
|
||||
--- status line
|
||||
---@return string out formatted status line
|
||||
function _G.Status()
|
||||
--- get the percentage through the file
|
||||
@ -101,64 +64,9 @@ do -- statusline
|
||||
return percent.."%%"
|
||||
end
|
||||
|
||||
--- get the number of lsp servers
|
||||
---@return string out the formatted number of servers
|
||||
local function lsp_servers()
|
||||
local out, nclients, hi
|
||||
local hi_groups = { "@boolean", "@constant", "@keyword", "@number" }
|
||||
|
||||
-- get the number of clients
|
||||
nclients = #vim.lsp.get_clients({ bufnr = 0 })
|
||||
|
||||
-- set the client display
|
||||
out = "λ"..nclients
|
||||
if nclients > 0 then
|
||||
local bufnr = vim.api.nvim_win_get_buf(0)
|
||||
if bufnr ~= last_bufnr then
|
||||
last_bufnr = bufnr
|
||||
i = i + 1
|
||||
if i > #hi_groups then
|
||||
i = 1
|
||||
end
|
||||
end
|
||||
|
||||
hi = "%#"..hi_groups[i].."#"
|
||||
out = hi..out.."%#StatusLine#"
|
||||
end
|
||||
|
||||
return out
|
||||
end
|
||||
|
||||
--- get git status information
|
||||
---@return string out git status information or nothing
|
||||
local function gitsigns()
|
||||
local reset = "%#StatusLine#"
|
||||
local hl = reset
|
||||
local lil_guy = "o/"
|
||||
|
||||
---@type table
|
||||
local status = vim.b.gitsigns_status_dict
|
||||
if not status then
|
||||
return ""
|
||||
end
|
||||
|
||||
if status.removed and status.removed > 0 then
|
||||
hl = "%#GitSignsDelete#"
|
||||
lil_guy = "<o>"
|
||||
elseif status.changed and status.changed > 0 then
|
||||
hl = "%#GitSignsChange#"
|
||||
lil_guy = "o7"
|
||||
elseif status.added and status.added > 0 then
|
||||
hl = "%#GitSignsAdd#"
|
||||
lil_guy = "\\o/"
|
||||
end
|
||||
|
||||
return hl..lil_guy..reset
|
||||
end
|
||||
|
||||
-- this is my statusline:
|
||||
--
|
||||
-- opts.lua [+] o/ λ1 163,61-60 88%
|
||||
-- opts.lua [+] λ1 163,61-60 88%
|
||||
--
|
||||
return table.concat {
|
||||
"%t", -- file name
|
||||
@ -167,10 +75,8 @@ do -- statusline
|
||||
"%r", -- readonly flag
|
||||
"%=", -- seperate left and right side
|
||||
|
||||
-- print out git status information in the form of a lil guy
|
||||
gitsigns(), " ",
|
||||
-- print out the number of lsp clients attached with nice colors :)
|
||||
lsp_servers(), " ",
|
||||
"λ"..#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
|
||||
@ -178,6 +84,6 @@ do -- statusline
|
||||
" "..percentage() -- percentage through the buffer
|
||||
}
|
||||
end
|
||||
vim.opt.statusline = "%!v:lua.Status()"
|
||||
vim.opt.laststatus = 3
|
||||
vim.o.stl = "%!v:lua.Status()"
|
||||
vim.o.ls = 3
|
||||
end
|
||||
|
Reference in New Issue
Block a user