repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: fix tab key and bad terminal mapping

5639c19fc6d32e1891c4039d9f58a502e429240f

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (4)

neovim/README.md

Modified
39 39 # todo
41 +* make highlights more visible when expanding snippets
41 42 * toggling case conventions
42 43 * Move to treesitter main branch
43 44 * check out `vim.snippet`

neovim/lazy-lock.json

Modified
42 42 "nvim-gomove": { "branch": "main", "commit": "2b44ae7ac0804f4e3959228122f7c85bef1964e3" },
43 43 "nvim-jdtls": { "branch": "master", "commit": "a4746791876166dc146eae573a1b49d24a6652e7" },
44 44 "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
45 - "nvim-lint": { "branch": "master", "commit": "3317b73ec3eb76cd8ca83e05880c07c83e368c1e" },
45 + "nvim-lint": { "branch": "master", "commit": "4055dc856d5ac8f6b85748006fd8fa6457e086e8" },
46 46 "nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" },
47 47 "nvim-navbuddy": { "branch": "master", "commit": "f34237e8a41ebc6e2716af2ebf49854d8c5289c8" },
48 48 "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
51 51 "nvim-spectre": { "branch": "master", "commit": "2b012554a2536465243c0dff3605b5927c49ed23" },
52 52 "nvim-surround": { "branch": "main", "commit": "84a26afce16cffa7e3322cfa80a42cddf60616eb" },
53 53 "nvim-tree.lua": { "branch": "master", "commit": "ddd1d6eb21c45433bdc65cc8015f2457998f2bf2" },
54 - "nvim-treesitter": { "branch": "master", "commit": "e9321bb914b3a5a88b7dff5392f0f5f8d83bee67" },
54 + "nvim-treesitter": { "branch": "master", "commit": "2bad828b48aed74efe8f7e4ea15550e18c7b482d" },
55 55 "nvim-treesitter-endwise": { "branch": "master", "commit": "60e8c288e011403f248b5f6478dde12bed8a6c55" },
56 - "nvim-treesitter-textobjects": { "branch": "master", "commit": "2aa454e4037424c678a8ff033951a5be39e54b9c" },
56 + "nvim-treesitter-textobjects": { "branch": "master", "commit": "252e65409bc783b0d154f3a341e423c2c4475b26" },
57 57 "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
58 58 "nvim-ts-context-commentstring": { "branch": "main", "commit": "734ebad31c81c6198dfe102aa23280937c937c42" },
59 - "nvim-web-devicons": { "branch": "master", "commit": "fd4abfc5237246670977972c6f518186b621a32d" },
59 + "nvim-web-devicons": { "branch": "master", "commit": "6e355632387a085f15a66ad68cf681c1d7374a04" },
60 60 "nvim-window": { "branch": "main", "commit": "fad0dc96de265b0bdcb21d1071329e5ab1deb4af" },
61 61 "oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" },
62 62 "overseer.nvim": { "branch": "master", "commit": "b04b0b105c07b4f02b3073ea3a98d6eca90bf152" },
65 65 "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
66 66 "qf_helper.nvim": { "branch": "master", "commit": "91dad029c11d1c39b0d1276eda52616f651072be" },
67 67 "resession.nvim": { "branch": "master", "commit": "dc8825439c619030925543a444c4186a2487c200" },
68 - "schemastore.nvim": { "branch": "main", "commit": "80d701841487f72bf9d3fa56b25146b95e190502" },
68 + "schemastore.nvim": { "branch": "main", "commit": "c5d5abc86910fb31b9f734cae2547322e81d3a26" },
69 69 "specs.nvim": { "branch": "main", "commit": "e929006d3f6bb8e43f03e13ac364c67236eb5299" },
70 70 "speedtyper.nvim": { "branch": "main", "commit": "2d158eed4c753995b0501a3a7a72464fbb213e3d" },
71 71 "ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" },

neovim/lua/bugabinga/plugins/cmp.lua

Modified
1 -local map = require 'std.map'
2 -local user_command = require 'std.user_command'
3 1 local icon = require 'std.icon'
5 3 return {
6 - 'hrsh7th/nvim-cmp',
7 - lazy = false,
8 - dependencies = {
9 - 'hrsh7th/cmp-nvim-lsp',
10 - 'hrsh7th/cmp-buffer',
11 - 'hrsh7th/cmp-path',
12 - 'hrsh7th/cmp-nvim-lua',
13 - 'saadparwaiz1/cmp_luasnip',
14 - 'onsails/lspkind.nvim',
15 - 'L3MON4D3/LuaSnip',
16 - },
17 - config = function ()
18 - local cmp = require 'cmp'
19 - local luasnip = require 'luasnip'
20 - local MAX_INDEX_FILE_SIZE = 4000
4 + 'hrsh7th/nvim-cmp',
5 + lazy = false,
6 + dependencies = {
7 + 'hrsh7th/cmp-nvim-lsp',
8 + 'hrsh7th/cmp-buffer',
9 + 'hrsh7th/cmp-path',
10 + 'hrsh7th/cmp-nvim-lua',
11 + 'saadparwaiz1/cmp_luasnip',
12 + 'onsails/lspkind.nvim',
13 + 'L3MON4D3/LuaSnip',
14 + },
15 + config = function ()
16 + local cmp = require 'cmp'
17 + local luasnip = require 'luasnip'
18 + local MAX_INDEX_FILE_SIZE = 4000
22 - local has_words_before = function ()
23 - local line, col = unpack( vim.api.nvim_win_get_cursor( 0 ) )
24 - return col ~= 0 and vim.api.nvim_buf_get_lines( 0, line - 1, line, true )[1]:sub( col, col ):match '%s' == nil
25 - end
20 + local snippet_next = function ( fallback )
21 + if luasnip.expand_or_jumpable() then
22 + luasnip.expand_or_jump()
23 + elseif cmp.visible() then
24 + cmp.select_next_item()
25 + else
26 + fallback()
27 + end
28 + end
27 - local snippet_next = function ( fallback )
28 - if luasnip.expand_or_jumpable() then
29 - luasnip.expand_or_jump()
30 - elseif cmp.visible() then
31 - cmp.select_next_item()
32 - elseif has_words_before() then
33 - cmp.complete()
34 - else
35 - fallback()
36 - end
37 - end
30 + local snippet_prev = function ( fallback )
31 + if luasnip.jumpable( -1 ) then
32 + luasnip.jump( -1 )
33 + elseif cmp.visible() then
34 + cmp.select_prev_item()
35 + else
36 + fallback()
37 + end
38 + end
39 - local snippet_prev = function ( fallback )
40 - if luasnip.jumpable( -1 ) then
41 - luasnip.jump( -1 )
42 - elseif cmp.visible() then
43 - cmp.select_prev_item()
44 - else
45 - fallback()
46 - end
47 - end
40 + local mapping = cmp.mapping.preset.insert {
41 + ['<C-d>'] = cmp.mapping.scroll_docs( -4 ),
42 + ['<C-f>'] = cmp.mapping.scroll_docs( 4 ),
43 + ['<C-e>'] = cmp.mapping.close(),
44 + ['<C-y>'] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, },
45 + ['<C-space>'] = cmp.mapping.complete(),
46 + ['<Tab>'] = cmp.mapping( snippet_next, { 'i', 's', } ),
47 + ['<S-Tab>'] = cmp.mapping( snippet_prev, { 'i', 's', } ),
48 + }
49 - local mapping = cmp.mapping.preset.insert {
50 - ['<C-d>'] = cmp.mapping.scroll_docs( -4 ),
51 - ['<C-f>'] = cmp.mapping.scroll_docs( 4 ),
52 - ['<C-e>'] = cmp.mapping.close(),
53 - ['<C-y>'] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, },
54 - ['<C-space>'] = cmp.mapping.complete(),
55 - ['<Tab>'] = cmp.mapping( snippet_next, { 'i', 's', } ),
56 - ['<S-Tab>'] = cmp.mapping( snippet_prev, { 'i', 's', } ),
57 - }
50 + local formatting = {}
51 + local ok, lspkind = pcall( require, 'lspkind' )
52 + if ok then
53 + formatting.format = lspkind.cmp_format {
54 + mode = 'symbol',
55 + symbol_map = {
56 + Copilot = icon.copilot,
57 + Class = icon.class,
58 + Color = icon.color,
59 + Constant = icon.constant,
60 + Constructor = icon.constructor,
61 + Enum = icon.enum,
62 + EnumMember = icon.enum_member,
63 + Event = icon.event,
64 + Field = icon.field,
65 + File = icon.file,
66 + Folder = icon.folder,
67 + Function = icon['function'],
68 + Interface = icon.interface,
69 + Keyword = icon.keyword,
70 + Method = icon.method,
71 + Module = icon.module,
72 + Operator = icon.operator,
73 + Property = icon.property,
74 + Reference = icon.reference,
75 + Snippet = icon.snippet,
76 + Struct = icon.struct,
77 + Text = icon.text,
78 + TypeParameter = icon.type_parameter,
79 + Unit = icon.unit,
80 + Value = icon.value,
81 + Variable = icon.variable,
82 + },
83 + menu = {
84 + buffer = '[buf]',
85 + nvim_lsp = '[LSP]',
86 + nvim_lua = '[nvim]',
87 + path = '[path]',
88 + luasnip = '[snip]',
89 + },
90 + }
91 + end
59 - --TODO: use custom icons
60 - local formatting = {}
61 - local ok, lspkind = pcall( require, 'lspkind' )
62 - if ok then
63 - formatting.format = lspkind.cmp_format {
64 - mode = 'symbol',
65 - symbol_map = {
66 - Copilot = icon.copilot,
67 - Class = icon.class,
68 - Color = icon.color,
69 - Constant = icon.constant,
70 - Constructor = icon.constructor,
71 - Enum = icon.enum,
72 - EnumMember = icon.enum_member,
73 - Event = icon.event,
74 - Field = icon.field,
75 - File = icon.file,
76 - Folder = icon.folder,
77 - Function = icon['function'],
78 - Interface = icon.interface,
79 - Keyword = icon.keyword,
80 - Method = icon.method,
81 - Module = icon.module,
82 - Operator = icon.operator,
83 - Property = icon.property,
84 - Reference = icon.reference,
85 - Snippet = icon.snippet,
86 - Struct = icon.struct,
87 - Text = icon.text,
88 - TypeParameter = icon.type_parameter,
89 - Unit = icon.unit,
90 - Value = icon.value,
91 - Variable = icon.variable,
92 - },
93 - menu = {
94 - buffer = '[buf]',
95 - nvim_lsp = '[LSP]',
96 - nvim_lua = '[nvim]',
97 - path = '[path]',
98 - luasnip = '[snip]',
99 - },
100 - }
101 - end
93 + local sources = {
94 + { name = 'neodev', },
95 + { name = 'nvim_lua', },
96 + { name = 'nvim_lsp', },
97 + { name = 'path', },
98 + { name = 'luasnip', },
99 + { name = 'neorg', },
101 + name = 'buffer',
102 + keyword_length = 4,
103 + options = {
104 + get_bufnrs = function ()
105 + local bufs = {}
106 + for _, bufnr in ipairs( vim.api.nvim_list_bufs() ) do
107 + -- Don't index giant files
108 + if vim.api.nvim_buf_is_loaded( bufnr ) and vim.api.nvim_buf_line_count( bufnr ) < MAX_INDEX_FILE_SIZE then
109 + table.insert( bufs, bufnr )
110 + end
111 + end
112 + return bufs
113 + end,
114 + },
115 + },
103 - local sources = {
104 - { name = 'nvim_lua', },
105 - { name = 'nvim_lsp', },
106 - { name = 'path', },
107 - { name = 'luasnip', },
108 - { name = 'neorg', },
109 - {
110 - name = 'buffer',
111 - keyword_length = 4,
112 - options = {
113 - get_bufnrs = function ()
114 - local bufs = {}
115 - for _, bufnr in ipairs( vim.api.nvim_list_bufs() ) do
116 - -- Don't index giant files
117 - if vim.api.nvim_buf_is_loaded( bufnr ) and vim.api.nvim_buf_line_count( bufnr ) < MAX_INDEX_FILE_SIZE then
118 - table.insert( bufs, bufnr )
119 - end
120 - end
121 - return bufs
122 - end,
123 - },
124 - },
125 - }
118 + cmp.setup {
119 + mapping = mapping,
120 + formatting = formatting,
121 + sources = sources,
127 - cmp.setup {
128 - mapping = mapping,
129 - formatting = formatting,
130 - sources = sources,
123 + completion = { autocomplete = false, },
124 + snippet = {
125 + expand = function ( args ) luasnip.lsp_expand( args.body ) end,
126 + },
132 - completion = { autocomplete = false, },
133 - snippet = {
134 - expand = function ( args )
135 - luasnip.lsp_expand( args.body )
136 - end,
137 - },
139 - -- experimental = { native_menu = false, },
140 - }
141 - end,
128 + -- experimental = { native_menu = false, },
130 + end,

neovim/lua/bugabinga/terminal.lua

Modified
23 23 command = [[ <C-\><C-n> ]],
26 - map.terminal.normal {
27 - description = 'Close current terminal',
28 - category = 'terminal',
29 - keys = '<F7>',
30 - buffer = true,
31 - command = [[ <C-\><C-n><cmd>q<cr> ]],
32 - }
34 26 vim.opt_local.spell = false
36 27 vim.cmd.startinsert()