Skip to content

Commit 5b93a30

Browse files
author
Gaspar Chilingarov
committed
update documentation and add install/update scripts
1 parent afda97c commit 5b93a30

5 files changed

Lines changed: 443 additions & 12 deletions

File tree

CHEATSHEET.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
2+
3+
# Vim-Elixir-IDE
4+
5+
List of defined shortcuts and (some) commands and some useful native Vim
6+
shortcuts/commands:
7+
8+
#### Navigation
9+
**Between Files**
10+
* `<Ctrl-P>` to start navigation in current project
11+
* `<Ctrl-P>` to recall last fuzzy search text
12+
* enter text to fuzzy filter file names
13+
* `<Ctrl-z>` allows to select multiple files
14+
* `<Ctrl-k>`/`<Ctrl-j>` or arrows move up/down in the list
15+
* `<Ctrl-v>` opens selected files in vertical split
16+
* `<Ctrl-s>` opens selected files in horizontal split
17+
18+
**In file**
19+
* `<F1>` shows Elixir docs for function under cursor.
20+
* `<Ctrl-@>` opens functions list for fuzzy search
21+
* `<Leader>l` opens all lines in the file for fuzzy search
22+
* `<Ctrl-]>` jump to definition of function/module under cursor
23+
* `<Ctrl-T>` return from previous jump
24+
* `<Leader>;;` search word under cursor, show match list and propmt to jump
25+
* `<Ctrl-Enter>` same as above, but only in GVim
26+
* `%` jumps to matching do/end tag, brackets, braces, etc. Also can be used
27+
after `<Ctrl-V>` or `v` to select function/text block.
28+
29+
Use Vim marks `:help marks` to navigate quickly between several positions in
30+
file or between files.
31+
32+
* `ma` .. `mz` set mark which is available only in current file
33+
* `mA` .. `mZ` set global mark which is available across files.
34+
* ```a`` .. ```z`` jumps between marks in current file (so many files may have `ma` mark)
35+
* ```A`` .. ```Z`` jumps between global marks and switches buffers if necessary.
36+
* ```.`` jumps to last edited position
37+
* ```````` jumps to position before last jump (basically jumps between 2 positions)
38+
39+
**In file using Tagbar**
40+
41+
* `<F4>` opens/closes Tagbar window.
42+
* `<Enter>` or click on function name takes you to function definition.
43+
* `<p>` on function name takes you to function definition, but focus stays in tagbar.
44+
* `<P>` on function name opens function in preview window.
45+
46+
More on [tagbar page](https://majutsushi.github.io/tagbar/).
47+
48+
#### Editing
49+
* `<F2>` to save current file to disk.
50+
* `ZZ` to save current file and close it. In GVim it keeps editor open.
51+
* `:bdd` closes current buffer, but keeps window split.
52+
* `<F3>` to toggle current fold open/close.
53+
* `zR` to open all folds.
54+
* `zM` to close all folds.
55+
* `<Ctrl-K><Ctrl-L>` highlight word under cursor in whole file.
56+
57+
* `<Ctrl-K><Ctrl-P>` toggles comment on current line/selection
58+
* `<Ctrl-K><Ctrl-[>` adds comment on current line/selection
59+
* `<Ctrl-K><Ctrl-]>` removes comment from current line/selection
60+
*It is impossible at all to map `<Ctrl-/>` in Vim :(. So please get used to these shortcuts.*
61+
62+
* `<Leader>=` to align vertically `=>` map keys.
63+
* `<Leader>-` to align vertically `->` function/case clauses.
64+
* `<Leader>:` to align vertically `:` map or Keyword list keys.
65+
* `<Leader>eq` to align vertically `=` assignment signs.
66+
67+
* `<Leader>$` or `<Leader>trailing` to remove trailing spaces from all lines.
68+
69+
#### Compilation
70+
* `:make` to compile changed files and show only errors
71+
* `<Leader>xc` to compile changed files and show errors+warnings
72+
* `<Leader>x!` to compile whole project and show errors+warnings
73+
* `:cw` to open quickfix window
74+
* `]e` go to next error/warning
75+
* `[e` go to previous error/warning
76+
77+
#### ExUnit
78+
79+
* `<Leader>xa` runs ExUnit tests on whole project
80+
* `<Leader>xf` runs ExUnit tests on current file
81+
* `<Leader>xl` runs ExUnit tests on current line of current file
82+
* `<Leader>xx` repeats last executed command
83+
84+
* `<Leader>wa` runs in background ExUnit tests on whole project
85+
* `<Leader>wf` runs in background ExUnit tests on current file
86+
* `<Leader>wl` runs in background ExUnit tests on current file:line
87+
* `<Leader>ww` runs again in background last executed command
88+
* `<Leader>ws` or `<Leader>wc` stop automatic test execution on save.
89+
90+
* `:cw` to open quickfix window
91+
* `]e` go to next error
92+
* `[e` go to previous error
93+
94+
#### Git integration
95+
* `:Gstatus` - show modified files and staged status
96+
* `-` (in normal mode) on file name moves between staged/unstaged mode
97+
* `p` (in normal mode) on file name allows to stage/unstage only parts of the file.
98+
* `d` (in normal mode) on file name opens diff between working copy and repository
99+
* `:Gcommit` starts commit of staged files (use save/exit to commit, clear
100+
message to abort)
101+
* `:Gdiff` - shows diff between current file and repository
102+
103+
More on [vim-figutive page](https://github.com/tpope/vim-fugitive).
104+
105+
#### Other
106+
107+
* `<Ctrl-X>` opens XTerm in current directory

README.md

Lines changed: 147 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@ avoid laborious task of finding and tuning of plugins/themes.
88
## Features
99
* Navigation
1010
* Jump to module/function definitions
11-
* Module/function/callback window for navigating in single file
11+
* Module/function/callback list window for navigating in single file
1212
* Fuzzy search by function/module name in file
1313
* Fuzzy filename search in project
1414
* Navigation to Elixir/Erlang source code
1515
* Editing
16-
* Line comment/uncomment
16+
* Automatic folding of functions and tests
17+
* Line comment/uncomment shortcuts
1718
* Autocompletion of module/function names
1819
* Autodetection of spacing format in your project (tab/spaces)
1920
* Removal of trailing spaces
2021
* Reformatting code (hashes, assignments, etc)
22+
* Compile and testing
23+
* Compile project from and jump to errors/warnings
24+
* Run ExUnit tests and jump to errors
25+
* Run ExUnit tests on source save and just to errors
2126
* Other
2227
* Colorschemes for Elixir programming
2328
* Git integration directly from Vim.
@@ -26,7 +31,22 @@ avoid laborious task of finding and tuning of plugins/themes.
2631
* Clutter free vim-airline settings
2732

2833

29-
See sections below for usage instructions and shortcuts.
34+
See [cheat sheet](CHEATSHEET.md) for quick overview of functionality and shortcuts offered.
35+
Read below for detailed usage instructions.
36+
37+
## Motivation
38+
39+
Finding, installing and tuning Vim plugins can be quite frustating and time
40+
consuming task. Especially making sure they do not conflict with each other
41+
and that they use consistent shortcuts.
42+
43+
Also it is easy to miss some useful ones in a wast variety of Vim plugins.
44+
Vim-Ide-Elixir offers curated set of plugins, which are tuned to seamlessly
45+
work together. Also some new pluging/settings provided for more comfortable
46+
work.
47+
48+
Plugin updates also come in (tested) bundles, which assures that changes in one
49+
plugin will not break others.
3050

3151
## Installation
3252

@@ -38,15 +58,24 @@ Following command with download plugin and all extras it uses.
3858
cd ~/.vim/bundle
3959
git clone https://github.com/gasparch/vim-ide-elixir.git vim-ide-elixir
4060
cd ~/.vim/bundle/vim-ide-elixir
41-
git submodule update --init --recursive
61+
./install.sh
4262
```
4363

64+
Follow instructions of install script.
65+
66+
**Manually install**
67+
4468
Update your `~/.vimrc` to contain following line instead of just `pathogen#infect`.
4569

4670
```vim
4771
execute pathogen#infect("bundle/{}", "bundle/vim-ide-elixir/bundle/{}")
4872
```
4973

74+
Also in the very end of the file add
75+
```vim
76+
call vimide#init()
77+
```
78+
5079
### Installing required utilities
5180

5281
In order to properly work this plugin requires number of additional programs installed.
@@ -73,20 +102,126 @@ Run provided script to automatically check out matching Erlang/OTP and Elixir ve
73102
## Updating plugin & submodules
74103
```sh
75104
cd ~/.vim/bundle/vim-ide-elixir
76-
git pull
77-
git submodule update --remote --merge
105+
./update.sh
78106
```
79107

108+
## Editing
109+
110+
Vim-Elixir-IDE tries to smart guess your tabulation settings and set it for the
111+
file using [vim-sleuth](https://github.com/tpope/vim-sleuth).
112+
80113
## Source browsing
81114

82-
Tagbar most of the time shows correct arity on functions and does not report multiple function clauses.
83-
GenServer callbacks moved to separate group.
115+
Tagbar most of the time shows correct arity on functions and does not report
116+
multiple function clauses. GenServer callbacks moved to separate group.
117+
118+
## Compiler and ExUnit integration
119+
120+
Compiler and ExUnit integration provided with vim-elixir-exunit module, which
121+
is designed to work with vim-elixir-ide. All commands can be executed in any
122+
subdirectory of project, it will find closest `mix.exs` in file hierarchy.
123+
124+
Following commands and shortcuts are available:
125+
126+
#### Compiling project
127+
128+
* `:make` will invoke `mix compile` and show only errors in quickfix list.
129+
Normal `:cl` `:copen` `:cnext` `:cprev` commands are available, but use of
130+
`[e` and `]e` is recommended.
131+
* `:cw` is redefined to show quickfix window always at bottom, even if split exists.
132+
* `:MixCompile` will compile files (`mix compile`) and show errors and warnings.
133+
All messages are loaded in quickfix.
134+
* `:MixCompile!` will recompile all project (`mix compile --force`) and show
135+
errors and warnings. All messages are loaded in quickfix.
136+
* `<Leader>xc` and `<Leader>x!` invoke `:MixCompile` and `:MixCompile!` respectively
137+
* `[e` and `]e` provide smart navigation between errors/warnings in quickfix,
138+
also trying to jump to correct column name (e.g. identificator if warning is
139+
'variable foo is not used').
140+
141+
142+
#### Running ExUnit
143+
144+
All ExUnit commands suppress warning messages in quickfix window. If you want
145+
to check warnings in project - use compile commands above. ExUnit output is
146+
cluttered by itself, so no need to add more information with warnings.
147+
148+
I recommend Vim8.x + XTerm as you can have much more with it - see below.
149+
150+
**Functionality for Vim version 7.x:**
151+
152+
* `ExUnitQfRunAll` or `<Leader>xa` runs ExUnit tests on whole project
153+
(`mix test`) and shows output in quickfix window
154+
* `ExUnitQfRunFile` or `<Leader>xf` runs ExUnit tests on current file
155+
(`mix test path/to/file`) and shows output in quickfix window
156+
* `ExUnitQfRunLine` or `<Leader>xl` runs ExUnit tests on current line of
157+
current file, effectively running just one test.
158+
(`mix test path/to/file.exs:123`) and shows output in quickfix window
159+
* `ExUnitQfRunRerun` or `<Leader>xx` repeats last executed command (ExUnitQfRunAll/File/Line)
160+
161+
You can navigate with `[e` and `]e` between errors. Both test name and exact
162+
failed assert lines are available in quickfix list. Latter is more useful most of the time.
163+
164+
Use `:copen` or `:cw` to check quickfix window, because most relevant ExUnit
165+
output is available there as well, g.e. assert failure messages, crash messages
166+
and etc.
167+
168+
Some less relevant ExUnit output (like GenServer crash logs and etc) are
169+
stripped to preserve space in quickfix window.
170+
171+
172+
**Functionality for Vim version 8.x:**
173+
174+
Vim 8 brings asynchronous jobs and allows to build much more real IDE-like experience.
175+
176+
This mode allows you to start XTerm (or any other terminal emulator) next to
177+
your Vim/GVim instance and have all output of ExUnit shown there, while also
178+
having possiblity to jump over errors using quickfix. This also allows you to
179+
close/reopen Vim/GVim without closing XTerm and still have output in it.
180+
Basically you position it once on your screen and then you are free to run
181+
open and close Vim as much times as you want.
182+
183+
Also this mode automatically re-runs your tests on any Elixir files saved in
184+
the project, removing hassle of switching and running them by hand.
185+
186+
Test run status is shown in status line, so you don't need to check it manually.
187+
188+
To check which test is executing now, especially if you just re-run it, see
189+
XTerm window title - it shows text like 'ExUnit test/foo\_test.esx'.
190+
191+
If you combine that with [ex\_unit\_notifier](https://github.com/navinpeiris/ex_unit_notifier) it
192+
becomes very easy to see if your tests fail or pass.
193+
194+
Available commands:
195+
196+
* `ExUnitWatchAll` or `<Leader>wa` runs ExUnit tests on whole project
197+
(`mix test`) and shows output in xterm + quickfix window
198+
* `ExUnitWatchFile` or `<Leader>wf` runs ExUnit tests on current file
199+
(`mix test path/to/file`) and shows output xterm + in quickfix window
200+
* `ExUnitWatchLine` or `<Leader>wl` runs ExUnit tests on current line of
201+
current file, effectively running just one test.
202+
(`mix test path/to/file.exs:123`) and shows output in xterm + quickfix window
203+
* `ExUnitWatchRerun` or `<Leader>ww` runs again last executed command
204+
(ExUnitWatchAll/File/Line). Most probably you do not need to run it manually,
205+
as it is executed on each save of Elixir file in current project.
206+
* `ExUnitWatchStop` or `<Leader>ws` or `<Leader>wc` (both stop/cancel mnemonics) stops
207+
automatic execution of tests on save.
208+
209+
Use `[e` and `]e` to navigate test errors.
210+
211+
212+
**Note**
213+
214+
All `mix test` commands executed with `--seed 0` parameter which forces
215+
execution from top to down of test file. If you want randomized execution
216+
sequence to check hidden errors in tests - you will need to run tests
217+
manually.
218+
219+
220+
221+
222+
84223

85-
## Shortcuts
86224

87-
`F4` for opening Tagbar.
88-
`Ctrl-@` to use Ctrl-P search on function names and quick jump on them
89-
`<Leader>l` to fuzzy search text in file
90225

91226

92227

ROADMAP.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
This is a roadmap of features planned for Vim-Elixir-IDE.
3+
4+
Items marked with x are done.
5+
6+
## Installation/upgrade
7+
x scripts to fetch Elixir/Erlang sources
8+
x scripts to download/install powerline fonts
9+
x scripts to download/install Hack font
10+
* scripts to pull updates (and switch submodules automatically)
11+
* make sure it is totally usable standalone, so I can attract testers
12+
13+
## Functionality
14+
* make it load w/reasonable defaults in empty vim (top)
15+
* add indentLine plugin to bundle (top)
16+
* add sensibleDefaults plugin
17+
* setup Hack font for GUI + size changes
18+
19+
## Editing
20+
21+
x compile time errors and jump to them
22+
x quickfix support for ExUnit test outputs + xterm integration (crashes/test fails)
23+
x test runner (test/test.watch) on project, file or current function
24+
* add switching between test/source file (`test file name == source + "_test.exs")
25+
26+
* templates for GenServer/GenStage/etc modules (may be also snipMate)
27+
28+
* highlight current identificator under cursor in function
29+
30+
* syntax highlight for fprof dump file
31+
* syntax highlight for eprof dump file
32+
33+
* snippets for ExUnit tests (integrate snipMate)
34+
* snippets for GenServer callbacks
35+
* snippets for def/depf/defmodule
36+
37+
* snippets for tracing fprof/eprof with some meaningful defaults
38+
39+
* syntax highlights for style problems (missing spaces, too much space,
40+
trailing space, etc) (low)
41+
42+
* fold big alias/import blocks
43+
* fold @moduledoc tags
44+
* fold big @doc tags (while keeping @spec open!)
45+
* better syntax highlight for console (desert-style) (low)
46+
* signs on left edge - syntax highlight for ExUnit test outputs (crashes/test fails) (low)
47+
48+
* nested level syntax highlight (like in https://github.com/bigfish/vim-js-context-coloring)
49+
50+
## Navigation
51+
52+
* faster in-file navigation (ctags?) (top)
53+
* clone tagbar and create cross reference browsing plugin (based on mix output)
54+
* make tagbar use alchemist.vim for getting tag information from file
55+
56+
## Syntax autofixes
57+
58+
* fix unused variables warnings automatically
59+
* integrate with dogma
60+
* integrate with credo + autocorrection of problems (spacing/indents/arguments definitions and etc)
61+
62+
## Refactoring
63+
64+
* variable renaming in single function clause
65+
* renaming of GenServer call atoms
66+
* renaming all function clauses + callers (using xref)
67+
* plugin to find large pieces of commented out code, which is not documentation
68+
* build code prefix trees to find (structurally same) duplicate code blocks
69+
70+
## Documentation
71+
* based on credo - add @moduledoc tags
72+
* automatic guessing of signatures from debug traces and generation of @spec
73+
74+
## Erlang support!!!
75+
* support erlang syntax highlighting/source navigation/etc

0 commit comments

Comments
 (0)