I use vim commands in my terminal.. But by default, the mode when I open up terminal is the "insert mode". Is it possible to enter in "command mode" when I open a terminal session?
No there in no way to start your terminal in command mode.
set keymap setting is used to customize the keymap within terminal. A line with
set keymap vi-command means that mappings below that line apply to command mode; a line with
set keymap vi-insert means that mappings below that line apply to insert mode. For more details see: http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal
But starting from bash version 4.3 you can change your prompt to highlight which mode you are currently in by putting
set show-mode-in-prompt on in your
~/.inputrc file. This with put either
(cmd) at the start of your prompt. You can further customize it by using command:
set vi-cmd-mode-string "\1\e[1;31m\2(cmd)\1\e[0m\2" -- will give light red color
set vi-ins-mode-string "\1\e[1;35m\2(ins)\1\e[0m\2" -- will give light purple color
You can pick any of the following color by their ANSI codes:
Dark Gray \e[1;30m
Light Blue \e[1;34m
Light Green \e[1;32m
Light Cyan \e[1;36m
Light Red \e[1;31m
Light Purple \e[1;35m
Readline Init File,
Depending on the command(s) you run to get your console in the desired mode, just add that line in
~/.inputrc. This should be sufficient.
~/.inputrc does not exist, you can create it without worries.
A line with
set keymap vi-command sets your Terminal to' command mode'; a line with
set keymap vi-insert your Terminal to 'insert mode'.