Just Midi
4989797e91
Directories are self explanatory + ui/* for ui stuff + statusbar in ui + keymap/* for keymaps + general for very minimal, required stuff
113 lines
2.9 KiB
Lua
Executable file
113 lines
2.9 KiB
Lua
Executable file
-- see `:help` for any questions
|
|
-- use `&<var>` to show value of vimscript variable
|
|
|
|
require('ui/statusbar')
|
|
|
|
-- API --
|
|
local o = vim.o -- options
|
|
local go = vim.go -- only-global options
|
|
local bo = vim.bo -- buffer local options
|
|
local wo = vim.wo -- window local options
|
|
|
|
local cmd = vim.cmd -- vim commands
|
|
local fn = vim.fn -- vim functions
|
|
local opt = vim.opt -- vim option object
|
|
|
|
local g = vim.g -- global variables
|
|
local b = vim.b -- buffer local variables
|
|
local w = vim.w -- window local variables
|
|
local t = vim.t -- tab local variables
|
|
local v = vim.v -- variables
|
|
local env = vim.env -- environment variables
|
|
|
|
|
|
|
|
o.showcmd = true
|
|
wo.cursorline = true
|
|
cmd 'filetype plugin indent on'
|
|
o.lazyredraw = true
|
|
o.showmatch = true -- matching bracket
|
|
|
|
|
|
-- Completion Menu
|
|
o.wildmenu = true
|
|
o.wildmode = 'list:longest,full'
|
|
|
|
|
|
-- Character Representation
|
|
o.sbr = '…' -- line wrap character
|
|
o.list = true
|
|
opt.listchars = { -- white space representation
|
|
tab = '▸ ',
|
|
trail = '•',
|
|
nbsp = '␣',
|
|
extends = '⟩',
|
|
precedes = '⟨'
|
|
}
|
|
|
|
|
|
-- Hybrid Numbers
|
|
function hybrid_numbers(x)
|
|
wo.number = true
|
|
wo.relativenumber = x
|
|
end
|
|
cmd([[
|
|
autocmd BufEnter,FocusGained,InsertLeave * lua hybrid_numbers(true)
|
|
autocmd BufLeave,FocusLost,InsertEnter * lua hybrid_numbers(false)
|
|
]])
|
|
|
|
|
|
-- Search
|
|
o.incsearch = true -- show matching patterns
|
|
o.hlsearch = true -- highlight all patterns
|
|
|
|
|
|
-- Status Bar
|
|
o.laststatus = 2 -- always visible
|
|
vim.o.statusline = "%!luaeval('status_bar()')"
|
|
|
|
|
|
-- Tabs
|
|
local indent_size = 4 --change to filetype
|
|
opt.expandtab = true -- tab key inserts spaces
|
|
opt.tabstop = indent_size
|
|
opt.shiftwidth = indent_size
|
|
opt.softtabstop = 0 -- to disable
|
|
opt.smarttab = true
|
|
|
|
--adjust to filetype
|
|
function no_ro_retab()
|
|
if vim.inspect(opt.readonly:get()) == false then
|
|
cmd '%retab'
|
|
end
|
|
end
|
|
cmd 'autocmd BufReadPost,BufWritePre,BufWritePost,BufNewFile * lua no_ro_retab()'
|
|
|
|
|
|
-- Text Width
|
|
wo.wrap = true
|
|
wo.linebreak = true
|
|
bo.textwidth = 70
|
|
|
|
bo.formatoptions = table.concat({
|
|
'j', -- remove comment when joining lines
|
|
'w', -- non-white space at end of line means end of paragraph
|
|
'c', -- insert comment when auto wrapping textwidth
|
|
'r', -- insert comment after hitting <enter>
|
|
'o', -- insert comment after hitting "o"
|
|
'q', -- format comments with "gq"
|
|
'l' -- long lines are not broken in insert mode
|
|
})
|
|
|
|
cmd([[
|
|
autocmd BufEnter * highlight OverLength ctermbg=darkgrey guibg=#592929
|
|
autocmd BufEnter * match OverLength /\%71v.*/
|
|
]]) --rewrite in lua
|
|
|
|
|
|
--WIP
|
|
-- Filetype: txt, md, tex
|
|
-- break lines, autowrap, autoformat, recognize numbered lists
|
|
--fix before enabling
|
|
--autocmd BufRead,BufNewFile *.md,*.txt,*.tex set fo-=l
|
|
--autocmd BufRead,BufNewFile *.md,*.txt,*.tex set fo+=tan
|