English 中文(简体)
如何在新窗口中以动态方式打开新文件
原标题:How to open a new file in vim in a new window
  • 时间:2012-05-25 19:28:24
  •  标签:
  • unix
  • vim

在新的 shell 窗口或制表符中打开 vim 。 我曾经在新窗口中打开文件的 < code>$ mate file 文件

我更喜欢有一个中心外壳, 由我在必要时在其他窗口或标签中发布命令和编辑文件。 人们通常如何在本地打开动态文件?

问题回答

从内部的振动, 使用以下一种

< 强度 > 打开当前 < /强度 > 下的新窗口 :

:new filename.ext

在当前 < / 坚固 > 旁边打开新窗口 < 坚固 > :

:vert new filename.ext

您可以使用自己的 < em> 窗口 < /em > 或 tabs ,从动态内进行。

一种方法就是利用内置的 file 探险家 ;通过 :Explore 激活它,或为标签介面使用 < explore (我觉得最舒适)。

:Texplore (和 :Sexlore ) 还将防止您在重新进入探险器后无意退出 :q 上的当前缓冲(编辑) 。

要在打开的标签间切换,请使用 gt gT (下个标签和上个标签)。

亦见"http://vim.wikia.com/wiki/Using_tab_pages" rel="不跟随 nofollow noreferrer"\ @em>Using 标签页。

我用这个微妙的别名:

alias vim= gnome-terminal -- vim 

-x现在已经退化了 我们需要使用 -相反

如果您不介意使用 gVim, 您可以启动一个单一实例, 这样当新文件用它打开时, 它会在当前运行的实例中自动在新标签中打开 。

您可以为此写入 : gVim -- remote-tab- silent file

You could always make an alias to this command so that you don t have to type so many words. For example I use linux and bash and in my ~/.bashrc file I have:

alias g= gvim -- remote-tab-silent < code> g= gvim -- remote-tab-silent

因此,不要做 $date file I do: $ g file

我使用以下文字, 虽然它是为 gnome- terminal 硬编码的。 它还更改了 CWD 和缓冲, 使活性与您当前的缓冲和目录相同 。

:silent execute  !gnome-terminal -- zsh -i -c "cd   shellescape(expand("%:h"))  ; vim  shellescape(expand("%:p"))  ; zsh -i"  <cr>




相关问题
Autoupdate VIM Plugins?

Is it possible to update vim plugins automatically?

how to unindent in vim without leaving edit mode?

I m writing a lot of python code recently, and i used the tab-to-space mode in vim. I was just wondering how would i unindent in vim without leaving edit mode for example after i finished if...: block....

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

Vim - Deleting XML Comments

How do I delete comments in XML? If the opening and the closing comment tags are on the same line, I use :g/^<!--.*-->$/d to delete the comment. How to delete the comments that are spread ...

Limiting a match in vim to certain filetypes?

I have the following in my .vimrc to highlight lines longer than 80 chars: highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.*/ This works quite well. However, the ...

Profiling Vim startup time

I’ve got a lot of plugins enabled when using Vim – I have collected plugins over the years. I’m a bit fed up with how long Vim takes to start now, so I’d like to profile its startup and see which of ...

热门标签