GitHub shows basic thigns with vim

  • vimrc without plugin
  • vimrc with basic plugins
  • vim basic commands
  • nvim and lua also available here
Remote EC2 via SSM

This is my vim environment

Remote EC2 via SSM

Basic Vimrc#

" tab width
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set cindent
set autoindent
set smartindent
set mouse=a
set hlsearch
set showcmd
set title
set expandtab
set incsearch
" line number
set number
hi CursorLineNr cterm=None
" highlight current line
set cursorline
hi CursorLine cterm=NONE ctermbg=23 guibg=Grey40
" change cursor between modes
let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"
" netrw wsize
let g:netrw_liststyle=3
let g:netrw_keepdir=0
let g:netrw_winsize=30
map <C-a> : Lexplore<CR>
" per default, netrw leaves unmodified buffers open. This autocommand
" deletes netrw's buffer once it's hidden (using ':q;, for example)
autocmd FileType netrw setl bufhidden=delete " or use :qa!
" these next three lines are for the fuzzy search:
set nocompatible "Limit search to your project
set path+=** "Search all subdirectories and recursively
set wildmenu "Shows multiple matches on one line
" highlight syntax
set re=0
syntax on
" colorscheme
colorscheme desert

Add Plugins#

first we need to install vim plug

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \

use vimplug to install some plugins

call plug#begin()
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'prettier/vim-prettier', { 'do': 'yarn install --frozen-lockfile --production' }
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'jiangmiao/auto-pairs'
Plug 'rakr/vim-one'
Plug 'psf/black', {'branch':'stable'}
Plug 'sbdchd/neoformat'
Plug 'navarasu/onedark.nvim'
call plug#end()

Simple Theme#

colorscheme and modification

let g:airline_theme='one'
colorscheme one
set background=dark
:highlight Normal ctermbg=236
:highlight clear LineNr
:highlight clear SignColumn
:highlight clear CursorLineNr
:highlight clear VertSplit
:highlight StatusLine cterm=reverse term=reverse ctermfg=59

paste from clipboard inside tmux

if &term =~ "screen"
let &t_BE = "\e[?2004h"
let &t_BD = "\e[?2004l"
exec "set t_PS=\e[200~"
exec "set t_PE=\e[201~"

modify cursorline

set number
hi CursorLineNr cterm=None
set cursorline
hi CursorLine cterm=None ctermbg=238 guibg=Grey40
let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"
set ttimeout
set ttimeoutlen=1
set ttyfast

OneDark Theme#

First, install onedark theme using vimplug

" Using Vim-Plug
Plug 'navarasu/onedark.nvim'

Update the ~/.vimrc

let g:onedark_config = {
\ 'style': 'deep',
\ 'toggle_style_key': '<leader>ts',
\ 'ending_tildes': v:true,
\ 'diagnostics': {
\ 'darker': v:false,
\ 'background': v:false,
\ },
\ }
colorscheme onedark

Second copy the theme into vim manually
copy -r onedark.vim/colors/ ~/.vim/colors/
copy -r autoload/onedark.vim ~/.vim/autoload


coc highlight

:highlight CocHighlightText ctermfg='white'
:highlight CocFloating ctermbg='white' ctermfg='black'
:highlight CocMenuSel ctermbg=7
:highlight Visual ctermbg=59
let g:fzf_layout = { 'window': { 'width': 1, 'height': 0.5, 'yoffset': 1}}

coc install language server

:CocInstall coc-pyright

configure fix on save prettier


and add to the coc-setting.json

"coc.preferences.formatOnSaveFiletypes": [
"python.pythonPath": "/usr/bin/python3"

Basic Vim#

create a new file with netrw


create a new file with vim

:edit newfile

mark a target directory


mark a file


move the marked file

mm mc

find files in vime then tab to select the matches

find src/filename

setpath before find a file

set nocompatible "Limit search to your project
set path+=** "Search all subdirectories and recursively
set wildmenu "Shows multiple matches on one line

find files with fuzzy finder


window split

<C-w> v # split vertically
<C-w> s # spit horizontally
<C-w> h # move to right
<C-w> l # move to the left
<C-w> c # close current window

tab navigation

:tabedit filename-1
:tabedit filename-2

navigate between tab files

gt #: next
Gt #: previous

search and replace words

Basic Commands#

hide and show status bar

:set -g status off
:set -g status on

new session


kill session

:kill-session(#session number)

vim show path of an openning file

1 and ctr+g


  • 256 color cheat sheet link
  • use the command :hi to find the colors you want
  • regular expression to find and replace empty lines

cursor and cursorline setting

set cursorline
hi CursorLineNr cterm=NONE
hi CursorLine cterm=None ctermbg=254
hi Search ctermbg=Black ctermfg=White

Mount Volume EC2#

list device


look at the volume of ec2 in aws console as below picture


run this command to check an file system already exist on the device and parition or not

sudo file -s /dev/sdf1

if an file system already exist, let create a new directory

sudo mkdir /data

then mount

sudo mount /dev/sdf1 /data

configure auto mount on startup

sudo cp /etc/fstab /etc/fstab.orig

check the UUID

sudo blkid

take note the UUID


update the /etc/fstab file by appending this line to the end

UUID=aebf131c-6957-451e-8d34-ec978d9581ae /data xfs defaults,nofail 0 2

verify that mount working

sudo umount /data
sudo mount -a

User Data#

cd ~
wget -O ~/.vimrc
cd flask-tailwind-polly-master
python3 -m ensurepip --upgrade
python3 -m pip install -r requirements.txt
cd app
export BUCKET_NAME="vpb-polly-demo-10072023"
export REGION="ap-southeast-1"
python3 -m app