neovim

Personal neovim configuration files
git clone git://gtms.dev/neovim.git
Log | Files | Refs

commit a435601e2d0dcbc44f068136598247e64c3dcb38
parent 411101818afab0c6ff553ed7f5cf70c50a36bf78
Author: Tomas Nemec <nemi@skaut.cz>
Date:   Tue, 25 Jan 2022 13:12:29 +0100

update

Diffstat:
Mlua/my-default.lua | 41++++++++++++++++++++++-------------------
Mlua/tms/p/bqf.lua | 2+-
Mlua/tms/p/cmp/init.lua | 2+-
Mlua/tms/p/nullls.lua | 4++--
Mlua/tms/p/telescope.lua | 48++++++------------------------------------------
Mlua/tms/p/treesitter.lua | 4----
Mlua/tms/plugins.lua | 21+++++++--------------
Mlua/tms/u/plugins.lua | 6++----
Aplugin/grep.lua | 17+++++++++++++++++
9 files changed, 58 insertions(+), 87 deletions(-)

diff --git a/lua/my-default.lua b/lua/my-default.lua @@ -2,25 +2,25 @@ local Color, colors, Group, groups, styles = require('colorbuddy').setup() local c = {} if vim.fn.empty('/home/tms/.cache/wal') > 0 then -- gruvbox - c.background='#1d2021' - c.foreground='#d5c4a1' - c.cursor='#d5c4a1' - c.color0='#1d2021' - c.color1='#fb4934' - c.color2='#b8bb26' - c.color3='#fabd2f' - c.color4='#83a598' - c.color5='#d3869b' - c.color6='#8ec07c' - c.color7='#d5c4a1' - c.color8='#665c54' - c.color9='#fb4934' - c.color10='#b8bb26' - c.color11='#fabd2f' - c.color12='#83a598' - c.color13='#d3869b' - c.color14='#8ec07c' - c.color15='#fbf1c7' + c.background = '#1d2021' + c.foreground = '#d5c4a1' + c.cursor = '#d5c4a1' + c.color0 = '#1d2021' + c.color1 = '#fb4934' + c.color2 = '#b8bb26' + c.color3 = '#fabd2f' + c.color4 = '#83a598' + c.color5 = '#d3869b' + c.color6 = '#8ec07c' + c.color7 = '#d5c4a1' + c.color8 = '#665c54' + c.color9 = '#fb4934' + c.color10 = '#b8bb26' + c.color11 = '#fabd2f' + c.color12 = '#83a598' + c.color13 = '#d3869b' + c.color14 = '#8ec07c' + c.color15 = '#fbf1c7' else c = dofile('/home/tms/.cache/wal/colors.lua') end @@ -149,6 +149,9 @@ Group.new('Typedef', colors.c3, colors.none) Group.new('TelescopeSelection', nil, dimm(N.bg, 0.05)) Group.new('TelescopeMatching', nil, nil, styles.underline + styles.bold) +-- Marks +Group.link('MarkSignHL', groups.Comment) + -- Lightspeed local ls1 = colors.c2 local ls2 = colors.c3 diff --git a/lua/tms/p/bqf.lua b/lua/tms/p/bqf.lua @@ -4,7 +4,7 @@ M.setup = function() require('bqf').setup { auto_enable = true, auto_resize_height = false, - preview = {auto_preview = false}, + preview = {auto_preview = true}, } end diff --git a/lua/tms/p/cmp/init.lua b/lua/tms/p/cmp/init.lua @@ -3,7 +3,7 @@ local M = {} local setup_sources = function() require('cmp_dictionary').setup({dic={}}) require('cmp').register_source('exe', require('tms.p.cmp.exe_source').new()) - require('cmp').register_source('glab_dpgw', require('tms.p.cmp.glab_source').new()) + -- require('cmp').register_source('glab_dpgw', require('tms.p.cmp.glab_source').new()) end M.setup = function() diff --git a/lua/tms/p/nullls.lua b/lua/tms/p/nullls.lua @@ -31,8 +31,8 @@ M.setup = function() builtins.formatting.prettier.with { filetypes = {'html', 'yaml', 'markdown', 'css', 'scss'}, args = h.range_formatting_args_factory({ - '--config', - vim.fn.expand('$CONFIG/prettier/config.yaml'), + '--parser', + vim.api.nvim_buf_get_option(0, 'filetype'), '--stdin-filepath', '$FILENAME', }), diff --git a/lua/tms/p/telescope.lua b/lua/tms/p/telescope.lua @@ -6,10 +6,8 @@ local action_set = require('telescope.actions.set') local action_generate = require('telescope.actions.generate') local action_state = require('telescope.actions.state') local pickers = require('telescope.pickers') -local make_entry = require('telescope.make_entry') local finders = require('telescope.finders') local sorters = require('telescope.sorters') -local conf = require('telescope.config').values local extensions = telescope.extensions local M = {} @@ -17,22 +15,6 @@ local M = {} M.b = builtin M.e = extensions -local escape_chars = function(string) - return string.gsub(string, '[%(|%)|\\|%[|%]|%-|%{%}|%?|%+|%*]', { - ['\\'] = '\\\\', - ['-'] = '\\-', - ['('] = '\\(', - [')'] = '\\)', - ['['] = '\\[', - [']'] = '\\]', - ['{'] = '\\{', - ['}'] = '\\}', - ['?'] = '\\?', - ['+'] = '\\+', - ['*'] = '\\*', - }) -end - local layouts = { dd = themes.get_dropdown(), dd_noprev = themes.get_dropdown {previewer = false}, @@ -62,30 +44,6 @@ function M.setup() } end -M.find_files = function() builtin.find_files(layouts.dd_large_noprev) end - --- show plugins and on select open new Tab and Cd there -M.plugins = function() - M.e.packer.plugins({ - attach_mappings = function(prompt_bufnr) - actions.select_default:replace(function(_, _) - local selection = actions.get_selected_entry(prompt_bufnr) - local path = require('tms.u.plugins').path(selection.directory, selection.name) - actions.close(prompt_bufnr) - vim.cmd(string.format('tabe %s', selection.readme)) - vim.cmd(string.format('tcd %s', path)) - end) - return true - end, - }) -end - -M.edit_neovim = function() - builtin.find_files(themes.get_dropdown {prompt_title = 'dotfiles', cwd = '~/.config/nvim', previewer = false}) -end - -M.spell_suggest = function() builtin.spell_suggest(layouts.dd) end - M.mail_address = function() pickers.new { results_title = 'Adresses', @@ -104,6 +62,12 @@ M.mail_address = function() }:find() end +M.edit_neovim = function() + builtin.find_files(themes.get_dropdown {prompt_title = 'dotfiles', cwd = '~/.config/nvim', previewer = false}) +end + +M.find_files = function() builtin.find_files(layouts.dd_large_noprev) end +M.spell_suggest = function() builtin.spell_suggest(layouts.dd) end M.lines = function() builtin.current_buffer_fuzzy_find(layouts.dd_large_noprev) end M.reloader = function() builtin.reloader(layouts.dd_noprev) end M.buffers = function() builtin.buffers(layouts.dd_large) end diff --git a/lua/tms/p/treesitter.lua b/lua/tms/p/treesitter.lua @@ -77,10 +77,6 @@ M.setup = function() playground = {enable = true, disable = {}, updatetime = 25, persist_queries = false}, context_commentstring = {enable = true, enable_autocmd = false, config = {scss = '// %s'}}, } - - require 'nvim-treesitter.highlight' - local hlmap = vim.treesitter.highlighter.hl_map - hlmap.error = nil end return M diff --git a/lua/tms/plugins.lua b/lua/tms/plugins.lua @@ -179,17 +179,7 @@ return packer.startup({ vim.keymap.nmap {'<leader>aL', '<Plug>SidewaysArgumentAppendLast'} end, } - use { -- aligning - 'godlygeek/tabular', - config = function() - -- vim.keymap.nmap {'<leader>a=', '<cmd>Tabularize /=<cr>'} - -- vim.keymap.vmap {'<leader>a=', '<cmd>Tabularize /=<cr>'} - -- vim.keymap.nmap {'<leader>a:', '<cmd>Tabularize /:\\zs<cr>'} - -- vim.keymap.vmap {'<leader>a:', '<cmd>Tabularize /:\\zs<cr>'} - -- vim.keymap.nmap {'<leader>a,', '<cmd>Tabularize /,<cr>'} - -- vim.keymap.vmap {'<leader>a,', '<cmd>Tabularize /,<cr>'} - end, - } + use {'godlygeek/tabular'} -- align use { -- replace 'windwp/nvim-spectre', config = function() @@ -391,11 +381,14 @@ return packer.startup({ config = function() require('tms.p.nullls').setup() end, } use { - disable = true, 'stevearc/aerial.nvim', after = {'telescope.nvim', 'nvim-treesitter'}, setup = function() vim.g.aerial = {backends = {'lsp', 'treesitter'}, highlight_on_jump = 0} end, - config = function() require('tms.p.aerial').setup() end, + config = function() + require('tms.p.aerial').setup() + require('telescope').load_extension('aerial') + vim.keymap.nnoremap {'<space>r', require('tms.p.telescope').aerial} + end, } -- use 'mfussenegger/nvim-jdtls' @@ -469,7 +462,7 @@ return packer.startup({ -- maybe - almost unsuedtelescope vim.keymap.nnoremap {'<space>o', telescope.b.oldfiles} vim.keymap.nnoremap {'<space>t', telescope.b.treesitter} - vim.keymap.nnoremap {'<space>P', telescope.plugins} + vim.keymap.nnoremap {'<space>P', telescope.e.packer.packer} end, } use {'nvim-telescope/telescope-packer.nvim', after = {'telescope.nvim'}} diff --git a/lua/tms/u/plugins.lua b/lua/tms/u/plugins.lua @@ -1,14 +1,12 @@ local M = {} M.path = function(dir, name) - local plugin_utils = require 'packer.plugin_utils' + local plugin_utils = require('packer.plugin_utils') local packer_lists = {} packer_lists['opt'], packer_lists['start'] = plugin_utils.list_installed_plugins() for p_path, _ in pairs(packer_lists[dir]) do local plugin_name = vim.fn.fnamemodify(p_path, ':t:r') - if plugin_name == name then - return p_path - end + if plugin_name == name then return p_path end end end diff --git a/plugin/grep.lua b/plugin/grep.lua @@ -0,0 +1,17 @@ +vim.cmd [[ +function! GrepOperator(type) + if a:type ==# 'v' + normal! `<v`>y + elseif a:type ==# 'char' + normal! `[v`]y + else + return + endif + + silent execute "grep! " . shellescape(@@) . " ." + copen +endfunction +]] + +vim.keymap.nnoremap {'<leader>r', ':set operatorfunc=GrepOperator<cr>g@'} +vim.keymap.vnoremap {'<leader>r', ':<c-u>call GrepOperator(visualmode())<cr>'}