i install fish and then oh-my-fish, forward i pressed some combinations of keys and than appear a letter [I] o my terminal.
[I] user#my-pc ~>
when i try to press ctrl + leftarrow changes to
[N] user#my-pc ~>
and when i press ctrl + rightarrow changes to
[I] user#my-pc ~>
In Bash or zsh i don't have this problem.
I tryed purge fish and omf destroy removing omf config files manually but nothing works.
How i solved.
I delete all fish cfg found in sudo find / -name fish than i run
echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_10/ /' | sudo tee /etc/apt/sources.list.d/shells:fish:release:3.list
curl -fsSL https://download.opensuse.org/repositories/shells:fish:release:3/Debian_10/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_fish_release_3.gpg > /dev/null
sudo apt update
sudo apt install fish ```
Something in oh-my-fish turned on vi-mode, which causes fish to display the current binding mode. This is so you aren't confused about whether you are in insert mode (where pressing "dd" will cause it to enter the text "dd") or in normal mode (where pressing "dd" will delete the current line).
Fish doesn't enable vi-mode by default, so you'd know when it happens. Unfortunately, some badly written third-party packages insist on enabling it for you without telling you (which I personally find to be quite arrogant).
For example the budspencer "theme"/"prompt" does so by default (but nowadays also turns off the mode indicator, leaving you without even a clue that it happened... blergh).
To go back to the normal emacs-inspired keybindings, run
set -U fish_key_bindings fish_default_key_bindings
once, interactively. This works unless something overrides it, in which case you need to remove it (and possibly complain to its authors).
Related
I'm using macOS Catalina which has built in Vim 8.1. I'm also using iTerm with zsh and oh-my-zsh. I installed neovim for my personal use and when I setting it up, I accidentally enter source .zshrc in Command mode instead of source init.vim. From then, when I open neovim or built in vim, it does not source init.vim anymore and shows error message like below:
Error detected while processing VIMINIT:
E33: No previous substitute regular expression
Press ENTER or type command to continue
There is a line in my .zshrc that exports VIMINIT variable
export VIMINIT="~/.config/nvim/init.vim"
How can I undo this or is there any other way to reset vim to original setting? Thank you so much
I tried #Niloct solution, unset VIMINIT and vim/neovim is backed to normal. After that, I reopen the iTerm and it showed error message again. Therefore I removed the export line from .zshrc and the problem has been solved.
To load a clean neovim:
nvim -u NONE -U NONE -N -i NONE
Actually I have an alias for that
alias vinone='nvim -u NONE -U NONE -N -i NONE'
This way you can type vinone and use your default neovim
To clarify which I've tried:
Ubuntu bash
Hyper
Powershell
Git bash
cmd
I have installed Ubuntu bash on my Windows 10 PC. When I open ubuntu.exe up and I type zsh after the shell has started, my zsh shell starts up instead, as expected. This is perfectly fine and it does exactly what I want.
The problem: When I do the following sequences:
cd
[TAB]
[ARROW KEYS] (select an item)
ENTER
It should cd into that folder. And it does that, but it literally takes over a minute to do so. CTRL+C to cancel does not work.
Now that I'm in that folder, I can clear the console by typing clear, so that's what I do:
user#user-pc > /mnt/c/folder/otherfolder > GIT-REPO > clear
When I type clear and hit enter, it takes probably 30+ seconds before it clears the window.
I have tried a bunch of themes and a bunch of terminals/command prompts, but none of them work, not even the default one.
I've installed zsh and oh-my-zsh by doing these commands inside the Ubuntu bash shell:
sudo apt-get install zsh
curl -L https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | bash
Any idea why this odd behavior happens? It looks like it's zsh, because I can easily cd into other folders using all of the above terminals. The problem also happens if I simply cd /mnt/c/folder/otherfolder/ with and without the trailing slash.
Does it only happen in that particular folder? IME, large git repositories can be really slow on zsh+WSL even with the default prompt.
After I attempted to uninstall oh-my-zsh, I am getting the error
/Users/Thomas/.zshrc:source:56: no such file or directory: /Users/Thomas/.oh-my-zsh/oh-my-zsh.sh
This issue indicates that the original shell needs to be reverted back to, however the provided command
chsh -s /bin/bash
is not working. I've restarted my iTerm as well. And my aliases still don't work, as well as exported variables such as $JAVA_HOME return empty, even though they are properly set using my former .bash_profile. Also rather than ending with a ~ my terminal prompt ends with a %
Thomas%
How can I revert?
One detail, when I attempted the uninstall via uninstall_oh_my_zsh I mistyped my password. Rather than prompting me again, it looked as though it went ahead and completed the uninstall, but maybe some component of it didn't complete properly.
Make sure you have Brew installed.
Enter brew remove zsh into the terminal then reset your terminal, it should reconfigure back to your original shell.
For this kind of error, you need to check if you set the default bash to zsh in .bashrc file. So, if there is any, just comment them out.
Example for mine.
#Launch Zsh
if [ -t 1 ]; then
exec zsh
fi
So, you just need to comment that out.
#Launch Zsh
#if [ -t 1 ]; then
#exec zsh
#fi
I'm trying to use vi mode in bash. via the .inputrc (on OSX):
set editing-mode vi
In vi insert mode, the right arrow key moves the cursor to the right, but it stops on the last character in the line. If the cursor is past the end of the line, it moves the cursor to the left. So, in sum, the farthest right you can go is to the last character in the line.
$ cd /usr/locl/bin
# Move the cursor to the middle of the line, and fix something there
$ cd /usr/local/bin
# Now move the cursor back to the end, and write a character (/)
$ cd /usr/local/bi/n
As shown above this means you cannot edit the end of the line without going into command mode (and using 'a').
I found an article which seems to indicate the version of readline/bash might be the problem. However I used brew to upgrade bash (GNU bash, version 4.3.42), and even tried to install and link readline (6.3.8), as recommend by that site. But no luck. Its possible the upgrade was done incorrectly.
This means I'm looking for one of the following:
The proper way to upgrade bash and readline in OSX terminal
A way to check the versions of bash/readline that OSX is actually using
Another fix for this bug (somehow passing in the virtualedit=onemore option in the inputrc)
Indications that the latest versions of readline might have re-introduced the bug, and solutions.
Also: if theres a similar thing with editrc
Note: I'm looking to make readline in bash act near identical to the default (for others who periodically use my terminal), but allow me to use vim mode. This means I don't need workarounds, but fixes.
Answer here: https://unix.stackexchange.com/a/222506/198846
Apparently it's a bug in the bash version shipped with OSX (3.2), it's fixed in 4.3 according to that answer. Use bash --version to check your bash version.
To fix, update bash, e.g.
macports: sudo port install bash
brew: brew install bash
Once installed bash --version will show it's updated (assuming standard brew/macports paths at the start of your $PATH)
You then have to change your default login shell (in System Preferences->Users & Groups->right click your user->advanced options->login shell) to the path of the new bash:
(default) macports: /opt/local/bin/bash
(default) brew: /usr/local/bin/bash
Changing the default login shell step is required even if which bash shows the macports/brew one.
All credit to the answer linked above.
Can't you edit .bashrc itself instead to use vi mode? The command set -o vi does it in my case (you are in edit mode initially). Also remove the .inputrc edit as the two may actually interact nefariously afterwards.
I know this might be more appropriate at Ask Different, but as I tried adding tags there, there was no vim tag, only macvim. So I figured I might get a better audience here.
In the Terminal, I do the following
$ vim --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Jan 31 2010 13:33:49)
When I browse to http://www.vim.org, I see a news item
Vim 7.3 released!
How do I update my built-in vim? I would very much like to do it cleanly (i.e. no duplicate installations, or any additional downloads, no macports, etc.)
I considered using Mercurial (as I already use it for other things), as per the instructions here.
$ hg clone https://vim.googlecode.com.hg/ vim
$ cd vim/src
$ make
But I think that would make a duplicate installation. Despite my "clean" requirement as mentioned above, "unclean" solutions are also welcome, since maybe there really is no other way.
If I understand things correctly, you want to install over your existing Vim, for better or worse :-) This is a bad idea and it is not the "clean" way to do it. Why? Well, OS X expects that nothing will ever change in /usr/bin unbeknownst to it, so any time you overwrite stuff in there you risk breaking some intricate interdependency. And, Let's say you do break something -- there's no way to "undo" that damage. You will be sad and alone. You may have to reinstall OS X.
Part 1: A better idea
The "clean" way is to install in a separate place, and make the new binary higher priority in the $PATH. Here is how I recommend doing that:
$ # Create the directories you need
$ sudo mkdir -p /opt/local/bin
$ # Download, compile, and install the latest Vim
$ cd ~
$ hg clone https://bitbucket.org/vim-mirror/vim or git clone https://github.com/vim/vim.git
$
$ cd vim
$ ./configure --prefix=/opt/local
$ make
$ sudo make install
$ # Add the binary to your path, ahead of /usr/bin
$ echo 'PATH=/opt/local/bin:$PATH' >> ~/.bash_profile
$ # Reload bash_profile so the changes take effect in this window
$ source ~/.bash_profile
Voila! Now when we use vim we will be using the new one. But, to get back to our old configuration in the event of huge f*ckups, we can just delete the /opt directory.
$ which vim
/opt/local/bin/vim
$ vim --version | head -n 2
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 27 2011 20:55:46)
MacOS X (unix) version
See how clean this is.
I recommend not to install in /usr/local/bin when you want to override binaries in /usr/bin, because by default OS X puts /usr/bin higher priority in $PATH than /usr/local/bin, and screwing with that opens its own can of worms.... So, that's what you SHOULD do.
Part 2: The "correct" answer (but a bad idea)
Assuming you're set on doing that, you are definitely on track. To install on top of your current installation, you need to set the "prefix" directory. That's done like this:
hg clone https://bitbucket.org/vim-mirror/vim or git clone https://github.com/vim/vim.git
cd vim
./configure --prefix=/usr
make
sudo make install
You can pass "configure" a few other options too, if you want. Do "./configure --help" to see them. I hope you've got a backup before you do it, though, in case something goes wrong....
Don't overwrite the built-in Vim.
Instead, install it from source in a different location or via Homebrew or MacPorts in their default location then add this line to your .bashrc or .profile:
alias vim='/path/to/your/own/vim'
and/or change your $PATH so that it looks into its location before the default location.
The best thing to do, in my opinion, is to simply download the latest MacVim which comes with a very complete vim executable and use it in Terminal.app like so.
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim' # or something like that, YMMV
Like Eric, I used homebrew, but I used the default recipe. So:
brew install mercurial
brew install vim
And after restarting the terminal homebrew's vim should be the default. If not, you should update your $PATH so that /opt/homebrew/bin is before /usr/bin. E.g. add the following to your .profile:
export PATH=/opt/homebrew/bin:$PATH
Note: Previous versions of Homebrew did install to /usr/local, so in that case you have to use /usr/local/bin instead of /opt/homebrew/bin.
A note to romainl's answer: aliases don't work together with sudo because only the first word is checked on aliases. To change this add another alias to your .profile / .bashrc:
alias sudo='sudo '
With this change sudo vim will behave as expected!
On Yosemite, install vim using brew and the override-system-vi option. This will automatically install vim with the features of the 'huge' vim install.
brew install vim --with-override-system-vi
The output of this command will show you where brew installed vim. In that folder, go down into /bin/vim to actually run vim. This is your command to run vim from any folder:
/usr/local/Cellar/vim/7.4.873/bin/vim
Then alias this command by adding the following line in your .bashrc:
alias vim="/usr/local/Cellar/vim/7.4.873/bin/vim"
EDIT: Brew flag --override-system-vi has been deprecated. Changed for --with-override-system-vi. Source: https://github.com/Shougo/neocomplete.vim/issues/401
brew install vim --override-system-vi
This blog post was helpful for me. I used the "Homebrew built Vim" solution, which in my case saved the new version in /usr/local/bin. At this point, the post suggested hiding the system vim, which didn't work for me, so I used an alias instead.
$ brew install vim
$ alias vim='/path/to/new/vim
$ which vim
vim: aliased to /path/to/new/vim
I just installed vim by:
brew install vim
now the new vim is accessed by vim and the old vim (built-in vim) by vi