Giter Club home page Giter Club logo

Comments (3)

junegunn avatar junegunn commented on July 19, 2024

Not sure if I understood your question correctly, but you seem to want shortcuts to jo and ko, right? Since this plugin sets the filetype of the browser buffer to "GV", you can use FileType GV autocmd to set up custom mappings like follows.

" Version 1
autocmd! FileType GV nmap <buffer> <c-n> jo
autocmd  FileType GV nmap <buffer> <c-p> ko

Makes sense? We can slightly improve the mappings to skip lines without commit hash.

" Version 2
autocmd! FileType GV nmap <buffer> <silent> <c-n> :call search('^.*[a-z0-9]')<cr>o
autocmd  FileType GV nmap <buffer> <silent> <c-p> :call search('^.*[a-z0-9]', 'b')<cr>o

The problem with the above mappings is that when GV is first started and the split on the right side is not yet open, <c-n> will directly go to the second commit. We can correct this by checking the number of windows on the tab.

" Version 3
autocmd! FileType GV nmap <buffer> <silent> <c-n> :if winnr('$') > 1<bar>call search('^.*[a-z0-9]')<bar>endif<cr>o
autocmd  FileType GV nmap <buffer> <silent> <c-p> :if winnr('$') > 1<bar>call search('^.*[a-z0-9]', 'b')<bar>endif<cr>o

I could probably add these mappings to the code so that they are activated by default, but for now, I'd like to keep things as simple as possible. Does this answer your question?

from gv.vim.

firedev avatar firedev commented on July 19, 2024

Thank you for your details explanation. Sorry I wasn't too clear about the question.

Is it possible to go to the next commit while staying in the preview window? So you can browse the history without leaving it. Sort of like you can do with fugitive's :Glog for the current file.

from gv.vim.

junegunn avatar junegunn commented on July 19, 2024

Fugitive mappings are available in the buffer. So P will bring you to the parent commit, though it won't synchronize the cursor on the browser window. I'll make GV fire a User autocmd so one can setup custom mappings on the buffer.

from gv.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.