##// END OF EJS Templates
add rst and md docs describing the auto_suggest feature
Martin Skarzynski -
Show More
@@ -0,0 +1,66 b''
1 Autosuggestion is a very useful feature available in [fish](https://fishshell.com/), [zsh](https://en.wikipedia.org/wiki/Z_shell), and [prompt-toolkit](https://python-prompt-toolkit.readthedocs.io/en/master/pages/asking_for_input.html#auto-suggestion).
2
3 [Ptpython](https://github.com/prompt-toolkit/ptpython#ptpython) allows users to enable this feature in
4 [ptpython/config.py](https://github.com/prompt-toolkit/ptpython/blob/master/examples/ptpython_config/config.py#L90>).
5
6 This feature allows users to accept autosuggestions with ctrl e, ctrl f, or right arrow as described below.
7
8 1. Start ipython
9
10 ![image](https://user-images.githubusercontent.com/13444106/94700432-76580100-0309-11eb-8798-040d47d1a540.png)
11
12 2. Run `print("hello")`
13
14 ![image](https://user-images.githubusercontent.com/13444106/94700528-91c30c00-0309-11eb-920d-4ef8aa79d79a.png)
15
16 3. Press p to see the autosuggestion
17
18 ![image](https://user-images.githubusercontent.com/13444106/94700681-bf0fba00-0309-11eb-94bd-bbddf4805da2.png)
19
20 4. Press ctrl f, or ctrl e, or right arrow to accept the suggestion
21
22 ![image](https://user-images.githubusercontent.com/13444106/94700883-fd0cde00-0309-11eb-9aa8-17270951f021.png)
23
24 You can also complete word by word:
25
26 1. Run `def say_hello(): print("hello")`
27
28 ![image](https://user-images.githubusercontent.com/13444106/94704474-f54f3880-030d-11eb-9d73-fa10ced850be.png)
29
30 2. Press d to see the autosuggestion
31
32 ![image](https://user-images.githubusercontent.com/13444106/94704519-fe400a00-030d-11eb-8b73-3c35ffaf1a9d.png)
33
34 3. Press alt f to accept to accept the first word of the suggestion
35
36 ![image](https://user-images.githubusercontent.com/13444106/94704602-14e66100-030e-11eb-90fc-d930463f52de.png)
37
38 Importantly, this feature does not interfere with tab completion:
39
40 1. After running `def say_hello(): print("hello")`, press d
41
42 ![image](https://user-images.githubusercontent.com/13444106/94704519-fe400a00-030d-11eb-8b73-3c35ffaf1a9d.png)
43
44 2. Press Tab to start tab completion
45
46 ![image](https://user-images.githubusercontent.com/13444106/94704969-80303300-030e-11eb-8379-6bff94582849.png)
47
48 3A. Press Tab again to select the first option
49
50 ![image](https://user-images.githubusercontent.com/13444106/94705023-90481280-030e-11eb-9cf7-76170d1004b9.png)
51
52 3B. Press alt f to accept to accept the first word of the suggestion
53
54 ![image](https://user-images.githubusercontent.com/13444106/94704602-14e66100-030e-11eb-90fc-d930463f52de.png)
55
56 3C. Press ctrl f or ctrl e to accept the entire suggestion
57
58 ![image](https://user-images.githubusercontent.com/13444106/94705115-ab1a8700-030e-11eb-9dee-da98fccca0a6.png)
59
60 To install a version of ipython with autosuggestions enabled, run:
61
62 `pip install git+https://github.com/mskar/ipython@auto_suggest`
63
64 Currently, autosuggestions are only shown in the emacs or vi insert editing modes:
65 - The ctrl e, ctrl f, and alt f shortcuts work by default in emacs mode.
66 - To use these shortcuts in vi insert mode, you will have to create [custom keybindings in your config.py](https://github.com/mskar/setup/commit/2892fcee46f9f80ef7788f0749edc99daccc52f4/).
@@ -0,0 +1,81 b''
1 Autosuggestion is a very useful feature available in `fish <https://fishshell.com/>`__, `zsh <https://en.wikipedia.org/wiki/Z_shell>`__, and `prompt-toolkit <https://python-prompt-toolkit.readthedocs.io/en/master/pages/asking_for_input.html#auto-suggestion>`__.
2
3 `Ptpython <https://github.com/prompt-toolkit/ptpython#ptpython>`__ allows users to enable this feature in
4 `ptpython/config.py <https://github.com/prompt-toolkit/ptpython/blob/master/examples/ptpython_config/config.py#L90>`__.
5
6 This feature allows users to accept autosuggestions with ctrl e, ctrl f,
7 or right arrow as described below.
8
9 1. Start ipython
10
11 |image|
12
13 2. Run ``print("hello")``
14
15 |image1|
16
17 3. Press p to see the autosuggestion
18
19 |image2|
20
21 4. Press ctrl f, or ctrl e, or right arrow to accept the suggestion
22
23 |image3|
24
25 You can also complete word by word:
26
27 1. Run ``def say_hello(): print("hello")``
28
29 |image4|
30
31 2. Press d to see the autosuggestion
32
33 |image5|
34
35 3. Press alt f to accept to accept the first word of the suggestion
36
37 |image6|
38
39 Importantly, this feature does not interfere with tab completion:
40
41 1. After running ``def say_hello(): print("hello")``, press d
42
43 |image7|
44
45 2. Press Tab to start tab completion
46
47 |image8|
48
49 3A. Press Tab again to select the first option
50
51 |image9|
52
53 3B. Press alt f to accept to accept the first word of the suggestion
54
55 |image10|
56
57 3C. Press ctrl f or ctrl e to accept the entire suggestion
58
59 |image11|
60
61 To install a version of ipython with autosuggestions enabled, run:
62
63 ``pip install git+https://github.com/mskar/ipython@auto_suggest``
64
65 Currently, autosuggestions are only shown in the emacs or vi insert editing modes:
66
67 - The ctrl e, ctrl f, and alt f shortcuts work by default in emacs mode.
68 - To use these shortcuts in vi insert mode, you will have to create `custom keybindings in your config.py <https://github.com/mskar/setup/commit/2892fcee46f9f80ef7788f0749edc99daccc52f4/>`__.
69
70 .. |image| image:: https://user-images.githubusercontent.com/13444106/94700432-76580100-0309-11eb-8798-040d47d1a540.png
71 .. |image1| image:: https://user-images.githubusercontent.com/13444106/94700528-91c30c00-0309-11eb-920d-4ef8aa79d79a.png
72 .. |image2| image:: https://user-images.githubusercontent.com/13444106/94700681-bf0fba00-0309-11eb-94bd-bbddf4805da2.png
73 .. |image3| image:: https://user-images.githubusercontent.com/13444106/94700883-fd0cde00-0309-11eb-9aa8-17270951f021.png
74 .. |image4| image:: https://user-images.githubusercontent.com/13444106/94704474-f54f3880-030d-11eb-9d73-fa10ced850be.png
75 .. |image5| image:: https://user-images.githubusercontent.com/13444106/94704519-fe400a00-030d-11eb-8b73-3c35ffaf1a9d.png
76 .. |image6| image:: https://user-images.githubusercontent.com/13444106/94704602-14e66100-030e-11eb-90fc-d930463f52de.png
77 .. |image7| image:: https://user-images.githubusercontent.com/13444106/94704519-fe400a00-030d-11eb-8b73-3c35ffaf1a9d.png
78 .. |image8| image:: https://user-images.githubusercontent.com/13444106/94704969-80303300-030e-11eb-8379-6bff94582849.png
79 .. |image9| image:: https://user-images.githubusercontent.com/13444106/94705023-90481280-030e-11eb-9cf7-76170d1004b9.png
80 .. |image10| image:: https://user-images.githubusercontent.com/13444106/94704602-14e66100-030e-11eb-90fc-d930463f52de.png
81 .. |image11| image:: https://user-images.githubusercontent.com/13444106/94705115-ab1a8700-030e-11eb-9dee-da98fccca0a6.png
General Comments 0
You need to be logged in to leave comments. Login now