repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: shared ignored file and buftypes

5a6fecf74ed68dbbb72e6fa3c18689a9fb4446ff

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (13)

git/gitconfig

Modified
3 3 [user]
4 4 name = Oliver Jan Krylow
5 5 email = oliver@bugabinga.net
7 7 [core]
8 - editor = hx
8 + editor = nvim
9 9 quotepath = false
10 10 autocrlf = input
11 11 pager = delta
12 12 [diff]
13 13 colorMoved = default
14 - tool = meld
14 + tool = difftastic
16 16 [difftool]
17 17 prompt = false
26 26 difftool = true
28 28 [merge]
29 - tool = meld_merge
29 + tool = nvim_merge
31 31 [mergetool]
32 32 prompt = true
34 34 [mergetool "meld_merge"]
35 35 cmd = "meld \"$LOCAL\" \"$MERGED\" \"$REMOTE\" "
37 +[mergetool "nvim_merge"]
38 + cmd = "nvim -d \"$LOCAL\" \"$MERGED\" \"$REMOTE\" "
37 40 [pull]
38 41 rebase = false

neovim/lua/bugabinga/lsp/init.lua

Modified
9 9 local auto = require'std.auto'
10 10 local ui = require'bugabinga.ui'
11 11 local table = require'std.table'
12 +local ignored = require'std.ignored'
13 14 local lsp_client_configs = require'bugabinga.lsp.clients'
36 37 local match = file_type_event.match
38 - local matches_to_ignore = {'noice', 'notify', 'help', 'TelescopePrompt', 'TelescopeResults', 'toggleterm', 'lazy', 'oil'}
39 + local matches_to_ignore = ignored.filetypes
39 40 if vim.iter(matches_to_ignore):find(match) then return end
41 42 -- vim.print("LSP START", file_type_event)
46 47 -- vim.print( "SEARCHING LSP CLIENT FOR:", match, buffer_path)
49 49 local potential_client_configs = vim.iter(lsp_client_configs)
50 50 :map(function(config)
51 51 vim.validate{
88 88 if not config then
89 - vim.print('FOUND NO LSP CLIENT FOR', buffer_path)
89 + -- vim.print('FOUND NO LSP CLIENT FOR', buffer_path)
90 90 return
109 109 on_error = function(code, ...) vim.print('LSP ERROR', code, ...) end,
110 110 before_init = config.before_init,
111 111 -- on_init = nil, -- should i send workspace/didChangeConfiguration here?
112 - on_exit = function(code, signal, client_id) vim.print("LSP CLIENT EXIT", code, signal, client_id) end,
113 - on_attach = function(client, bufnr) vim.print("LSP CLIENT ATTACH", client.data.client_id, bufnr) end,
112 + -- on_exit = function(code, signal, client_id) vim.print("LSP CLIENT EXIT", code, signal, client_id) end,
113 + -- on_attach = function(client, bufnr) vim.print("LSP CLIENT ATTACH", client.data.client_id, bufnr) end,
114 114 trace = 'off',
115 115 flags = { allow_incremental_sync = true, debounce_text_changes = 50, exit_timeout = 200},
116 116 root_dir = config.root_dir(buffer_path),
124 124 -- reuse_client = function(existing_client, config)end,
127 - vim.print("ATTACHING LSP CLIENT", client_id)
127 + -- vim.print("ATTACHING LSP CLIENT", client_id)
130 -local lsp_attach = function(...) vim.print("ATTACH LSP", ...) end
131 -local lsp_detach = function(...) vim.print("DETACH LSP", ...) end
130 +--TODO: setup keybinds on attach + omnifunc + tagfunc + folding
131 +local lsp_attach = function(...)
132 + -- vim.print("ATTACH LSP", ...)
133 +end
134 +local lsp_detach = function(...)
135 + -- vim.print("DETACH LSP", ...)
136 +end
133 138 auto 'lsp' {

neovim/lua/bugabinga/plugins/last-place.lua

Modified
1 +local ignored = require'std.ignored'
1 3 return {
3 5 'ethanholz/nvim-lastplace',
4 6 lazy = false,
5 7 opts = {
6 - lastplace_ignore_buftype = { 'noice', 'neotree', 'quickfix', 'nofile', 'help' },
7 - lastplace_ignore_filetype = { 'gitcommit', 'gitrebase', 'svn', 'hgcommit' },
8 + lastplace_ignore_buftype = ignored.buftypes,
9 + lastplace_ignore_filetype = ignored.filetypes,
8 10 lastplace_open_folds = true,

neovim/lua/bugabinga/plugins/noice.lua

Modified
48 48 relative = "cursor",
49 49 position = { row = 1, col = 0 },
50 50 size = { min_width = 42, width = "auto", height = 'auto' },
51 - border = { style =vim.g.border_style, padding = { 0, 1 } },
51 + border = { style = vim.g.border_style, padding = { 0, 1 } },
52 52 win_options = { winhighlight = { Normal = "Normal", FloatBorder = "NoiceCmdlinePopupBorder" } },
152 152 notify.setup {
153 153 stages = { shadow_fade, unpack(fade, 2) },
154 154 render = 'compact',
155 - timeout = 10000,
155 + timeout = 2500,
156 156 fps = 60,
157 157 top_down = false,

neovim/lua/bugabinga/plugins/specs.lua

Modified
1 1 local map = require'std.keymap'
2 +local ignored = require'std.ignored'
3 4 return {{
4 5 'edluffy/specs.nvim',
5 - keys = '<leader><leader>',
6 + keys = { '<leader><leader>', '<leader><leader><leader>' },
6 7 config = function()
7 8 local specs = require'specs'
10 11 show_jumps = true,
11 12 min_jump = 30,
12 13 popup = {
13 - delay_ms = 0, -- delay before popup displays
14 + delay_ms = 10, -- delay before popup displays
14 15 inc_ms = 10, -- time increments used for fade/resize effects
15 16 blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend
16 17 width = 10,
18 19 fader = specs.exp_fader,
19 20 resizer = specs.shrink_resizer
21 - -- TODO: API for commonly ignored file and buf types?
22 - ignore_filetypes = {},
23 - ignore_buftypes = {
24 - nofile = true,
25 - },
22 + ignore_filetypes = ignored.filetypes_kv,
23 + ignore_buftypes = ignored.buftypes_kv,
28 26 map.normal {
31 29 keys = '<leader><leader>',
32 30 command = specs.show_specs,
33 + map.normal {
34 + name = 'Find cursor, for real!',
35 + category = 'fun',
36 + keys = '<leader><leader><leader>',
37 + command = function()
38 + specs.show_specs{ width = 69, delay_ms = 69, inc_ms = 42}
39 + end,
40 + }
34 41 end,

neovim/lua/bugabinga/plugins/treesitter.lua

Modified
92 92 autotag = { enable = true },
94 - -- TODO(oli): configure this
94 + -- TODO: configure this
95 95 refactor = 'all',
97 97 context_commentstring = { enable = true, enable_autocmd = false },
149 149 maintainers = { '@IndianBoy42' },
152 - -- FIXME: this aucmd needs to be restricted to buffers where treesitter is loaded
153 - -- Treesitter highlights tend to highlight syntax errors immediately.
154 - -- But that i find distracting while typing.
155 - -- Disable the error highlight while typing, but keep it in normal mode.
156 - auto 'disable_error_highlight_while_typing' {
157 - {
158 - description = 'Disable the @error highlight while in Insert mode',
159 - events = 'InsertEnter',
160 - pattern = '*',
161 - command = function()
163 - end,
164 - },
165 - {
166 - description = 'Enable the @error highlight while in Normal mode',
167 - events = 'InsertLeave',
168 - pattern = '*',
169 - command = function()
171 - end,
172 - },
173 - }

neovim/lua/std/icon.lua

Modified
11 11 user = ' ',
12 12 data = '',
13 13 thread = '󱇫',
14 - ['function'] = '',
14 + ['function'] = '󰡱',
15 15 ['table'] = '',
16 16 toggle_on = '',
17 17 toggle_off = '',

neovim/lua/std/ignored.lua

Added
new file mode 100644
1 +local filetypes = {
2 + 'gitcommit',
3 + 'gitrebase',
4 + 'svn',
5 + 'hgcommit',
6 + 'help',
7 + 'noice',
8 + 'notify'
9 + 'TelescopePrompt',
10 + 'TelescopeResults',
11 + 'toggleterm',
12 + 'lazy',
13 + 'oil'
16 +local buftypes = {
17 + 'noice',
18 + 'neotree',
19 + 'quickfix',
20 + 'help',
21 + 'nofile',
24 +local as_kv = function(list)
25 + local tbl = {}
26 + for _, value in ipairs(list) do
27 + vim.validate { value = { value, 'string'} }
28 + tbl[value] = true
29 + end
30 + return tbl
31 +end
33 +local filetypes_kv = as_kv(filetypes)
34 +local buftypes_kv = as_kv(buftypes)
36 +return {
37 + filetypes = filetypes,
38 + filetypes_kv = filetypes_kv,
39 + buftypes = buftypes,
40 + buftypes_kv = buftypes_kv,

neovim/lua/std/project.lua

Modified
3 3 local join = require'std.table'.join
4 4 local dirname = vim.fs.dirname
5 5 local normalize = vim.fs.normalize
6 6 local exists = vim.loop.fs_stat
7 7 local validate = vim.validate
8 +local table = require'std.table'
9 ---TODO: can this be memoized for perf?
10 --- is the root of a buffer constant over time?
11 --- maybe not truly constant, but constant in relation to the lifetime of a neovim session?
10 +local cache = {}
11 +local hasher = vim.fn.sha256
12 +local markers_to_string = function(markers)
13 + return table.deep_concat(markers, {
14 + prefix = '',
15 + suffix = '',
16 + row_delimiter = '',
17 + key_value_delimiter = '',
18 + fill = '',
19 + newline = '',
20 + })
21 +end
22 +local create_hash = function(path, markers)
23 + local path_hash = hasher(path)
24 + local markers_hash = hasher(markers_to_string(markers))
25 + local hash = path_hash .. '|' .. markers_hash
26 + return hash
27 +end
28 +local cache_get = function(path, markers)
29 + local hash = create_hash(path, markers)
30 + local hit = cache[hash]
31 + -- vim.print('CACHE GET', hash, hit)
32 + return hit
33 +end
34 +local cache_set = function(project_root, path, markers)
35 + local hash = create_hash(path, markers)
36 + -- vim.print('CACHE SET', hash, project_root)
37 + cache[hash] = project_root
38 +end
13 40 --- number of max loop iterations when searching for markers
14 41 local MAX_TRAVERSAL_COUNT = 100
57 84 if not exists(stop) then error( ( 'the stop directory %s does not exist!' ):format(stop) ) end
86 + local cache_hit = cache_get(path, markers)
87 + if cache_hit then
88 + -- vim.print("CACHE HIT", cache_hit)
89 + return cache_hit
90 + end
59 92 local directory_scores = {}
60 93 local current_distance_to_buffer = 0
61 94 local loop_count = 0
65 98 --processes later.
66 99 --the stop itself never gets checked for markers!
67 100 -- stop if we reached the user defined stop instead of the file system root
68 - while path ~= stop do
101 + local current_path = path
102 + while current_path ~= stop do
69 103 if loop_count > MAX_TRAVERSAL_COUNT then error('searching for markers reached the max traversal count!') end
71 105 local score = {
72 - path = path,
106 + path = current_path,
73 107 marker_count = 0,
74 108 distance_to_buffer_file = current_distance_to_buffer,
75 109 markers = {},
78 112 for _, marker in ipairs(markers) do
79 - local marker_path = path .. '/' .. marker.name
113 + local marker_path = current_path .. '/' .. marker.name
80 114 if exists(marker_path) then
81 115 score.marker_count = score.marker_count + marker.weight
82 116 table.insert(score.markers, marker_path)
87 121 table.insert(directory_scores, score)
90 - path = dirname(path)
124 + current_path = dirname(current_path)
92 126 current_distance_to_buffer = current_distance_to_buffer + 1
93 127 loop_count = loop_count + 1
108 142 project_root = score.path
145 + if project_root then
146 + cache_set(project_root, path, markers)
147 + end
111 148 return project_root

neovim/lua/std/table/deep_concat.lua

Modified
13 13 [ 'options.render_value' ] = {options.render_value, 'function', true},
16 - local prefix = options.prefix or '⦃'
17 - local suffix = options.suffix or '⦄'
16 + local prefix = options.prefix or '⎨'
17 + local suffix = options.suffix or '⎬'
18 18 local key_value_delimiter = options.key_value_delimiter or ' ≔ '
19 19 local row_delimiter = options.row_delimiter or ','
20 20 local fill = options.fill or ' '

nushell/env.nu

Modified
9 9 let-env TERM = if ($env | get -i TERM_PROGRAM) == WezTerm { "wezterm" } else { "xterm-256color" }
11 +let-env PATH = ($env.PATH | prepend ( if $env.WIN32 { [] } else { [ $"($env.WORKSPACE)/tools", $"($env.HOME)/.cargo/bin" ] } ))
11 13 # theme for ls and other programs, that use LS_COLORS
12 14 # let-env LS_COLORS = ( try { vivid generate nord } catch { "" } )

nushell/modules/prompt.nu

Modified
87 87 $command_status_segment
88 88 (ansi reset)
89 89 (ansi dark_gray)
90 - $time_segment
90 + ( if (sys).host.hostname == "x230" { (akku) } else { $time_segment })
91 91 (ansi reset)
92 92 ] | str join

tools/install_wezterm_terminfo.sh

Added
new file mode 100644
1 +tempfile=$(mktemp) \
2 + && curl -o $tempfile https://raw.githubusercontent.com/wez/wezterm/main/termwiz/data/wezterm.terminfo \
3 + && tic -x -o ~/.terminfo $tempfile \
4 + && rm $tempfile