Configure Geany on Ubuntu as a useful PHP development tool

Source: Internet
Author: User
On Ubuntu, configure Geany as an easy-to-use PHP development tool. by adding a PPA source, Ubuntu users can install the latest Geany:
Sudo add-apt-repository ppa: geany-dev/ppa
Sudo apt-get update
Sudo apt-get install geany-plugins lxterminal
Because Geany does not support Gnome3 and KDE terminals, you need to install lxterminal as the built-in Terminal of Geany.

In the menu "edit-preferences-Virtual Terminal", you can set the terminal font, foreground color, and background color.
I use DejaVu Sans Mono for both the editor font and terminal font.

In the menu "edit-preferences-shortcut key", change the shortcut key "automatic completion" to Alt + /,
Because its default shortcut key is Ctrl + Space, it will conflict with the input method.
It is worth mentioning that the cursor does not follow the input method in the Geany editor and will always appear in the lower left corner. this is a flaw.

In the menu "edit-preference-file", for example, you can set to use GB18030 encoding to open a non-Unicode file,
In this way, the file with simplified Chinese encoding will not be garbled.
You can also perform encoding and conversion in "document-set file encoding.

In the menu "edit-preferences-editor", you can set settings such as "auto complete", "indent", and "Long Line logo,
For example, you can set a letter to automatically complete all words in the current open document.
For example, if you open two files functions. php and my. php, when you edit the content in my. php,
In addition to prompting PHP library functions, Geany also prompts functions in functions. php.
After you use a function in functions. php in my. php, "Ctrl + left click" this function
Is the function location in functions. php.
After the keyword is selected, the right-click menu "search" also provides the search/tag/jump function.

In the menu "Search-search in multiple files" or use "Ctrl + Shift + F" to call up "search in multiple files" dialog box,
If the shortcut key conflicts with the input method, you can change it to "Ctrl + Alt + F ".
This function of Geany calls the system's grep to search for files containing search keywords in multiple files,
The speed is fast and stable. specifying file suffixes, encoding types, search directories, subdirectories, and regular expressions are all supported.
The search result is displayed in the information window below. you can click it to open the specific row of the file where the search keyword is located.
If you accidentally search for a large Directory, use killall grep to close the process.
All in all, it is quite convenient to find something in the project by using this function.
Geany is not as accurate as Netbeans and other IDEs, but its quick and sufficient positioning is Geany.

Genay smart prompts for PHP library functions come from/usr/share/geany/php. tags support,
You can also use Geany to generate the tags file of your project.
For example, enter the wordpress directory to generate the tags file to the Geany user configuration Directory:
Geany-g ~ /. Config/geany/tags/wordpress. php. tags $ (find.-type f-name '*. php'-o-name' *. php5 ')
Note that the generated WordPress tags file is suffixed with. php. tags, and-o indicates Or (Or.
Load the generated wordpress. php. tags in the "tool-load tag file" menu, so that it will take effect without restarting Geany.
The tags file of the language that comes with Geany. the above mentioned php. tags is only one of them:
Ls-lh/usr/share/geany/*. tags
The latest php. tags file is integrated into the data directory of the official source package.
More tags code prompts (PHP/JS/HTML/CSS, etc ):
Http://wiki.geany.org/tags/start

Complete snippets fragments (PHP/JS/HTML/CSS, etc ):
Http://wiki.geany.org/snippets/start
For example, in an HTML file, enter form and press the Tab key to complete the part, and in the PHP file, enter for or switch and press the tab key to complete the part.
The Geany fragment is defined in snippets. conf:
/Usr/share/geany/snippets. conf
~ /. Config/geany/snippets. conf
Snippets. conf is a configurable text file. you can customize some commonly used fragments.
In the menu "tool-configuration file", you can open snippets. conf to edit it.

Color scheme:
Http://wiki.geany.org/themes/start
Put colorschemes and filedefs in the geany color scheme ~ Restart geany under/. config/Geany to implement installation,
In "view-change color scheme", you can select your favorite color scheme. the color scheme of the first image is Bespin.

In the main configuration file of Geany ~ /. Config/geany. conf records the most recent files:
[Files]
Recent_files = xxx
You can create a clear. sh file to clear the recently opened file:
#! /Bin/bash
Sed-I '/recent_files =\// c recent_files = '~ /. Config/geany. conf

Perform plug-in management in the menu "tools-plug-in manager", such as enabling "additional components", "file browser", "TreeBrowser", and "Pair Tag Highlighter ".

Some plug-ins also provide preferences, which can be configured. for example, in the menu "edit-plug-in preferences" Additional components"Li
Check "Mark all occurrences of a word when double-clicking it"
In this way, you can double-click a word in Notepad ++ to mark all the same words.
You can also select a word, press Ctrl + Shift + M to mark it, and then press the shortcut key to unmark it.

Pair Tag HighlighterClick tags in HTML to be highlighted in pairs.
However, sometimes the old highlight cannot be cleared in time. in this case, you can press Ctrl + S to save and execute Ctrl + R to reload the file.

If you want a project manager similar to IDE, enable TreeBrowserThis plug-in,
Because my desktop is Xfce, I set the external file manager used by TreeBrowser to the default thunar of Xfce, that is, thunar "% d"
Because TreeBrowser uses xterm by default to open the terminal in the current directory,
Replace xterm with lxterminal so that Geany calls lxterminal to open the terminal:
Sudo mv/usr/bin/xterm. backup
Sudo ln-s/usr/bin/lxterminal/usr/bin/xterm

In addition" Export"Plugin, which can export code files to highlighted HTML files.
In short, there are still a lot of plug-ins. here is a C developer developed using Geany. .

Built-in Geany Tag listIt lists the class, function, variable, fixed value, and other information of the current file,
It is displayed on the left. by default, it is sorted by name, or you can select the order in which it appears.

Geany's php file compilation Command corresponds to php-l "% f" for checking the syntax, and execution command corresponds to php "% f" for running the script.
You can perform the "compile" (syntax check) or "execute" operations in the "generate" menu. these operations can be further configured, such as specifying the absolute path PHP.
The information of the "compile" operation (syntax check) is listed in the information window below. The "execute" operation will run the program (such as the PHP script) in the pop-up terminal ).
The toolbar also provides buttons for convenient operations. you can customize your own toolbar in your preferences.

Geany can automatically detect file modifications and prompt users to reload them. you can also click the reload button on the toolbar to manually reload the files.
The shortcut keys of Geany are quite convenient. for example, Ctrl + E can be used to comment out or reverse comment.
Geany has good control and editing of large files. it is very easy to edit tens of thousands of lines of files, which is much better than Notepad ++ on Win.
Set Geany as the default editor in FileZilla. it is also convenient for FTP/SFTP to remotely modify files.

About IDE:
NetbeansPerfect support for HTML/CSS/JavaScript (jQuery/AngularJS)/PHP smart prompts and documentation prompts, rich shortcut keys and macro support,
The interface is hand-written and supports Xdebug, ZendDebugger debugging, git, svn, and hg version control, PHPUnit testing, and remote project development with ssh encryption.
Netbeans dynamically collects the amount of all files in the project in real time. even if you do not require the file, Netbeans will prompt which file contains the amount.
Netbeans is used as IDE and Geany as editor. it works well together.

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.