Giter Club home page Giter Club logo

vim-editerm's Introduction

vim-editerm

A plugin sets $EDITOR in :terminal to open a file in the working vim instead of a new one.

Usually, calling git commit, vim and suchlike commands in |:terminal|,
new vim process starts in their. But it makes some unfavorable situation depending on the settings.

This plugin, vim-editerm will set an environment varialble $EDITOR and override vim command with function that drops files in new buffer in parent vim.

Screenshot

INSTALLATION

With vim-plug:

Plug 'kyoh86/vim-editerm'

And if you want to override vim and create commands :edit|new|vnew|tabnew in :terminal, put below lines in .zshrc or .bashrc.

if [[ "${VIM_EDITERM_SETUP}" != "" ]]; then
  source "${VIM_EDITERM_SETUP}"
fi

USAGE

Without being conscious.

In :terminal, you can git commit in buffer in the parent vim.

If you want to stop editing with the error (i.e. to stop to commit), call :Cq or :CQ.

CONFIGURATION

Behavior to open files

We can change behavior to open files.

let g:editerm_opener = 'n'  " :new <file> (default)
let g:editerm_opener = 'e'  " :edit <file>
let g:editerm_opener = 'v'  " :vnew <file>
let g:editerm_opener = 't'  " :tabnew <file>

Or by .zshrc or .bashrc

export VIM_EDITERM_OPENER="n"  # :new <file>
export VIM_EDITERM_OPENER="e"  # :edit <file>
export VIM_EDITERM_OPENER="v"  # :vnew <file>
export VIM_EDITERM_OPENER="t"  # :tabnew <file>

Definition of the dropping commands

vim-editerm will create below commands which drop files to vim.

:drop <files...>
:edit <files...>
:new <files...>
:vnew <files...>
:tabnew <files...>

If you want to supress them:

let g:editerm_defdrop = '0'  " default: '1'

And if you want to change prefix of them:

let g:editerm_defdrop_prefix = 'vim_'  " default: ':'

Similar projects

LICENSE

MIT License

This software is released under the MIT License, see LICENSE.

vim-editerm's People

Contributors

kyoh86 avatar shun095 avatar tsuyoshicho avatar aiya000 avatar

Stargazers

misoobu avatar Greg Werbin avatar Scott avatar Yuta Katayama avatar xztaityozx avatar mst_ysk avatar Andy Shevchenko avatar kuator avatar  avatar  avatar tamago324 avatar yaegassy avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

vim-editerm's Issues

:cq に対応する

exit codeが設定される。git commitキャンセルさせたりとかするやつ

Create zsh / bash plugin

plugin/editerm.vim:

let $VIM_EDITERM_PLUGIN=expand('<sfile>:p:h') . '/sh_plugin'

.bashrc:

source $VIM_EDITERM_PLUGIN

:wqとかしたときにバッファが残る

git commit 二回目とかのときに再度読み込み見込みするか?みたいなこと聞かれてダルいし、
そのまま放置するとなんか上手くgit commitがエディタまちから帰ってこなく鳴るっぽい

helptag Conflict

*vim-editerm* Plugin sets $EDITOR using parent vim in :terminal

This plugin, *vim-editerm* will set an environment varialble `$EDITOR` and
override `vim` command with function that drops files in new buffer in parent
vim.

Conflict *vim-editerm*

repo> vim --cmd "try | helptags doc/ | catch | cquit | endtry" --cmd quit
(exit 1)

(And I know. Basically, vim helptag do not contain in repository.)

Support :Cq!

Now, :Cq closes buffer immediately.
But ideally, :Cq should never close dirty buffer.
So let me make :Cq supports bang (:Cq!).

Doesn't work with alacritty

$ git commit --amend                                                                 |~
hint: Waiting for your editor to close the file... \033]51;["call", "Tapi_EditermEdit|~
File", ["n", "/tmp/tmp.xvaPrTDM3y", "/home/kyoh86/.config/.git/COMMIT_EDITMSG"]]\007 |~
Setting up watches.                                                                  |~
Watches established. 

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.