Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Sep 14, 2022

LunarVim

LunarVim is a fast IDE layer for Neovim. Vim, at some point let you be focus on the code, and by that, use the keyboard as the main tool, instead of the mouse.

Here's the list of steps to install LunarVim (and NeoVim) in Ubuntu.

$ sudo apt install software-properties-common -y

$ sudo add-apt-repository ppa:neovim-ppa/stable -y

$ sudo apt update

$ sudo apt install neovim -y

$ bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh) 

Add lvim to $PATH

If your terminal can't find the lvim command, add the installation folder to your path or move the lvim command to somewhere in your path. The default install folder is ~/.local/bin.
 

 

Links:

  • https://www.linuxcapable.com/how-to-install-neovim-editor-on-ubuntu-22-04-lts/
  • https://www.lunarvim.org/01-installing.html#prerequisites
  • https://www.lunarvim.org/02-after-install.html#add-lvim-to-path 
  • https://github.com/neovim/neovim/releases/tag/v0.7.2
  • https://github.com/neovim/neovim/wiki/Installing-Neovim

 

 

 

Apr 7, 2022

Brush My VIM Skills

Today, I just come across two interesting articles about VIM editor.

Those are very good for refresh brush of my VIM skills. And it is also a good time to touch up my ".vimrc".


Links:

Jan 17, 2022

Getting started with Vim visual mode

Just learn about VIM's visual mode today.

Visual mode can be useful for manipulate chunks of text. It has 3 modes: character, line and block.

  • character mode : v [lowercase]
  • line mode: V [uppercase] 
  • block mode: ctrl+v

 

Character Mode

  • Press <v> to activate visual character mode. [VISUAL]
  • Use <arrow key> to highlight the desired text.
  • Press <d> to delete the text.
  • Press <u> to undo.
  • Press <p> to paste the text.
  • Press <c> to change the text. [INSERT] 

 

Line Mode

  • Press <shirt-v> (or capital V) to enter line mode. [VISUAL LINE]
  • Use <arrow key> to highlight multiple lines.
  • Press <d> to delete those lines.
  • Press <y> to yank those lines.
  • Press > to increase the indentation of those lines.
  • Press < to decrease the indentation of those lines.

 

Block Mode

  • Useful for manipulation of specific tabular data.
  • Press <ctrl-v> to enter visual block mode. [VISUAL BLOCK]
  • Use <arrow key> to highlight the single character column and verify the indentation

 

Links:

  • https://www.freecodecamp.org/news/vim-editor-modes-explained/

Jan 11, 2022

Plugins for VI or VIM Editor

Here's my note on learning how to configure plugins for my VIM.

VIM is extensible through plugins. There are 2 ways to install VIM plugins, either by manually or with a package manager.

VIM plugins provide extra features for typing text. With the right mix of plugins, we can take control of VIM and forge our unique VIM experience. Such as:

  • Customize theme color
  • syntax highlight
  • code linting

 

Install Plugins Manually (for vim 8.x and above)

1.0 Create the directory structure for storing plugins.

$ mkdir -p ~/.vim/pack/vendor/start

$ mkdir ~/.vim/pack/vendor/opt

2.0 Install a plugin NERDTree, text-based file manager for VIM, so that it will be loaded automatic.

$ git clone --depth 1 \
  https://github.com/preservim/nerdtree.git \
  ~/.vim/pack/vendor/start/nerdtree

 2.1 Launch VIM and strt NERDTree.

:NERDTree

3.0 You also can add a plugin but only load it when you need the plugin.

$ git clone --depth 1 \
  https://github.com/preservim/nerdtree.git \
  ~/.vim/pack/vendor/opt/nerdtree

3.1 To load the plugin into memory, for current session.

:packadd NERDTree

4.0  Note for organizing each plugin in directory.

$ mkdir -p ~/.vim/pack/NERDTree/start/
$ git clone --depth 1 \
  https://github.com/preservim/nerdtree.git \
  ~/.vim/pack/NERDTree/start/NERDTree
$ mkdir -p ~/.vim/pack/foo/start/
$ git clone --depth 1 \
  https://notabug.org/foo/foo.git \
  ~/.vim/pack/foo/start/foo


Using VIM Package Manager (any vim version)

1. Install vim-plug with:

$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

2. Create ~/.vimrc file and enter this text:

call plug#begin()
Plug 'preservim/NERDTree'
call plug#end()

3. Install the plugins (listed in ~/.vimrc), and wait for it finishes:

:PlugInstall

4. Update all plugins with vim-plug.

:PlugUpdate

:PlugUpdate NERDTree

5. Restore plugins. vim-plug has this command to generate a script restoring all the current plugins.

:PlugSnapshot ~/vim-plug.list


Below is my current ~/.vimrc configuration.

~/.vimrc

Links: