dotfiles
bugabingas dorkfiles
owned by bugabinga
adds custom tabline to nvim
bcb0237627827168bb789784de18a636a9b97097
Oliver Krylow <o.krylow@isp-insoft.de> ·
unsigned
Browse filesCompare with HEAD
Changed files (7)
indexa/config.windows.toml
Modified24 -_G.dump
= require(
"dump")
24 +Dump
= require(
"dump")
37 37 local cheatsheet, setup_cheatsheet
= require(
"cheatsheet")()
39 -_G.cheatsheet
= cheatsheet
41 39 cheatsheet(
"Stuff for bugabinga to remember about NeoVim")
43 41 local settings
= require(
"general_editor_settings")
44 42 settings(autocommand, data_path)
46 -local non_interactive
= #vim.api.nvim_list_uis()
== 0 48 -_G.plugins
= require(
"plugins")(data_path, non_interactive)
50 45 require(
"keybinds")(cheatsheet)
55 50 local _, setup_mkdir
= require(
"mkdir")()
56 51 setup_mkdir(autocommand)
59 - ":TSHighlightCapturesUnderCursor => This command shows the highlight group under the cursor, when TreeSitter is used" 55 +local non_interactive
= #vim.api.nvim_list_uis()
== 0 57 +Plugins
= require(
"plugins")(data_path, non_interactive)
64 -vim.cmd(
[[command! PluginsInstall packadd packer.nvim | lua plugins.install()]])
61 +vim.cmd(
[[command! PluginsInstall packadd packer.nvim | lua Plugins.install()]])
67 -vim.cmd(
[[command! PluginsUpdate packadd packer.nvim | lua plugins.update()]])
63 +vim.cmd(
[[command! PluginsUpdate packadd packer.nvim | lua Plugins.update()]])
69 64 cheatsheet(
":PluginsSync => Perform a clean followed by an update")
70 -vim.cmd(
[[command! PluginsSync packadd packer.nvim | lua plugins.sync()]])
65 +vim.cmd(
[[command! PluginsSync packadd packer.nvim | lua Plugins.sync()]])
73 -vim.cmd(
[[command! PluginsClean packadd packer.nvim | lua plugins.clean()]])
67 +vim.cmd(
[[command! PluginsClean packadd packer.nvim | lua Plugins.clean()]])
76 -vim.cmd(
[[command! PluginsCompile packadd packer.nvim | lua plugins.compile()]])
69 +vim.cmd(
[[command! PluginsCompile packadd packer.nvim | lua Plugins.compile()]])
78 70 cheatsheet(
":PluginsProfile => Show the measured startup times of plugins")
79 -vim.cmd(
[[command! PluginsProfile packadd packer.nvim | lua plugins.profile_output()]])
71 +vim.cmd(
[[command! PluginsProfile packadd packer.nvim | lua Plugins.profile_output()]])
72 +vim.cmd(
[[command! PluginsStatus packadd packer.nvim | lua Plugins.status()]])
81 -vim.cmd(
[[command! PluginsStatus packadd packer.nvim | lua plugins.status()]])
75 + compile_lazy_plugin_loading_script_on_save =
"BufWritePost plugins.lua source <afile> | PluginsCompile",
79 +cheatsheet(
"Drawing ASCII diagrams with venn.nvim:")
80 +cheatsheet(
"Activate visual edit: `:set virtualedit=all`")
81 +cheatsheet(
"Select blocks: `<C-v>`")
82 +cheatsheet(
"Invoke `:Vbox`")
neovim/lua/filetype/ansi_c.lua
Modified1 1 return function(autocommand)
2 - autocommand{
setup_build_for_dotfiles_boottripper =
[[ BufRead bootstripper.c set makeprg=../build.bat ]]}
neovim/lua/general_editor_settings.lua
Modified 10 10 vim.opt.laststatus
= 2 11 11 vim.opt.showtabline
= 2 13 + vim.opt.tabline
= [[%!v:lua.require'tabline'()]] 13 15 vim.opt.expandtab
= true neovim/lua/keybinds.lua
Modified 8 8 return function(cheatsheet)
10 11 local map = function(mode, left_hand_side, right_hand_side, options)
11 12 local default_options
= {
noremap =
true,
unique =
true }
20 21 map(
"n",
"<LEADER><F10>",
[[<CMD>PluginsSync<CR>]])
21 22 cheatsheet(
"LEADER + F10 => Sync nvim plugins configuration!")
24 - map(
"t",
"<ESC>",
"<C-\\><C-n>")
25 - map(
"t",
"<C-w>",
"<ESC><C-w>")
28 - map(
"n",
"<ESC>",
":nohlsearch<CR>", {
unique =
false,
silent =
true })
30 - map(
"n",
"<LEADER>t",
[[<CMD>Telescope tabs<CR>]])
31 - cheatsheet(
"LEADER + t => Select a tab")
33 24 map(
"n",
"<LEADER>b",
[[<CMD>Telescope buffers<CR>]])
34 25 cheatsheet(
"LEADER + b => Select a buffer")
39 30 map(
"n",
"<LEADER>e",
[[<CMD>NvimTreeToggle<CR>]])
40 31 cheatsheet(
"LEADER + e => Toggle file explorer")
33 + map(
"n",
"<LEADER>t",
[[<CMD>TroubleToggle<CR>]])
34 + cheatsheet(
"LEADER + t => Toggle the Trouble window.")
43 39 local opener_program
= "" 54 50 map(
"n",
"gx",
[[<CMD>lua require'spawn'(']] .. opener_program
.. [[',{ vim.fn.expand('<cfile>') } )<CR>]])
55 51 cheatsheet(
"gx => Open URL under cursor")
57 - cheatsheet(
"<ALT>j => Move line(s) down")
58 - cheatsheet(
"<ALT>k => Move line(s) up")
54 + cheatsheet(
"ALT + j => Move line(s) down")
55 + cheatsheet(
"ALT + k => Move line(s) up")
59 56 map(
"n",
"<A-j>",
[[<CMD>move .+1<CR>==]])
60 57 map(
"n",
"<A-k>",
[[<CMD>move .-2<CR>==]])
61 58 map(
"i",
"<A-j>",
[[<ESC><CMD>move .+1<CR>==gi]])
62 59 map(
"i",
"<A-k>",
[[<ESC><CMD>move .-2<CR>==gi]])
63 60 map(
"x",
"<A-j>",
[[<ESC><CMD>'<,'>move'>+1<CR>gv=gv]])
64 61 map(
"x",
"<A-k>",
[[<ESC><CMD>'<,'>move'<-2<CR>gv=gv]])
64 + map(
"t",
"<ESC>",
"<C-\\><C-n>")
65 + map(
"t",
"<C-w>",
"<ESC><C-w>")
68 + map(
"n",
"<ESC>",
":nohlsearch<CR>", {
unique =
false,
silent =
true })
neovim/lua/plugins.lua
Modified 30 30 open_fn
= require(
"packer.util").float,
134 - use({
"nvim-treesitter/playground" })
135 + "nvim-treesitter/playground",
136 + config =
function()
137 + local cheatsheet
= require(
"cheatsheet")
139 + ":TSHighlightCapturesUnderCursor => This command shows the highlight group under the cursor, when TreeSitter is used" 137 145 use({
"ziglang/zig.vim",
opt =
true,
ft =
"zig" })
228 + "jbyuki/venn.nvim",
219 235 local plugins
= setmetatable({}, {
220 236 __index =
function(_, key)
neovim/lua/tabline.lua
Addednew file mode 100644 2 + local buffer_names_to_ignore
= {
"NvimTree"}
3 + local get_icon = function(name, extension)
4 + if pcall(
require,
"nvim-web-devicons")
then return require"nvim-web-devicons".get_icon(name ,extension, {
default=
true})
end 8 + for _, buffer_number
in pairs(vim.api.nvim_list_bufs())
do 9 + if vim.api.nvim_buf_is_valid(buffer_number)
and vim.api.nvim_buf_is_loaded(buffer_number)
then 10 + local modified
= vim.bo.modified
and "" or " " 12 + local stylish_buffer_name
= vim.api.nvim_buf_get_name(buffer_number):match(
".-([^\\/]-)$")
or "" 13 + if vim.tbl_contains(buffer_names_to_ignore, stylish_buffer_name)
then goto continue
end 15 + if stylish_buffer_name
== "" then 16 + stylish_buffer_name
= "no name" 18 + elseif stylish_buffer_name
== "cheatsheet" then 21 + local extension
= stylish_buffer_name:match(
"%w+%.(.+)")
22 + icon
= get_icon(stylish_buffer_name, extension)
24 + stylish_buffer_name
= " " .. stylish_buffer_name
.. " " 25 + local is_current_buffer
= vim.api.nvim_get_current_buf()
== buffer_number
26 + tabline
= tabline
.. "%#TabLine" .. 27 + (is_current_buffer
and "Sel" or "")
.. "#" .. 28 + " " .. icon
.. stylish_buffer_name
.. (is_current_buffer
and modified
or " ")
33 + return tabline
.. "%#TabLineFill#"