[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Vim vs Emacs
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 146
Thread images: 16
File: editor-learning-curve.png (5 KB, 600x400) Image search: [Google]
editor-learning-curve.png
5 KB, 600x400
Which one do you use and why?
>>
Learning Vim recently. Tried Emacs, but the keyboard shortcuts didn't really appeal to me the way Vims do.

It is a shallow reason for picking one editor over another b/c the keys can be mapped to whatever you want.

Honestly, both are so customizable at this point they are basically equal in power. The editor wars of the early 90s are basically over and it resulted in a stalemate.
>>
Vim, I'm almost always working on a remote test box over ssh
>>
File: out.webm (4 KB, 600x400) Image search: [Google]
out.webm
4 KB, 600x400
>>54949769
>>
>>54950440
fuck off autist
>>
File: autism.png (195 KB, 985x485) Image search: [Google]
autism.png
195 KB, 985x485
>>54949769
Both are autism.
>>
>>54950440
>1 KB
>>
>>54949769

To be honest I just use Open Office. Any other stuff is gonna be autistic tier and not compatible with Microsoft Word, so yeah.
>>
>>54949769
vi isn't that hard.
>>
>>54950440
whoa a whole kb was saved
>>
>>54950496
This. While useful for bash scripts and fizz buzz bullshit vim and emacs are both impractical for serious development (something no one on g does).
>>
>>54950596
You're welcome
>>
>>54950597
so what do you recommend for development, then?
>>
File: 1465257206386.jpg (4 KB, 600x400) Image search: [Google]
1465257206386.jpg
4 KB, 600x400
>>54950440
Try harder
>>
>>54950597
Out of curiousity, why do you consider them impractical for serious development? What are their shortcomings in your opinion?
>>
>>54950440
Every single one of these has been artifacted to shit. They are in and of themselves a waste of data.
>>
>>54950260
I like emacs because of how powerful it is. It's more than a text editor and can do anything. You can use evil mode if you want vim emulation
>>
>>54950832
>>54950644

He's gone m80s, I reckon he's just repeating some shit he read somewhere.
>>
>>54949769
Vim, it's smaller and doesn't require a display server.
>>
>>54950496
No they aren't, my TA explained their use perfectly.

Say that you have to do some work on a computer that's not yours, most PCs on science, servers, etc, are running Linux. So no matter what they have installed, you can be sure that they're gonna have at the very least vi.

I'm not saying that you should use them for every day work, but you definitely have to know how to work with them.
>>
>>54949769
Emacs, it's what my father used and what my son will one day use.

A tool crafted to perfection for the pass 40 years, there will never be a replacement for it.
>>
emacs, because I was already using it for org-mode after being unable to find something else libre that handles repeating tasks the way I need.
>>
When I have to absolutely do something on Linux I just end up using nano or gedit + command line

If I had to do any serious coding on Linux I'd just shoot myself
>>
>>54951513
It's pretty rare to need that and also to need to do the work *on* the target computer (rather than copy file, edit it yourself, copy back).
>>
>>54952586
What's your editor on other operating systems?
>>
>>54952631
I'm using C# right now for work, if I weren't I would be using stuff like codeblocks, eclipse, or pycharm
>>
>>54950440
> 4kb
Mate I'm Australian, are you TRYING to make my reach my month's data cap in a day?
>>
>>54952630
>have to patch a small thing
>let me boot up my laptop, copy the file over, edit it and then paste it back

When you could've done that in one minute with vim.

Not knowing vim is literally computer illiteracy, it's one of the fundamentals. You have to know it, and that's coming from a raging Visual Studio fanboy.
>>
>>54952586
>doing serious coding on Windows
nice try pajeet
>>
File: spacemacs.png (97 KB, 551x601) Image search: [Google]
spacemacs.png
97 KB, 551x601
both
>>
Emacs if I'm going to code lisp
Vim if I'm going to mess with my OS
But I honestly like Vim more. Often in Emacs I miss the kinds of movements that can be done with Vim like dt% or f! or 15G
They are absolutely based
I could be using evil mode but it's not really the same and i feel awkward about using emacs as if it were vim, maybe I'm just stupid
>>
>>54950440
Pied piper does it again
>>
File: quacker.jpg (58 KB, 541x566) Image search: [Google]
quacker.jpg
58 KB, 541x566
>>54949769
So if I learn emacs do I get trapped in time?
>>
>>54956548
Yeah, that's why everyone who still uses emacs is stuck somewhere in the 90s.
>>
I'm Notepad++ and what is this
>>
Emacs + evil-mode
>>
>>54949769

I prefer Vim because I liked the typing system. The [ctrl] combinations of Emacs feel awkward for me..

Also I prefer the logic that you are normally in the meta world where you can just do meta stuff and switch to the "what you see is what you type" only when you have to. It makes navigation damn fast, once you mastered it.


Anyway, I think Emacs is better as stand alone IDE. Right now I'm doing fine, but maybe I'll look into "emacs evil mode" in the future, who knows?
>>
>>54953347
What is f!?
>>
Notepad, because I'm not autistic
>>
>>54956561
Underrated post
>>
>>54952586

This, for the first part.

Fuck coding in a non-unix os. Fuck windows for coding. Serious code is done in linux, using the appropriate tool. Like a jetbrains ide for python and java (like a normie), and a simple editor like nano for scripts/anything over ssh.
>>
been learning emacs from the oreily book for the past few weeks. they make a lot of claims about being able to do pretty much everything youll ever need to do on your computer in emacs, or script it if you know lisp which i do. is that really true?
>>
File: 1433844767228.gif (550 KB, 728x720) Image search: [Google]
1433844767228.gif
550 KB, 728x720
SublimeText 3
>>
File: editorlearningcurve.png (4 KB, 600x400) Image search: [Google]
editorlearningcurve.png
4 KB, 600x400
>>54950440
>>54950828
Bitches please
>>
>>54950573
Why does your code need to be compatible with ms word?
>>
>>54957079

It jumps to the next occurence of "!".
>>
>>54949769
vi/vim, depending on the system. Usually just use sed and cat for quick tasks
>>
>>54957706
On the same line.
>>
>>54956561
kek
>>
>>54950573
Anon you're not supposed to use OO for code
>>
>Which one do you use and why?
Vim.

I dunno, just everything beginner-orientated seemed to have explanations for vim when I was learning to use linux/bash/edit configs/etc. so I ended up using it.
>>
>>54956561
Topkek
>>
>>54957845

Good to know.

I always use "/" for that purpose..
>>
>>54958160
Use f, seriously it's very handy
f find forward, F backward, t and T are the same as f and F but put the cursor before and after respectively
; jumps to the next occurence of f, F, t and T
>>
>>54949769
the one not pictured: vim
>>
>>54958300
>Use f, seriously it's very handy
What's the point in trying to micromanage small movements when it takes me less time to just hold down ‘l’ and get to the right place in the line than it does to figure out what character to type after ‘f’ that will take me there?

The only “complicated” movement commands I think are worth bothering myself with are the ones for large movements. ^], ^O, ^I and so forth. They let me navigate effortlessly throughout a codebase, which is the real benefit of vim.

Micromanaging navigation within a line feels like the vim equivalent of optimizing fizzbuzz.
>>
>>54958358
Yeah ok mate, maybe you should just go back to sublimetext
>>
>>54957555
best

and 555, nice
>>
I use Vim but I'm not really a programmer and I am probably not using a lot of the more useful features. I just like deleting words and lines all at once and moving around without arrows mostly.
>>
What are the key differences between vi and vim? I learned vim from the start and things like backspace seem to so weird things in vi.
>>
>>54958358
>it takes me less time
sounds like pebcac
>>
I use Visual Studio Code.

It's not like the regular versions of Visual Studio. It's basically a cross-platform Notepad++ with a solution explorer panel and git built in.

It tries to do Intellisense and plugins for additional language support, but just using it as a simple text editor is the best way to go IMO. The Intellisense is rather nice when it works though.

It works on Windows, OS X, and muh linux if you swing that way. Also open source.

Give it a shot, it may surprise you.
>>
I use vim
>because of habit
>because it's pretty easy to get started (I don't have a very complicated vimrc but I can feel that it is a powerful text editor)

I didn't stick with emacs because
>it is too bloated
>I can't into their shortcut once I began with vim
>too many modifiers.
>(not a reason) some cringy chick I knew was all into emacs and I didn't want her to claim that I copied her and have some cringy flashback once in a while while editing some file.
>>
>>54958516
>It's not like the regular versions of Visual Studio.

Indeed, it's Visual Studio rewritten in Javascript. I just bought a new PC so that I can run this upcoming AAA texteditors.
>>
>>54958567
>it's Visual Studio rewritten in Javascript
seriously?
>>
>>54958595
>>
>>54958613
why
>>
>>54958625
It's 2016.
>>
>>54958567
>>54958595

No. It's an entirely different IDE written in JavaScript.

And since it's open source, you can go translate it to C or something if you give that much of a damn. Put it up on GitHub and do the community a service.
>>
>>54958642
>And since it's open source, you can go translate it to C
Senpai, I'm good with vim.
>>
>>54958665
What, don't like a challenge? Wimp.

But nah, vim's cool. I just really like Code, regardless of what language it's in. In fact, it's really easy to edit the appearance of everything since it's just a big blob of JS/HTML/CSS.

But to each their own. I don't understand why everyone on /g/ has to get so up in arms about differing preferences. You seem cool though fampai.
>>
>>54958300

I see, so you save the [Enter] command when you use "f"..?

But what I like about "/" that you can put in a complete patter like: "/test 1/;/test" (find the first "test" after "test 1") if you want to.


>>54958358

You could just repeat it with ";" until you are there.

(Personally I would use "/!" for finding the next "!" and then use "n" to scroll forward..)


>The only “complicated” movement commands I think are worth bothering myself with

Look at OP's pic, it's pretty much true for Vim:
You have to learn many comments at the same time and it doesn't seem to make sense in the beginning.

When you start with Vim you are actually SLOWER than using notepad. Then you get familiar with the basic movement. Then you can somehow "keep up" with a normal editor...

[This is the point where you can complete the Vimtutor in 15 minutes]

But then you suddenly realize all the additional good stuff. Get faster and faster. Record a macro, use bash from within Vim..

For exmaple it's pretty comfy to jump into a loop and press "ci}" to rewrite this loop.
>>
>>54958738
>But to each their own.
My man. Don't forget to name the Jew.
>>
File: 1465257206386.png (4 KB, 600x400) Image search: [Google]
1465257206386.png
4 KB, 600x400
>>54957555
at least try
>>
>>54958772
I don't think this image conveys 4KB of information.
>>
>>54958399
I've been using vim for 7 years now, I'm pretty sure that's longer than ST has been relevant for.

>>54958476
protip:
xset r rate 200 100
>>
>>54958801
>protip:
Way ahead of you senpai:
xset r rate 250
>>
>>54958744
>You could just repeat it with ";" until you are there.
Or I could just hold down l and get there in a shorter amount of time.

Say you are in this cursor position and you want to get to the MP_CSP_PRIM_BT_2020 near the top. What set of keys do you press where the time needed to come up with the keystrokes + execute them as necessary takes less time than it takes me to use hjkl?

(I timed it, it's about 1 second)

>But then you suddenly realize all the additional good stuff. Get faster and faster. Record a macro, use bash from within Vim..
I do these, what does this have to do with micromanaging short-range movement?

>For exmaple it's pretty comfy to jump into a loop and press "ci}" to rewrite this loop.
I do this as well. ‘c’ is probably my most used way of entering insert mode, next to ‘o’. stuff like ‘cw’ is a real time-save because it saves having to be precise with your movements. (You know, the very thing I'm generally avoiding when using hjkl)
>>
File: pos.png (11 KB, 724x611) Image search: [Google]
pos.png
11 KB, 724x611
>>54958871
>Say you are in this cursor position
fug

>>54958814
>Way ahead of you senpai:
actually try typing the command I gave you, I don't think you understand what it does
>>
>>54958881
>actually try typing the command I gave you, I don't think you understand what it does
I do, senpai. 100 repeats per second is useless tho. To each his own.
>>
>>54958871
Also, using bash inside vim if all you need is a terminal is stupid as fuck when you can just switch to an actual terminal.

Only time running shell commands inside vim actually helps is when using e.g. %!foo to process your buffer..
>>
>>54958905
How do you write numbers 1 to 100 in vim?
>>
>>54958895
Then I'm not sure why you're trying to suggest with “way ahead of you”. Your keyboard repeat rate is not only cripplingly slow (it would be faster to press the key repeatedly than wait for it to repeat...) but also has a higher waiting time before it kicks in

Either way, if you use that low keyboard repeat rate then I can actually understand why you need to micromanage movements this much. I guess it's just a non-issue for me since my keyboard repeat rate is high enough that I can just jk my way there before you've even finished reading the line number

but to each his own
>>
>>54958929
>way ahead of you
Because I've already had this in my xinit for many years.
>>
>>54958924
If I need to have a few identical lines with incrementing numerical constants, I'd use ^A to increment the lines as I'm pasting them. If it's more than, say, 5, I'd use a small macro (q). That's probably where my cut-off point is for “making a macro is faster than just repeating the keystrokes”.

Problem with most of the “vim tricks” is that they generally assume you're working in an empty buffer. But I'm probably working in a 1000-line .c file.
>>
>>54958952
Well I'd just
:r! bash -c 'for i in $(seq 100); do echo $i; done'


But to each his own.
>>
>>54958924
this is kind of a hack but,
<esc> :set nu
then type 100 I <return>
finally highlight the the numbered margin with your mouse right-click and copy then paste.
>>
>>54958964
Cool, but just one question: When's the last time you had to, while programming, insert a literal sequence of 100 incrementing integers on individual lines - not part of any source code, just raw integers?

Answer: Never, and that's where this method breaks down. Reason macros etc. are more used in reality is because you generally want to be making slight changes to those 100 lines as you go along, otherwise it's probably something you could instead just use a loop for.

Also, it's still faster for me to write
seq 100 | xclip
and press ‘p’ in vim than it is for you to write your silly
bash -c ''
and
for x in $(); do; done
boilerplate.

But whatever.
>>
>>54959037
>Cool, but just one question: When's the last time you had to, while programming, insert a literal sequence of 100 incrementing integers on individual lines - not part of any source code, just raw integers?
Last week when I was working on exploiting a buffer overflow and had to input an easily recognizable sequence of digits to see in the memory dump where the buffer ended.

But not everyone can be this hardcore. To each his own.
>>
>>54959067
>Last week when I was working on exploiting a buffer overflow and had to input an easily recognizable sequence of digits to see in the memory dump where the buffer ended.
Show me the .c source code that contained this verbatim list of 100 increasing integers on individual lines without any other code surrounding them
>>
>>54959094
Of course there was code surrounding it, what nonsense are you talking?
>>
>>54958964
:r! echo `seq 1 100` | sed s/' '/' \n'/g
>>
>>54959115
oops, what the fuck am i doing.
i mean
:r! seq 100
>>
>>54954438
HA
>>
I just use vi since it comes pre-installed on literally everything
>>
>>54959127
Good stuff. But in practice you often need more complicated stuff. E.g. in the exploit I was writing I used
:r !python -c "for i in range(1, 100): print('\\\\x{:02x}'.format(i), end='')"
>>
>>54959174
archfag detected
>>
>>54958871

>Say you are in this cursor position and you want to get to the MP_CSP_PRIM_BT_2020 near the top.

You see it's not an "either / or" decision. You can do both, depending on the situation..

My first reaction at your pic would be to press "20k" to jump 20 lines upwards.

I've counted it and yeah, it was pretty accurate, I just need to type "j" (one line down), "2n" (second next word) to get there.

But this was because I could see it and I'm pretty good at estimating lines. If I was lazy I could have typed:

"H" (jump to the top of the screen)
"/20" (jump to the first occurence of "20")

Don't you think this is faster?
>>
>>54959304
>Don't you think this is faster?
Breaks about even for me. Typing H/20 is rather uncomfortable on the fingers, actually.

Part of that is due to the the shift-unshift-shift dance involved in that exact keystroke, though.
>>
>>54959304

> "2n" (second next word) to get there

Sorry, I meant "2w".

It's like piano playing, once you are very familiar with the key strokes it difficult to explain exactly what you do..
>>
>>54959341
Time to get a better keyboard layout, famalam. Also learn into '}' and '{' if you're serious about moving around multiple lines.
>>
>>54959174
print('\\\\x{:02x}'.format(i), end='')
I bet it took you longer to figure out that exact invocation than it would have taken you to just record a macro that just presses ywp^A a few times (plus whatever escaping you need).
>>
>>54959382
I didn't realize vim could output hex numbers. Care to teach me, senpai?
>>
>>54959341

Oh well, it's about how your brain works.

You could also type "?20" (searching backwards) and you would be there immediately.

But it depends if you realize there is no other 20 between yoru current position and the 20 you are searching for.


Also:
What if you need to find the value you asked for, but it's 5 pages away?

You COULD use "scroll page" 5 times and then slowly move to to the place. OR you could just use the backwards search and be there in a few strokes..
>>
>>54959360
>Time to get a better keyboard layout, famalam.
the time it would take me to move from qwerty to whatever stupid meme layout you're proposing would NOT break even in my lifetime

I type at 165 wpm

>Also learn into '}' and '{' if you're serious about moving around multiple lines.
( and ) are actually easier to press and accomplish pretty much the same thing, except even better (more granularity)
>>
>>54959411
>I type at 165 wpm
Do you code at 165 wpm? Anyway, famalam, you don't need to change the position of the character keys to move the symbols into better positions.
>( and ) are actually easier to press
Keyboard layout etc., famalam.
>>
>>54959398
:help nrformats


>What if you need to find the value you asked for, but it's 5 pages away?
I never care about navigating to things not within my visual range.

Why? Because if it's a definition I want to go do, I can use ^D. If it's a previous or higher-level function I was editing, I can use ^O/^I to move along the stack. And if it's a really big function, or an interconnected function I'm editing, I'm using split buffers anyway.

(And if I didn't know I wanted to split the buffer, then I'll just split it now and use ^O to go back to where I was before)
>>
>>54958881
Colorscheme?
>>
>>54959451
:help nrformats

Good stuff, but now I have to remember to change this.
>>
>>54959446
>Anyway, famalam, you don't need to change the position of the character keys to move the symbols into better positions.
If you need to press shift to type !, @, #, $, %, ^, & or *, feel free to stop responding

>Keyboard layout etc., famalam.
If you need to press shift to press () or [], feel free to stop responding

>>54959474
What kind of weird system are you on? It was already “bin,hex” for me out of the box.

>>54959453
my own
>>
>>54959491
>If you need to press shift to type !, @, #, $, %, ^, & or *, feel free to stop responding
No senpai, my layout is based on programmer dvorak with some modifications.
>What kind of weird system are you on? It was already “bin,hex” for me out of the box.
Sure but if the number doesn't start with 0x vim won't recognize it as hex.
>>
>>54959507
>Sure but if the number doesn't start with 0x vim won't recognize it as hex.
So use {0x01, 0x02, ...} instead of "\x01\x02...". Or type it as "\0x01\0x02" and s/0x/x/g
>>
>>54950440
someone mind explaining what's with all the retard webms? just another le ebin maymay or what
it's pretty retarded
>>
>>54959538
subtle webp shilling
>>
>>54959507
>No senpai, my layout is based on programmer dvorak with some modifications.
Mine's QWERTY international with the number key swapped with the symbols row and the () [] {} permuted such that shift+() is {}, and then a fuck-ton of symbols added to all the useless function keys and AltGr layer.
>>
>>54957478
this
and hotaru is a qt
>>
>>54959507

>programmer dvorak
>I press "2 3 4"
>it types "7 5 3"

Uhm... BSD user?
>>
>>54959577
I don't user the number keys. I've added a numpad on level 3.
>>
>>54959597

Classy.
>>
>>54949769
Well, shit. I tried to put it into a text converter and got a much larger file
>>
File: 011.png (517 KB, 899x1300) Image search: [Google]
011.png
517 KB, 899x1300
>>
>>54959491
>my own

mind to share on pastebin/git/bitbucket?
>>
>>54959553
>number key swapped with the symbols row and the () [] {} permuted such that shift+() is {}

that is a very good idea. stealin' it
>>
>>54961044
https://github.com/haasn/gentoo-conf/blob/nanodesu/home/nand/.Xdefaults#L31
https://github.com/haasn/gentoo-conf/blob/nanodesu/home/nand/.vim/vimrc#L91
>>
>>54961370
I remember that account. What other projects are you shitposting in?
>>
>>54950440
Is this /g/'s epic new meme?
>>
>>54961397
?
>>
>>54957705
>>54957904
They didn't say anything about coding, and the original post didn't say anything about coding either, just about editors. Text editors aren't JUST for coding anyway, I use notepad for word processing when away from home since it uses a lot less power than a full fledged word processor. Though granted, any decent editor can save in plain text, which IS compatible with MS Word.
>>
Vim and emacs are like yin and yang. A development environment is more than a text editor, it's debugging, building, testing, doing FS and network ops, etc. The philosophy behind emacs is that it should be extensible enough to do anything, so emacs power users often live inside emacs.

I use vim, just as a text editor. It's just one component of a workflow, following the UNIX philosophy.
>>
netbeans > vim > emacs
>>
File: 1465225924560.jpg (45 KB, 600x800) Image search: [Google]
1465225924560.jpg
45 KB, 600x800
I learned vim by lighting myself on fire and screaming non stop for three days.
>>
>>54961397
He's that mpv guy
>>
Notepad++, faggots get mad.

When I was at school and used linux I chose emacs over him though. Vim was absolutely cancerous.
>>
>>54962692
>I can't use it or bother to learn it therefore it's cancerous
Found the true cancer
>>
>>54962710

It's literally so bad man. I just want to type my shit, not have to click I for insert, and then do it. Why would you bother with such cancer?
>>
>>54951410
probably talking about IDEs. Personally, I use vim in intellij
>>
Emacs
There is no better text editor.
>>
>>54949769
Lisp > Vimscript
>>
File: sadpuppy.jpg (75 KB, 440x660) Image search: [Google]
sadpuppy.jpg
75 KB, 440x660
>>54956561
i use emacs.
>>
File: 1465305501700.png (3 KB, 600x400) Image search: [Google]
1465305501700.png
3 KB, 600x400
>>54958772
you can do better
>>
>>54963927
btw it would probably be lighter in svg
>>
>>54963927
yours is distorted/altered from the original
>>
>>54956561
IM JUST RUNNING IN THE 90S

http://webmshare.com/mxDRJ
>>
>>54949769
Emacs, it's just the first real text editor I ever used (before that always used IDE or notepad++)
>>
>>54964019
reuploaded on a proper file host
https://0x0.st/c1R.webm
>>
>>54962773
you can use vim as that if you want
that is automatically start in insert mode
Thread replies: 146
Thread images: 16

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.