├── CNAME ├── icon ├── 16.png ├── 48.png └── 128.png ├── screenshot.png ├── README.md ├── js ├── settings.js ├── options.js ├── jquery.cbpQTRotator.js ├── modernizr.custom.js ├── ga.js └── jquery.min.js ├── chrome └── index.html ├── options.html ├── manifest.json ├── css ├── component.css └── basscss.min.css ├── compositor.json └── index.html /CNAME: -------------------------------------------------------------------------------- 1 | vimtips.alexbaldwin.com 2 | -------------------------------------------------------------------------------- /icon/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbaldwin/vimtips/HEAD/icon/16.png -------------------------------------------------------------------------------- /icon/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbaldwin/vimtips/HEAD/icon/48.png -------------------------------------------------------------------------------- /icon/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbaldwin/vimtips/HEAD/icon/128.png -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbaldwin/vimtips/HEAD/screenshot.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vimtips 2 | 3 |  4 | 5 | Vim tips! 6 | -------------------------------------------------------------------------------- /js/settings.js: -------------------------------------------------------------------------------- 1 | chrome.storage.sync.get('darkMode', function (obj) { 2 | if (obj.darkMode) { 3 | document.getElementsByTagName('body')[0].classList.add('darkMode') 4 | } 5 | }); 6 | -------------------------------------------------------------------------------- /chrome/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Vim tips!
\n" 72 | }, 73 | { 74 | "component": "footer", 75 | "links": [ 76 | { 77 | "href": "https://github.com/alexbaldwin/vimtips", 78 | "text": "GitHub" 79 | }, 80 | { 81 | "href": "https://github.com/alexbaldwin", 82 | "text": "alexbaldwin" 83 | } 84 | ] 85 | } 86 | ] 87 | } -------------------------------------------------------------------------------- /js/jquery.cbpQTRotator.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jquery.cbpQTRotator.js v1.0.0 3 | * http://www.codrops.com 4 | * 5 | * Licensed under the MIT license. 6 | * http://www.opensource.org/licenses/mit-license.php 7 | * 8 | * Copyright 2013, Codrops 9 | * http://www.codrops.com 10 | */ 11 | ;( function( $, window, undefined ) { 12 | 13 | 'use strict'; 14 | 15 | // global 16 | var Modernizr = window.Modernizr; 17 | 18 | $.CBPQTRotator = function( options, element ) { 19 | this.$el = $( element ); 20 | this._init( options ); 21 | }; 22 | 23 | // the options 24 | $.CBPQTRotator.defaults = { 25 | // default transition speed (ms) 26 | speed : 700, 27 | // default transition easing 28 | easing : 'ease', 29 | // rotator interval (ms) 30 | interval : 8000 31 | }; 32 | 33 | $.CBPQTRotator.prototype = { 34 | _init : function( options ) { 35 | 36 | // options 37 | this.options = $.extend( true, {}, $.CBPQTRotator.defaults, options ); 38 | // cache some elements and initialize some variables 39 | this._config(); 40 | // show current item 41 | this.$items.eq( this.current ).addClass( 'cbp-qtcurrent' ); 42 | // set the transition to the items 43 | 44 | 45 | if( this.support ) { 46 | this._setTransition(); 47 | } 48 | // start rotating the items 49 | this._startRotator(); 50 | 51 | }, 52 | _config : function() { 53 | 54 | // the content items 55 | this.$items = this.$el.children( 'div.cbp-qtcontent' ); 56 | // total items 57 | this.itemsCount = this.$items.length; 58 | // current item's index 59 | this.current = Math.floor(Math.random() * this.$items.length); 60 | // support for CSS Transitions 61 | this.support = Modernizr.csstransitions; 62 | // add the progress bar 63 | if( this.support ) { 64 | this.$progress = $( '' ).appendTo( this.$el ); 65 | } 66 | 67 | }, 68 | _setTransition : function() { 69 | setTimeout( $.proxy( function() { 70 | this.$items.css( 'transition', 'opacity ' + this.options.speed + 'ms ' + this.options.easing ); 71 | }, this ), 25 ); 72 | }, 73 | _startRotator: function() { 74 | 75 | if( this.support ) { 76 | this._startProgress(); 77 | } 78 | 79 | setTimeout( $.proxy( function() { 80 | if( this.support ) { 81 | this._resetProgress(); 82 | } 83 | // this._next(); 84 | this._startRotator(); 85 | }, this ), this.options.interval ); 86 | 87 | }, 88 | _next : function() { 89 | 90 | // hide previous item 91 | this.$items.eq( this.current ).removeClass( 'cbp-qtcurrent' ); 92 | // update current value 93 | // this.current = this.current < this.itemsCount - 1 ? this.current + 1 : 0; 94 | // randomize value 95 | this.current = Math.floor(Math.random() * this.itemsCount); 96 | // show next item 97 | this.$items.eq( this.current ).addClass('cbp-qtcurrent'); 98 | 99 | }, 100 | _startProgress : function() { 101 | 102 | setTimeout( $.proxy( function() { 103 | this.$progress.css( { transition : 'width ' + this.options.interval + 'ms linear', width : '100%' } ); 104 | }, this ), 25 ); 105 | 106 | }, 107 | _resetProgress : function() { 108 | this.$progress.css( { transition : 'none', width : '0%' } ); 109 | }, 110 | destroy : function() { 111 | if( this.support ) { 112 | this.$items.css( 'transition', 'none' ); 113 | this.$progress.remove(); 114 | } 115 | this.$items.removeClass( 'cbp-qtcurrent' ).css( { 116 | 'position' : 'relative', 117 | 'z-index' : 100, 118 | 'pointer-events' : 'auto', 119 | 'opacity' : 1 120 | } ); 121 | } 122 | }; 123 | 124 | var logError = function( message ) { 125 | if ( window.console ) { 126 | window.console.error( message ); 127 | } 128 | }; 129 | 130 | $.fn.cbpQTRotator = function( options ) { 131 | if ( typeof options === 'string' ) { 132 | var args = Array.prototype.slice.call( arguments, 1 ); 133 | this.each(function() { 134 | var instance = $.data( this, 'cbpQTRotator' ); 135 | if ( !instance ) { 136 | logError( "cannot call methods on cbpQTRotator prior to initialization; " + 137 | "attempted to call method '" + options + "'" ); 138 | return; 139 | } 140 | if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) { 141 | logError( "no such method '" + options + "' for cbpQTRotator instance" ); 142 | return; 143 | } 144 | instance[ options ].apply( instance, args ); 145 | }); 146 | } 147 | else { 148 | this.each(function() { 149 | var instance = $.data( this, 'cbpQTRotator' ); 150 | if ( instance ) { 151 | instance._init(); 152 | } 153 | else { 154 | instance = $.data( this, 'cbpQTRotator', new $.CBPQTRotator( options, this ) ); 155 | } 156 | }); 157 | } 158 | return this; 159 | }; 160 | 161 | } )( jQuery, window ); 162 | 163 | // Execute 164 | $('#cbp-qtrotator').cbpQTRotator(); 165 | -------------------------------------------------------------------------------- /js/modernizr.custom.js: -------------------------------------------------------------------------------- 1 | /* Modernizr 2.6.2 (Custom Build) | MIT & BSD 2 | * Build: http://modernizr.com/download/#-csstransitions-shiv-cssclasses-testprop-testallprops-domprefixes-load 3 | */ 4 | ;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.csstransitions=function(){return D("transition")};for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e22 |24 |23 |
aenter into insert mode after the character your cursor is on.
28 |30 |29 |
Aenter into insert mode at the end of the current line.
35 |37 |36 |
bmove cursor to first character of previous word.
41 |43 |42 |
Bmove cursor to first character of previous non-blank series of characters.
47 |49 |48 |
<C-b>scroll page backwards (move up in the file).
54 |56 |c stands for “change” will not do anything on its own, but acts as a modifier to other commands. Here are some common commands handy for editing front end code.
55 |
60 |62 |61 |
cwcw stands for change word. This will delete the word your cursor is over and enter into insert mode.
66 |68 |67 |
ci(Change all text in between a set of parenthesis.
72 |74 |73 |
ci"If your cursor is in between a set of quotes, this will delete everything inside those quotes and drop you into insert mode.
78 |80 |79 |
ct"Change text til the quotes.
84 |86 |85 |
2ct"Change text from cursor up til the 2nd quote in a line.
90 |92 |91 |
cF"Change from cursor backwards finding and including the previous quote.
96 |98 |97 |
CDelete until the end of the line and enter into insert mode.
103 |105 |104 |
:cd ../Change directories to one previous.
109 |111 |110 |
:cd ~/Sites/projectnameChange directories to a known directory.
116 |118 |CTRL-c In Normal mode, any pending command is aborted. Also aborts current search.
117 |
123 |125 |124 |
ddDelete the current line.
129 |131 |130 |
DDelete from cursor until the end of the line. Same asd$.
135 |137 |136 |
dwDelete the word your cursor is on. Difference between this and cw is that you do not enter into insert mode.
141 |143 |142 |
2dwThis will delete the word your cursor is on as well as the next one. You can replace 2 with any number.
147 |149 |148 |
d^Delete from cursor to beginning of the line.
153 |155 |154 |
d/patternDeletes up to first matched pattern.
159 |161 |160 |
2df"Delete from cursor to find the 2nd quote mark. This is inclusive so it will delete the second quote. This is a handy command for deleting attributes in html if your cursor is on the first letter of the attribute.
165 |167 |166 |
di"Delete everything inside of these quotes.
171 |173 |172 |
da"Delete everything with quotes wrapped around (including the quotes).
177 |179 |178 |
<C-d>Scroll half page (in this case “d” is a mnemonic for “down”).
184 |186 |185 |
:%dDeletes all lines in a file.
190 |192 |191 |
:2,8dDeletes lines two through eight.
197 |199 |198 |
ejumps to the end of the next word.
203 |205 |204 |
Ejumps to the end of the next non-blank series of characters.
209 |211 |210 |
gejumps to the end of the previous word.
216 |218 |217 |
:ea 5mjump to five minutes ago. Seriously.
222 |224 |223 |
:ea 1hjump to 1 hour ago.
228 |230 |229 |
:ea 14h 30mjump to 14 hours and 30 minutes ago. Ok you get the point.
234 |236 |235 |
:e filenameopen file in the current window.
240 |242 |241 |
:e .open file explorer in current directory.
247 |249 |f is for finding things so it doesn’t do anything on it’s own. It will jump to the next character you type after f. It can be combined with c,d,y to change, cut, and copy sections of text.
248 |
253 |255 |254 |
frjumps to the next r on the (same line only).
259 |261 |260 |
ftjumps to the next t on the (same line only).
265 |267 |266 |
f,jumps to the next , on the (same line only).
271 |273 |272 |
Frjumps to the previous r (same line only).
277 |279 |278 |
Ftjumps to the previous t (same line only).
283 |285 |284 |
F,jumps to the previous , (same line only).
289 |291 |290 |
2df"delete from cursor through two occurences of “.
295 |297 |296 |
<C-f>scrolls one full page forward.
302 |304 |303 |
gxGo to url under your cursor in a browser.
308 |310 |309 |
gfGo open file under your cursor in the current window.
314 |316 |315 |
g;Go to the last place you edited text.
320 |322 |321 |
g,Go forward in the change list.
326 |328 |327 |
4g,Go forward 4 spots on the change list.
332 |334 |333 |
gg=Gor1G=Gformat the entire file.
338 |340 |339 |
gnGrab the next match from last search and visually select it.
344 |346 |345 |
giGo into insert mode at the end of the last insert you did.
350 |352 |351 |
geGo to the end of the previous word.
356 |358 |357 |
gpPastes just like p but leave the cursor after the pasted text.
362 |364 |363 |
gPPastes just like P but leave the cursor after the pasted text.
368 |370 |369 |
gvReselects most recent visual selection.
374 |376 |375 |
gv$AReselects most recent visual selection then moves to the end of the line, and enters insert mode.
380 |382 |381 |
g~~Switch case of all characters in current line.
386 |388 |387 |
gqFormat selected text.
393 |395 |394 |
:%g/pattern/norm @qRun macro q on all lines in a file that match a pattern.
399 |401 |400 |
:%g/^\d/norm yyGpThis searches for all lines of a file that start with a digit as the first character. It then copies the line and pastes it at the bottom of the file.
405 |407 |406 |
:%g/^$/norm ddDelete all blank lines in a file.
411 |413 |412 |
:%g/^\$/norm "AyyYank (copy) all lines that start with a dollar sign and append them to register A.
418 |420 |419 |
hMove cursor one character to the left.
424 |426 |425 |
4hMove cursor four characters to the left.
430 |432 |431 |
dhDelete character to the left of cursor.
436 |438 |437 |
:hOpens up vim help in a new window.
442 |444 |443 |
:h aOpens vim help to documentation on the a key.
448 |450 |449 |
:h i_CTRL-ROpens vim help to documentation on pressing control and r while in insert mode.
454 |456 |455 |
HMove cursor to first (highest) line in window.
461 |463 |462 |
iEnter insert mode where your cursor is. Any text you insert will be inserted before the character your cursor was over.
467 |469 |468 |
4i<tab><escape>Insert 4 tabs (leaves you in command mode, not insert mode).
473 |475 |474 |
80i*<escape>Insert 80 * characters.
479 |481 |480 |
IInsert text at the very beginning of the line.
486 |488 |487 |
jMoves cursor down one line.
492 |494 |493 |
32jMoves the cursor down 32 lines.
498 |500 |499 |
JJoins two lines removing indent.
505 |507 |506 |
kmoves cursor up one line.
511 |513 |512 |
8kmoves cursor up 8 lines.
517 |519 |518 |
<C-w>Krotates window to horizontal split.
523 |525 |524 |
dkdelete current line and line above cursor.
530 |532 |531 |
lMove cursor right one character.
536 |538 |537 |
dlDelete character under cursor. Same as x.
542 |544 |543 |
LMove cursor to last line in window.
549 |551 |m is for marking spots (which you can think of as bookmarks in your files). It does not do anything by itself.
550 |
555 |557 |556 |
mkmark spot as k.
561 |563 |562 |
'kreturn the cursor to the spot you marked as “k”.
567 |569 |568 |
d'kdelete from the cursor’s position to the spot you marked as “k”.
573 |575 |574 |
c'kchange from the cursor’s position to the spot you marked as “k”.
579 |581 |580 |
y'kyank/copy from the cursor’s position to the spot you marked as “k”.
585 |587 |586 |
MMove cursor to middle of window.
592 |594 |593 |
nmoves forward to next match of a search pattern.
598 |600 |599 |
Nmoves backwards to previous match of a search pattern.
604 |606 |605 |
gnsearch forward for the last used search pattern.
611 |613 |612 |
oOpens a new line below where your cursor is and places you in insert mode.
617 |619 |618 |
OOpens a new line above where your cursor is and places you in insert mode.
623 |625 |624 |
CTRL-oGo backwards in the jumplist (list of where your cursor has been). Trust me this is like movement steroids.
629 |631 |630 |
12CTRL-oYou can also pass it a count so this will go backwards in the jumplist 12 spots.
636 |638 |637 |
:onlyCloses all splits except for the current one.
643 |645 |Paste is a pretty big deal when you are dealing with code. So p should be one of your best friends.
644 |
649 |651 |650 |
ppastes in the last thing you yanked or deleted (copied or cut) after the cursor.
655 |657 |656 |
Ppastes in the last thing you yanked or deleted (copied or cut) before the cursor.
661 |663 |662 |
2ppastes in the last thing you yanked or deleted (copied or cut) twice.
667 |669 |668 |
xpthis will swap two characters. Technically it just deletes the character under your cursor, then pastes it back in. This is the equivalent ofdlp.
673 |675 |674 |
"*pPastes in text from your system clipboard.
679 |681 |680 |
"2pThis will paste in text from the second register. You will use this all of the time. Most useful when you delete something you want to paste, then delete something else. Move to the place where you want to paste text, hit p and go “doh”. Just remember"2p.
685 |687 |686 |
"%pPastes in the name of the current file.
691 |693 |692 |
:212puPastes in last copy or delete on line 212. 212 can be any line number.
697 |699 |698 |
:42pu *Pastes in system clipboard text at line 42.
703 |705 |704 |
"/pPastes in your last search pattern.
709 |711 |710 |
:<c-r>/Pastes in your last search pattern when you are on the command line.
715 |717 |716 |
"apPastes in the contents of register a. To see a list of registers and what they have in them, do:regor:registers.
721 |723 |722 |
"= 8*8<CR>pPastes in evaluation of the expression8*8. This could be any maths you want.=is the expression register, which allows you to do calculations. From normal mode you can launch it by hitting"=.
728 |730 |q records things - so it doesn’t do much on its own. You need to tell it what register to store the recorded sequence in.
729 |
734 |736 |735 |
qaBegins recording into register a. Enter in keystrokes you want to save, then hitqto end the recording.
740 |742 |741 |
@aWill play back what you just recorded into register a.
746 |748 |747 |
:qquits file only if you have no unsaved changes.
752 |754 |753 |
:q!quits file without writing any of your changes.
758 |760 |759 |
:wqsaves and quits file.
764 |766 |765 |
:12,42wqsaves lines 12 to 42 and quits file.
770 |772 |771 |
:wqasaves and quits all files in buffer.
777 |779 |778 |
rReplaces character under cursor with next input i.e.
783 |785 |784 |
raReplaces the character under the cursor with a.
789 |791 |790 |
REnter “replace mode” which is like insert mode except you will overwrite characters instead of insert between them.
796 |798 |797 |
:r filenameRead the contents of filename and place into the current buffer.
802 |804 |803 |
:r !lsPastes in the output of ls. ! calls an external process in vim. So this can be pretty userful.
808 |810 |809 |
:r !cd -; lsPastes in the directory listing of the last directory you were in.
814 |816 |815 |
:r !w3m -dump http://somewebsite.comPastes in the content from somewebsite.com without any of the markup. Must have w3m installed. WHICH YOU SHOULD :) If you have homebrew installed you can simply runbrew install w3m.
820 |822 |821 |
:r !treePastes in the output from running tree on a directory.
826 |828 |827 |
:regor:registersPrint out a list of available registers and their contents. Registers are like a multi-shelf clipboard. But it also stores all of your recent deletes. In vim delete behaves more like cut than a true delete.
833 |835 |834 |
sdeletes the character your cursor is on and enters into insert mode.
839 |841 |840 |
Sdeletes the whole line you are on and enters into insert mode.
846 |848 |847 |
:spThis will split the current window horizontally. Sp is short for split.
852 |854 |853 |
:sp file.txtThis will split the current window horizontally with a file named file.txt.
858 |860 |859 |
:vsp file.txtThis will split the current window vertically. vsp stands for vertical split.
864 |866 |s is how you do find and replace, so let’s just say it is all of the important.
865 |
870 |872 |871 |
:s/foo/barreplaces foo with bar on the current line for the first occurance of foo.
876 |878 |877 |
:12,42s/foo/barreplaces foo with bar on lines 12,42 for the first occurance of foo in each line.
882 |884 |883 |
:12,42s/foo/bar/greplaces all occurances of foo with bar on lines 12,42.
888 |890 |889 |
:%s/foo/bar/greplaces all occurances of foo with bar for the entire file.
894 |896 |895 |
:'<,'>s/foo/bar/greplaces all occurances of foo with bar for the last visual selection.
900 |902 |901 |
:%~Repeat last substitute with same substitute string but with last used search pattern across the entire file.
906 |908 |907 |
:%s/\ class=".*"//g"Delete all classes in markup for the current file.
912 |914 |913 |
:%s/\ id=".*"//g"Delete all ids in markup for the current file.
918 |920 |919 |
:bufdo %s/\ class=".*"//ge | updateDelete all classes in markup for all files in buffer.
924 |926 |925 |
:tabdo %s/\ class=".*"//ge | updateDelete all classes in markup for all files in the current tab.
930 |932 |931 |
:%s/\s\+$//eRemoves trailing whitespace.
937 |939 |938 |
tmeans ‘til’ so it doesn’t do anything on its own. It is very similar to f but f is inclusive. T is exclusive meaning it will stop before the character you are finding.
943 |945 |944 |
tfput cursor one character before the next occurance of f.
949 |951 |950 |
;repeat latest f, F, t, or T.
955 |957 |956 |
,repeat it in the opposite direction.
961 |963 |962 |
dt<Delete up until the next<. This is handy in the markup world.
967 |969 |968 |
dt"Delete from cursor until next “.
973 |975 |974 |
dT}Delete backwards from cursor until previous }.
980 |982 |981 |
uUndo changes.
986 |988 |987 |
UUndo all latest changes on one line, the line where the latest change was made.
992 |994 |993 |
<C-r>Redo changes.
998 |1000 |999 |
<C-u>Scroll window upwards to the amount set by the “scroll” option. Default is half a screen.
1005 |1007 |1006 |
:undolList all the history points in your tree of changes.
1012 |1014 |1013 |
vStart visual mode on a per character basis.
1018 |1020 |1019 |
VStarts visual mode linewise (selects whole lines).
1024 |1026 |1025 |
CTRL-vStarts visual mode blockwise (very favorite).
1030 |1032 |1031 |
gvReselect last visual selection.
1037 |1039 |1038 |
wMoves to the next word.
1043 |1045 |1044 |
3wMoves to the third word.
1050 |1052 |1051 |
xdelete character under your cursor.
1056 |1058 |1057 |
Xthis will delete a character before the cursor. Same asdh.
1063 |1065 |y stands for copy, I mean yank. It doesn’t do anything by itself. It is very similar to c and d in how it can be used.
1064 |
1069 |1071 |1070 |
yyCopies current line.
1075 |1077 |1076 |
"xyyCopies current line into register x.
1081 |1083 |1082 |
"jYCopies current line into register j. If you like “Y” to work from the cursor to the end of line (which is more logical, but not Vi-compatible) use “:map Y y$”.
1087 |1089 |1088 |
:12,112yCopies lines 12 through 112.
1093 |1095 |1094 |
mk { motion } y'kMark a spot k, navigate to a new spot and then copies from mark k to the current position of your cursor.
1099 |1101 |1100 |
yt"Copies from current cursor postion to the next quote on the same line.
1105 |1107 |1106 |
yt>Copies from current cursor postion to the next > on the same line.
1111 |1113 |1112 |
yT>Copies from current cursor postion to the previous > on the same line.
1117 |1119 |1118 |
yf>Copies from current cursor postion up to and including the next > on the same line.
1123 |1125 |1124 |
yF>Copies from current cursor postion up to and including the previous > on the same line.
1129 |1131 |1130 |
<C-y>Scroll up by 1 line.
1135 |1137 |1136 |
12<C-y>Scroll up 12 lines.
1142 |1144 |1143 |
z<CR>Redraws the screen so that your cursor line is at the top of the window. Same aszt.
1148 |1150 |1149 |
z-Redraws the screen so that your cursor line is at the bottom of the window. Same aszb.
1154 |1156 |1155 |
zzRedraws the screen so that your cursor line is at the middle of the window.
1161 |1163 |1162 |
*search forward for the word under cursor in current file. Super useful for finding common hex codes in css. And other things.
1167 |1169 |1168 |
#search backward for the word under cursor in current file.
1173 |1175 |1174 |
/Forward search for things.
1179 |1181 |1180 |
/<p>Forward search for the next opening paragraph tag.
1185 |1187 |1186 |
/\Forward search for the next space.
1191 |1193 |1192 |
/^}Forward search for closing bracket of a css class, if the css class is closed at the beginning of a new line i.e.
1197 |1199 |1198 |
?Backwards search.
1203 |1205 |1204 |
?httpSearch backwards for the stringhttp.
1210 |1212 |1211 |
==Format current line of code.
1216 |1218 |1217 |
>>Indent current line.
1222 |1224 |1223 |
.Repeat last change.
1228 |1230 |1229 |
@:Repeat last command line.
1234 |1236 |1235 |
:set pasteSet this if you are pasting in content from the system clipboard. Trust me.
1240 |1242 |1241 |
:set paste!Using ! at the end of any set reverses the current setting. This is useful so that you only have to remember one command and you never have to remember current state. For instance to be able to see line numbers you can do:set nuor:set number. To undo these commands, you would set:set nonuor:set nonumber. This seems like a lot to remember. An alternative is using ! like so:set nu!This will reverse whatever state set number currently resolves to. If line numbers are currently shown, they will be hidden. If they are hidden, they will become revealed. I use this pattern a lot when changing settings of file.
1247 |1249 |1248 |
:12,54=Format lines 12 through 54.
1253 |1255 |1254 |
:56,99>Indent lines 56 through 99.
1259 |1261 |1260 |
:52,84yYank / copy lines 52 through 84.
1265 |1267 |1266 |
12>>Indent 12 lines including the line you are on.
1272 |1274 |Remember
1273 |<C-means the control key. So<C-b>would translate to pressing control and b at the same time.
1278 |1280 |1279 |
<C-b>Scroll backwards one full screen.
1284 |1286 |1285 |
<C-u>Scroll backwards or ‘up’ a half screen.
1290 |1292 |1291 |
<C-d>Scroll forwards or ‘down’ a half screen.
1296 |1298 |1297 |
<C-f>Scroll forwards.
1302 |1304 |1303 |
<C-y>Scroll backwards count lines (defaults to one).
1308 |1310 |1309 |
<C-e>Scroll forwards one full line.
1314 |1316 |1315 |
<C-y>Scroll backwards one full line.
| t |