repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: moved neoclip into telescope config

23e889720d1040fc65477d5df2b1324818f1637e

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (4)

neovim/README.md

Modified
39 39 # todo
41 41 * make highlights more visible when expanding snippets
42 +* fix bug:
43 + cursor restore position on (session?) load jumps one location to somewhere
44 + after correct location
42 45 * toggling case conventions
43 46 * Move to treesitter main branch
44 47 * check out `vim.snippet`

neovim/ftplugin/lua.lua

Modified
2 2 -- Options to add `gf` functionality inside `.lua` files.
3 3 vim.opt_local.include = [[\v<((do|load)file|require)[^''"]*[''"]\zs[^''"]+]]
4 4 vim.opt_local.includeexpr = "substitute(v:fname,'\\.','/','g')"
5 5 for _, path in pairs( vim.api.nvim_list_runtime_paths() ) do
6 - vim.opt_local.path:append( path .. '/lua' )
6 + vim.opt_local.path:append( path .. '/lua' )
8 8 vim.opt_local.suffixesadd:prepend '.lua'
10 10 local map = require 'std.map'
12 12 map.normal {
13 - description = 'Wrap word under cursor with require call',
14 - keys = '<leader>rq',
15 - category = 'refactor',
16 - -- surround word with '
17 - -- insert `require`
18 - -- move 3 words
19 - command = "ebi'<esc>ea'<esc>bbirequire <esc>www",
20 - buffer = true,
21 - remap = true,
13 + description = 'Wrap word under cursor with require call',
14 + keys = '<leader>rq',
15 + category = 'refactor',
16 + -- surround word with '
17 + -- insert `require`
18 + -- move 3 words
19 + command = "ebi'<esc>ea'<esc>bbirequire <esc>www",
20 + buffer = true,
21 + remap = true,
24 24 --TODO: add debug.print, require, prequire
25 25 prequire 'nvim-surround'.buffer_setup {
26 - surrounds = {
27 - ['P'] = {
28 - add = { 'vim.print(', ')', },
29 - find = 'vim%.print%b()',
30 - delete = '^(vim%.print%()().-(%))()$',
31 - change = {
32 - target = '^(vim%.print%()().-(%))()$',
33 - },
34 - },
35 - },
26 + surrounds = {
27 + ['R'] = {
28 + add = { "require '", "'", },
29 + find = "require%b''",
30 + --FIXME: find out how to craft these, those cannot be correct right now
31 + delete = "^(require')().-(')()$",
32 + change = {
33 + target = "^(require')().-('()$",
34 + },
35 + },
36 + ['P'] = {
37 + add = { 'vim.print(', ')', },
38 + find = 'vim%.print%b()',
39 + delete = '^(vim%.print%()().-(%))()$',
40 + change = {
41 + target = '^(vim%.print%()().-(%))()$',
42 + },
43 + },
44 + },

neovim/lua/bugabinga/plugins/neoclip.lua

Deleted
deleted file mode 100644
1 -local map = require 'std.map'
3 -map.normal {
4 - description = 'Open clipboard history...',
5 - category = 'history',
6 - keys = '<c-p><c-h>',
7 - command = function ()
8 - local telescope = require 'telescope'
9 - telescope.load_extension 'neoclip'
10 - telescope.extensions.neoclip.default()
11 - end,
12 -}
14 -return {
15 - 'AckslD/nvim-neoclip.lua',
16 - event = 'TextYankPost',
17 - dependencies = {
18 - 'nvim-telescope/telescope.nvim',
19 - },
20 - opts = {},
21 -}

neovim/lua/bugabinga/plugins/telescope.lua

Modified
1 1 require 'bugabinga.health'.add_dependency
3 - name = 'ripgrep',
4 - name_of_executable = 'rg',
3 + name = 'ripgrep',
4 + name_of_executable = 'rg',
6 - {
7 - name = 'find-fd',
8 - name_of_executable = 'fd',
9 - }
10 - {
11 - name = 'CMake',
12 - name_of_executable = 'cmake',
13 - }
6 + {
7 + name = 'find-fd',
8 + name_of_executable = 'fd',
9 + }
10 + {
11 + name = 'CMake',
12 + name_of_executable = 'cmake',
13 + }
15 15 local map = require 'std.map'
16 16 local icon = require 'std.icon'
18 18 map.normal {
19 - description = 'Switch to recently used folders',
20 - category = 'navigation',
21 - keys = '<c-p><c-z>',
22 - command = function () require 'telescope'.extensions.zoxide.list() end,
19 + description = 'Switch to recently used folders',
20 + category = 'navigation',
21 + keys = '<c-p><c-z>',
22 + command = function () require 'telescope'.extensions.zoxide.list() end,
25 25 map.normal.visual.terminal {
26 - description = 'Search help files',
27 - category = 'help',
28 - keys = '<F1>',
29 - command = function () require 'telescope.builtin'.help_tags() end,
26 + description = 'Search help files',
27 + category = 'help',
28 + keys = '<F1>',
29 + command = function () require 'telescope.builtin'.help_tags() end,
32 32 map.normal {
33 - description = 'Open last search...',
34 - category = 'plugins',
35 - keys = '<c-p>',
36 - command = function () require 'telescope.builtin'.resume() end,
33 + description = 'Open last search...',
34 + category = 'plugins',
35 + keys = '<c-p>',
36 + command = function () require 'telescope.builtin'.resume() end,
39 39 map.normal {
40 - description = 'Open search for all files...',
41 - category = 'search',
42 - keys = '<c-p><c-p>',
43 - command = function () require 'telescope.builtin'.find_files() end,
40 + description = 'Open search for all files...',
41 + category = 'search',
42 + keys = '<c-p><c-p>',
43 + command = function () require 'telescope.builtin'.find_files() end,
46 46 map.normal {
47 - description = 'Open search for keymaps...',
48 - category = 'search',
49 - keys = '<c-p><c-k>',
50 - command = function () require 'telescope.builtin'.keymaps() end,
47 + description = 'Open search for keymaps...',
48 + category = 'search',
49 + keys = '<c-p><c-k>',
50 + command = function () require 'telescope.builtin'.keymaps() end,
53 53 map.normal {
54 - description = 'Open search for symbols...',
55 - category = 'search',
56 - keys = '<c-p><c-s>',
57 - command = function () require 'telescope.builtin'.symbols() end,
54 + description = 'Open search for symbols...',
55 + category = 'search',
56 + keys = '<c-p><c-s>',
57 + command = function () require 'telescope.builtin'.symbols() end,
60 60 map.normal {
61 - description = 'Open search for all file contents...',
62 - category = 'search',
63 - keys = '<c-p><c-g>',
64 - command = function () require 'telescope.builtin'.live_grep() end,
61 + description = 'Open search for all file contents...',
62 + category = 'search',
63 + keys = '<c-p><c-g>',
64 + command = function () require 'telescope.builtin'.live_grep() end,
67 67 map.normal {
68 - description = 'Open search for current buffer content...',
69 - category = 'search',
70 - keys = '<c-p><c-/>',
71 - command = function () require 'telescope.builtin'.current_buffer_fuzzy_find() end,
68 + description = 'Open search for current buffer content...',
69 + category = 'search',
70 + keys = '<c-p><c-/>',
71 + command = function () require 'telescope.builtin'.current_buffer_fuzzy_find() end,
74 74 map.normal {
75 - description = 'Open search for buffers...',
76 - category = 'search',
77 - keys = '<c-e>',
78 - command = function () require 'telescope.builtin'.buffers() end,
75 + description = 'Open search for buffers...',
76 + category = 'search',
77 + keys = '<c-e>',
78 + command = function () require 'telescope.builtin'.buffers() end,
81 +map.normal {
82 + description = 'Open clipboard history...',
83 + category = 'history',
84 + keys = '<c-p><c-v>',
85 + command = function ()
86 + require 'telescope'.extensions.neoclip.default()
87 + end,
81 90 return {
82 - 'nvim-telescope/telescope.nvim',
83 - version = '0.*',
84 - cmd = 'Telescope',
85 - event = 'VeryLazy',
86 - dependencies = {
87 - {
88 - 'nvim-telescope/telescope-fzf-native.nvim',
89 - build =
90 - function ( plugin_spec )
91 - local result
92 - result = vim.system( { 'cmake', '-S.', '-Bbuild', '-DCMAKE_BUILD_TYPE=Release', },
93 - { text = true, cwd = plugin_spec.dir, } ):wait()
94 - if result.code ~= 0 then error( result.stderr ) end
95 - result = vim.system( { 'cmake', '--build', 'build', '--config', 'Release', },
96 - { text = true, cwd = plugin_spec.dir, } ):wait()
97 - if result.code ~= 0 then error( result.stderr ) end
98 - result = vim.system( { 'cmake', '--install', 'build', '--prefix', 'build', },
99 - { text = true, cwd = plugin_spec.dir, } ):wait()
100 - if result.code ~= 0 then error( result.stderr ) end
101 - end,
102 - },
103 - 'nvim-lua/plenary.nvim',
104 - 'nvim-tree/nvim-web-devicons',
105 - 'nvim-telescope/telescope-symbols.nvim',
106 - 'jvgrootveld/telescope-zoxide',
107 - },
108 - config = function ()
109 - local telescope = require 'telescope'
110 - local actions = require 'telescope.actions'
111 - local themes = require 'telescope.themes'
91 + 'nvim-telescope/telescope.nvim',
92 + version = '0.*',
93 + cmd = 'Telescope',
94 + event = 'VeryLazy',
95 + dependencies = {
96 + {
97 + 'nvim-telescope/telescope-fzf-native.nvim',
98 + build =
99 + function ( plugin_spec )
100 + local result
101 + result = vim.system( { 'cmake', '-S.', '-Bbuild', '-DCMAKE_BUILD_TYPE=Release', },
102 + { text = true, cwd = plugin_spec.dir, } ):wait()
103 + if result.code ~= 0 then error( result.stderr ) end
104 + result = vim.system( { 'cmake', '--build', 'build', '--config', 'Release', },
105 + { text = true, cwd = plugin_spec.dir, } ):wait()
106 + if result.code ~= 0 then error( result.stderr ) end
107 + result = vim.system( { 'cmake', '--install', 'build', '--prefix', 'build', },
108 + { text = true, cwd = plugin_spec.dir, } ):wait()
109 + if result.code ~= 0 then error( result.stderr ) end
110 + end,
111 + },
112 + 'nvim-lua/plenary.nvim',
113 + 'nvim-tree/nvim-web-devicons',
114 + 'nvim-telescope/telescope-symbols.nvim',
115 + 'jvgrootveld/telescope-zoxide',
116 + 'AckslD/nvim-neoclip.lua',
117 + },
118 + config = function ()
119 + local telescope = require 'telescope'
120 + local actions = require 'telescope.actions'
121 + local themes = require 'telescope.themes'
113 - local ivy = themes.get_ivy { hidden = true, layout_config = { preview_width = 0.69, }, }
114 - local dropdown = themes.get_dropdown { layout_config = { width = 0.69, }, }
115 - local cursor = themes.get_cursor { layout_config = { preview_width = 0.42, width = 0.69, }, }
123 + local ivy = themes.get_ivy { hidden = true, layout_config = { preview_width = 0.69, }, }
117 - telescope.setup {
118 - defaults = {
119 - selection_strategy = 'reset',
120 - hidden = true,
121 - scroll_strategy = 'limit',
122 - wrap_results = true,
123 - layout_config = {
124 - horizontal = { prompt_position = 'bottom', preview_width = 0.69, },
125 - vertical = { mirror = false, },
126 - width = 0.69,
127 - height = 0.42,
128 - preview_cutoff = 124,
129 - },
130 - prompt_prefix = icon.telescope .. ' ',
131 - selection_caret = icon.arrow_right .. ' ',
132 - file_ignore_patterns = {
133 - '.git/',
134 - '.svn/',
135 - '.cache',
136 - '%.o',
137 - '%.a',
138 - '%.out',
139 - '%.class',
140 - '%.pdf',
141 - '%.mkv',
142 - '%.mp4',
143 - '%.zip',
144 - '%.spl',
145 - },
146 - mappings = {
147 - i = {
148 - ['<c-j>'] = actions.cycle_history_next,
149 - ['<c-k>'] = actions.cycle_history_prev,
150 - ['<c-n>'] = actions.move_selection_next,
151 - ['<c-p>'] = actions.move_selection_previous,
152 - ['<c-s>'] = actions.file_split,
153 - ['g?'] = actions.which_key,
154 - },
155 - n = { q = actions.close, },
156 - },
157 - },
158 - -- FIXME: some themes have an issue, where filtered results do not get
159 - -- selected and are not in view
160 - pickers = {
161 - find_files = ivy,
162 - fd = ivy,
163 - keymaps = dropdown,
164 - diagnostics = dropdown,
165 - symbols = cursor,
166 - live_grep = ivy,
167 - current_buffer_fuzzy_find = cursor,
168 - buffers = cursor,
169 - help_tags = dropdown,
170 - },
171 - extensions = {
172 - zoxide = { prompt_title = 'Navigate deez nuts!', },
173 - },
174 - }
125 + telescope.setup {
126 + defaults = {
127 + hidden = true,
128 + prompt_prefix = icon.telescope .. ' ',
129 + selection_caret = icon.arrow_right .. ' ',
130 + file_ignore_patterns = {
131 + '.git/',
132 + '.svn/',
133 + '.cache',
134 + '%.o',
135 + '%.a',
136 + '%.out',
137 + '%.class',
138 + '%.pdf',
139 + '%.mkv',
140 + '%.mp4',
141 + '%.zip',
142 + '%.spl',
143 + },
144 + mappings = {
145 + i = {
146 + ['<c-j>'] = actions.cycle_history_next,
147 + ['<c-k>'] = actions.cycle_history_prev,
148 + ['<c-n>'] = actions.move_selection_next,
149 + ['<c-p>'] = actions.move_selection_previous,
150 + ['<c-s>'] = actions.file_split,
151 + ['g?'] = actions.which_key,
152 + },
153 + n = { q = actions.close, },
154 + },
155 + },
156 + pickers = {
157 + find_files = ivy,
158 + fd = ivy,
159 + keymaps = ivy,
160 + diagnostics = ivy,
161 + symbols = ivy,
162 + live_grep = ivy,
163 + current_buffer_fuzzy_find = ivy,
164 + buffers = ivy,
165 + help_tags = ivy,
166 + },
167 + extensions = {
168 + zoxide = { prompt_title = 'Navigate deez nuts!', },
169 + },
176 - telescope.load_extension 'fzf'
177 - telescope.load_extension 'zoxide'
178 - end,
172 + require 'neoclip'.setup()
174 + telescope.load_extension 'fzf'
175 + telescope.load_extension 'zoxide'
176 + telescope.load_extension 'neoclip'
177 + end,