Status line
This commit is contained in:
@@ -2,3 +2,4 @@ require "core.settings"
|
|||||||
require "core.commands"
|
require "core.commands"
|
||||||
require "core.autocmds"
|
require "core.autocmds"
|
||||||
require "core.keys"
|
require "core.keys"
|
||||||
|
require "core.statusline"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ opt.relativenumber = true
|
|||||||
opt.scrolloff = 8
|
opt.scrolloff = 8
|
||||||
opt.sidescrolloff = 8
|
opt.sidescrolloff = 8
|
||||||
opt.title = true
|
opt.title = true
|
||||||
-- opt.titlestring = "filename [+=-] - NVIM"
|
opt.titlestring = "%t - NVIM"
|
||||||
opt.wrap = false
|
opt.wrap = false
|
||||||
opt.clipboard = "unnamedplus"
|
opt.clipboard = "unnamedplus"
|
||||||
opt.splitbelow = true
|
opt.splitbelow = true
|
||||||
@@ -20,7 +20,10 @@ opt.splitright = true
|
|||||||
opt.showmode = false
|
opt.showmode = false
|
||||||
|
|
||||||
opt.grepprg = "rg --vimgrep --smart-case"
|
opt.grepprg = "rg --vimgrep --smart-case"
|
||||||
|
|
||||||
opt.path = ".,**"
|
opt.path = ".,**"
|
||||||
|
vim.cmd "set path-=node_modules/**"
|
||||||
|
vim.cmd "set wildignore-=*/node_modules/*"
|
||||||
|
|
||||||
-- Netrw
|
-- Netrw
|
||||||
g.netrw_banner = 0
|
g.netrw_banner = 0
|
||||||
|
|||||||
38
lua/core/statusline.lua
Normal file
38
lua/core/statusline.lua
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
local fn, api = vim.fn, vim.api
|
||||||
|
|
||||||
|
local modes = {
|
||||||
|
["n"] = "NORMAL",
|
||||||
|
["v"] = "VISUAL",
|
||||||
|
["V"] = "VISUAL LINE",
|
||||||
|
[""] = "VISUAL BLOCK",
|
||||||
|
["i"] = "INSERT",
|
||||||
|
["R"] = "REPLACE",
|
||||||
|
["Rv"] = "VISUAL REPLACE",
|
||||||
|
["c"] = "COMMAND",
|
||||||
|
["nt"] = "TERMINAL"
|
||||||
|
}
|
||||||
|
|
||||||
|
local function mode()
|
||||||
|
local current_mode = api.nvim_get_mode().mode
|
||||||
|
return string.format(" %s ", modes[current_mode]):upper()
|
||||||
|
end
|
||||||
|
|
||||||
|
function StatusLine()
|
||||||
|
local filename = fn.expand("%:t")
|
||||||
|
local filetype = vim.bo.filetype
|
||||||
|
local lineinfo = fn.line(".") .. ":" .. vim.fn.col(".")
|
||||||
|
local percent = fn.line(".") / fn.line("$") * 100
|
||||||
|
|
||||||
|
return table.concat {
|
||||||
|
mode(),
|
||||||
|
" ",
|
||||||
|
filename,
|
||||||
|
"%=%#StatusLineExtra#",
|
||||||
|
filetype,
|
||||||
|
" ",
|
||||||
|
string.format("%3.0f", percent) .. "%% ",
|
||||||
|
lineinfo
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.o.statusline = "%!luaeval('StatusLine()')"
|
||||||
Reference in New Issue
Block a user