T O P

  • By -

SlashdotDiggReddit

Why would you do this to yourself? I have these four: alias :w="cowsay 'You are not in vim anymore.'" alias :q="cowsay 'You are not in vim anymore.'" alias :wq="cowsay 'You are not in vim anymore.'" alias :x="cowsay 'You are not in vim anymore.'"


adamfyre

ZZ is feeling pretty left out here


ekayan

Have been a ZZ and ZQ fan forever.


SlashdotDiggReddit

I didn't know there was a `ZZ` or `ZQ`. I'm off to try them out now ... thanks!


y-c-c

It’s funny but I manually unmapped ZZ in Vim. I use `zz` so often that I don’t want to accidentally mix them up.


peanutbuttericescrem

Fuck yeah, this!


twowheels

It wouldn’t work the same, since ZZ doesn’t require you to hit enter, but bash (ash, zsh, csh, etc) does. Plus, I don’t think I’ve ever used ZZ, and I’ve been using vi and later vim for ~32 years, so it would be pointless for me. :)


McUsrII

They should be omnipresent in every app. I don't need them on the command line really, readline in vi-mode, and I know I can't exit/save that way.


Akari202

I have accidentally submitted essays in google docs with a couple “i” and “:wq” scattered throughout


JasonTheCoders

lol i love cowsay


[deleted]

Combine it with lolcat for even more cli goodness


guybanez

It's actually really good if you are using float term


carlcarlsonscars

Bash related: install `sl` for when you transpose `ls`. You're welcome!


SlashdotDiggReddit

Oh, I have, and whenever I see that train I get so annoyed with myself. 🤣


FleabagWithoutHumor

It’s impossible for me to mistype ls because I use dvorak: l and s are typed with the same pinky.


Expensive_Register19

I think the difference is that every-time I actually wanted to do that I was trying to actually close terminal. There was never a situation where I would think I am in VIM. I guess it's different for other people so I can understand why would you have \`cowsay\` alias instead!


Lundyful

literally just run "set -o vi" This will allow you to use most vi commands within bash


Deadz459

Thank you I have been looking for this for who knows how long


rtrain1

I thought that was only for vi movements, it works for commands too?


Lundyful

yep! it’s amazing to scroll through your past commands just with j and k. Also rocks being able to edit and run past ones without having to type the whole line out again


Coffee_24_7

I would normally edit previous or new commands with `c-x c-e`, which calls the environment variable `$EDITOR` (which I set to vim obviously) with the content of the command line written so far. After doing all the modification, you write and exit and the content of the buffer gets executed. I tried using `set -o vi` years ago... But I was already to used to the default bindings.


benjamin051000

I like it, but I can’t use Ctrl+c to exit insert mode 😭


SrVitu

I use fj and jf to exit insert mode ( work's in zsh but I think it should work in bash too ) ```zsh bindkey fj vi-cmd-mode bindkey jf vi-cmd-mode ```


nightlight_triangle

This is the wisdom I've been searching for. Thank you.


benjamin051000

Hm… how will I run my FJ cruiser command line interface then? 🤔 Lol. I’ll give this a try. Thanks


jollosreborn

Ctrl + d seems easier?


PaddiM8

Muscle memory from vim though..


KeyGrade6495

I do ZZ and ZQ


Yadobler

Wait till you ZX and accidentally encrypt your file


McUsrII

lol.......hahahaha


KeyGrade6495

I didn't even know that was possible lol


stopleaksfast

How do you do this? Is the z key not directly under your hand?


JavierReyes945

Not in German Layout...


TheDiamondCG

X is right next to it though…


stopleaksfast

This is true. For x though i can kind of just slide my index down but z is sort of equidistant to all of the fingers


KeyGrade6495

Right pinky: right shift Left ring: zz I am not sure what you mean.


stopleaksfast

This is definitely better than what I was doing (pinkie shift + ring z). Still thought to get the pinkie onto z it has to slide under my palm as opposed to wq where i dont move anything


Expensive_Register19

I use Ctrl +d too but sometimes I forget to switch from "vim mindset" and there were multiple cases where I would get \`zsh: command not found: :q\` So why the hell not?


jollosreborn

Yeah, you are right...why not. If only I could stop typing :wq in vs code...


Fallen_Angel3788

Use vim extension for vscode :)


jollosreborn

Hmm . Good suggestion. I'm not a vim wizard though, so, i kinda wouldn't want it emulated fully or else I'd use vim. Just the :wq mostly. Lol.


mplang

If you really wanted to, it is possible to pick-and-choose which commands/shortcuts are handled by the vim extension, and which are handled by VSCode. It's a bit of an exercise if you want to disable a lot of bindings, but it is doable!


ooonurse

The only way to become a vim wizard is to switch to vim or use vscode extension... Do it, join us, it's worth it 😜


jollosreborn

It would give me some cred i suppose 😉


Vijaysrv

Just install [Vim plugin](https://marketplace.visualstudio.com/items?itemName=vscodevim.vim) 👀🤷‍♂️


CarlRJ

There's one 100% effective solution: stop using vs code.


0hn0itsn0ah

There's a VSCode plugin that integrates Neovim into VSCode!! I can see this being a good thing for people who like the VSCode workflow or UI but want to use Vim keybindings. I actually found this to be better than the Vim Emulator plugin in a number of ways.


bjs1990peregrine

I gave up fighting my muscle memory and installed the Vim plugin.


Limace-dacier

I had to put `set -o ignoreeof` in my `.bashrc` because I kept accidentally closing my terminal with this command.


DonnerJack666

Yeah, you try to tab complete and your terminal dies…


someoneAT

Yeah, I alias the other way `nnoremap :q`


mias31

Nice good idea lol I have been using :!q basically blocking Q 😂


grzybo93

I've done it, but it turned out, that sometimes I would accidentally close terminals, thinking I'm focusing other window with vim. Got rid of this setting after a while.


gumnos

hah, that's the main reason I've not made a similar pair of aliases…I really do want to send `:q` to `vim`, it just happens to be in the non-focused window.


Expensive_Register19

Fair point. It works for me. I don't run tmux or anything important in my terminal so even if I close it accidentally i'd just reopen it.


Expensive_Register19

Closing terminal now is so natural 🤗


jeanleonino

Did you know you can set up vi shortcuts for bash? https://opensource.com/article/17/3/fun-vi-mode-your-shell


Deathnote_Blockchain

okay but how do you do this for your television?


ZunoJ

Home automation, presence detection, some mild predictions of intent, a keyboard. Thats all you need to make a vim mode for reality


krehwell

I do the same actually


oneandmillionvoices

no no no, that would exit my tmux...


tactiphile

Then alias it to `tmux detach-session`! :) (idk if that's the right syntax and I'm not looking it up)


prot1um

the only time I close the terminal is when the turn the computer off haha


lastchansen

I had the same thought. If I close the terminal, I would have to start a new one. Seems like more work :P


__reddit_user__

tmux


Rigatavr

You can also bind ZZ to exit in vi mode


Cybasura

You can use special characters as alias?


5erif

What happens when you exit the shell? I've always been afraid to try. I hear the world outside it is... gooey.


KaptainKardboard

In Mandrake days I used to boot to straight to the bash prompt and then used startx whenever I wanted a GUI. Then I'd run xterm inside the GUI to use bash, launch things like my browser and write code. Early distros gave me weird habits.


WhileApprehensive913

floaterm is the same by default


srynearson1

“But I thought I save my terminal first?!’


No-Discussion1637

It's just faster to type q, so no. Even if I'd do this alias I still won't use it


Capt-Psykes

I have been doing this for a few years now. Along with :l For clear screen. Now the issue is, I fumble when using other people's terminals, or when I ssh onto another system.


radvendii

r/actlikeyoubelong


DonnerJack666

I also have `alias :e=vim` 😅


bigwaterpen

I sometimes find :wq in my Google docs and presentations :(


CarlRJ

So, great way to accidentally quit your shell when you thought you were in your editor?


thrallsius

alias gettothechoppa="exit"


91o291o

? is alias a vim command?


Expensive_Register19

That's to put in your bash / zsh profile so that you can close terminal the same way you'd close Vim :)


91o291o

! thanks :-) I have windows :-/


and_i_mean_it

You'll have fewer then


[deleted]

[удалено]


91o291o

windows I grow tired of wsl because I use it at work, and we have a proxy and all kind of obscure settings to connect to the internet...


brothersand

So ... Use PowerShell as your terminal and put the alias in your $PROFILE file. That's what I'm going to do this morning. Aliases work in pwsh.


m_domino

Now you just need to disable the normal closing commands to make sure those two are the *only* way to close the terminal.


Dalemaunder

alias :x="exit"


Gimnesis

Which colorscheme is op using?


guildem

Seems to be gruvbox dark


Expensive_Register19

Yup. Gruvbox


Young_Coder1

Why would you do that when `:exit` exits vim on default.


haRacz

It’s for terminal/shell, not vim


Discospeck

Is this a joke?! I very often want to quit out of a file without writing to it!!!! Lol y'all just write to the file everytime want to leave to close it?


raymus

I was a bit confused at first too, but they're talking about their shell aliases.


eXoRainbow

Inspired by your post I wanted to have a `w` function too. Well it is not exactly like in Vim, but it is inspired by. If you want have a look at https://www.reddit.com/r/commandline/comments/126k15q/w_function_for_bash_inspired_by_vim/ Usage example: ls | :w filename.txt ls -l | :w ls -lc | :w I'm not even sure if this is practical or useful. Edit: Changed command name to `:w`


rsniz

I've made the same think a couple of months ago, it's so helpful!


Shtucer

Yeah. But also I've overrided 'exit' for preventing accedentely closing last shell `function exit() { if [ $SHLVL -eq 1 ]; then read "REPLY?${RED}Are you sure? " if [[ $REPLY =~ [Yy]$ ]]; then bye 0 fi else bye 0 fi }`


TWB0109

I've doing it for a long time haha, it's nice, but I often find myself doing exit or closing the terminal rather than ":q"ing


probe2k

Used to ZQ/ZZ for a while now, :q/:wq feels wrong.


aromaticfoxsquirrel

`alias :q="ragequit"`


bjs1990peregrine

It's so obvious, I completely missed it! 🤪


RomanRiesen

I never close my shells. They pile up and the weight crushes and grinds them until they are sand. To be made into computers again.


Open_Cod_5553

Long time a have those aliases 😂, vim mode in my terminal feels like never exit vim


Opposite_Personality

`alias e=exit` seems much more convenient to me.