changeset 7:34930197e9d4

Updating hg diff tool. Adding support for global searching
author Luka Sitas <lsitas@avatarasoftware.com>
date Thu, 30 Oct 2025 13:45:31 -0400
parents 3017fd33ad8b
children 9c80955f0c6e
files .vimrc plugins/globalsearch.vim plugins/hghelp/hghelp.vim
diffstat 3 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/.vimrc	Tue Oct 28 15:26:12 2025 -0400
+++ b/.vimrc	Thu Oct 30 13:45:31 2025 -0400
@@ -2,7 +2,6 @@
 map <Space> <leader>
 map <Leader>w :update<CR>
 map <Leader>q :qall<CR>
-map <Leader>g :term gpt<CR>
 set mouse=a
 inoremap <C-a> <C-x><C-i>
 
@@ -10,6 +9,8 @@
 source $HOME/.vim/plugins/taghelp
 source $HOME/.vim/plugins/dbtables/dbtables.vim
 source $HOME/.vim/plugins/hghelp/hghelp.vim
+source $HOME/.vim/plugins/globalsearch.vim
+
 
 let g:db_user = ""      " Replace with your default database username
 let g:db_password = ""  " Replace with your default database password
@@ -24,6 +25,7 @@
 highlight Comment cterm=italic gui=italic
 autocmd FileType *.blade.php setlocal commentstring=#\ %s
 
+set path+=**
 set nowrap                            " Dont wrap
 set backspace=indent,eol,start        " http://vi.stackexchange.com/a/2163
 set laststatus=2                      " Show status line on startup
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/globalsearch.vim	Thu Oct 30 13:45:31 2025 -0400
@@ -0,0 +1,13 @@
+function! GrepIncludingIgnored(pattern, path = '**/*')
+   if a:pattern =~ '^/.*/[a-z]*$'
+       let search_pattern = a:pattern
+   else
+       let search_pattern = '/' . a:pattern . '/g'
+   endif
+
+   execute 'vimgrep ' . search_pattern . ' ' . a:path
+endfunction
+
+" Map it to a command for easy use
+command! -nargs=+ GlobalSearch call GrepIncludingIgnored(<f-args>)
+command! -nargs=+ GS call GrepIncludingIgnored(<f-args>)
--- a/plugins/hghelp/hghelp.vim	Tue Oct 28 15:26:12 2025 -0400
+++ b/plugins/hghelp/hghelp.vim	Thu Oct 30 13:45:31 2025 -0400
@@ -13,18 +13,14 @@
   let l:current_file = a:file !=# '' ? a:file : expand('%')
   let l:filetype = &filetype
   let l:temp_file = tempname()
-  execute 'tabnew'
-  execute 'silent !hg cat -r . ' . l:current_file . ' > ' . l:temp_file
-  execute 'edit ' . l:temp_file
+  let l:command = 'hg cat -r . ' . l:current_file . ' > ' . l:temp_file
+  let result = system(l:command . ' 2>&1')
+  execute 'tabe ' . l:temp_file
   execute 'setfiletype' l:filetype
   setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile 
   execute 'vert diffsplit' l:current_file
 endfunction
 
-
-
-
-
 command HGDiff call s:OpenHgDiff(expand('%'))
 command Commit call s:CommitWithFormat()