Skip to content

Commit 4017a58

Browse files
committed
Add missing documentation
1 parent 3102227 commit 4017a58

File tree

2 files changed

+119
-42
lines changed

2 files changed

+119
-42
lines changed

README.md

Lines changed: 104 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ definitions with their patterns and replacements, look at the file
444444
<% foo = { one: 'two' } %>
445445
```
446446

447-
### Haml
447+
### Haml/Slim
448448

449449
* If-clauses:
450450
``` haml
@@ -510,19 +510,19 @@ Object* foo = bar->baz;
510510
const foo = '${bar}/baz'
511511
```
512512

513-
### CoffeeScript arrows
513+
### CoffeeScript
514514

515-
``` coffeescript
516-
functionCall (foo) ->
517-
functionCall (foo) =>
518-
```
519-
520-
### CoffeeScript dictionary shorthands
515+
* Arrows:
516+
``` coffeescript
517+
functionCall (foo) ->
518+
functionCall (foo) =>
519+
```
521520

522-
``` coffeescript
523-
foo = {one, two}
524-
foo = {one: one, two}
525-
```
521+
* Dictionary shorthand:
522+
``` coffeescript
523+
foo = {one, two}
524+
foo = {one: one, two}
525+
```
526526

527527
### Clojure
528528

@@ -583,39 +583,56 @@ foo = {one: one, two}
583583

584584
### Elixir
585585

586-
Charlist -> Binary -> Atom
586+
* Charlist -> Binary -> Atom
587+
``` elixir
588+
foo = 'bar'
589+
foo = "bar"
590+
foo = :bar
591+
```
587592

588-
``` elixir
589-
foo = 'bar'
590-
foo = "bar"
591-
foo = :bar
592-
```
593+
* List shorthands
594+
``` elixir
595+
["one", "two", "three"]
596+
~w(one two three)
593597

594-
Elixir list shorthands
598+
[:one, :two, :three]
599+
~w(one two three)a
600+
```
595601

596-
``` elixir
597-
["one", "two", "three"]
598-
~w(one two three)
602+
### Rust
599603

600-
[:one, :two, :three]
601-
~w(one two three)a
602-
```
604+
* Void typecheck:
605+
``` rust
606+
let value = complicated_expression();
607+
let value: () = complicated_expression();
608+
```
603609

604-
Capitalized boolean constants :
610+
* Turbofish:
611+
```rust
612+
let value = iterator.collect();
613+
let value = iterator.collect::<Todo>();
614+
```
605615

606-
``` elixir
607-
flag = True
608-
flag = False
609-
```
616+
The type inserted is a placeholder, but it should be relatively easy to jump to it and edit it with a `cw`. In the future, this might be improved.
610617

611-
### Rust
618+
* String type:
619+
```rust
620+
let hello = "Hello, World";
621+
let hello = r"Hello, World";
622+
let hello = r#"Hello, World"#;
623+
```
612624

613-
Void typecheck
625+
* Option `is_some`/`is_none`:
626+
``` rust
627+
list.get(1).is_some()
628+
list.get(1).is_none()
629+
```
614630

615-
``` rust
616-
let value = complicated_expression();
617-
let value: () = complicated_expression();
618-
```
631+
* Equality assertion
632+
``` rust
633+
assert_eq!(foo, bar);
634+
assert_ne!(foo, bar);
635+
```
619636

620637
### TOML
621638

@@ -635,6 +652,57 @@ Task items
635652
- [x] Task 1
636653
```
637654

655+
### Python
656+
657+
* Dict access:
658+
659+
``` python
660+
spam['eggs']
661+
spam.get('eggs')
662+
```
663+
664+
* String style:
665+
666+
``` python
667+
'Ham'
668+
"Ham"
669+
f"Ham"
670+
```
671+
672+
* Dictionary style:
673+
674+
``` python
675+
{'foo': 'bar', 'bar': 'baz'}
676+
dict(foo='bar', bar='baz')
677+
```
678+
679+
Note that this will only work for simple dictionaries. Nesting and more complicated expressions break this, because it uses a single regex. A future dedicated implementation using my "sideways" plugin might work better here.
680+
681+
### Jinja
682+
683+
Tag type:
684+
685+
``` jinja
686+
{{ content }}
687+
{% content %}
688+
{# content #}
689+
```
690+
691+
### Vimscript
692+
693+
* Script-local functions:
694+
``` vim
695+
call s:TestFunction()
696+
call <SID>TestFunction()
697+
```
698+
699+
* String styles:
700+
``` vim
701+
let foo = "{bar}/baz"
702+
let foo = $"{bar}/baz"
703+
let foo = '{bar}/baz'
704+
```
705+
638706
## Similar work
639707

640708
This plugin is very similar to two other ones:

doc/switch.txt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ Pointer dots/arrows (g:switch_builtins.cpp_pointer):
629629
Object* foo = bar->baz;
630630
<
631631

632-
Javascript ~
632+
JavaScript ~
633633

634634
Function definitions (g:switch_builtins.javascript_function)
635635
>
@@ -745,11 +745,6 @@ Elixir list shorthands (g:switch_builtins.elixir_list_shorthand)
745745
[:one, :two, :three]
746746
~w(one two three)a
747747
<
748-
Capitalized boolean constants (g:switch_builtins.capital_true_false):
749-
>
750-
flag = True
751-
flag = False
752-
<
753748
Rust ~
754749

755750
Void typecheck (g:switch_builtins.rust_void_typecheck)
@@ -814,6 +809,8 @@ Dictionary style (g:switch_builtins.python_dict_style)
814809
{'foo': 'bar', 'bar': 'baz'}
815810
dict(foo='bar', bar='baz')
816811
<
812+
Note that this will only work for simple dictionaries. Nesting and more complicated expressions break this, because it uses a single regex. A future dedicated implementation using my "sideways" plugin might work better here.
813+
817814
Jinja ~
818815

819816
Tag type (g:switch_builtins.jinja_tag_type)
@@ -822,7 +819,19 @@ Tag type (g:switch_builtins.jinja_tag_type)
822819
{% content %}
823820
{# content #}
824821
<
822+
Vimscript~
825823

824+
Script-local functions (g:switch_builtins.vim_script_local_function)
825+
>
826+
call s:TestFunction()
827+
call <SID>TestFunction()
828+
<
829+
String styles (g:switch_builtins.vim_string_style)
830+
>
831+
let foo = "{bar}/baz"
832+
let foo = $"{bar}/baz"
833+
let foo = '{bar}/baz'
834+
<
826835

827836
==============================================================================
828837
SETTINGS *switch-settings*

0 commit comments

Comments
 (0)