oyaji's Blog

gedit tips

 

自从开始编程了以后,一直苦于没有找到一款好的编辑器。 用过很多功能强大的IDE,但是觉得它们太笨重,有非常多的不需要的功能。

在mac上,由于textmate迟迟不推出2.0版本,而现在的版本又在多字节的文字显示有问题,所以一直再用Coda,勉强还能过去。 在Linux上,感觉gedit还不错,但是总是觉得它功能有些不全。

最近终于发现了一个好东西Gmate,可以在Linux下近乎实现textmate中的功能,而且gedit也有mac版,所以理论上说,mac下面也能用。

简单的说,Gmate是一个对gedit提供theme,code snippets和多种实用插件的集合包。 下面把我个人觉得应该使用的内容记录一下,供以后配置的时候参考。

安装

首先安装gedit,然后在安装gmate

配置

Theme

Gmate提供很多,个人喜好的theme是如下三个

  • Monokai
  • GitHub
  • Railscasts Improved

Plugins

大部分是Gmate提供的,也有自己download的,基础的插件是Gedit自带(default)的。

  1. Advanced Bookmarks (download)

    在读代码的时候非常有用,可以对代码作暂时的说明,能非常方便的比较代码

  2. Align (gmate)

    可以自己指定分隔符,使代码在列方向对齐

  3. File Browser Pane (default)

    这个是必备的,以下的很多plugin都以此为基础

  4. Fuzzy Open (gmate)

    模糊查找当前文件夹下的文件,非常的方便,而且如果使用git的话,还可以显示文件在git repo中的当前状态

  5. File Search (download)

    一直没有扎到一个十分好用的搜索多个文件内容的插件,这个算是最好用的了。 可以设置rails常用的文件类型如下,速度会快很多。

    *.rb *.rake *.erb *.yml *.css *.js *.html
  6. Classbrowser (gmate)

    可以列出当前文件的类,方法,变量等信息。需要安装 ctags-exuberant 包。

  7. TODO List (gmate)

    相当方便的用来在代码中做记录的插件

  8. Gemini (gmate)

    自动补全引号、括号等字符

  9. Quick Highligt Mode (gmate)

    方便快捷的选择代码高亮的语言模板,不必再在很长的list中用鼠标拖动选择

  10. Rails Extract Partial (gmate)

    抽出选中的内容,并用其创建新的partial文件的快捷方式

  11. Rails File Loader (gmate)

    判断文件是否为rails的文件,如果是的话,则自动打开rubyonrails的高亮模式

  12. Rails Hotcommands (gmate)

    Rails相关的快捷键

  13. Rails Hotkeys (gmate)

    用快捷键打开rails中的各种文件,适合没有怎么customize过的项目

  14. Regex Search Replace (gmate)

    用正则表达式查找当前文件中的字符

  15. Smart Indent (gmate)

    在编写程序的同时自动indent

  16. TabSwitch (gmate)

    在打开的文件之间切换

  17. Text Tools (gmate)

    进行编辑、选择的键盘快捷方式

    Clear Line:         '<Shift><Control>c'
    Duplicate Line      '<Shift><Control>d'
    Move Line Up        '<Alt>Up'
    Move Line Down      '<Alt>Down'
    Select Enclosed Text    '<Alt><Control>9'
    Select Word         '<Alt>W'
    Select Word Special '<Alt><Shift>W'
  18. Save without trailing space (gmate)

    在保存文件的时候去除所有文件结尾的空字符,仅仅保留一个newline

  19. Word Completion (gmate)

    非常不错的补全插件

  20. Multi Edit (gmate)

    同时进行多点编辑的插件

  21. Zen Coding (gmate)

    超级快速编辑html的插件。语法参考

  22.  

     

    Pair character autocompletion plugin for gedit

     

    A gedit plugin that automatically inserts brackets, quotes, and parenthesis.

    Usage

    Automatically inserts a closing parenthesis ) whenever an opening parenthesis ( is typed. The default paired characters are ()[]{},""'', and ``. The plugin is smart enough to automatically overwrite existing closing brackets when appropriate.

    Selecting a block of text and typing an opening parenthesis or quote character will enclose the selection in quotes or parenthesis.

    To quickly jump out of nested quotes or brackets and start a newline, type Ctrl+Return. To jump to the end of the line, insert a semicolon, and start a newline, type Ctrl+Shift+Return.

    Custom sets of per-language paired characters are supported. To change the default paired characters, or add support for new languages, edit the file pair_char_lang.py.

    Installation

    1. Download the latest version of the plugin and extract it
    2. Run the install.sh script.
    3. Restart gedit if it is already started.
    4. Select Edit->Preferences from the menu. Click on the Plugins tab and enable the Pair Character Completion plugin.

    -->>from 旷兄的提示。补记

不足之处:

没有完整的emacs风格的快捷键支持,虽然可以用

gconftool-2 --set /desktop/gnome/interface/gtk_key_theme Emacs --type string
gconftool-2 --set /desktop/gnome/interface/gtk_key_theme Default --type string

的方式,将gtk的keybinding在emacs和default之间来回切换, 但是在emacs的模式下,keybinding有些能用(比如C-f, C-b, C-a, C-e), 但是有些还是不能用(比如C-v还是粘贴)




Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee