aboutsummaryrefslogtreecommitdiffstats
path: root/vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim')
-rw-r--r--vim/vimrc42
1 files changed, 38 insertions, 4 deletions
diff --git a/vim/vimrc b/vim/vimrc
index cd930e8..f079754 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -42,8 +42,8 @@ nnoremap <C-p>p :GitFiles<CR>
nnoremap <leader>o :Tags<CR>
nnoremap <leader>h :History<CR>
nnoremap <silent> <leader>0 :Files<CR>
-nnoremap <silent> <leader>; :BLines<CR>
-nnoremap <silent> <leader>l :Lines<CR>
+nnoremap <silent> <leader>l :BLines<CR>
+nnoremap <silent> <leader>; :Lines<CR>
nnoremap <silent> <leader>o :BTags<CR>
nnoremap <C-p>b :Buffers<CR>
nnoremap <silent> <leader>? :History:<CR>
@@ -53,6 +53,40 @@ nnoremap <silent> <leader>CC :Commands<CR>
" Open quickfix list in a right vertical split (good for Ngrep results)
command! Vlist botright vertical copen | vertical resize 50
nnoremap <leader>v : Vlist<CR>
+
+" Do do a sort of fuzzy line match in the buffer insread
+" of BLines - call with :SearchAndAddToQuickfix ^IDEA and it will
+" open in quickfix:
+function! SearchAndAddToQuickfix(pattern)
+ " Clear the current quickfix list
+ call setqflist([])
+
+ " Initialize an empty list to store quickfix items
+ let l:qf_list = []
+
+ " Iterate over each line in the buffer to find matches
+ for l:num in range(1, line('$'))
+ let l:line = getline(l:num)
+
+ " If the line matches the search pattern, add it to the quickfix list
+ if l:line =~ a:pattern
+ call add(l:qf_list, {'filename': expand('%:p'), 'lnum': l:num, 'col': 1, 'text': l:line})
+ endif
+ endfor
+
+ " Set the quickfix list with the collected items
+ if !empty(l:qf_list)
+ call setqflist(l:qf_list, 'r')
+ " Open the quickfix window
+ copen
+ else
+ echo "No matches found for pattern: " . a:pattern
+ endif
+endfunction
+
+" Command to use the function, :SearchAndAddToQuickfix [pattern]
+command! -nargs=1 SearchAndAddToQuickfix call SearchAndAddToQuickfix(<q-args>)
+
" }}}
" Options {{{
set clipboard=unnamed,unnamedplus " just past in with out needing "*
@@ -369,8 +403,8 @@ let g:gruvbox_italic = 0
"colorscheme evening
"colorscheme sitruuna
-"colorscheme ayu
-colorscheme evening
+colorscheme ayu
+"colorscheme evening
"colorscheme gruvbox
" }}}
" GPG files {{{