Tabbed Editing with GViM and Nautilus File Manager

The default text editor of GNOME desktop environment is ‘gedit‘. I prefer ViM because it has much better functionality and customizability, and moreover, it launches faster. One thing I’ve been missing from GViM, a GUI version of ViM, was tabbed editing. GViM already supports tabbed editing, but opening a text file from Nautilus File Manager always creates a new window by default.

GNOME 데스크탑 환경의 기본 텍스트 편집기는 gedit입니다. 저는 기능도 훨씬 많고 커스터마이즈도 용이한데다가 실행 속도도 더 빠른 ViM을 선호합니다. ViM의 GViM에서 한 가지 아쉬웠던 기능은 탭 편집 기능(탭 브라우징처럼 탭으로 여러 문서를 편집하는 기능)입니다. GViM은 이미 탭 편집 기능을 제공하지만 Nautilus 파일 관리자에서 텍스트 파일을 열면 기본적으로 새 창을 열게 되어 있습니다.

Fortunately, I finally found out how to change this behavior. Nautilus stores its file association information in ~/.local/share/applications directory. You can put customized .desktop files there, and then you can associate certain file type to the customized .desktop file. In my case, I want text files to be opened in a new tab of the current GViM window. I put gvim-usercustom.desktop file to ~/.local/share/applications directory:

운좋게도 이 동작을 바꾸는 방법을 결국 알아냈습니다. Nautilus는 파일 연결 정보를 ~/.local/share/applications 디렉토리에 저장합니다. 이 디렉토리에 커스터마이즈한 .desktop 파일을 넣고 특정 파일 유형을 그 .desktop 파일에 연결할 수 있습니다. 제 경우에는 현재 떠 있는 GViM 창의 새 탭에 텍스트 파일이 열리기를 원하는 것이죠. 그래서 gvim-usercustom.desktop 파일을 ~/.local/share/applications 디렉토리에 넣어 주었습니다:

[Desktop Entry]
Encoding=UTF-8
Name=GVim Text Editor (Tab)
Comment=Edit text files in a new tab
Exec=gvim --remote-tab %F
Terminal=false
Type=Application
Icon=/usr/share/pixmaps/vim.svg
Categories=Application;Utility;TextEditor;
StartupNotify=true
MimeType=text/plain;
NoDisplay=true

If you prefer other text editor and want to change its default bahavior, you could copy its .desktop file from /usr/share/applications/ and rename it to <appname>-usercustom.desktop and tweak it a little bit. Refering to this document will also help you if the application you want to associate with a certain file type isn’t listed in a default setting.

다른 편집기를 더 선호하고 그 편집기의 기본 동작을 바꾸고 싶다면 /usr/share/applications/ 디렉토리에서 그 편집기의 .desktop 파일을 복사해 <appname>-usercustom.desktop으로 이름을 바꾸고 손을 좀 보면 될 겁니다. 특정 파일 유형에 연결하고자 하는 어플리케이션이 기본 설정에 포함되어 있지 않다면 이 문서를 참조하면 도움이 될 것입니다.

2 Comments Tabbed Editing with GViM and Nautilus File Manager

  1. Joseph, Jang

    주로 메모를 간단하고 빠른 편집기에 하는 것을 선호하는데, 안그래도 gedit의 느린 실행 속도에 불편해하고 있었습니다.

Comments are closed.