dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Compare Notes Search fix tabline to only consider tabs 5c3b661f16d2f803543119e445fe9fc9ba82bc68
Oliver Krylow <o.krylow@isp-insoft.de > · 17 Aug 2021
unsigned
Browse files Compare with HEAD
- adds svn to vcs tools when looking for a branch name
- fix statusline bug, where global setting was used instead of
window-local
Changed files (4) 36 36 - [ ] rewrite bootstripper and java commmands with zig. how to run them? precompile? zig run?
37 37 - [ ] encrypt box key
38 + - [ ] disable syntax highlighting (treesitter) for inactive buffers and dim color
neovim/lua/general_editor_settings.lua Modified 66 66 vim.opt.showcmd
= false 67 67 vim.opt.wildmode
= "list:longest" 69 - vim.opt.autochdir
= false 69 + vim.opt.autochdir
= true 71 71 vim.opt.autoread
= true neovim/lua/statusline.lua Modified 5 5 NvimTree
= {
"Files" ,
"" },
6 6 packer
= {
"Plugins" ,
"" },
7 7 help
= {
"Help" ,
"龎" },
8 + [
"" ]
= {
"no name" ,
"" },
9 10 local lsp_symbols
= {
Error =
"" ,
Information =
"" ,
Warning =
"" ,
Hint =
"" }
25 26 update_statuslines = function ()
26 27 for _, window_number
in pairs (vim.api.nvim_list_wins())
do 27 28 if vim.api.nvim_get_current_win()
== window_number
then 28 - vim.opt.statusline
= [[%!v:lua.require'statusline'.render("current")]] 29 - elseif vim.api.nvim_buf_get_name(
0 )
~= "" then 30 - vim.opt.statusline
= [[%!v:lua.require'statusline'.render()]] 29 + vim.wo[window_number].statusline
= [[%!v:lua.require'statusline'.render("current")]] 31 + vim.wo[window_number].statusline
= [[%!v:lua.require'statusline'.render()]] 35 36 update_vcs_branch_name = function ()
36 37 if not pcall (
require ,
"plenary" )
then 40 + local Job
= require (
"plenary.job" )
41 + local git
= Job:new({
43 + args = {
"branch" ,
"--show-current" },
44 + cwd = vim.fn.expand(
"%:p:h" ),
45 + on_exit =
function (output)
46 + local result
= output:result()[
1 ]
48 + vcs_branch_name
= result
52 + local svn
= Job:new({
55 + cwd = vim.fn.expand(
"%:p:h" ),
56 + on_exit =
function (output)
57 + local result
= output:result()[
4 ]
58 + result
= result
and result:match(
"Relative URL:%s%^/([%w/]+).*" )
or nil 60 + vcs_branch_name
= result
65 + local all
= { git, svn }
66 + for _, tool
in pairs (all)
do 39 - require (
"plenary.job" )
42 - args = {
"branch" ,
"--show-current" },
43 - cwd = vim.fn.expand(
"%:p:h" ),
44 - on_exit =
function (output)
45 - local result
= output:result()[
1 ]
47 - vcs_branch_name
= "%#LineNr#%=" .. branch_icon
.. " " .. result
49 - vcs_branch_name
= "" 56 71 render = function (active)
57 72 local filetype
= vim.bo.filetype
58 73 local special_window
= special_windows[filetype]
59 - if active
and special_window
then 60 - return "%#LineNr#%=" .. special_window[
2 ]
.. " " .. special_window[
1 ]
.. "%=" 74 + if special_window
then 75 + return "%#Statusline" 76 + .. (active
and "" or "NC" )
78 + .. special_window[
2 ]
80 + .. special_window[
1 ]
62 - local edited
= vim.bo.mod
and "" or "" 63 - local modifiable
= vim.bo.modifiable
and "" or "" 83 + local edited
= vim.bo.mod
and "" or " " 84 + local modifiable
= vim.bo.modifiable
and " " or "" 64 85 local diagnostics
= get_lsp_diagnostics_count()
87 + local vcs_info
= vcs_branch_name
and (
"%#LineNr#%=" .. branch_icon
.. " " .. vcs_branch_name)
or nil 66 89 local statusline
= "%#Statusline" 67 90 .. (active
and "" or "NC" )
74 - .. (diagnostics
~= "" and " " .. diagnostics
.. " " or " " )
75 - .. (active
and vcs_branch_name
or "" )
97 + .. (active
and (diagnostics
~= "" and " " .. diagnostics
.. " " or " " )
or " " )
98 + .. (active
and vcs_info
or "" )
80 103 setup = function (autocommand)
82 - update_statusline =
"CursorHold,CursorHoldI * lua require'statusline'.update_statuslines()" ,
83 - update_vcs_branch_name =
"BufEnter,BufWinEnter,WinEnter,BufReadPost * lua require'statusline'.update_vcs_branch_name()" ,
105 + update_statuslines =
"BufEnter,WinEnter,BufWinEnter,BufReadPost * lua require'statusline'.update_statuslines()" ,
107 + update_vcs_branch_name =
"BufEnter,WinEnter,BufWinEnter,BufReadPost * lua require'statusline'.update_vcs_branch_name()" ,
neovim/lua/tabline.lua Modified 17 17 render = function ()
18 18 local buffer_names_to_ignore
= {
'NvimTree' }
21 - for _, buffer_number
in pairs (vim.api.nvim_list_bufs())
do 22 - if vim.api.nvim_buf_is_valid(buffer_number)
and vim.api.nvim_buf_is_loaded(buffer_number)
then 20 + for _, current_tab
in pairs (vim.api.nvim_list_tabpages())
do 21 + if vim.api.nvim_tabpage_is_valid(current_tab)
then 22 + local current_window
= vim.api.nvim_tabpage_get_win(current_tab)
23 + if not vim.api.nvim_win_is_valid(current_window)
then goto continue
end 24 + local current_buffer
= vim.api.nvim_win_get_buf(current_window)
25 + if not (vim.api.nvim_buf_is_valid(current_buffer)
and vim.api.nvim_buf_is_loaded(current_buffer))
then goto continue
end 23 26 local modified
= vim.bo.modified
and "" or " " 25 - local stylish_buffer_name
= vim.api.nvim_buf_get_name(buffer_number):match(
".-([^\\/]-)$" )
or "" 26 - if vim.tbl_contains(buffer_names_to_ignore, stylish_buffer_name)
or stylish_buffer_name
== "" then goto continue
end 28 + local current_buffer_name
= vim.api.nvim_buf_get_name(current_buffer)
29 + local stylish_buffer_name
= current_buffer_name:match(
".-([^\\/]-)$" )
or "" 30 + if vim.tbl_contains(buffer_names_to_ignore, stylish_buffer_name)
then goto continue
end 32 - if stylish_buffer_name
== "cheatsheet" then 32 + if stylish_buffer_name
== "" then 33 + stylish_buffer_name
= "no name" 35 + elseif stylish_buffer_name
== "cheatsheet" then 35 38 local extension
= stylish_buffer_name:match(
"%w+%.(.+)" )
36 39 icon
= get_icon(stylish_buffer_name, extension)
38 41 stylish_buffer_name
= " " .. stylish_buffer_name
.. " " 39 - local is_current_buffer
= vim.api.nvim_get_current_buf()
== buffer_number
42 + local is_current_buffer
= vim.api.nvim_get_current_buf()
== current_buffer
40 43 tabline
= tabline
.. "%#TabLine" .. 41 44 (is_current_buffer
and "Sel" or "" )
.. "#" .. 42 45 " " .. icon
.. stylish_buffer_name
.. (is_current_buffer
and modified
or " " )