Installation - fairulazmin/note GitHub Wiki
Main reference from Chris@Machine and theFrugalComputerGuy
Create a .vimrc file
touch ~/.vimrc
Make directory for Neovim config
mkdir ~/.config/nvim
Create an init.vim file
touch ~/.config/nvim/init.vim
Make directory for general settings
mkdir ~/.vim/general
Create a settings.vim file
touch ~/.vim/general/settings.vim
Make directory for general settings
mkdir ~/.config/nvim/general
Create a settings.vim file
touch ~/.config/nvim/general/settings.vim
open the ~/.vim/general/settings.vim or ~/.config/nvim/general/settings.vim file via vim and add the following code:
syntax enable
set encoding=UTF-8 " String-encoding used internally are considered to be full width
set fileencoding=UTF-8 " File-content encoding for the current buffer
set ruler " Show the line and column number of the cursor position, seperated by a comma
set mouse=a " Enables mouse support, hold the shift key while using the mouse
set splitbelow " When on, splitting a window will put the new window below the current one
set splitright " When on, splitting a window will put the new window right of the current one
set tabstop=2 " Number of spaces that a <Tab> in the file counts for
set shiftwidth=2
set smartindent " Do smart autoindenting when starting a new line
set autoindent " Copy indent from current line when starting a new line
set laststatus=2 " always
set clipboard=unnamedplus " ALWAYS use the clipboard for ALL operations (instead of interacting with the '+' and/or '*' registers explicitly)
set incsearch " While typing a search command, show where the pattern, as it was typed so far, matches. The matched string is highlighted.
set cursorline " Highlight the screen line of the cursor with CursorLine
set relativenumber " Show the line number relative to the line with the cursor in front of each line.
set belloff=all " Stop annoying bell
set background=dark " Tell vim the background color
Add the following line to .vimrc
source $HOME/.vim/general/settings.vim
Add the following line to init.vim
source $HOME/.config/nvim/general/settings.vim
Make directory for keys mapping
mkdir ~/.vim/keys
Create a mapping.vim file
touch ~/.vim/keys/mapping.vim
Make directory for keys mapping
mkdir ~/.config/nvim/keys
Create a mapping.vim file
touch ~/.config/nvim/keys/mapping.vim
open the ~/.vim/keys/mapping.vim or ~/.config/nvim/keys/mapping.vim file via vim and add the following code:
" change leader key form default "\" to <Space>
let mapleader=" "
" escape from insert mode using kj key
inoremap kj <Esc>
" Go to next tab
nnoremap <TAB> gt
" Go to previous tab
nnoremap <S-TAB> gT
" Use `Alt+{hjkl}` to resize windows
nnoremap <silent> <M-j> :resize -2<CR>
nnoremap <silent> <M-k> :resize +2<CR>
nnoremap <silent> <M-h> :vertical resize -2<CR>
nnoremap <silent> <M-l> :vertical resize +2<CR>
" Better window navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Map <Esc> to exit terminal-mode
tnoremap <Esc> <C-\><C-n>
" To use `Ctl+{h,j,k,l}` to navigate windows from any mode:
:tnoremap <C-h> <C-\><C-N><C-w>h
:tnoremap <C-j> <C-\><C-N><C-w>j
:tnoremap <C-k> <C-\><C-N><C-w>k
:tnoremap <C-l> <C-\><C-N><C-w>l
:inoremap <C-h> <C-\><C-N><C-w>h
:inoremap <C-j> <C-\><C-N><C-w>j
:inoremap <C-k> <C-\><C-N><C-w>k
:inoremap <C-l> <C-\><C-N><C-w>l
:nnoremap <C-h> <C-w>h
:nnoremap <C-j> <C-w>j
:nnoremap <C-k> <C-w>k
:nnoremap <C-l> <C-w>l
" Faster indentation
:noremap > >>
:noremap < <<
Add the following line to .vimrc
source $HOME/.vim/keys/mapping.vim
Add the following line to init.vim
source $HOME/.config/nvim/keys/mapping.vim
Download plug.vim and put it in the "autoload" directory.
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Make directory for vim-plug
mkdir ~/.vim/vim-plug
Create a plugins.vim file
touch ~/.vim/vim-plug/plugins.vim
Make directory for vim-plug
mkdir ~/.config/nvim/vim-plug
Create a plugins.vim file
touch ~/.config/nvim/vim-plug/plugins.vim
Get various of plugins from VimAwesome
open the ~/.vim/vim-plug/plugins.vim and ~/.config/nvim/vim-plug/plugins.vim file via nvim/vim and add the following code:
call plug#begin('~/.vim/autoload/plugged')
" Plugin for Git
Plug 'tpope/vim-fugitive'
" Provide mappings to easily delete, change and add surroundings in pairs
Plug 'tpope/vim-surround'
call plug#end()
Add the following line to .vimrc
source $HOME/.vim/vim-plug/plugins.vim
Add the following line to init.vim
source $HOME/.config/nvim/vim-plug/plugins.vim
Open Vim
vim
Open Neovim
nvim
Install all the plugins
:PlugInstall
To update plugins
:PlugUpdate
To upgrade vim-plug
:PlugUpgrade