added statusline
This commit is contained in:
@@ -6,4 +6,5 @@ if [ -x /opt/homebrew/bin/brew ]; then
|
|||||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export EDITOR='vim'
|
export EDITOR='nvim'
|
||||||
|
export VISUAL='nvim'
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
Some sane defaults for git, zsh (using oh-my-zsh), vim and tmux.
|
Some sane defaults for git, zsh (using oh-my-zsh), kitty, neovim and tmux.
|
||||||
|
|
||||||
Install needed packages:
|
Install needed packages:
|
||||||
|
|
||||||
Linux:
|
Linux:
|
||||||
```apt install git vim zsh lsd tmux```
|
```apt install git neovim zsh lsd tmux```
|
||||||
|
|
||||||
macOS:
|
macOS:
|
||||||
```brew install git vim lsd tmux```
|
```brew install git neovim lsd tmux```
|
||||||
|
|
||||||
From your users home directory (~/), execute:
|
From your users home directory (~/), execute:
|
||||||
```git clone gitea@git.24unix.net:tracer/dotfiles.git .config/dotfiles```
|
```git clone gitea@git.24unix.net:tracer/dotfiles.git .config/dotfiles```
|
||||||
@@ -14,7 +14,7 @@ From your users home directory (~/), execute:
|
|||||||
To install oh-my-zsh and symlink the config files run:
|
To install oh-my-zsh and symlink the config files run:
|
||||||
```sh .config/dotfiles/install.sh```
|
```sh .config/dotfiles/install.sh```
|
||||||
|
|
||||||
This replaces the managed dotfiles in your home directory (`.zshrc`, `.zprofile`, `.vimrc`, `.gitconfig`, `.p10k.zsh`, and `~/.config/tmux`).
|
This replaces the managed dotfiles in your home directory (`.zshrc`, `.zprofile`, `.gitconfig`, `.p10k.zsh`, `~/.config/kitty`, `~/.config/nvim`, and `~/.config/tmux`).
|
||||||
|
|
||||||

|

|
||||||
[original image, 1.8M](https://24unix.net/build/images/Settings/user_screen_original.png)
|
[original image, 1.8M](https://24unix.net/build/images/Settings/user_screen_original.png)
|
||||||
|
|||||||
49
nvim/lua/tracer/statusline.lua
Normal file
49
nvim/lua/tracer/statusline.lua
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
local function progress_bar()
|
||||||
|
local columns = vim.o.columns
|
||||||
|
local total_lines = vim.fn.line("$")
|
||||||
|
local current_line = vim.fn.line(".")
|
||||||
|
local current_col = vim.fn.virtcol(".")
|
||||||
|
|
||||||
|
local bar_width = math.max(columns - 65, 3)
|
||||||
|
local progress
|
||||||
|
|
||||||
|
if total_lines > 1 then
|
||||||
|
progress = math.floor((current_line - 1) * (bar_width - 1) / (total_lines - 1))
|
||||||
|
else
|
||||||
|
progress = math.floor(bar_width / 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
local pad = #tostring(total_lines) - #tostring(current_line) + 3
|
||||||
|
- #tostring(current_col) + 3
|
||||||
|
- #tostring(math.floor(current_line * 100 / math.max(total_lines, 1)))
|
||||||
|
|
||||||
|
return string.rep(" ", math.max(pad, 0))
|
||||||
|
.. " ["
|
||||||
|
.. "%#DiffAdd#"
|
||||||
|
.. string.rep("-", progress)
|
||||||
|
.. "%#DiffDelete#0%#DiffAdd#"
|
||||||
|
.. string.rep("-", math.max(bar_width - progress - 1, 0))
|
||||||
|
.. "%*]"
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.render()
|
||||||
|
local encoding = vim.bo.fenc ~= "" and vim.bo.fenc or vim.o.enc
|
||||||
|
local bomb = vim.bo.bomb and ",B" or ""
|
||||||
|
|
||||||
|
return table.concat({
|
||||||
|
"%f",
|
||||||
|
" [",
|
||||||
|
encoding,
|
||||||
|
bomb,
|
||||||
|
"%M%R%H%W] ",
|
||||||
|
"%y",
|
||||||
|
" [%l/%L,%v] [%p%%]",
|
||||||
|
progress_bar(),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.o.statusline = "%!v:lua.require'tracer.statusline'.render()"
|
||||||
|
|
||||||
|
return M
|
||||||
Reference in New Issue
Block a user