Iterm2 case insensitive autocomplete - terminal

How can I add case insensitive autocomplete to Iterm2 terminal? I have tried:
set completion-ignore-case on
But this does not seem to be the solution.

Set ignore case on in inputrc file. The following command will create the file with the command if not exist already
echo "set completion-ignore-case On" >> ~/.inputrc
Then run
source ~/.inputrc
to load it on current instance of terminal.

I was entering in the set completion-ignore-case on as a command in the command line. I instead needed to navigate to my root directory, create a file named .inputrc and input the set completion-ignore-case on text in that file.

Related

Why doesn't .vimrc get executed?

When I try to use . .vimrc it gives and error:
bash: runtime! command not found
bash: syntax: command not found
bash: filetype: command not found
bash: filetype: command not found
It just randomly stopped working for no reason, all other dotfiles seem to work fine. The .vimrc contains this:
runtime! archlinux.vim
set number
set noswapfile
set nobackup
syntax on
set autoindent
set smartindent
set smarttab
filetype plugin on
filetype indent on
set incsearch
set hlsearch
It also gave an error inside a comment when it was there.
The . (or source) command is a bash command which reads a file (which should be a valid bash script) in the context of the current shell instance.
The .vimrc file is not a bash script, it's something that's read and processed by vim rather than bash.
It's no different to trying to compile C code with a Pascal compiler. The file content is not suitable for what you're trying to do with it. The .vimrc file should be automatically picked up next time you run a vim instance.
~/.vimrc is the runtime configuration file for vim i.e. the file will be read by vim when it starts and all the statements are vim specific.
As you are trying to source the file in bash, you are getting the errors as bash has no idea of the vim specific statements like runtime, syntax etc.
use vimorvi instead of source command to activate .vimrc.Because .vimrc is not *.sh like .bashrc and etc.

bash script "ignores" .vimrc

I have a problem as follows:
I have a script which copies a log file from remote machine, does some modification on it and then opens it in vim, problem is vim doesn't auto recognize the file type (which outside of the script id does) – I need this for coloring the log.
Script as follows:
/usr/bin/rcp 14.1.61.10$node:/output/LocalLog_IPNode$node.log /export/home/fpd/tmp/tmp_local_log
chmod 777 /export/home/fpd/tmp/tmp_local_log/*
sed -i 's/[A-Z]\{4,8\}.*[oigus][kbdct][sel]\//---/g' /export/home/fpd/tmp/tmp_local_log/LocalLog_IPNode$node.log
vi /export/home/fpd/tmp/tmp_local_log/LocalLog_IPNode$node.log
My .vimrc:
au BufNewFile,BufReadPost LocalLog* set filetype=local_log
Note that the files opens in vim (if it helps the manual command ":set syntax=local_log" doesn't work either).
After exiting the script and manually opening the log everything works fine =(
Your problem is that the autocommand option is only availaible in vim and not vi.
So if this is available on your system, you should replace the last command line by :
vim /export/home/fpd/tmp/tmp_local_log/LocalLog_IPNode$node.log
Vim stands for "Vi Improved" and many options are only available in the latter.
To be sure you can do:
:help autocommand
It is always mentioned if the feature is vi or vim compatible.

Terminal configuration is incorrect

I'm having issues with two parts of my Terminal installation in particular.
The first is the prompt area. Look at how on each new line it says 108% instead of >. I'd like to know how I can switch that back to >.
![Image of Terminal][1]
The second issue is that I'm having issues setting my $EDITOR variable for tmux to work.
I've worked and set up the .tmux.conf file, and used the following line to attempt to set the editor:
EDITOR = "vim"
I was able to solve this issue with the following:
For the first issue (108 was set as my prompt), I went into my .zshrc file and added export PS1="%/$ ", then saved the file. My command prompt instantly changed back to normal, and I was fine.
For the second issue (echo $EDITOR was not returning anything, so tmux was not generating new projects), I simply entered my .zshrc file, and I added export before EDITOR so that the line looked like export EDITOR="vim".

Add custom shortcut by command-line - Ubuntu 12.10

How do you add a shortcut by commandline?
If we do it by hand (Keyboard > Custom Shortcuts) it works as it is supposed to do.
When we want to do it by commandline (in a bashscript as example)
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name "killscript"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command "pkill chromium"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding "<Primary><Alt>X"
This doesn't work.. When I'll check the shortcut by the dconfeditor I see that it has the proper name, binding and command set up.
Any ideas how I could get this fixed?
You can always change the settings in the GUI and watch the changes in the terminal using:
dconf watch /
You will notice that there are 4 commands the 3 you already have to set name, binding, and command and a 4th that adds the command to an array:
/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/binding
'<Primary>1'
/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/name
'test'
/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/command
'test'
/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings
['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']
So to add your custom0 command to the array use this command and then it works
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"
Also, check this detailed answer on how to manipulate the array https://askubuntu.com/a/597414
I'm not sure how you would make a custom keybaord shortcut (like a hotkey or something) but if you're working from the commandline and want to make a long command shorter, you could use an alias in your .bashrc or .bash_profile file
alias ls='ls -la'
if it's more complicated, you make a bash script and make it executable and, if you want to access it from wherever you are, add the folder it's in to your PATH varible

Tab autocompletion in bash vi shell mode

When using MSYS on a windows platform, I "set -o vi" to use the vi shell mode. Tab autocompletion for files and directories stops working. How to I renable this while remaining in vi shell mode?
Try:
bind -q complete
to see if it's set.
To set it at the Bash prompt:
bind '"\C-i":complete'
It should already be set by default, but it may be overridden in /etc/inputrc or ~/.inputrc possibly inside a $if mode=vi / $endif block. You can set for subsequent shell starts by adding this line to your ~/.inputrc file:
"\C-i": complete
For dir/file name completion try: ESC-\ or ESC-= or ESC-*
In my case (ubuntu 18.04) it doesn't work for commands.

Resources