Coder Social home page Coder Social logo

vim-merginal's Introduction

INTRODUCTION

Merginal aims to provide a nice interface for dealing with Git branches. It offers interactive TUI for:

  • Viewing the list of branches
  • Checking out branches from that list
  • Creating new branches
  • Deleting branches
  • Merging branches
  • Rebasing branches
  • Solving merge conflicts
  • Interacting with remotes(pulling, pushing, fetching, tracking)
  • Diffing against other branches
  • Renaming branches
  • Viewing git history for branches

REQUIREMENTS

Merginal is based on Fugitive, so it requires Fugitive. If you don't have it already you can get it from https://github.com/tpope/vim-fugitive

It should go without saying that you need Git.

Under Windows, vimproc is an optional requirement. Merginal will work without it, but it'll pop an ugly console window every time it needs to run a Git command. You can get vimproc from https://github.com/Shougo/vimproc.vim

USAGE

To use Merginal you need to know but one command: :Merginal. It'll open the branch list buffer, unless the repository is in merge mode then it'll open the merge conflicts buffer.

Like Fugitive's commands, :Merginal is native to the buffer, and will only work in buffers that are parts of Git repositories.

You can also toggle the buffer with :MerginalToggle or close it with :MerginalClose.

To see a list of keymaps available in each Merginal buffer, press ?.

vim-merginal's People

Contributors

arvida avatar blueyed avatar ckangnz avatar dakennguyen avatar daltonmatos avatar deresmos avatar idanarye avatar krimha avatar sfahlberg avatar tecfu avatar vais avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-merginal's Issues

Color Support

Great plugin, it works for me.
But in merginal windows, file with D|M|A Tag has same color
Maybe different color support would be helpful, like fugitive?

Can't use Psearch on the Merginal buffer

Error detected while processing function psearch#Open:
line    1:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/idanarye/.vim/bundle/psearch.vim/autoload/psearch.py", line 296, in open
    self.update_launcher()
  File "/home/idanarye/.vim/bundle/psearch.vim/autoload/psearch.py", line 207, in update_launcher
    self.search(self.input_so_far)
  File "/home/idanarye/.vim/bundle/psearch.vim/autoload/psearch.py", line 149, in search
    vim.command("b {0}".format(self.curr_buf.number))
vim.error: attempt to refer to deleted buffer

Marginal fails due to Fugitive command being replaced

When I try to run :Merginal, it fails with the following error. Looks like it just requires changing to the new fugitive command to fix it.

`Error detected while processing function merginal#openMerginalBuffer[10]..413[39]..422[9]..397[2]..410[1]..409[8]..function merginal#openMerginalBuffer[10]..413[39]..422[9]..397[2]..410[1]..409[4]..<SNR>90_repo_git_command:
line    1:
E605: Exception not caught: fugitive: fugitive#repo().git_command(...) has been replaced by FugitiveShellCommand(...)
Error detected while processing function merginal#openMerginalBuffer[10]..413[39]..422[9]..397:`

Wrong argument order in git using `mergeBranchUnderCursor`

Merging with extra arguments, for instance --no-ff, does not work. Instead we get an error like:

merge: --no-ff - not something we can merge

If we are merging dev, it seems like it tries to call git merge --no-commit dev -- --no-ff, while it seems to me that we would want something like git merge --no-commit --no-ff -- dev.

Merginal Toggle seems to fail after updating version

I've just updated to latest version of the plugin and it started failing for me with the following message. I'm on neovim, but this plugin was working till I updated it though. Any ideas on what could be causing please?

Error detected while processing function <SNR>143_toggleBasedOnMergeMode[18]..merginal#openMerginalBuffer[10]..399[39]..408[9]..383[2]..396[1]..395[4]..<SNR>230_repo_git_command:
line    1:
E605: Exception not caught: fugitive: fugitive#repo().git_command(...) has been replaced by FugitiveShellCommand(...)
Error detected while processing function <SNR>143_toggleBasedOnMergeMode[18]..merginal#openMerginalBuffer[10]..399[39]..408[9]..383:
line    2:
E171: Missing :endif
Error detected while processing function <SNR>143_toggleBasedOnMergeMode[18]..merginal#openMerginalBuffer[10]..399:
line   39:
E171: Missing :endif
Error detected while processing function <SNR>143_toggleBasedOnMergeMode:
line   18:
E171: Missing :endif

Set nonumber in merginal buffer

When opening the merginal buffer, numbers appear if I have the number option set. It would be nice to have a clean buffer.

Auto resize branch window to length of longest branch name

Ability for the branch vsplit to be resized to the length of longest branch name (+ padding)

I have done work for this already and changes keep existing functionality in place (require user to enter settings in vimrc to reach this functionality)

fatal: ambiguous argument '<name>': both revision and filename

If a branch name happens to match the name of a file/directory name in the project, the "gl" mapping fails:

Press ? for help

=== Showing History For: ===
<name>
============================

fatal: ambiguous argument '<name>': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Please append -- to the end of the command as a matter of course.

disable remote branches in branchList

first of all, thanks for this plugin is very helpful

i'm asking if there is a way to disable the remote branches in the branch list

because if the developer is changing only/most frequently in local branches, a big list of remote branches isn't great, there is an option to filter/search but it could be better if it only displays local branches

Error when calling :MerginalToggle inside Merginal buffer

I get the following error when I call :MerginalToggle inside the Merginal buffer (although the buffer does successfully close):

Error detected while processing function <SNR>108_toggleBasedOnMergeMode..merginal#closeMerginalBuffer:
line   14:
E16: Invalid range: 2wincmd w
Error detected while processing function <SNR>108_toggleBasedOnMergeMode:
line   27:
E171: Missing :endif

filetype for Merginal buffers is not set

Running set filetype? on a Merginal buffer returns nothing.
This prevents people from setting autocommands based on the filetype.

My suggestion is to set filetype to 'merginal' just as Fugitive sets it to 'fugitive'

new mf command produces error

The mn command is working perfect, but when I created a branch, then went back to master, fire up :Merginal, go with the cursor over the new branch and press mf I get the following error:

Error detected while processing function <SNR>168_mergeBranchUnderCursorUsingFugitive:                                                                                                        
line    3:                                                                                                                                                                                    
E121: Undefined variable: l:branchName                                                                                                                                                        
E15: Invalid expression: ':Gmerge '.l:branchName.handle

Can you reproduce this?

Creating new branch replaces existing buffer

Hi there, thanks for creating this plugin. Seems like something I'm definitely interested in.

I hit such a nasty bug in my first operation with it, that I feel like I should report it in as much detail as possible for you....seems like you've put a lot of effort into this.

Here goes:
With only one buffer open for a file named myfile.py (no other buffers, tabs, etc), I wrote changes to disk with :w. So I had a modified file in my working tree that wasn't staged to the index. I then used :MerginalToggle to open the Merginal buffer. I pressed A to create a new branch and typed newbranch as the name. The output was:

Branch `devel` to: newbranch[output] Switched to a new branch 'newbranch'
[output] M        myfile.py
Press ENTER or type command to continue

However, after I pressed Return to dismiss the output, the contents of the buffer that was myfile.py had been replaced with Merginal contents!! This data appeared as new, unsaved data—but to my surprise, the buffer number and current filename had NOT changed! The current file being edited was still myfile.py and was now marked as [Modified]... I was confused and in shock to say the least! The original Merginal split was still open to the left. The modifiable flag was off in my file buffer, so I couldn't make any edits to the contents, but I actually went so far as to save the buffer because I was in such disbelief that it clobbered my file, and in fact, yes, here was the result:

workstation [~/dev/project]$ cat myfile.py
Press ? for help

  devel
  foo
  master
* newbranch
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
workstation [~/dev/project]$

Sorry I don't have cycles to debug it or read the vimscript, but it scared the pants off me so bad that I'm probably going to start reading more plugin code before I ever use a new one for the first time. :-)

Thanks

Buffer with this name already exists

Not sure how I got into this state, but after awhile of using vim and merginal, I encountered:

:Merginal                                                                                                                                                                                                                                                                        
Error detected while processing function <SNR>263_toggleBasedOnMergeMode[16]..merginal#openMerginalBuffer[5]..635:                                                                                                                                                               
line   26:                                                                                                                                                                                                                                                                       
E95: Buffer with this name already exists 

It then opens a blank buffer where Merginal would normally show up.

I tried to delete this buffer and try again with :bd but trying again throws the same error.

Then I listed my buffers and noticed Merginal:branchList existed. I switched to it and found the expected Merginal UI but it was non-respnosive, so I deleted the buffer. At this point :Merginal started working again.

If it is not the root directory, the file can not be opened

Summary

The problem that the file displayed with gd etc. could not be opened correctly if the current directory is not the root directory of git.

Reproduction

  1. Change directory to vim-merginal
  2. Change README.md somewhat
  3. :cd doc in vim
  4. :Merginal
  5. gd
  6. Enter README.md

Cannot come back to master.

When checking commits and pressing cc its nicely comming back to previous version.
But when I select branch name "master" in this window and press cc again is not taking me to the latest changes. I expect that the git checkout master will fire up. Instead I have error:

image
image

Show line number on merginal

Is it possible to show line number when using merginal so i can easily jump to the branch i wanted to check out?

Filtering branch list

Would be great to filter the branch list in the merginal window. One common use case would be to view branches based on their merge status. E.g. $ git branch --{,no-}merged

numbers on the merginal buffers

Hi there, I love merginal! Just curious whether there's any way to get numbers so I can more quickly navigate around. thanks!

Gsdiff not an editor command

awesome plugin...I'm working on a project where there is no debugger, so it's a real "fumble in the dark with printf" type situation, plus the compiler will only work on windows but I'm developing on linux, so the branches are getting big because that's where all the "try it and see what happens" work is.

When I open a branch with gd and then try to open a file with ds, I get:

Error detected while processing function 355:                                                                                                                                                                                                                                 
line   25:                                                                                                                                                                                                                                                                    
E492: Not an editor command: :Gsdiff v1_31_hotfix                                                                                                                                                                                                                             
Press ENTER or type command to continue    

Is this because of a version conflict with fugitive?

fugitive#detect() removed

I'm getting an error when I try to open Merginal:

Error detected while processing function merginal#openMerginalBuffer[5]..31[27]..fugitive#detect:
line    1:
E605: Exception not caught: Third party code is using fugitive#detect() which has been removed. Contact the author if you have a reason to still use it
Error detected while processing function merginal#openMerginalBuffer[5]..31:
line   27:
E171: Missing :endif

I've tried removing all plugins except Merginal and Fugitive, but the problem persists.

I had a quick look at the Fugitive repo, and a recent change may have broken Merginal: tpope/vim-fugitive@cd7db1d#diff-4c8459efc2f0fea43a9d26047a9e5e06R6328

Map <CR> to checkout the branch under cursor

It seems to me that the most intuitive action one needs to do with the Merginal is to switch branches. Is it just my stupidity that I cannot find it in documentation, or CR is really not mapped to call b:merginal.checkoutBranch()<CR>? Shouldn't it be so?

Git pull and push does not work if there are two remotes

When I had only one git remote repo it worked as expected - ps and pl on the branch did git pull. Now it opens a prompt when I have to choose which remote to pull from or push to, but when remote is chosen nothing happens.

Rebase error on newer git versions

I'm currently using git version 2.7.3 and it appears, that .git/rebase-apply/msg-clean file is no longer present while doing rebase. (Worked fine in 2.5.4). Invoking rb shortcut, produces following error:

Error detected while processing function merginal#invokeKeyMap[1]..379[16]..378[5]..<SNR>71_rebaseBranchUnderCursor[7]..merginal#openRebaseConflictsBuffer[10]..merginal#tryRefreshRebaseConflictsBuffer:
line    2:
E484: Can't open file /Users/ajgon/Projects/dummy/.git/rebase-apply/msg-clean

Async?

Hey,

I've been updating my vimrc so that most of my vim tasks can be async using skywind3000/asyncrun.vim.
With this, fugitive can Gpush, Gpull, Gfetch... all asynchronously by adding

command! -bang -nargs=* -complete=file Make AsyncRun -program=make @ <args>

in vimrc.

But I just found out that when I pull/push using merginal, it still performs tasks synchronously.

Is it possible to make these process async if asyncrun is installed?

Cheers,

Chris

Quick help in the Merginal window

Hi,

Thanks for the amazing plugin. However, I'm feeling it would be great if we can have a "quick help" in the Merginal's window because there are too many key mappings for me to memorize. For example, in NERDTree's window, I can " Press ? for help. After pressing ?, I get a bunch of helpful hints.

How do you think?

Thanks.

Feature request: pull requests using hub

Really liking Merginal, great work! I've recently started using hub for github and thought it would be great if merginal allowed you to create a pull request using hub.

The command is $ hub pull-request which opens a vim buffer to type your PR title and description.

open file while staying in merginal buffer

I was wondering if there's a way to open up a file, for example in the diff list, and stay in the merginal buffer window. In nerdtree, you can type go and it'll open the file and stay in the nerdtree buffer.

Does this work with VIM8 and git2?

:Merginal shows error Error during processing function merginal#openMerginalBuffer[5]..merginal#modulelib#createObject[4]..<SNR>265_populate:

no key in dictionary: branchList

Line 2 and Line 5.

(it's a translate, my vim shows errors in russian)

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.