Use of Vim

Source: Internet
Author: User
Tags file handling

: Ve vertically Open Directory structure

: S Level Open Directory structure

Original: Https://stackoverflow.com/questions/14385379/explore-filesystem-directories-in-vim

The best-of-explore filesystem/directories in Vim is the one, the best suits your needs. As it is phrased, the this question can ' t get a answer because there's no "to" universally agreed upon.

On the other hand, if you want to a overview of the many ways to explore the filesystem in Vim then, yes, that's a Question that can is answered. In a non-exhaustive, though.

Nerdtree and NETRW are already covered. These plugins show you a tree-like list of files and directories so can act on. Before trying Nerdtree, I ' d suggest try your hands on NETRW as it comes with Vim by default and offers a much wider RA Nge of features than Nerdtree. You should look around on http://www.vim.org because there is a bunch of similar plugins.

On the opposite side of the spectrum, you have Vim ' s own file handling capabilities. Here's a sample of commands you can use from Vim to open files:

:e filename     edits filename:sp filename    edits filename in an horizontal split:vs filename    edits filename in a vertical split:tabe filename  edits filename in a new tab

You have a tab-completion, just like in the shell:

:e <tab>        goes through all the directories/files in the working directory

You can use wildcards, of course:

:e **/*.js<tab> shows all the js files in the working directory and its subdirectories

Assuming you set wildmenu ~/.vimrc has in your, you can make tab-completion even better with a horizontal menu which can be custom Ized further ...

You can also use "args" ... but that'll be is for another time.

Somewhere between Vim ' s default commands and Netrw/nerdtree you can find a bunch of "fuzzy" and less fuzzy file openers mo Re or less modeled after a feature introduced in TextMate a while Ago:fuzzyfinder, Lustyexplorer, Command-t, CTRLP and MA NY other variations on the same theme. The core concept is to provide your with a list of choice so narrow down by typing more characters in a prompt until The file ou want to edit is selected.

If you decide your want to go down the plugin road, I'm suggest you visit http://www.vim.org, compare what ' s there, try a f EW plugins and decide for yourself.

Anyway, you should get used to the basics before looking for a plugin.

------------------------------------------------------------------

1.How do I switch between panes in Split mode in Vim?

I ' ve done the : Split command and now I want to switch between panes. (: S,: Ver command can be split screen)

In command mode, hits ctrl-w and then a direction, or just ctrl-w again to switch between panes.

Ctrl-w, S would create a horizontal split.
Ctrl-w, V would create a vertical split.
Ctrl-w, direction'll allow your to move among the panes.
: ls'll show your open buffers.
: b <number> would open the specified buffer in the current pane.

You can use <ctrl> + w + W to switch the panes in order.
A suggest-to-put this codes in your VIMRC file
""""""""""""""""""""""""""""""""""""""""""
Map <C-j> <c-w>j
Map <C-k> <c-w>k
Map <C-h> <c-w>h
Map <C-l> <c-w>l

That means your could use <CTRL>+J/K/H/L to switch the right direction just as you use the j/k/h/l to move the Curs Or

Use of Vim

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.