From 86669142bfe2b55186565ccce3815a558b496d4d Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Thu, 1 Jul 2021 15:30:12 -0700 Subject: [PATCH] lua grep theming --- .vim/nvim.lua | 27 +++++++++++++++++++++++++++ .vimrc | 14 +++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.vim/nvim.lua b/.vim/nvim.lua index f6684e1..1c3d772 100644 --- a/.vim/nvim.lua +++ b/.vim/nvim.lua @@ -111,3 +111,30 @@ require('lspkind').init({ Struct = 'struct', }, }) + +require('telescope').setup { + +} + +local builtin = require'telescope.builtin' + +local dropdown = require'telescope.themes'.get_dropdown({ + --previewer = false, + --prompt_title = "", + --results_height = 16, + --width = 0.6, + --borderchars = { + --{"─", "│", "─", "│", "╭", "╮", "╯", "╰"}, + --prompt = {"─", "│", " ", "│", "╭", "╮", "│", "│"}, + --results = {"─", "│", "─", "│", "├", "┤", "╯", "╰"}, + --preview = {"─", "│", "─", "│", "╭", "╮", "╯", "╰"} + --}, + --winblend = 10 +}) + +git_grep_word = function(conf) + local opt = dropdown + opt.cwd = vim.fn.systemlist("git rev-parse --show-toplevel")[1] + for k,v in pairs(conf) do opt[k] = v end + builtin.grep_string(opt) +end diff --git a/.vimrc b/.vimrc index a6706c4..302349c 100644 --- a/.vimrc +++ b/.vimrc @@ -134,8 +134,8 @@ Plug 'sjbach/lusty' Plug 'mhinz/vim-signify' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } -Plug 'junegunn/fzf.vim' +"Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } +"Plug 'junegunn/fzf.vim' Plug 'airblade/vim-rooter' "Plug 'bling/vim-bufferline' Plug 'majutsushi/tagbar' @@ -902,10 +902,14 @@ call denite#custom#var('grep', { \ }) "nnoremap g :Denite -buffer-name=search-buffer grep "nnoremap aa :RipGrep! -nnoremap aa :RgRoot! -nnoremap aw :RgRoot! +"nnoremap aa :RgRoot! +"nnoremap aw :RgRoot! "nnoremap :Files! `git rev-parse --show-toplevel` -nnoremap :GFiles +"nnoremap :GFiles +nnoremap lua require('telescope.builtin').git_files() +nnoremap ag lua git_grep_word{ word_match = "-w", only_sort_text = true, search = ''} +nnoremap aw lua git_grep_word{ word_match = "-w", only_sort_text = true } + " For C++ -- A is a great plugin which allows you to jump from the c file to the " header and vice-versa. Mneumonic here is headerheader. nnoremap hh :A