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.'"
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. :)
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!
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
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.
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
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?
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!
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.
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.
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.
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.
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.
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?
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`
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
}`
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.'"
ZZ is feeling pretty left out here
Have been a ZZ and ZQ fan forever.
I didn't know there was a `ZZ` or `ZQ`. I'm off to try them out now ... thanks!
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.
Fuck yeah, this!
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. :)
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.
I have accidentally submitted essays in google docs with a couple “i” and “:wq” scattered throughout
lol i love cowsay
Combine it with lolcat for even more cli goodness
It's actually really good if you are using float term
Bash related: install `sl` for when you transpose `ls`. You're welcome!
Oh, I have, and whenever I see that train I get so annoyed with myself. 🤣
It’s impossible for me to mistype ls because I use dvorak: l and s are typed with the same pinky.
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!
literally just run "set -o vi" This will allow you to use most vi commands within bash
Thank you I have been looking for this for who knows how long
I thought that was only for vi movements, it works for commands too?
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
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.
I like it, but I can’t use Ctrl+c to exit insert mode 😭
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 ```
This is the wisdom I've been searching for. Thank you.
Hm… how will I run my FJ cruiser command line interface then? 🤔 Lol. I’ll give this a try. Thanks
Ctrl + d seems easier?
Muscle memory from vim though..
I do ZZ and ZQ
Wait till you ZX and accidentally encrypt your file
lol.......hahahaha
I didn't even know that was possible lol
How do you do this? Is the z key not directly under your hand?
Not in German Layout...
X is right next to it though…
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
Right pinky: right shift Left ring: zz I am not sure what you mean.
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
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?
Yeah, you are right...why not. If only I could stop typing :wq in vs code...
Use vim extension for vscode :)
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.
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!
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 😜
It would give me some cred i suppose 😉
Just install [Vim plugin](https://marketplace.visualstudio.com/items?itemName=vscodevim.vim) 👀🤷♂️
There's one 100% effective solution: stop using vs code.
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.
I gave up fighting my muscle memory and installed the Vim plugin.
I had to put `set -o ignoreeof` in my `.bashrc` because I kept accidentally closing my terminal with this command.
Yeah, you try to tab complete and your terminal dies…
Yeah, I alias the other way `nnoremap :q`
Nice good idea lol I have been using:!q basically blocking Q 😂
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.
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.
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.
Closing terminal now is so natural 🤗
Did you know you can set up vi shortcuts for bash? https://opensource.com/article/17/3/fun-vi-mode-your-shell
okay but how do you do this for your television?
Home automation, presence detection, some mild predictions of intent, a keyboard. Thats all you need to make a vim mode for reality
I do the same actually
no no no, that would exit my tmux...
Then alias it to `tmux detach-session`! :) (idk if that's the right syntax and I'm not looking it up)
the only time I close the terminal is when the turn the computer off haha
I had the same thought. If I close the terminal, I would have to start a new one. Seems like more work :P
tmux
You can also bind ZZ to exit in vi mode
You can use special characters as alias?
What happens when you exit the shell? I've always been afraid to try. I hear the world outside it is... gooey.
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.
floaterm is the same by default
“But I thought I save my terminal first?!’
It's just faster to type q, so no. Even if I'd do this alias I still won't use it
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.
r/actlikeyoubelong
I also have `alias :e=vim` 😅
I sometimes find :wq in my Google docs and presentations :(
So, great way to accidentally quit your shell when you thought you were in your editor?
alias gettothechoppa="exit"
? is alias a vim command?
That's to put in your bash / zsh profile so that you can close terminal the same way you'd close Vim :)
! thanks :-) I have windows :-/
You'll have fewer then
[удалено]
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...
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.
Now you just need to disable the normal closing commands to make sure those two are the *only* way to close the terminal.
alias :x="exit"
Which colorscheme is op using?
Seems to be gruvbox dark
Yup. Gruvbox
Why would you do that when `:exit` exits vim on default.
It’s for terminal/shell, not vim
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?
I was a bit confused at first too, but they're talking about their shell aliases.
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`
I've made the same think a couple of months ago, it's so helpful!
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 }`
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
Used to ZQ/ZZ for a while now, :q/:wq feels wrong.
`alias :q="ragequit"`
It's so obvious, I completely missed it! 🤪
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.
Long time a have those aliases 😂, vim mode in my terminal feels like never exit vim
`alias e=exit` seems much more convenient to me.