repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: keymaps for comments and cleanup of todos

880edb8861dfa10c42de4f838465434b7a5b7928

Oliver Jan Krylow <olver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (10)

neovim/after/syntax/lua.lua

Deleted
deleted file mode 100644
1 --- TODO: map syntax elements to pretty symbols
2 --- function = ƒn⟮
3 --- return = ⏎
4 --- end = ⟯
5 --- ( = ⦅
6 --- ) = ⦆
7 --- for
8 --- do = ⟮
9 --- while = Ꝏ
10 --- if
11 --- then = ⟮
12 --- else
13 --- elseif
14 --- { = ⎨
15 --- } = ⎬
16 --- ... = …
17 --- .. = ‥
18 --- -- = ―
19 --- [[ = ⟪
20 --- ]] = ⟫
22 --- FIXME: conceal feature is too simple
23 --- it affects all characters in comments and strings
24 --- that could maybe be circumvented with complex matches and regions, but integ with TS would be more elegant
25 --- it changes the highlighting of concealed stuff
26 --- furthermore, i struggled to get the quoting of special character right when calling syntax command from lua
28 -vim.opt_local.conceallevel = 2

neovim/filetype.lua

Modified
4 4 -- use builtin lua filetype detection
5 5 vim.g.do_filetype_lua = 1
6 6 -- disable builtin filetype.vim
7 7 vim.g.did_load_filetypes = 0
9 9 vim.filetype.add {
10 - extension = {
11 - service = 'systemd',
12 - mount = 'systemd',
13 - timer = 'systemd',
14 - socket = 'systemd',
15 - network = 'systemd',
16 - just = 'just',
17 - -- lua = function(path)
18 - -- if path:match 'neovim' and path:match 'dotfiles' then
19 - -- -- TODO: a custom file type for lua neovim configuration can be used to
20 - -- -- start the lua lsp in a specific mode to neovim
21 - -- return 'neovim.lua'
22 - -- end
23 - -- return 'lua'
24 - -- end,
25 - },
26 - filename = {
27 - ['justfile'] = 'just',
28 - ['Justfile'] = 'just',
29 - ['.justfile'] = 'just',
30 - ['.Justfile'] = 'just',
31 - },
10 + extension = {
11 + service = 'systemd',
12 + mount = 'systemd',
13 + timer = 'systemd',
14 + socket = 'systemd',
15 + network = 'systemd',
16 + just = 'just',
17 + },
18 + filename = {
19 + ['justfile'] = 'just',
20 + ['Justfile'] = 'just',
21 + ['.justfile'] = 'just',
22 + ['.Justfile'] = 'just',
23 + },

neovim/ftplugin/java.lua

Modified
1 --- TODO: add kool conceals for java syntax
2 --- https://github.com/alok/python-conceal/blob/master/after/syntax/python.vim
3 -vim.opt_local.conceallevel = 2
5 1 local want = require 'bugabinga.std.want'
6 2 want {
7 3 'jdtls',
32 28 vim.notify 'starting eclipse.jdt.ls in syntaxserver mode'
35 - -- TODO: refactor most jdtls setup into module
36 - -- TODO: is there stuf that can be cached here?
37 - -- profile this file
38 31 local installed, jdtls_installer = installer.get_server 'jdtls'
39 32 if not installed then
40 33 vim.notify('jdtls is not installed!', error)
75 68 shared_configuration = jdtls_config_dir
77 - --FIXME: sometimes the jdtls cannot start (code 13).
70 + -- sometimes the jdtls cannot start (code 13).
78 71 -- it seems to have to do with invalif configuration "config_linux" and/or "~/.config/jdtls"
79 72 local jdtls_command = {
80 73 'java',
82 75 '-Declipse.application=org.eclipse.jdt.ls.core.id1',
83 76 '-Dosgi.bundles.defaultStartLevel=4',
84 77 '-Declipse.product=org.eclipse.jdt.ls.core.product',
85 - -- '-Dosgi.checkConfiguration=true',
86 - -- '-Dosgi.sharedConfiguration.area=' .. shared_configuration,
87 - -- '-Dosgi.sharedConfiguration.area.readOnly=true',
88 - -- '-Dosgi.configuration.cascaded=true',
89 78 '-Dlog.protocol=' .. tostring(debug_log),
90 79 '-Dlog.level=ALL',
91 - --TODO: switch to ZGC
92 - '-XX:+UseParallelGC',
93 - '-XX:GCTimeRatio=4',
94 - '-XX:AdaptiveSizePolicyWeight=90',
80 + '-XX:+UnlockExperimentalVMOptions',
81 + '-XX:+UseZGC',
82 + -- '-XX:+UseParallelGC',
83 + -- '-XX:GCTimeRatio=4',
84 + -- '-XX:AdaptiveSizePolicyWeight=90',
95 85 '-Dsun.zip.disableMemoryMapping=true',
96 86 '-Djava.import.generatesMetadataFilesAtProjectRoot=false',
97 87 '-Xmx4G',
104 94 '-jar',
105 95 vim.fn.glob(jdtls_install_dir .. '/plugins/org.eclipse.equinox.launcher_*.jar', false, false),
106 96 '-configuration',
107 - -- vim.fn.expand('~/.config/jdtls', false, false),
108 97 shared_configuration,
109 98 '-data',
110 99 jdtls_workspace_dir,

neovim/ftplugin/neo-tree.lua

Deleted
deleted file mode 100644
1 ---FIXME: seems to have no effect right now, even though this file gets loaded.
2 -vim.opt_local.colorcolumn = {}

neovim/init.lua

Modified
54 54 require 'bugabinga.autopairs'
55 55 require 'bugabinga.todo'
56 56 require 'bugabinga.markdown'
57 -require 'bugabinga.repl'
58 57 require 'bugabinga.surround'
60 59 -- treesitter
63 62 -- lsp
64 63 require 'bugabinga.lsp'
66 --- TODO:
67 --- [ ] DAP
68 --- [ ] put all keybinds into facade
69 --- [ ] preview multimedia with telescope
70 --- [ ] icon facade: icon.get("name")
71 --- [ ] use nvim-specific lsp only in neovim config
72 --- [ ] stop treesitter error highlight while typing
73 --- [ ] fix gitsigns highights
74 --- [ ] hydra cycle buffers
75 --- [ ] add fstabfmt to null-ls
76 --- [ ] load plugins/init.lua and sync on write. reload init.lua?
77 --- [ ] lsp diagnostics hide in insert mode
78 --- [ ] cross platform status bar
79 --- [ ] show winbar
80 --- [ ] show read only files in winbar
81 --- [ ] make cursor red if diagnostics
82 --- [ ] toggle diagnostics keybind
83 --- [~] start a toggleterm with: watch <buffer> { clear; mdcat <buffer> }
84 --- [~] disable gomove in special buffers
85 --- [x] replace filetype.lua plugin with builtin: https://neovim.io/news/2022/04
86 --- [x] add keybind to dismiss notify window
87 --- [x] make keymap facade immediate and support buffer local binds
88 --- [~] disable gomove in special buffers
89 --- [x] replace filetype.lua plugin with builtin: https://neovim.io/news/2022/04
90 --- [x] undofile not work?
91 --- [x] why does redo not work?
92 --- [x] JDTLS
93 --- [~] bindings for luadev
94 --- [~] close toogleterms on quit
95 --- [-] LSP diagnostics on save
96 --- [x] make focus handle hybrid linenumbers and less jitter
97 --- [x] disable shade for some buffers
98 --- [~] turn off colorcolumns in certain buffers, only show in active buffer, use focus?
99 --- [~] check for system dependecneis, extend checkhealth?
100 --- [~] illuminate+LSP + treesitter.refactor.highlight.definitions
101 --- [x] LSP
102 --- [~] gf to lua modules
103 --- [x] AUTOCMD
104 --- [x] COMPLETION
105 --- [x] JAVA, RUST, ZIG
106 --- [~] MARKDOWN
107 --- [~] nushell
108 --- [x] XML, TOML, JSON, YAML
109 --- [x] TREESITTER
110 --- [~] ~~SVN~~
111 --- [~] ~~VIM-ENEUCH for nvim~~
112 --- [x] KEYBINDINGS
113 --- [x] PAQ
114 --- [x] impatient
115 --- [x] icons + colorscheme
116 --- [x] TELESCOPE
117 --- [x] TERMINAL
118 --- [x] GIT
119 --- [x] TREE
120 --- [x] restore last cursor position
121 --- [x] bind nohl
122 --- [x] configure Comment
65 +-- TODO: DAP
66 +-- TODO: put all keybinds into facade
67 +-- TODO: preview multimedia with telescope
68 +-- TODO: icon facade: icon.get("name")
69 +-- TODO: use nvim-specific lsp only in neovim config
70 +-- TODO: stop treesitter error highlight while typing
71 +-- TODO: fix gitsigns highights
72 +-- TODO: hydra cycle buffers
73 +-- TODO: add fstabfmt to null-ls
74 +-- TODO: load plugins/init.lua and sync on write. reload init.lua?
75 +-- TODO: lsp diagnostics hide in insert mode
76 +-- TODO: cross platform status bar
77 +-- TODO: show winbar
78 +-- TODO: show read only files in winbar
79 +-- TODO: make cursor red if diagnostics
80 +-- TODO: toggle diagnostics keybind
125 83 -- PLUGINS TO TRY
135 93 -- https://github.com/jakewvincent/mkdnflow.nvim
136 94 -- https://github.com/rktjmp/lush.nvim
137 95 -- https://github.com/jbyuki/venn.nvim
96 +-- https://github.com/ziontee113/color-picker.nvim
97 +--
98 +-- DAP PLUGINS
99 +-- https://github.com/mfussenegger/nvim-dap
100 +-- https://github.com/nvim-telescope/telescope-dap.nvim
101 +-- https://github.com/theHamsta/nvim-dap-virtual-text
102 +-- https://github.com/rcarriga/nvim-dap-ui

neovim/lua/bugabinga/comments.lua

Modified
1 +local map = require 'bugabinga.std.keymap'
1 2 local want = require 'bugabinga.std.want'
2 -want { 'Comment' }(function(comment)
3 - --FIXME: use keymap facade instead of default bindings
4 - comment.setup()
3 +want { 'Comment' } (function(comment)
4 + comment.setup {
5 + mappings = {
6 + basic = false,
7 + extra = false,
8 + extended = false,
9 + },
10 + }
12 + -- taken from documentation, not sure why exactly these options are necessary
13 + local options = { expr = true, remap = true }
14 + map {
15 + description = 'Toggle linewise comment',
16 + category = map.CATEGORY.EDITING,
17 + mode = map.MODE.NORMAL,
18 + keys = 'gcc',
19 + command = "v:count == 0 ? '<Plug>(comment_toggle_current_linewise)' : '<Plug>(comment_toggle_linewise_count)'",
20 + options = options,
21 + }
22 + map {
23 + description = 'Toggle blockwise comment',
24 + category = map.CATEGORY.EDITING,
25 + mode = map.MODE.NORMAL,
26 + keys = 'gbc',
27 + command = "v:count == 0 ? '<Plug>(comment_toggle_current_blockwise)' : '<Plug>(comment_toggle_blockwise_count)'",
28 + options = options,
29 + }
31 + map {
32 + description = 'Toggle motion linewise comment',
33 + category = map.CATEGORY.EDITING,
34 + mode = map.MODE.NORMAL,
35 + keys = 'gc',
36 + command = '<Plug>(comment_toggle_linewise)',
37 + }
38 + map {
39 + description = 'Toggle motion blockwise comment',
40 + category = map.CATEGORY.EDITING,
41 + mode = map.MODE.NORMAL,
42 + keys = 'gb',
43 + command = '<Plug>(comment_toggle_blockwise)',
44 + }
46 + map {
47 + description = 'Toggle visual linewise comment',
48 + category = map.CATEGORY.EDITING,
49 + mode = map.MODE.VISUAL,
50 + keys = 'gc',
51 + command = '<Plug>(comment_toggle_linewise_visual)',
52 + }
53 + map {
54 + description = 'Toggle visual blockwise comment',
55 + category = map.CATEGORY.EDITING,
56 + mode = map.MODE.VISUAL,
57 + keys = 'gb',
58 + command = '<Plug>(comment_toggle_blockwise_visual)',
59 + }
5 60 end)

neovim/lua/bugabinga/options/autocommands.lua

Modified
1 1 local auto = require 'bugabinga.std.auto'
3 3 auto 'highlight_yanked_text' {
4 - description = 'briefly highlight yanked text',
5 - events = 'TextYankPost',
6 - pattern = '*',
7 - callback = function()
8 - vim.highlight.on_yank { timeout = 500 }
9 - end,
4 + description = 'briefly highlight yanked text',
5 + events = 'TextYankPost',
6 + pattern = '*',
7 + callback = function()
8 + vim.highlight.on_yank { timeout = 500 }
9 + end,
12 12 auto 'disable_colorcolumn_in_special_buffers' {
13 - description = 'Hide colorcolumn in buffers, that do not show source code.',
14 - events = { 'FileType' },
15 - --FIXME: neo-tree filetype seems not to get matched, why?
16 - pattern = 'Trouble,qf,neo-tree,help,toggleterm',
17 - callback = function()
18 - vim.opt_local.colorcolumn = {}
19 - end,
20 -}
22 -auto 'change_readonly_style' {
23 - description = 'Change some highlights for readonly buffers.',
24 - events = { 'BufEnter' },
25 - callback = function()
26 - if vim.bo.readonly then
27 - -- TODO: use extmark to somehow indicate this file is readonly
28 - vim.notify 'this buffer is read-only'
29 - end
30 - end,
13 + description = 'Hide colorcolumn in buffers, that do not show source code.',
14 + events = { 'FileType' },
15 + pattern = 'Trouble,qf,help,toggleterm',
16 + callback = function()
17 + vim.opt_local.colorcolumn = {}
18 + end,

neovim/lua/bugabinga/options/keymaps.lua

Modified
1 1 local map = require 'bugabinga.std.keymap'
2 2 -- set <SPACE> as leader key
3 3 map {
4 - mode = map.MODE.ALL,
5 - keys = map.KEY.SPACE,
6 - command = map.COMMAND.NOP,
7 - visible = false,
4 + mode = map.MODE.ALL,
5 + keys = map.KEY.SPACE,
6 + command = map.COMMAND.NOP,
7 + visible = false,
9 9 vim.g.mapleader = ' '
10 10 vim.g.maplocalleader = ' '
12 12 -- disable default ENTER binding
13 13 map {
14 - mode = map.MODE.ALL,
15 - keys = map.KEY.ENTER,
16 - command = map.COMMAND.NOP,
17 - visible = false,
14 + mode = map.MODE.ALL,
15 + keys = map.KEY.ENTER,
16 + command = map.COMMAND.NOP,
17 + visible = false,
20 20 -- disable command history keymap, because i fatfinger it too often
23 23 -- when pausing between q and :, the binding still opens command history.
24 24 -- this may be related to the timeoutlen setting?
25 25 map {
26 - mode = map.MODE.ALL,
27 - keys = 'q:',
28 - command = map.COMMAND.NOP,
29 - visible = false,
26 + mode = map.MODE.ALL,
27 + keys = 'q:',
28 + command = map.COMMAND.NOP,
29 + visible = false,
31 31 map {
32 - mode = map.MODE.ALL,
33 - keys = 'q/',
34 - command = map.COMMAND.NOP,
35 - visible = false,
32 + mode = map.MODE.ALL,
33 + keys = 'q/',
34 + command = map.COMMAND.NOP,
35 + visible = false,
37 37 map {
38 - mode = map.MODE.ALL,
39 - keys = 'Q',
40 - command = map.COMMAND.NOP,
41 - visible = false,
38 + mode = map.MODE.ALL,
39 + keys = 'Q',
40 + command = map.COMMAND.NOP,
41 + visible = false,
43 43 -- disable them evil arrows
44 44 map {
45 - mode = map.MODE.ALL,
46 - keys = map.KEY.UP,
47 - command = map.COMMAND.NOP,
48 - visible = false,
45 + mode = map.MODE.ALL,
46 + keys = map.KEY.UP,
47 + command = map.COMMAND.NOP,
48 + visible = false,
50 50 map {
51 - mode = map.MODE.ALL,
52 - keys = map.KEY.DOWN,
53 - command = map.COMMAND.NOP,
54 - visible = false,
51 + mode = map.MODE.ALL,
52 + keys = map.KEY.DOWN,
53 + command = map.COMMAND.NOP,
54 + visible = false,
56 56 map {
57 - mode = map.MODE.ALL,
58 - keys = map.KEY.LEFT,
59 - command = map.COMMAND.NOP,
60 - visible = false,
57 + mode = map.MODE.ALL,
58 + keys = map.KEY.LEFT,
59 + command = map.COMMAND.NOP,
60 + visible = false,
62 62 map {
63 - mode = map.MODE.ALL,
64 - keys = map.KEY.RIGHT,
65 - command = map.COMMAND.NOP,
66 - visible = false,
63 + mode = map.MODE.ALL,
64 + keys = map.KEY.RIGHT,
65 + command = map.COMMAND.NOP,
66 + visible = false,
69 69 local function open_link_under_cursor()
70 - local file_under_cursor = vim.fn.expand '<cfile>'
71 - --check that it vaguely resembles an URI
72 - if file_under_cursor and file_under_cursor:match '%a+://.+' then
73 - local Job = require 'plenary.job'
74 - Job:new({
75 - --FIXME: a x-platform command is needed here
76 - command = 'firefox',
77 - args = { file_under_cursor },
78 - on_exit = function(status, code)
79 - print(status:result(), code)
80 - vim.notify('Openend ' .. file_under_cursor)
81 - end,
82 - }):start()
83 - end
70 + ---@diagnostic disable-next-line: missing-parameter
71 + local file_under_cursor = vim.fn.expand '<cfile>'
72 + --check that it vaguely resembles an URI
73 + if file_under_cursor and file_under_cursor:match '%a+://.+' then
74 + local Job = require 'plenary.job'
75 + Job:new({
76 + command = 'firefox',
77 + args = { file_under_cursor },
78 + on_exit = function()
79 + vim.notify('Openend ' .. file_under_cursor)
80 + end,
81 + }):start()
82 + end
86 85 map {
87 - description = 'Open web link under cursor in browser',
88 - category = map.CATEGORY.NAVIGATION,
89 - mode = map.MODE.NORMAL,
90 - keys = 'gx',
91 - command = open_link_under_cursor,
86 + description = 'Open web link under cursor in browser',
87 + category = map.CATEGORY.NAVIGATION,
88 + mode = map.MODE.NORMAL,
89 + keys = 'gx',
90 + command = open_link_under_cursor,
94 93 map {
95 - description = 'Dismiss current notifications',
96 - category = map.CATEGORY.NOTIFY,
97 - mode = map.MODE.NORMAL,
98 - keys = map.KEY.ESCAPE,
99 - command = function()
100 - pcall(vim.notify.dismiss)
101 - end,
94 + description = 'Dismiss current notifications',
95 + category = map.CATEGORY.NOTIFY,
96 + mode = map.MODE.NORMAL,
97 + keys = map.KEY.ESCAPE,
98 + command = function()
99 + pcall(vim.notify.dismiss)
100 + end,

neovim/lua/bugabinga/plugins/init.lua

Modified
169 169 'mfussenegger/nvim-jdtls',
170 170 -- debug adapter protocol
171 171 'mfussenegger/nvim-dap',
172 - -- repls in neovim
173 - 'hkupty/iron.nvim',
174 172 -- color picker
175 173 'ziontee113/color-picker.nvim',
176 174 -- motions around object

neovim/lua/bugabinga/repl.lua

Deleted
deleted file mode 100644
1 -local want = require 'bugabinga.std.want'
2 -want {
3 - 'iron.core',
4 - 'iron.view',
5 -}(function(core, view)
6 - core.setup {
7 - config = {
8 - -- If iron should expose `<plug>(...)` mappings for the plugins
9 - should_map_plug = false,
10 - -- Whether a repl should be discarded or not
11 - scratch_repl = true,
12 - repl_open_cmd = view.curry.right(80),
13 - -- how the REPL window will be opened, the default is opening
14 - -- a float window of height 40 at the bottom.
15 - },
16 - -- Iron doesn't set keymaps by default anymore. Set them here
17 - -- or use `should_map_plug = true` and map from you vim files
18 - -- FIXME: setup own keybinds
19 - keymaps = {
20 - send_motion = '<space>sc',
21 - visual_send = '<space>sc',
22 - send_file = '<space>sf',
23 - send_line = '<space>sl',
24 - send_mark = '<space>sm',
25 - mark_motion = '<space>mc',
26 - mark_visual = '<space>mc',
27 - remove_mark = '<space>md',
28 - cr = '<space>s<cr>',
29 - interrupt = '<space>s<space>',
30 - exit = '<space>sq',
31 - clear = '<space>cl',
32 - },
33 - -- If the highlight is on, you can change how it looks
34 - -- For the available options, check nvim_set_hl
35 - highlight = {
36 - italic = true,
37 - },
38 - }
39 -end)