Difference between revisions of "Yi/FAQ"

From HaskellWiki
< Yi
Jump to navigation Jump to search
(Remove link to ancient configs)
(13 intermediate revisions by 9 users not shown)
Line 2: Line 2:
   
 
*How do I install Yi?
 
*How do I install Yi?
:get it from Hackage. Configure, compile and install Yi as you would do for any other Cabal package.
+
:Get it from Hackage. Configure, compile and install Yi as you would do for any other Cabal package. See also above-mentioned (2.3 Platform Support).
   
*Setup configure fails with
+
*Setup configure fails with
 
Setup.hs: Package yi-0.4 can't be built on this system.
 
Setup.hs: Package yi-0.4 can't be built on this system.
 
:It means that you have no UI package available. You need VTY or GTK2hs installed. Get them from Hackage.
 
:It means that you have no UI package available. You need VTY or GTK2hs installed. Get them from Hackage.
   
*cabal install yi fails with dependency errors, eg:
+
*cabal install yi fails with dependency errors, e.g.:
 
$ cabal install yi
 
$ cabal install yi
 
Resolving dependencies...
 
Resolving dependencies...
Line 31: Line 31:
   
 
* I can't install <tt>yi-gtk</tt> or <tt>yi-vty</tt>! It wants <tt>sourceview</tt> or something.
 
* I can't install <tt>yi-gtk</tt> or <tt>yi-vty</tt>! It wants <tt>sourceview</tt> or something.
: As the Hackage descriptions say, yi-gtk and yi-vty are ''only'' for versions of older than Yi 0.3. You really should be running the latest development (Darcs) or stable (Hackage) versions of Yi, so ''don't'' try to install these two packages. Yi supports VTY and Gtk2hs directly in the <tt>yi</tt> package now.
+
: As the Hackage descriptions say, yi-gtk and yi-vty are ''only'' for versions of older than Yi 0.3. You really should be running the latest development (GitHub) or stable (Hackage) versions of Yi, so ''don't'' try to install these two packages. Yi supports VTY and Gtk2hs directly in the <tt>yi</tt> package now.
 
*On Mac OS X if you get an error message similar to this:
 
*On Mac OS X if you get an error message similar to this:
 
yi: can't load .so/.DLL for: gthread-2.0 (dlopen(libgthread-2.0.dylib, 10): image not found)
 
yi: can't load .so/.DLL for: gthread-2.0 (dlopen(libgthread-2.0.dylib, 10): image not found)
Line 41: Line 41:
 
:(Adjust the specific path to your system. You can find the right location using <tt>locate libgthread</tt>)
 
:(Adjust the specific path to your system. You can find the right location using <tt>locate libgthread</tt>)
   
  +
*On Mac OS 10.6 (Snow Leopard) if you get the following error:
==== Development ====
 
  +
Loading package cairo-0.11.1 ... <command line>: can't load .so/.DLL for: pixman-1 (dlopen(/opt/local/lib/libpixman-1.dylib, 9): no suitable image found. Did find:
  +
/opt/local/lib/libpixman-1.dylib: mach-o, but wrong architecture)
  +
cabal: Error: some packages failed to install:
  +
yi-0.6.2.4 failed during the building phase. The exception was:
  +
ExitFailure 1
  +
  +
:then the problem is that GHC currently only supports linking against i386 libraries, and your ports are compiled for x86_64. To fix, recompile your ports with the +universal variant like so:
  +
  +
port install installed +universal
  +
  +
* Compilation fails with errors about template-haskell or data-accessor:
  +
Add constraints about which release of those libraries to use.
  +
$ cabal install yi --constraint="data-accessor < 0.2.1" --constraint="template-haskell < 2.4"
  +
  +
=== Default key bindings ===
  +
  +
==== CUA key bindings ====
  +
  +
===== File operations =====
  +
{|
  +
| Ctrl-o
  +
| Open file.
  +
|-
  +
| Ctrl-s
  +
| Save the current file.
  +
|-
  +
| Ctrl-q
  +
| Quit the editor.
  +
|}
  +
  +
===== Cursor/selection movement =====
  +
{|
  +
| &rarr;
  +
| Move cursor forward one character.
  +
|-
  +
| &larr;
  +
| Move cursor back one character.
  +
|-
  +
| &darr;
  +
| Move cursor down one line.
  +
|-
  +
| &uarr;
  +
| Move cursor down one line.
  +
|-
  +
| Shift+&rarr;
  +
| Extend selection forward one character.
  +
|-
  +
| Shift+&larr;
  +
| Extend selection back one character.
  +
|-
  +
| Shift+&darr;
  +
| Extend selection down one line.
  +
|-
  +
| Shift+&uarr;
  +
| Extend selection up one line.
  +
|-
  +
| Ctrl-&rarr;
  +
| Move cursor forward one word.
  +
|-
  +
| Ctrl-&larr;
  +
| Move cursor back one word.
  +
|-
  +
| Home
  +
| Move cursor to beginning of line.
  +
|-
  +
| End
  +
| Move cursor to end of line.
  +
|-
  +
| Ctrl-Home
  +
| Move cursor to beginning of document.
  +
|-
  +
| Ctrl-End
  +
| Move cursor to end of document.
  +
|}
  +
  +
===== Miscellaneous operations =====
  +
  +
{|
  +
| Ctrl-f
  +
| Incremental search.
  +
|-
  +
| Ctrl-x
  +
| Cut the selected area and save it to the clipboard
  +
|-
  +
| Ctrl-c
  +
| Copy the selected area to the clipboard
  +
|-
  +
| Ctrl-v
  +
| Paste contents of clipboard at cursor.
  +
|-
  +
| Ctrl-z
  +
| Undo last operation.
  +
|-
  +
| Ctrl-y
  +
| Redo last operation.
  +
|}
  +
  +
==== Vim key bindings ====
  +
==== Emacs key bindings ====
  +
  +
C = Control
  +
  +
M = Meta = Alt|Esc
  +
  +
===== Basics =====
  +
{|
  +
|C-x C-f
  +
|"Find" file i.e. open/create a file in buffer
  +
|-
  +
|C-x C-s
  +
|Save the file
  +
|-
  +
|C-x C-w
  +
|Write the text to an alternate name
  +
|-
  +
|C-x i
  +
|Insert file at cursor position
  +
|-
  +
|C-x b
  +
|Create/switch buffers
  +
|-
  +
|C-x C-b
  +
|Show buffer list
  +
|-
  +
|C-x k
  +
|Kill buffer
  +
|-
  +
|C-z
  +
|Suspend Yi
  +
|-
  +
|C-x C-c
  +
|Close down Yi
  +
|}
  +
  +
===== Basic movement =====
  +
  +
{|
  +
|C-f
  +
|Forward char
  +
|-
  +
|C-b
  +
|Backward char
  +
|-
  +
|C-p
  +
|Previous line
  +
|-
  +
|C-n
  +
|Next line
  +
|-
  +
|M-f
  +
|Forward one word
  +
|-
  +
|M-b
  +
|Backward one word
  +
|-
  +
|C-a
  +
|Beginning of line
  +
|-
  +
|C-e
  +
|End of line
  +
|-
  +
|C-v
  +
|One page up
  +
|-
  +
|M-v
  +
|Scroll down one page
  +
|-
  +
|M-<
  +
|Beginning of text
  +
|-
  +
|M->
  +
|End of text
  +
|}
  +
  +
===== Editing =====
  +
  +
{|
  +
|M-n
  +
|Repeat the following command n times
  +
|-
  +
|C-u
  +
|Repeat the following command 4 times
  +
|-
  +
|C-d
  +
|Delete a char
  +
|-
  +
|M-d
  +
|Delete word
  +
|-
  +
|M-Del
  +
|Delete word backwards
  +
|-
  +
|C-k
  +
|Kill line
  +
|-
  +
|C-Space
  +
|Set beginning mark (for region marking for example)
  +
|-
  +
|C-W
  +
|"Kill" (delete) the marked region region
  +
|-
  +
|M-W
  +
|Copy the marked region
  +
|-
  +
|C-y
  +
|"Yank" (paste) the copied/killed region/line
  +
|-
  +
|M-y
  +
|Yank earlier text (cycle through kill buffer)
  +
|-
  +
|C-x C-x
  +
|Exchange cursor and mark
  +
|-
  +
|C-t
  +
|Transpose two chars
  +
|-
  +
|M-t
  +
|Transpose two words
  +
|-
  +
|M-u
  +
|Make letters uppercase in word from cursor position to end
  +
|-
  +
|M-c
  +
|Simply make first letter in word uppercase
  +
|-
  +
|M-l
  +
|Opposite to M-u
  +
|}
  +
  +
===== Important =====
  +
  +
{|
  +
|C-g
  +
|Quit the running/entered command
  +
|-
  +
|C-x u
  +
|Undo previous action
  +
|-
  +
|M-/
  +
|Undo previous action
  +
|}
  +
  +
===== Search/Replace =====
  +
  +
{|
  +
|C-s
  +
|Search forward
  +
|-
  +
|C-r
  +
|Search backward
  +
|-
  +
|M-%
  +
|Query replace
  +
|-
  +
|Space or y
  +
|Replace this occurrence
  +
|-
  +
|Del or n
  +
|Don't replace
  +
|-
  +
|!
  +
|Replace all following occurrences
  +
|-
  +
|ENTER or q
  +
|Quit replace
  +
|}
  +
  +
===== Window-Commands =====
  +
  +
{|
  +
|C-x 2
  +
|Split window vertically
  +
|-
  +
|C-x o
  +
|Change to other window
  +
|-
  +
|C-x 0
  +
|Delete window
  +
|-
  +
|C-x 1
  +
|Close all windows except the one the cursors in
  +
|}
  +
  +
===== DIRectory EDitor (dired) =====
  +
  +
{|
  +
|C-x d
  +
|Start up dired
  +
|-
  +
|C (large C)
  +
|Copy
  +
|-
  +
|d
  +
|Mark for erase
  +
|-
  +
|D
  +
|Delete right away
  +
|-
  +
|e or f
  +
|Open file or directory
  +
|-
  +
|g
  +
|Re-read directory structure from file
  +
|-
  +
|m
  +
|Mark with *
  +
|-
  +
|n
  +
|Move to next line
  +
|-
  +
|q
  +
|Quit dired
  +
|-
  +
|R
  +
|Rename file
  +
|-
  +
|u
  +
|Remove mark
  +
|-
  +
|x
  +
|Delete files marked with D
  +
|-
  +
| +
  +
|Create directory
  +
|}
  +
  +
===== Programming =====
  +
  +
{|
  +
|M-m
  +
|Move to first (non-space) char in this line
  +
|-
  +
|M-^
  +
|Attach this line to previous
  +
|-
  +
|M-;
  +
|Formatize and indent comment
  +
|-
  +
  +
===== C, C++ and Java Modes =====
  +
  +
{|
  +
|M-a
  +
|Beginning of statement
  +
|-
  +
|M-e
  +
|End of statement
  +
|-
  +
|C-c C-c
  +
|Comment out marked area
  +
|}
  +
  +
=== Development ===
   
 
*How do I install Yi for development?
 
*How do I install Yi for development?
  +
:Fork the repository on GitHub, then clone your version to your machine. Push to your repo on GitHub, and then make merge requests.
:Get it from http://code.haskell.org/yi while there are other repositories of Yi out there, this is the latest.
 
   
 
*What are some of the dependancies?
 
*What are some of the dependancies?
  +
:There is a rather long list of dependencies for Yi, check the yi.cabal file for a list.
:The development version of Yi currently requires Cabal-1.4, fingertree-0.0, and utf8-string-0.3.1.
 
   
 
::If you are on Mac OS X and are using MacPorts, then these will not be included in the GHC in that distribution. Many of the dependancies are in MacPorts (for example: ghc, ghc-devel, alex, and gtk2hs). However, you may have some trouble building with Cabal-1.5.2, since it is a development version of Cabal. To work around these issues, you might have to add the line "Build-Type: Simple" to the .cabal files in the above required packages.
 
::If you are on Mac OS X and are using MacPorts, then these will not be included in the GHC in that distribution. Many of the dependancies are in MacPorts (for example: ghc, ghc-devel, alex, and gtk2hs). However, you may have some trouble building with Cabal-1.5.2, since it is a development version of Cabal. To work around these issues, you might have to add the line "Build-Type: Simple" to the .cabal files in the above required packages.
Line 55: Line 408:
 
==== How to Configure Yi ====
 
==== How to Configure Yi ====
   
  +
You can find some user configs at [https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Config/Users https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Config/Users]
You can find configuration file examples in the 'examples/' directory, or online at [http://code.haskell.org/yi/examples/ http://code.haskell.org/yi/examples/].
 
  +
  +
A good way to start is to copy yi.hs in your $XDG_CONFIG_HOME/yi directory (create it if needed), and hack as needed.
   
A good way to start is to copy yi.hs in your ~/.yi directory (create it if needed), and hack as needed.
 
 
=== Usage ===
 
=== Usage ===
 
==== GError on startup ====
 
==== GError on startup ====
 
I get the error message "yi.exe: <<System.Glib.GError.GError>>" when I try to run yi.
 
I get the error message "yi.exe: <<System.Glib.GError.GError>>" when I try to run yi.
   
Sometimes this is a result of yi not being able to find the contents of the art directory. Check that the install has be done correctly.
+
Sometimes this is a result of yi not being able to find the contents of the art directory when trying to start in graphical mode (e.g. Gtk or Pango). Check that the install has be done correctly or use the VTY mode (<tt>$ yi -f vty</tt>).
   
 
For more detail on the error, modify main in Yi/Main.hs to catch GError:
 
For more detail on the error, modify main in Yi/Main.hs to catch GError:
Line 70: Line 424:
 
startEditor finalCfg state) (\(GError dom code msg) -> fail msg)
 
startEditor finalCfg state) (\(GError dom code msg) -> fail msg)
 
</pre>
 
</pre>
  +
  +
Note that more recent versions of Yi (e.g. from the GitHub repo) no longer simply display the anonymous GError but instead provide a more detailed error message (making the above code snippet unnecessary).
  +
  +
[[Category:FAQ]]

Revision as of 01:20, 23 June 2014

Installation

  • How do I install Yi?
Get it from Hackage. Configure, compile and install Yi as you would do for any other Cabal package. See also above-mentioned (2.3 Platform Support).
  • Setup configure fails with
Setup.hs: Package yi-0.4 can't be built on this system.
It means that you have no UI package available. You need VTY or GTK2hs installed. Get them from Hackage.
  • cabal install yi fails with dependency errors, e.g.:
$ cabal install yi
Resolving dependencies...
cabal.exe: dependencies conflict: ghc-6.8.3 requires bytestring ==0.9.0.1.1
however
bytestring-0.9.0.1.1 was excluded because bytestring-0.9.0.1 was selected
instead
bytestring-0.9.0.1.1 was excluded because yi-0.3 requires bytestring =0.9.0.1
Try removing all your old yi packages, and do
cabal update

before attempting to install.

  • cabal install -fghcAPI fails
If you want GHC API special capabilities, you have to download, configure, build and copy separately:
cd yi
cabal configure -fghcAPI
cabal build
cabal copy
  • Compilation fails with a message about alex not being available?
Currently, Cabal doesn't track programs, just libraries, so it won't warn you if you are missing Alex (as many people are). The solution here is to just cabal install alex first. (Yi uses Alex to generate code for parsing stuff with syntax, like Haskell source.)
  • I can't install yi-gtk or yi-vty! It wants sourceview or something.
As the Hackage descriptions say, yi-gtk and yi-vty are only for versions of older than Yi 0.3. You really should be running the latest development (GitHub) or stable (Hackage) versions of Yi, so don't try to install these two packages. Yi supports VTY and Gtk2hs directly in the yi package now.
  • On Mac OS X if you get an error message similar to this:
yi: can't load .so/.DLL for: gthread-2.0 (dlopen(libgthread-2.0.dylib, 10): image not found)
then your dynamic library search path variable is probably not set correctly. You can set it (in Bash) using:
export DYLD_LIBRARY_PATH=/opt/local/lib
(Adjust the specific path to your system. You can find the right location using locate libgthread)
  • On Mac OS 10.6 (Snow Leopard) if you get the following error:
 Loading package cairo-0.11.1 ... <command line>: can't load .so/.DLL for: pixman-1 (dlopen(/opt/local/lib/libpixman-1.dylib, 9): no suitable image found.  Did find:
       /opt/local/lib/libpixman-1.dylib: mach-o, but wrong architecture)
 cabal: Error: some packages failed to install:
 yi-0.6.2.4 failed during the building phase. The exception was:
 ExitFailure 1
then the problem is that GHC currently only supports linking against i386 libraries, and your ports are compiled for x86_64. To fix, recompile your ports with the +universal variant like so:
 port install installed +universal
  • Compilation fails with errors about template-haskell or data-accessor:

Add constraints about which release of those libraries to use.

 $ cabal install yi --constraint="data-accessor < 0.2.1" --constraint="template-haskell < 2.4"

Default key bindings

CUA key bindings

File operations
Ctrl-o Open file.
Ctrl-s Save the current file.
Ctrl-q Quit the editor.
Cursor/selection movement
Move cursor forward one character.
Move cursor back one character.
Move cursor down one line.
Move cursor down one line.
Shift+→ Extend selection forward one character.
Shift+← Extend selection back one character.
Shift+↓ Extend selection down one line.
Shift+↑ Extend selection up one line.
Ctrl-→ Move cursor forward one word.
Ctrl-← Move cursor back one word.
Home Move cursor to beginning of line.
End Move cursor to end of line.
Ctrl-Home Move cursor to beginning of document.
Ctrl-End Move cursor to end of document.
Miscellaneous operations
Ctrl-f Incremental search.
Ctrl-x Cut the selected area and save it to the clipboard
Ctrl-c Copy the selected area to the clipboard
Ctrl-v Paste contents of clipboard at cursor.
Ctrl-z Undo last operation.
Ctrl-y Redo last operation.

Vim key bindings

Emacs key bindings

C = Control

M = Meta = Alt|Esc

Basics
C-x C-f "Find" file i.e. open/create a file in buffer
C-x C-s Save the file
C-x C-w Write the text to an alternate name
C-x i Insert file at cursor position
C-x b Create/switch buffers
C-x C-b Show buffer list
C-x k Kill buffer
C-z Suspend Yi
C-x C-c Close down Yi
Basic movement
C-f Forward char
C-b Backward char
C-p Previous line
C-n Next line
M-f Forward one word
M-b Backward one word
C-a Beginning of line
C-e End of line
C-v One page up
M-v Scroll down one page
M-< Beginning of text
M-> End of text
Editing
M-n Repeat the following command n times
C-u Repeat the following command 4 times
C-d Delete a char
M-d Delete word
M-Del Delete word backwards
C-k Kill line
C-Space Set beginning mark (for region marking for example)
C-W "Kill" (delete) the marked region region
M-W Copy the marked region
C-y "Yank" (paste) the copied/killed region/line
M-y Yank earlier text (cycle through kill buffer)
C-x C-x Exchange cursor and mark
C-t Transpose two chars
M-t Transpose two words
M-u Make letters uppercase in word from cursor position to end
M-c Simply make first letter in word uppercase
M-l Opposite to M-u
Important
C-g Quit the running/entered command
C-x u Undo previous action
M-/ Undo previous action
Search/Replace
C-s Search forward
C-r Search backward
M-% Query replace
Space or y Replace this occurrence
Del or n Don't replace
! Replace all following occurrences
ENTER or q Quit replace
Window-Commands
C-x 2 Split window vertically
C-x o Change to other window
C-x 0 Delete window
C-x 1 Close all windows except the one the cursors in
DIRectory EDitor (dired)
C-x d Start up dired
C (large C) Copy
d Mark for erase
D Delete right away
e or f Open file or directory
g Re-read directory structure from file
m Mark with *
n Move to next line
q Quit dired
R Rename file
u Remove mark
x Delete files marked with D
+ Create directory
Programming
C, C++ and Java Modes
M-m Move to first (non-space) char in this line
M-^ Attach this line to previous
M-; Formatize and indent comment
M-a Beginning of statement
M-e End of statement
C-c C-c Comment out marked area

Development

  • How do I install Yi for development?
Fork the repository on GitHub, then clone your version to your machine. Push to your repo on GitHub, and then make merge requests.
  • What are some of the dependancies?
There is a rather long list of dependencies for Yi, check the yi.cabal file for a list.
If you are on Mac OS X and are using MacPorts, then these will not be included in the GHC in that distribution. Many of the dependancies are in MacPorts (for example: ghc, ghc-devel, alex, and gtk2hs). However, you may have some trouble building with Cabal-1.5.2, since it is a development version of Cabal. To work around these issues, you might have to add the line "Build-Type: Simple" to the .cabal files in the above required packages.

Configuration

How to Configure Yi

You can find some user configs at https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Config/Users

A good way to start is to copy yi.hs in your $XDG_CONFIG_HOME/yi directory (create it if needed), and hack as needed.

Usage

GError on startup

I get the error message "yi.exe: <<System.Glib.GError.GError>>" when I try to run yi.

Sometimes this is a result of yi not being able to find the contents of the art directory when trying to start in graphical mode (e.g. Gtk or Pango). Check that the install has be done correctly or use the VTY mode ($ yi -f vty).

For more detail on the error, modify main in Yi/Main.hs to catch GError:

 Right finalCfg -> do catchGError (do
                                   when (debugMode finalCfg) $ initDebug ".yi.dbg" 
                                   startEditor finalCfg state) (\(GError dom code msg) -> fail msg)

Note that more recent versions of Yi (e.g. from the GitHub repo) no longer simply display the anonymous GError but instead provide a more detailed error message (making the above code snippet unnecessary).