Coding in vim

>coding in vim

Fucking tryhard nerds. Why do you guys always feel the need to make things harder on yourselves for no reason? Just use a normal text editor like real programmers. Stop being edgy.

Other urls found in this thread:

github.com/roxma/vim-tmux-clipboard
twitter.com/SFWRedditGifs

Show me where on the doll Vim touched you while you were K0d1ng, son.

Vim is easier.

Editing text is easier in vim than a plain text editor like nano because I have to press fewer keys to perform the same edits. To delete four lines, I can simply press 4dd How do I do that in nano or notepad.exe?

Vim is also easier than an IDE. IDEs shove a bunch of buttons and menus in your face. All the useful features that IDEs have, like auto-completion, exist in Vim as plugins. Plugins you only install if you need, and which don't clutter up your screen with complicated GUIs.

If you want to use something other than vim, that's fine with me. What you use doesn't bother me. Why are you bothered by what I use?

its just a specialized tool some swear by. Why are you so butthurt op??

Low effort troll.

Have fun with your "normal text editor" when you have to work in a terminal on remote boxes multiple times a day.

What should you do first? Install 100MB worth of dependencies or set up X11 forwarding? My nipples are so erect with anticipation.

how often do you have to delete 4 lines that you wouldn't just use an IDE? Also the guis can be useful in some cases, although i agree they can be cluttered. Programming in visual studio is like trying to use my grandmas computer where all the icons are the size of my fist and nothing has ever been closed

clearly you have no idea what vim can do and have no interest in learning so fuck off

>simply press 4dd How do I do that in nano or notepad.exe?
wow vim is really efficient at deleting code. too bad it's so clunky for writing it

what's point of running instance of editor on remote server and sending screen view every time vim redraw a screen? why not copying whole remote file into local temp file and sending changes on save?

I don't use most of that. It took around a day to get used to all the stuff I needed to be more productive than using sublime or something similar.

Sure, go ahead. Are you going to do that with FTP? SCP? rsync? Some plugin? Does your text editor support that? Time to Google. Oh, and configure. Oh, and make sure your server supports that. It doesn't? Oh well, time to make sure that the appropriate daemon is running. Crap, permissions aren't set for your user. Better chown or chmod them. Okay, that's done. Shit, your computer crashed. Good thing you had those changes backed up. Your local changes and your remote ones are out of sync now. Hope someone didn't edit things remotely while you were booting back up.

Question for vim users: How often do you use vim's screen splitting? I've seen people using tmux instead, sounds like it's redundant.

I use both. Vim screen splitting is useful if you want a shared copy/paste buffer that interacts with vim's macros / commands. If instead you're comfortable:

a) using tmux's built in emacs-style keybindings and copy-paste mode
or
b) customizing tmux to have vi keybindings and using its copy-paste mode

...and you don't care about vim's commands or macro system, then perhaps there isn't a need for vi splits. Up to you.

I prefer the power of knowing and using both.

>coding in vim
>coding

Bazinga yourself, normoid.

>what are shared network folders

Jesus, user, I'm all for vim, but its no where near that hard to sync code you're working on to a remote server, you could also just use a git repo.

>Are you going to do that with FTP? SCP? rsync? Some plugin? Does your text editor support that?
via abstraction layer over remote access protocols, my editor supports it out of box
>your server supports
it does and requires no configuration
>appropriate daemon is running
no daemons beside that for remote access (ssh mostly)
>permissions aren't set for your user
you mean using sudo? surely you wouldn't be able to r/w it with vim neither anyway
>chown or chmod them
something is telling me when you have permissons to chown and chmod, you also have permissions to rw that file
> your computer crashed
how often that happens? good I have local backup files then
>local changes and your remote ones are out of sync now
by one save, how often do you save files? once per day? no
>hope someone didn't edit things remotely while you were booting back up
how would vim on remote solve this? my editor has a way to deal with edits on opened file

Vim/emacs shits are not "programmers". they are hippies first and wannabe CS turds second. they're that loser that takes 100 level courses for 6 years so they can offhandedly mention they use a "real" 80s lang.

>Why you guys always feel the need to make things harder on yourselves for no reason?
Reason is there and it's what happens when you have extra human baggage living on free welfare. They have way too much time yet know they can never really make it in the private sector so they spend decades trying to out-tryhard each other. Vim/emacs is just temporary conversational quantum window dressing, if you were to somehow prove to them that you are better at it, they would immediately pretend to have not used it at all and then make up some even stupdier shit like "oh real programmers use a text ed with no features at all now". It's all just a loser game they play to keep the suicide thoughts at bay.

How is it with vim copy/pasting outside that vim window?

Not great.

Good for you, user.

What do you do when you want to read command output into your editor?
How about editing files that match a given pattern?
Macro recording and repeating?

All of these things require messing with a GUI. In the first case, your only option is literally piping to a file which you then go find in your file tree, open up, select, copy, and paste.

In vim it's just:
:r!command


Vim is faster for so many things, if you learn it. If you don't want to learn it, that's fine. You'll just be less efficient.

Can open stdin as source or run shell command and open new buffer from its stdout.
Has macros.

I should expand on this: In this case, depending on where you're wanting to paste, you'll fill the appropriate buffer.

vim's for vim.
tmux for tmux.
select/copy/paste in your wm for your wm.

>use emacs
>everything just werkz

feel bad for vim shitters to be honest

emacs gtfo go play fucking dunnet

If Sublime / Atom / VS Code can do this over SSH I'd be legitimately impressed.

I used vim exclusively up until my 3rd year of CS since nobody told me IDEs were a thing. It's objectively shittier in most aspects, there's no solution tree, package suggestions or autocorrect and I can't imagine how anyone can use it for large projects without being horribly inefficient

ok now what

>solution tree
you have UNIX, who cares?
> package suggestions
packages for what?
> autocorrect
>> autocorrect
>>> autocorrect
>>>> autocorrect

I want a pretty emacs infograph

use the shovel, man

go e


that game is the tits

>doesn't use vim for on the fly editing on a remote HPC
I'm sorry that your job/career doesn't require you to use command line editor

>Not realizing 4dd was an example
Are you being obtuse on purpose?

>everything just werkz
Yeah after you install a shit ton of extensions (or whatever the fuck they call them) and tweak your configuration file. This all takes a few days. Just werkz, man.

Don't forget learning a special Lisp. Easy peasy.

Yeah this. Good luck working on million-line code bases with a shitty little text editor and plugins that are inferior in every way to their IDE counterparts.

If you spend all day inside a text editor, why wouldn't you tune it exactly the way you like?

I don't know the Java/C# libraries by heart, and I like knowing that my code is buggy before I compile it. Who knows tho, maybe that's a crutch that experienced programmers don't even need

>million-line code bases

Sounds like the kind of code I'd want to work in.

Screen splitting? Every single time I use it

Wow, you really need a gf or something man. Your life sucks.

>using stupid example
>blamimg objections for not understanding th example
Vim is really good at deleting stuff, I mean it. But swapping between insert and normal mode is annoying and required befause of things like no eol wrapping and lack of cursor movement.

Oh man, no, don't get me wrong. If you're writing Java or C#, by all means use IntelliJ / VS. Dynamic recompilation is a boon when you can get it.

But if you're scripting or writing in a language that doesn't have a mature IDE specifically built for it, then it's good to know vim or emacs.

Y-you too.

So no one has mentioned the extremely lightweight, no-config beauty of Vim?

Lemme tell you about my vim set up. 10 lines of .vimrc and that's it. Any server, any fresh install, any slow machine is an instantly efficient development machine. I appreciate that about Vim.

Low config, low resources. And of course the macros and three-mode editing is obviously superior (but admitedly people really dont want that to be true and fight you if you say it).

>swapping insert and normal is annoying
>the core compotency of Vim is annoying

It's fucking essential dude. You need to be spending as little time in Insert as possible. Push yourself to stay in normal. Use visual mode to copy past.

Also. Keybind jk to esc. Insert to normal that way

post those 10 lines please

You can bind the escape key to something closer to the home row of it's that bad.
>Cursor movement
one of the good things about vim is the moment, like any tool you just need to learn how to use it. You can set eol wrapping in the config as well, I'm pretty sure.

>keybind jk to Esc
What? How am I going to insert jk characters then?

Hello fellow vim user. Fancy seeing you here, edumacating the plebian riff-raff. I'll be over here managing a dying OpenStack tenant and crying tears of insomnia. Enjoy the trolls!

>wow vim is really efficient at deleting code
>how often do you have to delete 4 lines
Vim isn't just better at deleting for lines of code. Vim is better at every conceivable text editing operation. Adding characters, removing characters, searching, transforming, etc. You name it, vim is better at it.

>how often do you edit code
Very often. Nearly every day of the week, for many hours each day. A text editor that makes editing code efficient is important to me.

How the fuck do you type "jk"?

filetype off
syntax off # syntax highlighting? I aint bitch made
filetype plugin indent on

imap jk # escape insert mode. You can remap kj, Jk, Kj, and other combinations without issue
vmap ht # escape visual mode

# use control + normal mode nav keys to navigate between horiz and vert splits
noremap h_
noremap l_
noremap j_
noremap k_

# two spaces for tab
set tabstop=2
set shiftwidth=2
set expandtab

set hlsearch

set smarttab
set number # line numbers

set t_Co=0 # no colours at all
set backspace=indent,eol,start # allows gvim to work properly

set shell=/bin/bash\ -i # so that my bashrc is loaded if I execute commands

set ruler

hi LineNr term=NONE

cd ~/repos/your-work-repo

can you think of an english word that uses jk in succession?

set autochdir
> two spaces for tab
>:[

>But swapping between insert and normal mode is annoying
Going into insert mode is only a single keypress. Leaving insert mode is only a single key press. The number of keypresses I save by using vim far exceeds the additional keypresses I need to switch modes.

>annoying
Muscle memory. I don't even think about it. It's like driving a car. Is using your blinkers every time you turn annoying? No, you do it without even thinking about it. Muscle memory.

what is the problem about that? Vim is great for small projects and web shits. If you are used to that you can be much more productive. You can even auto complete and stuff with the right plugins. If you are not confortable with the commands and want to feel like you are using an ide you can use nerdtree or whatever.
If your language is not some bloated shit vim works great... I would never use visual studio for c/c++ since my vim config works flawless for that and I'm multiple times more productive.

If you absolutely have to type 'jk' then you can do one character at a time for that *one* time that you have to do it in your fucking life.

you sound like a wizard. please tell me you're getting paid equiv of 50+ USD/hr.

>Question for vim users: How often do you use vim's screen splitting?
Almost constantly.

>I've seen people using tmux instead, sounds like it's redundant.
Separate vim instances in tmux windows is inconvenient, since each vim instance won't have access to the other buffers.

And tbqh, NeoVim's :term makes tmux a bit redundant. Not entirely redundant, I still use tmux on remote machines, but not locally anymore.

I feel like sometimes using a full IDE is better, but I've never run into it, and I definitely prefer to reserve my system resources for my web browser or build processes

I prefer mapping my caps lock to another esc. Who uses that anyway?

Visual Studio > vim

by the time you've finished typing your esoteric vim command to do some basic shit, I've deployed an entire auto scaling web app and database into Azure

Roughly 50/hr, living in a cheap state

Not a bad life except for the days that I hate it.

>>How is it with vim copy/pasting outside that vim window?
just werks with neovim.

>by the time you've done something actually useful, I've made some webshit
Woopdefuckingdoo

> NeoVim's :term

I might switch to this. Is this buggy at times?

I dream about the day I'll use vim efortlessly. Shame I can't find the time to go through vimtutor

Not him, but I've not run into it being buggy. Granted, I don't use :term daily but even so I've not noticed issues

Not him but to go along with this, does neovim's :term have any benefit over emacs's term-mode?

You almost never need to do that. And if you do, you just pause a moment before pressing k.

I don't use that keybinding though. I have my capslock key bound to escape.

Not needing to be an octopus to use it, for starters

Guys at work got me to map it to Ctrl. Omg the time savings.

With vim-tmux-navigator, you can use the vim ctrl+[hjkl] to move between tmux panes and vim splits seamlessly without leaving the home row (QWERTY)

$ cat ~/.tmux.conf
bind k selectp -U
bind j selectp -D
bind h selectp -L
bind l selectp -R

Nigger that's 21 lines.

You should also at least add:
set hidden
set wildmenu
set incsearch


The fact that hidden isn't set by default is probably vim's greatest bug.

hahaha real fucking funny, buddy

>>I might switch to this. Is this buggy at times?
No, rock solid. I switched a few months ago and have never had any trouble at all. It was a drop-in replacement too, I didn't need to fuck with my vimrc or plugins at all.

>does neovim's :term have any benefit over emacs's term-mode?
Probably not. I use [neo]vim but emacs is a big-boy editor too. I assume it's term-mode is competently implemented.

Thank. I used emacs for the first time in my clover OS VM a few days ago. I was worried I was going to break something, but I was able to edit text just fine. It didn't really seem like anything special, just a more extensible notepad

I prefer using an IDE for larger projects or when using smth like java.
My vimrc just works for scala, c/c++ and web shits though. I don't think I need a full featured ide if I can build, debug or test with few cli commands.

There is a global buffer in tmux that you can use (I think you need to use it in conjunction with the mouse mode, but not sure).

Also there is this... github.com/roxma/vim-tmux-clipboard

Imagine you had a lisp machine as your text editor. That's emacs. Incredibly powerful system. It's just a shame it has awful modifier key heavy editing. I suppose there's always evil mode...

Definitely. I guess I was just so used to vim, and remembering how different it was even I guess started using it, that I thought emacs would be something similar. Maybe one day I'll take a look into it

Before I switched to neovim I was giving switching to emacs some serious consideration. I never really bit the bullet and made the switch though, and now I'm glad I didn't.

If you want this to work with vim + tmux together, there is a modification to this you need that checks if the pane is vim or not. Otherwise you won't be able to navigate between vim splits when they are inside of a tmux pane without using a different keystroke combination.

Emacs is worth learning. So is vi.

Turns out most Unix utilities with an interface chose one dialect or the other. Most provide an option to turn on one or the other but they're always horribly incomplete or not supported in earlier versions.

Just learn both. It takes time but it's worth it.

amen brother

emacs looks great but I'm dealing with my vim config and making my whole system vim centric for so long that I'm just too lazy to try it out.

whoa, thanks user. hidden and incsearch look very useful but I'm not sure about wildmenu

Indeed. I love neovim, I use it constantly.
Soon™

Yep you said it. But even with Java you can do something like

:au BufWritePost *.java !javac *.java && java yourfile.java


which would automatically build and run your code on save

I've integrated vim keybinds into visual studio... maximum profit.

wildmenu gives you tab completion in ex mode, with the completion options listed on the line above your : line. For instance it works when using :e or :h

you can cat files over ssh you idiot

That's a pain in the ass when you could just use a real man's text editor like vim or emacs.

I actually dont use ex mode at all. should I be?

Sorry, I don't really mean ex-mode. I mean all the normal mode : commands. I don't know what that's technically called. Shit like :wq and whatnot. :e opens files, I use that all the time with wildmode. :h to open vim's help window, very useful with wildmode to get what you're looking for.

>Shit, your computer crashed.
wot.

>Hope someone didn't edit things remotely
trust me they didnt mate, they're too busy not coding, and even if they did, you use git, so who fucking cares, resolve the conflict and move on.

this poster is 100% full of shit. even if he's supporting Vim which is the masterrace editor

ahh. I honestly am not convinced that I could gain a lot from it. But thanks for pointing out that wildcard exists.

I didn't realize your entire OS was in source control. My mistake. I guess that explains why you think you can edit and view all files over SSH as a single user.

No, I'm not full of shit. Some people in this thread are short-sighted Electron (aka Chrome with a skin) editor babies. Maybe the backup example was contrived, but good luck being a sysadmin without a command line editor. That would be an interesting life.

Vim is not for programmers. It's for bored sysadmins.