hmmm nice demonstration. check out this usage of vim's snippets (I added interactive behaviour) : playterm.org / r / snippet-plugin-for-vim-powa-1304449951
Don't you love it when someone watches your vid then just has to one-up you with some nerdy comment? BTW, mine is that you could have used a regex instead of recording a macro there. :-P
@mytube232 You were saying that your editor 'doesn't know how to make a site design with tables'. But these tables are being used to represent data, so they are being used correctly and semantically. If your editor can't do that, it is missing some important (X)HTML functionality. Tables aren't always bad - like I've just said, these are not being used to format the web page look and feel, but to show data properly. Hope you understand now.
@Hassan99999 I understood the first time as well. But there is no need to insult others. And that was sarcasm in case you haven't noticed. It's the programmed who makes sites, not editor. If you don't know why you are doing what you are doing then you are nothing more than a macro who happens to breathe.
@Hassan99999 first of all, dumbass, don't insult others. You have no right to do so just because someone doesn't like the same editor or same video as you. We all have our rights and freedom to like whatever we want.
i like vim too, but yes, visual studio and even ms word can do this. ctrl shift r to record a macro, ctrl shift p to run the macro. ctrl left and ctrl right to move left/right one word at a time.
I actually remapped 'LCtrl' to 'Caps Lock' and 'Esc' to tilde (~). It's much better this way, especially if you have big keyboard like MS Natural 4000.
@bob8984 This is actually a new Microsoft product called 'Microsoft® Vim 2010™' shown here is the Professional Ultimate Small Business Enterprise Edition.
The secret is the counts. You recorded a macro of which last operation was going a line down, then played it using a count which is the same as the number of lines. Still there are details I wanna know, can you make a better quality version, with commentary :)
Also, do other editors *cough*emacs*cough* have this Counts feature, for operations e.g. macros?
I just got myself a job as an open source software developer, and I realized that I would be made fun of if I didn't use either vim or emacs. I chose vim, but GODDAMN is it hard to learn! I've never seen a more unintuitive program in my life. 'J' for down and 'K' for up, '0' to jump to beginning of line and '$' to jump to the end? Seriously, what the fuck?!
It's great, because you don't ever have to (at least I've never had to) take your fingers away from the keys. You're always positioned to do the next input ;)
It's the fastest editor out there when you have learned it and know how to use it for its full potential.
The only command I use are / for search, dd to delete a line p to put it back. So sure, I don't use Vim to its full potential but it still works just fine.
You can also append to the end of a line by pressing "A" (remember: "A"-ppend) or "a" for "append here", or "i" for "insert here" or "I" for "insert at the beginning of the line (first non-blanc character)"
Less "what the fuck" than pressing left-arrow multiple times to get the same result.
'j' looks like a down arrow so j is down, k is next do down so that's the up arrow, l is to the right of the up down arrows so it's the right arrow, and h is to the left of the up down arrows.
You can also use ^ for the begging of line because in a regex the ^ stands for the begging of line and the $ stands for the end of the line
that's why i use caps lock as a control key. i don't know what i would do without it. now emacs is very comfortable, especially when combined with the dvorak layout.
Wrong, I already inverted caps lock with backspace. But I understand your point and i could remap escape with, maybe, left control key, only in Vim. THX for the idea!
Not a good shortcut on non-English keyboards on which "]" requires the use of Alt Gr. On mine, I get Ctrl + Alt Gr + 9, which doesn't even respond ...
Yes, my editor can do this. It's no big deal. But I see a lot of my students nowadays using half-baked light-weight editors like Kate or overblown systems like Eclipse. Special purpose systems are okay, but one still needs a powerful general text editor like vim or emacs. Personally I use emacs. You gotta switch the control and caplocks, but then youur fingers never leave the keyboard. And you have powerful keyboard macros and such. I'm sure you get the same in vim, but I could never adjust.
I just checked this video again. I posted like a year ago in this same video something like "I wanna learn how to do that!" :) and indeed I have. Now without vim I just can't program.
Anybody selling viper here is just a fool. Don't dare to compare viper/vimemu/eclipseplugins/etc with my baby.
Not in this case, the information was semantically best represented as a table.
Saying that nothing should be coded as a table is as stupid as trying to code everything in a table.
Yes, in standard English what I was formatting was a "Price List", but it had multiple columns (and rows), to use a list in this situation would be semantically incorrect.
It would also need a lot more CSS to format it, and I don't see how using a list in this case would reduce the amount of HTML.
walter0bz: whats wrong with selecting and then just pressing y to copy, d to cut, or p to paste? Why do you want ctrl+x/c/v, when vim's keys are even simpler. If you really, really want theat, then map the keys manually and put it in your vimrc.
walter0bz: To select, press v and move the cursor, or simply drag using the mouse like you select in any editor (if using Gvim or Vim with X). I didn't say ctrl+p, I said p. Simply press p to paste. To cut a line, you can press either shift+v followed by 'd', or press 'd' two times in a row. Remember you must do all this outside of insert-mode.
Youtube won't let me post it because it looks like html, but you can do the same thing with a simple regular expression. Often faster and (once you're familiar with regexps) easier than recording macros.
It's basically a search and replace for
"anything followed by 4 sets of numbers" with "html row, anything in a cell, each set in a cell, end row". I wish I could show you here. Look for :%s/.../.../
This is a great point. I use regex a lot in programming, but find the Vim regex engine can be a little esoteric. Since I lack confidence with them anyway, I end up spending hours editing regex Vim. Trying to work out whether something isn't working because I've done something wrong, or there's some character Vim's regex engine needs some character to be escaped.
So, in the end, I gravitate toward using macros. :)
However, there is a fantastic plugin for Vim called 'VimRegEx'
This comment has received too many negative votesshow
great video. I just hope that most programmers are not involved in this kind of stuff. Programming is about manipulating code, that's written in text, true, but most of the time we don't care about manipulating text so much. We care about manipulating code, and that's done 100% better by syntax aware editors, refactoring tools etc. Vi and Emacs have their uses like grep and sed, but for programmers, I HOPE they're not too much relevant (if they are, mhm think about changing job)
> I just hope that most programmers are not involved in this kind of stuff.
Lots are, many programmers find they can write code a lot faster in Vim than an IDE. It's totally a matter of choice though.
Vim can do the code manipulation you speak of. Including code completion and refactoring. I program in PHP using Vim, for example, including real-time debugging using XDebug. There's more to Vim than you might think. ;)
I know very well that you can extend Vim in order to do what you need. But then you could use VS in the first place as well. My point was and is not that vim should not be used, but that all those nice text editing functionalities have nothing to do with coding, coding is about thinking and manipulating code, that rarely involves repeating 100 times the same operation or doing complex searches. But I know that vim and emacs can be good for editing code as well. They're just harder to learn.
Vim (and VI) are fantastic for many reasons, not the least of which is the ability to move around in a file without moving your hands off the main keys.
While in command mode, hjkl do left, down, up, and right respectively. You can run all over the screen with your cursor without ever moving your hands off the main keys. That saves huge amounts of time.
Using a mouse for positioning the cursor is really slow, and moving your right hand to the arrow keys is also quite slow.
This comment has received too many negative votesshow
Lol. I remember the first time I made myself try Vim and Emacs. With Emacs, I wanted to write a simple "Hello World" program. A problem suddenly arose when I tried pressing "tab" (because Emacs did not tab in automatically). All I heard was "pling" as if I had done something so as to cause an error. Needless to say I have never used that shitty editor again.
And yet, neither Eclipse or Visual Studio can do what was shown in the video. And they're both inordinately bloated.
I can appreciate that some people prefer a fully-fledged IDE, but there's no need to slag off the choices of others. Particularly when all you achieve in so doing is advertise the fact you couldn't be arsed to learn the software.
You really could'nt be more wrong with your opinion about Emacs and tabs.
Maybe you tried to code either Java or C++ code? Emacs have different modes ie. for "plain text" like ".txt" or java source code ".java". When you open emacs like this "emacs Hello.java", you'll end up using Emacs java-mode. In this mode (and C/C++ too), when you press tab, your current line automagically goes to the right identation, and not more! And that's the only feature I have really missed in my beloved Eclipse.
Vim is hard to learn, but it pays off. When I started using it, it pissed me off all the time, but it's just a matter of time. I am sure if you gave it more time you would love it.
This comment has received too many negative votesshow
VI and Emacs both suck because they were invented before important interface developments such as graphical windowed environments, scroll bars and arrow keys and haven't adapted to take full advantage of these types of things.
imagine if typewriters had been invented before shorthand writing systems -- they would never have taken off
but in the case of shorthand (eg Gregg shorthand,) typewriters were an honest replacement. they were faster and easier. in the case of code *text* editing, GUI manipulations are simply a different, much slower way of doing things -- but it's easier for newbies who don't realize they may spend the next 10+ years programming and should invest in the best tools
They voted this way because here gathered renegades, worshipers of the wicked vi editor. (vi vi vi = 6 6 6).
The holy truth is that GNU Emacs (God bless it)is the best editor in the Universe, much better than anything else. Can you play "tetris" inside vi? NO! Can you read e-mail in vi? No! Can you run debugger inside vi? No!
Well, if flexibility is your standard, Emacs, as good as it is, fails. Windows, Linux, OS X all can do much more things than Emacs can.
To use your line of reasoning, can Emacs do wifi? Can Emacs manage your photo library? Can Emacs edit or HD video? Nope. Does that mean it sucks as an editor? Not really.
Because VI/Vim cannot do some of the non-editor things that Emacs can do, does that mean it's not as good as Emacs? No.
They voted this way because here gathered renegades, worshipers of the wicked vi editor. (vi vi vi = 6 6 6).
The holy truth is that GNU Emacs (God bless it)is the best editor in the Universe, much better than anything else. Can you play "tetris" inside vi? NO! Can you read e-mail in vi? No! Can you run debugger inside vi? No!
emacs is a good IDE, but Vi's modal editing model is much more flexible and powerful than emacs' C-blah hotkeys
where in emacs you work close to the text, vim promotes a higher-level view that grants significant efficiency gains. eg, the . operator which repeats the last whole edit
when using Vi you're in command mode most of the time, like a hawk scouting the landscape. when something needs editing, you swoop down to the precise spot, instantly slice things up, and return to your flight
You just do not know, but emacs can behave like vi. Type "M-x vi-mode" and you will have your beloved vi with its dot i.e. "operator which repeats the last whole edit" and be "like a hawk scouting the landscape".
You can type "Ctrl-x Esc Esc" and it will repeat to you any of your last big commands (like in bash you can browse your history). Actually you do not need to type the M-x commands every time - you can assign these commands to F1 - F24 keys, or to Ctrl-something or Meta-something
indeed. vi's editing model is so nice a few editors out there have an emulation for it. i see that as a victory :)
though i use too many of the advanced Vim features (time travel, g+/-, non-trivial movement and editing sequences, lack of uglyness, etc) to be comfortable with an emulation
vi mode in Emacs is made for people with bad habits, who want to quit. It is like a nicotine patch for a heavy smoker, who wants to quit. Get rid of vi. You do not need it - Emacs is better.
By the way, Emacs can also do time traveling and teleportation and other non-trivial movements in space-time continuum.
Agreed. With emacs, viper and vimpulse you would probably get the ultimate editor. I haven't got my foot around emacs yet but am inclined to switch because of what you mention.
Time travel g+/- is also emulated nicely in Emacs vi-mode....
I doubt that there is a vi command that Emacs can't emulate, or even extend.
The built-in "time travel" system in Emacs is even more powerful, you can even travel back your own travels within the whole Emacs session, and set macros involving multiple files and travel in time through all the files/directories you visited and all the things you have done.
In Emacs, keyshortcuts are just a way to execute commands.
The commands written in Lisp are the real heart. It has nothing to do with "C-blah hotkeys", it can be customized to press "F6" or "ESC g +" or anything you want to, instead of "C-blah".
Macros in Emacs are lists of commands, not keys. You can even open, rename, save, close multiple files and add all of it to a macro. All can be macroed or can be extended/customizable via hooks for that command.
it was probably voted down because THEY didn't give an explanation of just how "emacs can do it all much better" -- anyone wanna offer one in his stead?
In that video I'm pretty sure he entered visual mode 'v', then selected the block, perhaps using 'ab', then '>>'. You can also type the number of lines to shift as a multiplier prefix. eg. '3>>' will shift three lines.
Looking more carefully, he marked a spot (mm), moved up by the "search previous" command (#) which moved to the previous <tbody>, entered visual line mode (V), then moved to the mark ('m). The (vab) for selecting blocks only works on parentheses and curly brackets. A useful way of selecting blocks in HTML is by moving to the opening/closing tag, entering visual line mode (V) and then using the search next or previous command (*) or (#).
wtf! I wanna learn how to do that. I use vim but only for quick edits. I know people say it can be amazingly powerful, I tried, but it's a pain in the ass to learn.
Sed is very useful, although I was already in Vim and it hardly took any time to do.
I did use macros, press qq then @q as jeduan pointed out. To repeat it over and over I just put a number in front of the @q, e.g. 54@q repeats the macro 54 times. :)
vim = true power
italopenna 2 months ago
Only problem is, you're editing f*&king pedantic HTML. I never touch markup itself if it can be avoided--that's what DOM libraries are for.
samplingrate 3 months ago
lols, Emacs can top that easy. ^^ Just check your video response. Woot! Lamexorz. *trollface*
bikutorusan 4 months ago
YES it can(Emacs)
it's easy!
you can write your own elisp program to do that
I don't think it's hard!!!
sinoohemehran 5 months ago
hmmm nice demonstration. check out this usage of vim's snippets (I added interactive behaviour) : playterm.org / r / snippet-plugin-for-vim-powa-1304449951
leondustar 5 months ago
ha, ha, even kate can do more.
SteamJZK 6 months ago
Oh yeah... notepad can do that...
MulletDrummer 7 months ago
My Emacs can.
bellicjr 7 months ago
How do I install this? I have microsoft 2007 if that helps.
:D
BFWaffy 7 months ago 4
needs music
supergenius1994 10 months ago
i just remembered someone said notepad ++ vs. VI ....
buahahahahaha fail.
VIM for the win.
aaronpsamuel 10 months ago
this is cool :) always liked the look of vi but im too in love with emacs to even consider trying it out
rflood89 10 months ago
Don't you love it when someone watches your vid then just has to one-up you with some nerdy comment? BTW, mine is that you could have used a regex instead of recording a macro there. :-P
cstubing 1 year ago
Oh boy, so many tables. Am happy my editor doesn't know how to make site design with tables :)
mytube232 1 year ago
@mytube232 These tables are being used to semantically represent data, dumbass.
Hassan99999 1 year ago 2
Comment removed
mytube232 1 year ago
@mytube232 You were saying that your editor 'doesn't know how to make a site design with tables'. But these tables are being used to represent data, so they are being used correctly and semantically. If your editor can't do that, it is missing some important (X)HTML functionality. Tables aren't always bad - like I've just said, these are not being used to format the web page look and feel, but to show data properly. Hope you understand now.
Hassan99999 1 year ago 3
@Hassan99999 I understood the first time as well. But there is no need to insult others. And that was sarcasm in case you haven't noticed. It's the programmed who makes sites, not editor. If you don't know why you are doing what you are doing then you are nothing more than a macro who happens to breathe.
mytube232 1 year ago
@mytube232 Oh fuck this. You are just so fucking retarded there is no point arguing with you anymore.
Hassan99999 1 year ago
@Hassan99999 And you are genius because you like Vim. LOL speaking of retarded!
mytube232 1 year ago
@Hassan99999 first of all, dumbass, don't insult others. You have no right to do so just because someone doesn't like the same editor or same video as you. We all have our rights and freedom to like whatever we want.
mytube232 1 year ago
i like vim too, but yes, visual studio and even ms word can do this. ctrl shift r to record a macro, ctrl shift p to run the macro. ctrl left and ctrl right to move left/right one word at a time.
reinux 1 year ago
This has been flagged as spam show
Microsoft VIM ? are you smoking ? the very essence of VIM (open) would never allow microsoft to poop it up.
aaronpsamuel 1 year ago
Microsoft VIM ? are you smoking crack? the very essence of VIM (open) would never allow microsoft to poop it up.
aaronpsamuel 1 year ago
@aaronpsamuel
Woosh
Baldurpet 1 year ago
Notepad++ has macros too ;).
OmadFeyd 1 year ago
Emacs = Eight Megs And Constantly Swapping
Emacs sucks! Vi forever!
samplingrate 1 year ago
Vim rocks.
I actually remapped 'LCtrl' to 'Caps Lock' and 'Esc' to tilde (~). It's much better this way, especially if you have big keyboard like MS Natural 4000.
CantSeemToThink 1 year ago
thanks for the quick reply. I like how it looks all high tech.
bob8984 1 year ago
how did you make your microsoft word with an all black screen and cool colors? Is that only for Windows 7??? or can i do that on Vista too???
Thanks for any replies
bob8984 1 year ago 71
@bob8984 This is actually a new Microsoft product called 'Microsoft® Vim 2010™' shown here is the Professional Ultimate Small Business Enterprise Edition.
jeevesbond 1 year ago 237
@jeevesbond lol
america0014 1 year ago
@jeevesbond ahahahaha
Phanto88 1 year ago
@jeevesbond I am going to add this to stumbleupon just for that comment
supergenius1994 10 months ago
@jeevesbond hahahaha
MikeAK147 7 months ago
@jeevesbond Nice!
vrathulram 2 months ago
@bob8984 Can't tell if sarcastic or not.
calvin28 1 year ago
@bob8984 You can change the default screen background and text for every version of Windows for awhile now.
ibcnunabit 1 year ago
@bob8984 I really hope you are not serious...
FloobenShnooben 1 year ago
@bob8984 I've never seen anything this stupid
integrii 8 months ago
This comment has received too many negative votes show
vi is a nightmare. try using it on a text-only server and youll know the very meaning of hell.
EduEnYT 1 year ago
@EduEnYT : vi or vim properly configured (not like the crap from Debian or Ubuntu)?
bmw739 1 year ago
Yes, emacs has a counts thing. Probably. If not you can just write a plugin.
phallus99 1 year ago
The secret is the counts. You recorded a macro of which last operation was going a line down, then played it using a count which is the same as the number of lines. Still there are details I wanna know, can you make a better quality version, with commentary :)
Also, do other editors *cough*emacs*cough* have this Counts feature, for operations e.g. macros?
randomguy625 1 year ago
Im a big fan of vim, but I would do something like this with sed or perl regex
chrisll666 2 years ago 3
only one opened file per window??
semigotbanned 2 years ago
of course you can have several files in one window, splitted horizontally and/or vertically and/or using tabs
glezmen 1 year ago
This has been flagged as spam show
No, and i don't care. I don't use text tools to build the HTML part of a site...
decapattack 2 years ago
Yes, it can do that.
ytspenning123 2 years ago
An alternative to remapping the Escape key is to use the Ctrl-[ combination which is enabled by default in VIM.
pgllama 2 years ago
зачот, тоже так умею )
assaissa 2 years ago
I just use kate,or nano
sodukube1 2 years ago
This comment has received too many negative votes show
Yep. VI is a mold that grows on computers, much like how funk is a fungus that grows on musical geniuses.
Except funk is good.
drwtbr 3 years ago
I just got myself a job as an open source software developer, and I realized that I would be made fun of if I didn't use either vim or emacs. I chose vim, but GODDAMN is it hard to learn! I've never seen a more unintuitive program in my life. 'J' for down and 'K' for up, '0' to jump to beginning of line and '$' to jump to the end? Seriously, what the fuck?!
robatron3 3 years ago
It's great, because you don't ever have to (at least I've never had to) take your fingers away from the keys. You're always positioned to do the next input ;)
It's the fastest editor out there when you have learned it and know how to use it for its full potential.
Tuxxy87 3 years ago 4
Dude I just use the arrow keys...
The only command I use are / for search, dd to delete a line p to put it back. So sure, I don't use Vim to its full potential but it still works just fine.
LTS1287 2 years ago
hjkl mimics the arrow keys on a qwert.-keyboard.
You can also append to the end of a line by pressing "A" (remember: "A"-ppend) or "a" for "append here", or "i" for "insert here" or "I" for "insert at the beginning of the line (first non-blanc character)"
Less "what the fuck" than pressing left-arrow multiple times to get the same result.
rpgwapn 2 years ago
If you don't know touch, learn that first.
theyerdahl 2 years ago
An easy way to rember the hjkl movments are:
'j' looks like a down arrow so j is down, k is next do down so that's the up arrow, l is to the right of the up down arrows so it's the right arrow, and h is to the left of the up down arrows.
You can also use ^ for the begging of line because in a regex the ^ stands for the begging of line and the $ stands for the end of the line
SoSlipknot 2 years ago
emacs can do this, both with macros and simple lisp scripting.
but notepad...ugh, just thinking about using notepad for programming. *shudder*
tetavo 3 years ago 2
vim and emacs have startingly similar featuresets, unless you count EMACS PINKY!
(which requires an erector set to solve. seriously, look it up.)
antivert 3 years ago
that's why i use caps lock as a control key. i don't know what i would do without it. now emacs is very comfortable, especially when combined with the dvorak layout.
tetavo 3 years ago
On the same note, you cannot attain real Vim efficiency without remapping Escape to Caps Lock.
theyerdahl 2 years ago 10
Wrong, I already inverted caps lock with backspace. But I understand your point and i could remap escape with, maybe, left control key, only in Vim. THX for the idea!
smoppi 2 years ago
I LOVE YOU.
Cutlesnap 2 years ago
Well, you can, by remapping Caps to Control and using C-c. Having the actual Caps Lock in it's original place, however, is a very bad idea.
sapht 2 years ago
Use CTRL + [ instead of Esc.
rumli 2 years ago
Not a good shortcut on non-English keyboards on which "]" requires the use of Alt Gr. On mine, I get Ctrl + Alt Gr + 9, which doesn't even respond ...
theyerdahl 2 years ago
lol, remap Capslock to Esc, and Shift+Capslock to Capslock using Autohotkey
randomguy625 1 year ago
CTRL-C is much more convenient
glezmen 1 year ago
@theyerdahl you can, just use Ctrl+[ ;)
rufuseprobably 1 year ago
@theyerdahl I usually remap Esc to jj. Much easier I think
johansenbradley 1 year ago
Yes, my editor can do this. It's no big deal. But I see a lot of my students nowadays using half-baked light-weight editors like Kate or overblown systems like Eclipse. Special purpose systems are okay, but one still needs a powerful general text editor like vim or emacs. Personally I use emacs. You gotta switch the control and caplocks, but then youur fingers never leave the keyboard. And you have powerful keyboard macros and such. I'm sure you get the same in vim, but I could never adjust.
LucasFibonacci 3 years ago 3
Gedit would like to have a word with you.
:D
LTS1287 2 years ago
Vanilla gedit is a rather sparse editor.
theyerdahl 2 years ago 2
@LTS1287 : a word or a Word (from MS)?
bmw739 1 year ago
I'd say I pretty half way there when it comes to editing in VIM.
carnage123123123 3 years ago
I just checked this video again. I posted like a year ago in this same video something like "I wanna learn how to do that!" :) and indeed I have. Now without vim I just can't program.
Anybody selling viper here is just a fool. Don't dare to compare viper/vimemu/eclipseplugins/etc with my baby.
rolnxyz 3 years ago
Vim is amazing, I love the matching brackets features, it makes programming so easy.
starfreakclone 3 years ago
Most decent editor can can by using a Regex. VIM still rocks though.
btakita 3 years ago
Doh, I pressed the audio preview too late.
For the anal retentive, I meant to say:
Most decent editors can do this by using a Regex. VIM still rocks.
btakita 3 years ago
vi(m) rocks!
thetrojan01gr 3 years ago
This comment has received too many negative votes show
try not using tables, it makes your source so much cleaner :)
hessiess 3 years ago
Not in this case, the information was semantically best represented as a table.
Saying that nothing should be coded as a table is as stupid as trying to code everything in a table.
Yes, in standard English what I was formatting was a "Price List", but it had multiple columns (and rows), to use a list in this situation would be semantically incorrect.
It would also need a lot more CSS to format it, and I don't see how using a list in this case would reduce the amount of HTML.
jeevesbond 3 years ago 27
@jeevesbond I'm sorry to disapoint you, but I agree with hessiess, table is not the standardz!!
Also, tables are not web scale, you sure need html5 or jQuery or something
dgoponciano 9 months ago
@dgoponciano html5? jQuery? in 2006?!
AleksandarToplek 8 months ago
@AleksandarToplek Yeah! and you need this: bit.ly / llSW7Y
dgoponciano 8 months ago
@dgoponciano well... you'r right there ;D
AleksandarToplek 8 months ago
@hessiess
You NOT use tables to format your web page.
Tables are for data. CSS is for web page formatting.
y0uG0tpwned1 1 year ago
I heard someone claim that VI could edit C++ source/header files simultaneously intelligently interspersed.. is that so?
walter0bz 3 years ago 2
Simple macro? Yes..
TextMate anyone?
2mareks 3 years ago
hohohoh, yes it can. --emacs user
wallyqs 3 years ago
I know this sound stupid, but can you compile code in VI?
Or do you just load the files into an IDE and compile them from there?
Tuxxy87 3 years ago
You CAN invoke the shell from within the vi editor and then directly invoke the compiler (for compiling your code from shell).
kprasad 3 years ago
Hmm, I'll see what I can dig up there, haven't done anything like that before so I'm 100% green. Thanks.
Tuxxy87 3 years ago
just type :make in vim to compile...
esdac 3 years ago
is there a version of VIM which uses ctrl-xcv, shift-select ? do like the idea of it but the key layout is very alien
walter0bz 3 years ago
walter0bz: whats wrong with selecting and then just pressing y to copy, d to cut, or p to paste? Why do you want ctrl+x/c/v, when vim's keys are even simpler. If you really, really want theat, then map the keys manually and put it in your vimrc.
esdac 3 years ago
how does it 'select'?
ctrl-p seems to do completion for me, seems interesting but not 'paste'
Is there a single key to 'cut line'
walter0bz 3 years ago
walter0bz: To select, press v and move the cursor, or simply drag using the mouse like you select in any editor (if using Gvim or Vim with X). I didn't say ctrl+p, I said p. Simply press p to paste. To cut a line, you can press either shift+v followed by 'd', or press 'd' two times in a row. Remember you must do all this outside of insert-mode.
esdac 3 years ago
@walter0bz
Cream is a version of VIM that uses Ctrl+V, Ctrl+C, etc, and shift-select - keys just like a GUI app.
It's actually pure VIM, which is customised. You could customise those keys yourself too.
Autotrope 2 years ago 2
vi is awesome
432olim 3 years ago 3
uhuh try emacs and come back :)
xorg62 3 years ago
lol wat
24oscar24 3 years ago
HOLY CRAP!!
Headcrabb 3 years ago
How do you run the macro across a range of lines or 'to marker' ? It seems silly to have to know the # of lines in advance..
slay2k 3 years ago
Youtube won't let me post it because it looks like html, but you can do the same thing with a simple regular expression. Often faster and (once you're familiar with regexps) easier than recording macros.
It's basically a search and replace for
"anything followed by 4 sets of numbers" with "html row, anything in a cell, each set in a cell, end row". I wish I could show you here. Look for :%s/.../.../
daten 3 years ago 3
This is a great point. I use regex a lot in programming, but find the Vim regex engine can be a little esoteric. Since I lack confidence with them anyway, I end up spending hours editing regex Vim. Trying to work out whether something isn't working because I've done something wrong, or there's some character Vim's regex engine needs some character to be escaped.
So, in the end, I gravitate toward using macros. :)
However, there is a fantastic plugin for Vim called 'VimRegEx'
jeevesbond 3 years ago 4
@jeevesbond Try using RegexBuddy for regexes. Easier to learn them too.
arienh4 1 year ago
This comment has received too many negative votes show
great video. I just hope that most programmers are not involved in this kind of stuff. Programming is about manipulating code, that's written in text, true, but most of the time we don't care about manipulating text so much. We care about manipulating code, and that's done 100% better by syntax aware editors, refactoring tools etc. Vi and Emacs have their uses like grep and sed, but for programmers, I HOPE they're not too much relevant (if they are, mhm think about changing job)
PesceA 3 years ago
> I just hope that most programmers are not involved in this kind of stuff.
Lots are, many programmers find they can write code a lot faster in Vim than an IDE. It's totally a matter of choice though.
Vim can do the code manipulation you speak of. Including code completion and refactoring. I program in PHP using Vim, for example, including real-time debugging using XDebug. There's more to Vim than you might think. ;)
jeevesbond 3 years ago
I know very well that you can extend Vim in order to do what you need. But then you could use VS in the first place as well. My point was and is not that vim should not be used, but that all those nice text editing functionalities have nothing to do with coding, coding is about thinking and manipulating code, that rarely involves repeating 100 times the same operation or doing complex searches. But I know that vim and emacs can be good for editing code as well. They're just harder to learn.
PesceA 3 years ago
vim and emacs are created by programmers for programmers, and have been in development since 1976.
They have all the functions for editing code, and more(specially emacs, which has a built-in shrink).
But if you really want to get work done, there's always ed.
iAlta 3 years ago
Vim (and VI) are fantastic for many reasons, not the least of which is the ability to move around in a file without moving your hands off the main keys.
While in command mode, hjkl do left, down, up, and right respectively. You can run all over the screen with your cursor without ever moving your hands off the main keys. That saves huge amounts of time.
Using a mouse for positioning the cursor is really slow, and moving your right hand to the arrow keys is also quite slow.
michaelteter 3 years ago
This comment has received too many negative votes show
Lol. I remember the first time I made myself try Vim and Emacs. With Emacs, I wanted to write a simple "Hello World" program. A problem suddenly arose when I tried pressing "tab" (because Emacs did not tab in automatically). All I heard was "pling" as if I had done something so as to cause an error. Needless to say I have never used that shitty editor again.
With Vim? Let's just not go there.
Eclipse and Visual Studio for the win!
MikaelUmaN 3 years ago
And yet, neither Eclipse or Visual Studio can do what was shown in the video. And they're both inordinately bloated.
I can appreciate that some people prefer a fully-fledged IDE, but there's no need to slag off the choices of others. Particularly when all you achieve in so doing is advertise the fact you couldn't be arsed to learn the software.
jeevesbond 3 years ago
You really could'nt be more wrong with your opinion about Emacs and tabs.
Maybe you tried to code either Java or C++ code? Emacs have different modes ie. for "plain text" like ".txt" or java source code ".java". When you open emacs like this "emacs Hello.java", you'll end up using Emacs java-mode. In this mode (and C/C++ too), when you press tab, your current line automagically goes to the right identation, and not more! And that's the only feature I have really missed in my beloved Eclipse.
wallyllaw 3 years ago
I know that. I was talking about my first experiences with those editors. It was a nightmare.
If they work for other people, that's fine; I'm glad for you. They're just not my style.
MikaelUmaN 3 years ago
Vim is hard to learn, but it pays off. When I started using it, it pissed me off all the time, but it's just a matter of time. I am sure if you gave it more time you would love it.
rolnxyz 3 years ago 2
This comment has received too many negative votes show
VI and Emacs both suck because they were invented before important interface developments such as graphical windowed environments, scroll bars and arrow keys and haven't adapted to take full advantage of these types of things.
chocosnark 3 years ago
imagine if typewriters had been invented before shorthand writing systems -- they would never have taken off
but in the case of shorthand (eg Gregg shorthand,) typewriters were an honest replacement. they were faster and easier. in the case of code *text* editing, GUI manipulations are simply a different, much slower way of doing things -- but it's easier for newbies who don't realize they may spend the next 10+ years programming and should invest in the best tools
Techra 3 years ago 2
Vi, maybe. Vim on the other hand has scrollbars, tabs and works correctly with arrow keys.
In short: you're talking out yer arse mate.
jeevesbond 3 years ago
Gnu Emacs can do it all much better.
iromanovsky 4 years ago
Why was this voted so bad?
Give me an explanation.
GPadd 3 years ago
who voted? What are you talking about?
iromanovsky 3 years ago
iromanovsky's post.
GPadd 3 years ago
They voted this way because here gathered renegades, worshipers of the wicked vi editor. (vi vi vi = 6 6 6).
The holy truth is that GNU Emacs (God bless it)is the best editor in the Universe, much better than anything else. Can you play "tetris" inside vi? NO! Can you read e-mail in vi? No! Can you run debugger inside vi? No!
Can you talk to psychoanalyst in vi? No!
Can vi answer phone calls? No!
Can vi prepare breakfast for you? No!
So vi is not as good as some people say.
iromanovsky 3 years ago
Well, if flexibility is your standard, Emacs, as good as it is, fails. Windows, Linux, OS X all can do much more things than Emacs can.
To use your line of reasoning, can Emacs do wifi? Can Emacs manage your photo library? Can Emacs edit or HD video? Nope. Does that mean it sucks as an editor? Not really.
Because VI/Vim cannot do some of the non-editor things that Emacs can do, does that mean it's not as good as Emacs? No.
I suspect you just have a fondness for CTRL key.
michaelteter 3 years ago 3
They voted this way because here gathered renegades, worshipers of the wicked vi editor. (vi vi vi = 6 6 6).
The holy truth is that GNU Emacs (God bless it)is the best editor in the Universe, much better than anything else. Can you play "tetris" inside vi? NO! Can you read e-mail in vi? No! Can you run debugger inside vi? No!
Can you talk to psychoanalyst in vi? No!
Can vi answer phone calls? No!
Can vi prepare breakfast for you? No!
So vi is not as good as some people say.
iromanovsky 3 years ago
emacs is a good IDE, but Vi's modal editing model is much more flexible and powerful than emacs' C-blah hotkeys
where in emacs you work close to the text, vim promotes a higher-level view that grants significant efficiency gains. eg, the . operator which repeats the last whole edit
when using Vi you're in command mode most of the time, like a hawk scouting the landscape. when something needs editing, you swoop down to the precise spot, instantly slice things up, and return to your flight
Techra 3 years ago 4
You just do not know, but emacs can behave like vi. Type "M-x vi-mode" and you will have your beloved vi with its dot i.e. "operator which repeats the last whole edit" and be "like a hawk scouting the landscape".
You can type "Ctrl-x Esc Esc" and it will repeat to you any of your last big commands (like in bash you can browse your history). Actually you do not need to type the M-x commands every time - you can assign these commands to F1 - F24 keys, or to Ctrl-something or Meta-something
iromanovsky 3 years ago 2
indeed. vi's editing model is so nice a few editors out there have an emulation for it. i see that as a victory :)
though i use too many of the advanced Vim features (time travel, g+/-, non-trivial movement and editing sequences, lack of uglyness, etc) to be comfortable with an emulation
Techra 3 years ago 3
> vi's editing model is so nice a
> few editors out there have an
> emulation for it. i see that as a
> victory :)
vi mode in Emacs is not a "victory of vi"!
vi mode in Emacs is made for people with bad habits, who want to quit. It is like a nicotine patch for a heavy smoker, who wants to quit. Get rid of vi. You do not need it - Emacs is better.
By the way, Emacs can also do time traveling and teleportation and other non-trivial movements in space-time continuum.
iromanovsky 3 years ago
emacs is better because of its extensibility.
vi is better because of its editing model.
That is all.
theyerdahl 2 years ago 7
Agreed. With emacs, viper and vimpulse you would probably get the ultimate editor. I haven't got my foot around emacs yet but am inclined to switch because of what you mention.
sapht 2 years ago
Time travel g+/- is also emulated nicely in Emacs vi-mode....
I doubt that there is a vi command that Emacs can't emulate, or even extend.
The built-in "time travel" system in Emacs is even more powerful, you can even travel back your own travels within the whole Emacs session, and set macros involving multiple files and travel in time through all the files/directories you visited and all the things you have done.
Ferkiwi 3 years ago
Sorry... that was a response for Techra.
In Emacs, keyshortcuts are just a way to execute commands.
The commands written in Lisp are the real heart. It has nothing to do with "C-blah hotkeys", it can be customized to press "F6" or "ESC g +" or anything you want to, instead of "C-blah".
Macros in Emacs are lists of commands, not keys. You can even open, rename, save, close multiple files and add all of it to a macro. All can be macroed or can be extended/customizable via hooks for that command.
Ferkiwi 3 years ago
it was probably voted down because THEY didn't give an explanation of just how "emacs can do it all much better" -- anyone wanna offer one in his stead?
Techra 3 years ago
Can Your Editor do This?
yes, all mines can do it. the only things they can't do as vim is to be so fast and so lightweighted (but for what I care...).
pspad, for example, can do this with macro or regex replace, and it can handle well block moving.
Is there another video that shows what else can do vim so "wonderfully"?
gokudomatic 4 years ago
You used the Shft+V VISUAL LINE mode to indent that text. Is there a reason why you didn't use Ctrl+v VISUAL BLOCK mode?
TheYouuTubeRipper 4 years ago
very good!
I only use vim too.. the best!
chackalsjc 4 years ago
This comment has received too many negative votes show
Yuck. Brief will do anything vim does, of course, but I use QEdit.
NotSoOldHippy 4 years ago
how do you tab multiple lines a once?
luisjoseve 4 years ago
Use the Shift key to select several lines, and then type >>.
Ilyakub 4 years ago 5
thanks
luisjoseve 4 years ago
In that video I'm pretty sure he entered visual mode 'v', then selected the block, perhaps using 'ab', then '>>'. You can also type the number of lines to shift as a multiplier prefix. eg. '3>>' will shift three lines.
Techra 4 years ago 5
Looking more carefully, he marked a spot (mm), moved up by the "search previous" command (#) which moved to the previous <tbody>, entered visual line mode (V), then moved to the mark ('m). The (vab) for selecting blocks only works on parentheses and curly brackets. A useful way of selecting blocks in HTML is by moving to the opening/closing tag, entering visual line mode (V) and then using the search next or previous command (*) or (#).
Techra 4 years ago 4
EMACS!!
ahh, the flames...
unsignedchar 4 years ago 4
vim4life... making the simple things even simpler
trashemailaddress 4 years ago
wtf! I wanna learn how to do that. I use vim but only for quick edits. I know people say it can be amazingly powerful, I tried, but it's a pain in the ass to learn.
rolnxyz 4 years ago
But WELL WORTH the time spent learning it. What's several hours or days mastering commands compared to a life of use and vi/vim is fun.
TheYouuTubeRipper 4 years ago
Sed is very useful, although I was already in Vim and it hardly took any time to do.
I did use macros, press qq then @q as jeduan pointed out. To repeat it over and over I just put a number in front of the @q, e.g. 54@q repeats the macro 54 times. :)
jeevesbond 5 years ago
Nice, though it'd take less time if you used raw sed.
SphinxTheGeek 5 years ago
I believe he uses macros. You first do qq, do all the stuff and then @@
jeduan 5 years ago 2
so what vim scripts do you use? it's too small to see
debianuser182 5 years ago
Vim is total pwnage ^^
profox111 5 years ago 3