kitchen sink again :(
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
local misc = require('core.misc')
|
||||
local misc = require("core.misc")
|
||||
local auto = misc.auto
|
||||
|
||||
-- color stuff
|
||||
@ -17,6 +17,7 @@ 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 }
|
||||
|
||||
-- indents + tabs
|
||||
local tabwidth = 2
|
||||
@ -31,7 +32,7 @@ vim.opt.softtabstop = tabwidth
|
||||
-- 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.opt.clipboard = "unnamedplus" -- system clipboard
|
||||
end)
|
||||
|
||||
vim.opt.updatetime = 200
|
||||
@ -49,12 +50,12 @@ vim.opt.showmatch = true
|
||||
vim.opt.incsearch = true
|
||||
|
||||
-- wild menus
|
||||
vim.opt.wildoptions = 'pum'
|
||||
vim.opt.wildoptions = "pum"
|
||||
vim.opt.pumblend = 3
|
||||
vim.opt.pumheight = 20
|
||||
|
||||
vim.opt.wildignorecase = true
|
||||
vim.opt.wildignore = '*.o'
|
||||
vim.opt.wildignore = "*.o"
|
||||
|
||||
-- netrw
|
||||
vim.g.netrw_banner = 0
|
||||
@ -63,26 +64,31 @@ 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"
|
||||
|
||||
-- folding
|
||||
auto("FileType", {
|
||||
callback = function()
|
||||
-- FIXME: it causes errors every once in a while
|
||||
-- support lsp folding
|
||||
if vim.fn.has("nvim-0.11") then
|
||||
auto('LspAttach', {
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
-- if vim.fn.has("nvim-0.11") then
|
||||
-- auto("LspAttach", {
|
||||
-- callback = function(args)
|
||||
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
-- if not client then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
if client:supports_method('textDocument/foldingRange') then
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
vim.wo[win][0].foldmethod = "expr"
|
||||
vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
-- if client:supports_method("textDocument/foldingRange") then
|
||||
-- local win = vim.api.nvim_get_current_win()
|
||||
-- vim.wo[win][0].foldmethod = "expr"
|
||||
-- vim.wo[win][0].foldexpr = "v:lua.vim.lsp.foldexpr()"
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
-- end
|
||||
|
||||
-- or just rely on treesitter
|
||||
if require("nvim-treesitter.parsers").has_parser() then
|
||||
@ -96,7 +102,7 @@ auto("FileType", {
|
||||
|
||||
-- lsp folding: vim.o.foldexpr = "v:lua.vim.lsp.foldexpr()"
|
||||
-- waiting on https://github.com/neovim/neovim/pull/31311 to hit a release
|
||||
require('core.lsp.functions').add_capabilities({
|
||||
require("core.lsp.functions").add_capabilities({
|
||||
textDocument = {
|
||||
foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
@ -108,13 +114,29 @@ require('core.lsp.functions').add_capabilities({
|
||||
vim.opt.foldlevelstart = 99
|
||||
vim.opt.foldlevel = 99
|
||||
vim.opt.foldenable = true
|
||||
vim.o.fillchars = 'fold: '
|
||||
vim.o.fillchars = "fold: "
|
||||
|
||||
_G.Fold_text = require('core.folding')
|
||||
vim.opt.foldtext = 'v:lua.Fold_text()'
|
||||
_G.Fold_text = require("core.folding")
|
||||
vim.opt.foldtext = "v:lua.Fold_text()"
|
||||
|
||||
-- statusline
|
||||
function _G.Status()
|
||||
local function percentage()
|
||||
local percent, line, lines
|
||||
|
||||
line = vim.api.nvim_win_get_cursor(0)[1]
|
||||
lines = vim.api.nvim_buf_line_count(0)
|
||||
|
||||
percent = math.floor((line / lines) * 100)
|
||||
if percent == 0 then
|
||||
return "Top"
|
||||
elseif percent == 100 then
|
||||
return "Bot"
|
||||
end
|
||||
|
||||
return percent.."%%"
|
||||
end
|
||||
|
||||
return table.concat {
|
||||
"%t", -- file name
|
||||
" %h", -- help buffer tag
|
||||
@ -125,8 +147,10 @@ function _G.Status()
|
||||
-- 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
|
||||
" %P" -- percentage through display window
|
||||
"%<", -- we can start truncating here
|
||||
" "..percentage() -- percentage through the buffer
|
||||
}
|
||||
end
|
||||
vim.o.statusline="%!v:lua.Status()"
|
||||
|
Reference in New Issue
Block a user