Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. # The power of Vim
  2.  
  3. ## Example 1 (power of dot)
  4.  
  5. example.h
  6.  
  7. ```c++
  8. bool Process1(int nitems);
  9. bool Process2(int position);
  10. bool Process3(int ntrials, bool property);
  11. Example
  12. ```
  13. ## Example 2 (smart ranges)
  14.  
  15. example.ts
  16.  
  17. ```typescript
  18. if (!entry.used && equivalent(entry.key()), qk.key && entry.contexts) {
  19. }
  20. ```
  21.  
  22. ## Example 3 (delimited blocks)
  23.  
  24. example.html
  25. `cit` change inside tag
  26. `dat` delete around tag
  27.  
  28. ```html
  29. <div class="something">
  30. <a href="/somelink">
  31. <span>asd</span>
  32. </a>
  33. </div>
  34. ```
  35.  
  36. ## Example 4 (other motions) vim is not only hjkl
  37.  
  38. H // (higher)
  39. L // (lower)
  40. M // (middle)
  41.  
  42. // scrolling
  43. zt // scrolling to top
  44. zz // scrolling to middle
  45. zb // scrolling to bottom
  46.  
  47. ## Example 5 (other commands) power of visual
  48. ```typescript
  49. const someconstant1 = 1;
  50. const someconstant5 = 1;
  51. const someconstant2 = 1;
  52. const someconstant4 = 1;
  53. const someconstant6 = 1;
  54. const someconstant3 = 1;
  55. ```
  56.  
  57. ## Example 6 (Ex Mode)
  58.  
  59. `:g/pattern/d` delete lines (power of g)
  60. `:g/pattern/exe "somecommand"` execute somecommand on lines matching pattern
  61. `:s/pattern/newpattern/` search and replace
  62.  
  63. ```typescript
  64. const someFunction(somevar: number) {
  65. switch (somevar) {
  66. case 1:
  67. doSome(somevar);
  68. break;
  69. case 2:
  70. doSome(somevar + 3);
  71. console.log(2);
  72. break;
  73. case 3:
  74. doSome(somevar);
  75. break;
  76. case 4:
  77. doSome(somevar);
  78. console.log(2);
  79. break;
  80. case 5:
  81. doSome(somevar);
  82. console.log(2);
  83. break;
  84. default:
  85. break;
  86. }
  87. }
  88. ```
  89.  
  90. ## Example 7 Macros
  91.  
  92.  
  93. `q<some key>` starts recording
  94. `@<some key>` stops recording
  95. `@@` run last macro
  96.  
  97. qaI"<ESC>f:c$"<ESC>jq
  98.  
  99. qa # starts recording in register a
  100. I"<ESC> # insert " at the soft start of line then go back to normal
  101. f:c$"<ESC> # find next : then change with " and go back to normal
  102. j # go down one line
  103. q # end recording
  104.  
  105.  
  106. ```bash
  107. 192.168.0.3:33
  108. 192.168.0.4:12
  109. 19.168.0.5:1234
  110. 192.168.0.6:4341
  111. 192.168.0.7:4444
  112. 192.168.0.2:1
  113. 200.168.0.8:1234
  114. 201.168.0.9:4200
  115. 20.168.0.10:223
  116.  
  117. ```
  118.  
  119.  
  120. ## Plugins
  121.  
  122. undotree new thing I won't remember
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement