• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

vim

Vim Cheatsheet

October 27, 2022

Almost all are not able to remember all the shortcuts that are available for the vi or vim editor. I will call it vim throughout this article. There are several cheatsheets out there, but the one that works for me is the one provided by rtorr in Github. I use the cheatsheet often. I suggest that you start small. At the very least learn how to navigate in vim. Once you feel comfortable doing that, you can learn other advanced shortcuts such as editing, search and replace, working with multiple files and many much more. I hope you’ll find the cheatsheet as helpful as it has done for me. Again if you missed the link above, I posted it below.

Vim Cheatsheet

Filed Under: Linux Tagged With: cheatsheet, commands, vi, vim

Vim Colors

October 25, 2022

I had trouble getting my vi editor to display all black background color. This includes the background color after the end of the file. I just wanted an all black background for better visibility. I did a little bit of googling and found this nice little gem. I happen to like the dessert theme and went with that instead of the recommended mustang theme which I don’t have installed. Hope you’ll find this helpful.

set t_Co=256
set background=dark
colorscheme dessert
highlight Normal ctermbg=NONE
highlight nonText ctermbg=NONE

set t_Co=256 set background=dark colorscheme dessert highlight Normal ctermbg=NONE highlight nonText ctermbg=NONE

Filed Under: Linux Tagged With: background, black, dark, theme, vim

Set Vim Colors Permanently

August 12, 2022

Here’s how to set Vim colors permanently.

vi ~/.vimrc

vi ~/.vimrc

Add the following.

highlight Normal ctermfg=white ctermbg=black

highlight Normal ctermfg=white ctermbg=black

Filed Under: Linux Tagged With: background, colors, foreground, permanent, vim

Vi Search and Replace

April 3, 2022

How to do search and replace in Vim.

Search for “foo” and replace it with “bar” in the current line. Use :s

:s/foo/bar/g

:s/foo/bar/g

Search for “foo” and replace it with “bar” in the entire document. Use :%s

:%s/foo/bar/g

:%s/foo/bar/g

You can also pipe instead of forward slash. Useful if your search contains a /.

:%s|foo/|bar|g

:%s|foo/|bar|g

Filed Under: Linux Tagged With: entire, file, replace, search, vim

GCP Cloud Shell Vim Settings

March 10, 2021

I had an issue with using the backspace in Vim in GCP’s Cloud Shell. Every time I’m in the insert mode and I want to edit using backspace, it doesn’t delete the characters. It shows these characters “^?” instead. Well, it turned out to be a backspace setting that you can set within .vimrc. So, here’s my working setup.

colo desert
syntax on
set backspace=indent,eol,start
set nocompatible

colo desert syntax on set backspace=indent,eol,start set nocompatible

  • The first line uses the desert theme.
  • The second line turns on syntax highlighting. It’s on by default.
  • The third line fixes the backspace issue I mentioned above.

Filed Under: Cloud Tagged With: backspace, cloud, gcp, shell, vim, vimrc

Remove Sudo Password

July 28, 2020

Removing sudo password is typically not a good practice. If you’re a seasoned system administrator, or you’re the only one using your own desktop, being prompted for a sudo password can get really annoying. Here’s how to stop getting prompted every time you run sudo.

Run visudo.

sudo visudo

sudo visudo

Edit the sudo line and set to below.

%sudo ALL=(ALL) NOPASSWD: ALL

%sudo ALL=(ALL) NOPASSWD: ALL

Save file.

Filed Under: Linux Tagged With: nopasswd, password, prompt, remove, sudo, vim

Vim Page Up & Down

June 16, 2019

How to Page Up and & Down in VIM.

# Page Down
Ctrl-B
# Page Up
Ctrl-F

# Page Down Ctrl-B # Page Up Ctrl-F

Filed Under: Linux Tagged With: page down, page up, vim

Change VIM Colors

March 20, 2019

Vim is a text editor. Edit the ~.vimrc

# vim ~.vimrc
colo desert
syntax on

# vim ~.vimrc colo desert syntax on

Filed Under: Linux Tagged With: colors, desert, editor, terminal, vim

  • Go to page 1
  • Go to page 2
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2023