Showing posts with label sublime text. Show all posts
Showing posts with label sublime text. Show all posts

Wednesday, May 8, 2013

[How to] Install Sublime Text 2 in Linux

How to install Sublime Text 2 in Linux

¿De qué está hablando? Versión en español

A very nice text editor


If you are looking for a nice text editor or if you simply got tired of Gedit or Geany, Sublime Text won't let you down.

This editor has a lot of features, like Geany but it's more unique. You can improve your experience by installing plugins.

This editor supports a lot of languages like C, HTML, PHP, Java, LISP, Bash...

Installation

If you want to fully install this editor you need to follow the next steps:

Step 1.

Go the download page of Sublime and select the architecture that corresponds you.

Step 2.

Extract the files with the following command:

tar xvf Sublime\ Text\ 2.0.1\ x64.tar.bz2

Step 3.

You will need to move them to the /opt directory (most of the manually installed programs will go there). You need root privileges.

sudo mv Sublime\ Text\ 2 /opt

Step 4.

If you want to be able to launch Sublime from the Terminal you will need to create a symbolic link. You can use the name that you want "sublime_text", "sexy-editor"... in my case I decided to call it sublime.

sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

Step 5.

If you use Ubuntu and Unity, you can integrate Sublime to Unity creating the following file (you can adapt this to your desktop):

sudo sublime /usr/share/applications/sublime.desktop

Put the following content in that file and modify it if you need it so it will integrate to the desktop of your choice:

[Desktop Entry]
Version=1.0
Name=Sublime Text 2
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor

Exec=sublime
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity



Step 6.

If you want to use Sublime Text to open all your text files you need to change the default applications.

sudo sublime /usr/share/applications/defaults.list

Replace all the iterations of gedit.desktop with sublime.desktop. You can use Ctrl + D to select all the iterations that you want and then you just need to write what you want. It will replace all the selections that you made.

Step 7.

Install the Package Manager. That way you can download different plugins for this text editor. You need to give some permissions to the configuration file of Sublime. Use the following command (replacing {your username} with your actual username):

sudo chown -R {your username}:{your username} "/home/{your username}/.config/sublime-text-2"

Then launch Sublime as root.

sudo sublime

Open the Console, go to "View">"Show Console" and put the following command:

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'

Then you only need to relaunch Sublime Text and you are good to go.

[Tutorial] Instalar Sublime Text 2 en Linux

¿Cómo instalar Sublime Text 2 en Linux?

What is he talking about? English version

Un editor de texto muy simpático


Si están buscando un editor de texto muy simpático o si simplemente se aburrieron de Geany o Gedit, Sublime Text no los decepcionará.

Es un editor que viene con muchas funcionalidades, más o menos como Geany pero tiene varias cosas únicas. Hay como descargar plugins que van a aumentar la funcionalidad del editor.

Así mismo este editor reconoce varios lenguajes de programación como C, HTML, Java, LISP, Bash...

Instalación

Para instalar este editor sigan los pasos siguientes:

Paso 1.

Vayan a la página de descargas de Sublime y seleccionen la versión de Linux que les corresponde.

Paso 2.

Extraigan los ficheros con el comando siguiente:

tar xvf Sublime\ Text\ 2.0.1\ x64.tar.bz2

Paso 3.

Muevanlos a la carpeta /opt (ahí es donde la mayoría de programas que no están en los repositorios oficiales se instalan). Se necesita usar sudo.

sudo mv Sublime\ Text\ 2 /opt

Paso 4.

Hay que crear un enlace simbólico, así podremos lanzar Sublime desde un Terminal. (Esto equivaldría a hacer un Acceso Directo). Pueden usar el nombre que quieran, como sublime_text, editor-sexi... en este caso yo he decido llamarlo sublime.

sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

Paso 5.

Si usan Ubuntu y Unity, pueden integrar Sublime a Unity creando el archivo siguiente:

sudo sublime /usr/share/applications/sublime.desktop

Llenen este archivo con el siguiente contenido, pueden adaptarlo al escritorio que usen (KDE, Gnome..):

[Desktop Entry]
Version=1.0
Name=Sublime Text 2
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor

Exec=sublime
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity



Paso 6.

Si quieren que desde ahora todos los archivos de texto se abran con sublime van a tener que editar la lista de aplicaciones.

sudo sublime /usr/share/applications/default.list

Cambien todo lo que esté marcado con gedit.desktop por sublime.desktop.
En Sublime Text pueden seleccionar todas las iteraciones de una palabra con Ctrl + D , luego solo tienen que escribir lo que quieran normalmente y va a reemplazar todas las iteraciones que seleccionaron.

Paso 7.

Instalen el gestionario de paquetes de Sublime Text. Así podrán instalar diferentes plugins para su editor. Para eso tienen que dar permisos de ejecución a la carpeta de configuración de Sublime. Usen el comando siguiente (remplazando {su usuario} por el nombre de su usuario):

sudo chown -R {su usuario}:{su usuraio} "/home/{su usuario}/.config/sublime-text-2"

Luego lancen sublime como super utilizador

sudo sublime

Abran la Consola de Sublime yendo a "View">"Show Console" y pongan el comando siguiente

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'

Luego solo tendrán que reiniciar Sublime y listo.

Les gustó este post? Aquí pueden ver lo que se va a venir en este blog (por el momento). No se olviden de agregarme a sus círculos en G+ o de seguirme en Twitter: @RobertoXMed