.gvimrc
cd ==> This will take you to your home directory
touch .gvimrc and add the below mentioned content
To set all these configurations in your .gvimrc for all gVim instances, you can add the following lines to your .gvimrc file as seen from the image you provided:
syntax on
set background=dark
colorscheme murphy
set backspace=2
set nu
set hlsearch
set ic
nnoremap <F5> :let keyword=input("Enter keyword: ") \| execute ":%s/".keyword."//gn"<CR>
Here’s a
brief overview of each command:
- syntax on: Enables syntax highlighting.
- set background=dark: Sets the background color to
dark.
- colorscheme murphy: Applies the murphy colorscheme.
- set backspace=2: Configures the backspace key to
behave more predictably.
- set nu: Displays line numbers.
- set hlsearch: Highlights search results.
- set ic: Makes searches case-insensitive.
- nnoremap <F5> :let keyword=input("Enter
keyword: ") \| execute
":%s/".keyword."//gn"<CR>: Maps F5 to prompt for
a keyword and count occurrences.
By adding
these lines to your .gvimrc file, all instances of gVim will have these
configurations applied.
how to set and source
o set and
source your .gvimrc file for all gVim instances, follow these steps:
Setting Up
.gvimrc
- Open Your .gvimrc File:
- Create or edit the .gvimrc file in your home
directory (~/.gvimrc).
- Add Your Custom Settings:
- Add your desired configurations to the .gvimrc
file. Here’s an example:
syntax on
set background=dark
colorscheme murphy
set backspace=2
set nu
set hlsearch
set ic
nnoremap <F5> :let keyword=input("Enter keyword: ") \| execute ":%s/".keyword."//gn"<CR>
Sourcing .gvimrc
- Source the File in an Active Session:
- To apply the changes without restarting gVim, you
can source the .gvimrc file by executing the following command within
gVim:
:source ~/.gvimrc
- This command reloads your .gvimrc file, applying
the custom settings immediately.
Verification
- Check if Settings are Applied:
- Verify that your settings, like syntax
highlighting, background color, and key mappings, have been applied. Open
a file and test if pressing F5 prompts you to enter a keyword as you
configured.
By following
these steps, all your customizations in .gvimrc should be in effect for all
gVim instances.