added relativenumber option & statusline option (#279)

This commit is contained in:
Galen Rowell 2021-08-18 22:13:56 +10:00 committed by GitHub
parent e663122638
commit fa965c9797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -13,6 +13,7 @@ M.ui = {
hidden_statusline = { hidden_statusline = {
-- these are filetypes, not pattern matched -- these are filetypes, not pattern matched
"NvimTree", "NvimTree",
-- "terminal",
}, },
} }
@ -27,6 +28,8 @@ M.options = {
timeoutlen = 400, timeoutlen = 400,
clipboard = "unnamedplus", clipboard = "unnamedplus",
number = true, number = true,
-- relative numbers in normal mode tool at the bottom of options.lua
relativenumber = false,
numberwidth = 2, numberwidth = 2,
expandtab = true, expandtab = true,
shiftwidth = 2, shiftwidth = 2,

View File

@ -13,7 +13,7 @@ M.ui = {
hidden_statusline = { hidden_statusline = {
-- these are filetypes, not pattern matched -- these are filetypes, not pattern matched
"NvimTree", "NvimTree",
"toggleterm", -- "terminal",
}, },
} }
@ -28,6 +28,7 @@ M.options = {
timeoutlen = 400, timeoutlen = 400,
clipboard = "unnamedplus", clipboard = "unnamedplus",
number = true, number = true,
relativenumber = false,
numberwidth = 2, numberwidth = 2,
expandtab = true, expandtab = true,
shiftwidth = 2, shiftwidth = 2,

View File

@ -27,7 +27,7 @@ opt.fillchars = { eob = " " }
-- Numbers -- Numbers
opt.number = options.number opt.number = options.number
opt.numberwidth = options.numberwidth opt.numberwidth = options.numberwidth
-- opt.relativenumber = true opt.relativenumber = options.relativenumber
-- Indenline -- Indenline
opt.expandtab = options.expandtab opt.expandtab = options.expandtab
@ -67,9 +67,16 @@ for _, plugin in pairs(disabled_built_ins) do
g["loaded_" .. plugin] = 1 g["loaded_" .. plugin] = 1
end end
-- Don't show status line on certain windows -- Use relative & absolute line numbers in 'n' & 'i' modes respectively
-- vim.cmd[[ au InsertEnter * set norelativenumber ]]
-- vim.cmd[[ au InsertLeave * set relativenumber ]]
-- Don't show any numbers inside terminals
vim.cmd [[ au TermOpen term://* setlocal nonumber norelativenumber ]] vim.cmd [[ au TermOpen term://* setlocal nonumber norelativenumber ]]
vim.cmd [[let hidden_statusline = luaeval('require("chadrc").ui.hidden_statusline') | autocmd BufEnter,BufWinEnter,WinEnter,CmdwinEnter,TermEnter * nested if index(hidden_statusline, &ft) >= 0 | set laststatus=0 | else | set laststatus=2 | endif]]
-- Don't show status line on certain windows
vim.cmd [[ au TermOpen term://* setfiletype terminal ]]
vim.cmd [[ let hidden_statusline = luaeval('require("chadrc").ui.hidden_statusline') | autocmd BufEnter,BufWinEnter,WinEnter,CmdwinEnter,TermEnter * nested if index(hidden_statusline, &ft) >= 0 | set laststatus=0 | else | set laststatus=2 | endif ]]
-- Open a file from its last left off position -- Open a file from its last left off position
-- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]] -- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]