Right-click a SHELL program in Ubuntu and use VIM to open a specified file.

Source: Internet
Author: User
This is a holiday and I am bored at home. So I read books and write programs every day, and, of course, I like VIM in my Ubuntu9.10 ,,, supports some quick operations and runs some external commands. However, it is troublesome to use VIM to edit a file. Each time you open a terminal and then enter the file directory... Later, I naturally thought of adding the command for opening a file to the right-click menu... I wrote a SHELL. Of course, this SHELL is very simple. It doesn't use this regular expression, either.

This is a holiday, so I am bored at home, so I read books and write programs every day, and, of course, in my Ubuntu 9.10, I still like the VIM ,,, supports some quick operations and runs some external commands. However, it is troublesome to use VIM to edit a file. Each time you open a terminal and then enter the file directory... Later, I naturally thought of adding the command for opening a file to the right-click menu... I wrote a SHELL. Of course, this SHELL is very simple. It is useless to use this regular expression, and there are not many commands. As follows:

 
#! /Bin/bash # This is a script program that calls the VI editor through Shell to open # selected files. # Author: wangshui # Email: csauthor@gmail.com # personal website: http://www.oscoder.cn # Distributed under the terms of gnu gpl version2 or later # install in ~ /. Gnome2/nautilus-scripts or ~ /Nautilus/scripts # You need to be running Nautilus 1.0.3 + to use scripts. # When a directory is selected, go there. otherwise go to current # directory. if more than one directory is selected, show error. if [-n "$ NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"]; thenset $ NAUTILUS_SCRIPT_SELECTED_FILE_PATHSif [$ #-eq 1]; thendestination = "$1" if [-f "$ destination"]; thendestination = "$1" elsezenity -- error -- titl E = "Error-Open Vi here" \ -- text = "You can only select a file that Vi supported! "Exit 1 fielsezenity -- error -- title =" Error-Open Vi here "\ -- text =" Only select the one file. "exit 1 unzip iexec x-terminal-emulator-e vi" $ destination"
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.