

Update: TNG V2 is now available. For useful concise Mac/Linux terminal commands and more for beginners including Vim, please visit Commands.


I am hoping to share VIM in a new light, with additions or compilations of fitting customizations and plugins, particularly for the purpose of note-taking and writing. Terminal editors remain one of the most powerful ways for word processing and programming in my humble opinion. Vim is lightweight and customizable. Vi/Vim is also commonly available on Linux, even on legacy UNIX servers.
Basic steps to start and use Vim for note-taking and writing:
- Launch or install VIM
- Practice commands
- Vundle (Plugins Manager)
- Goyo
- Airline and Startify (optional)
- Color schemes (optional)
- Emmet, Jedi, NERDTree (optional)
** These steps are designed (hopefully) for customized comfort or basic usefulness yet prettified appearance in vim writing.
Bear in mind I am in no way a Vi/Vim expert, but I have spent hours testing and configuring to determine what works or not so I hope this post can assist and propel others further ahead of me in learning the basics and kickstart their terminal editor experience for note-taking and writing. I have created a TNG (TakeNotesGuide) V2 theme (customized vim environment with lines comments for explanation) for your quick and personal use in note-taking and writing.


Features of TNG V2 theme
- User-friendly vim start screen
- Fast and easy documents access upon startup and internally
- Open and switch across multiple documents with Tab (Shift-Tab for Startify menu, Tab to switch and Ctrl-x to close current Tab window.)
- Status bar information includes the date, time, and word count (markdown format)
- Goyo with F8 for minimalistic writing
- Easier to copy from vim and paste in Mac desktop
- Spellcheck
- Mouse clicks support
- Autosave changes upon Tab to buffer switch
- Comment and uncomment with ease
- Backspace key works
- Comfortable window size upon Vim launch
- Emmet for code expansion
- Jedi-vim for coding
- NERDTree for left-side directory tree view
A quick guide to using the customized TNG V2 theme
- Copy or overwrite with this .vimrc (On Mac OSX) settings into your home directory
- Start vim by typing $vim and enter from prompt
- Install Vundle and all plugins (instructions below) and restart vim
- Select file for editing by entering the number accordingly, enter at cursor position or clicking
- Or type :e followed by space and file name to create a new file
- Or select Directory from start screen e.g. type the number beside to open the current directory listing
- Open another or more files with Shift-TAB (optional)
- Press TAB to move across the opened files with autosave function
- Ctrl-x to close tab or file or :wq to write and quit vim
- Activate or disable a distraction-free writing environment by pressing F8 or typing :Goyo
- Save the document first, then highlight text in vim and Ctrl-c to copy before pasting in Mac Desktop with CMD+v


Launch or install Vim
Vi/Vim comes built-in with most systems I know (except Windows). To install VIM, please download it from here. After installation and if typing vim at terminal prompt does not launch it, one can look for it for example in /usr/bin and append a new working export PATH line into ~/.bash_profile. We can now type vim to launch from any terminal directory then. Edit this file from your home directory (~):.bash_profile by adding this line:
export PATH=”${PATH}:/usr/bin/”
(You may have to change the path to where your VIM is installed)
Tip:
- Vim scripts are written in Vim script language. Developers and intermediate or advanced users may learn the language directly from vim itself with :help vim-script-intro
Practice commands
From the terminal command prompt type vimtutor (Tutor for learning VIM in about 8 chapters) and enter to start learning with practice. Alternatively, start Vim and practice with the below basic notes I have extracted based on what I thought is more useful.
More tips:
- Type vim . will launch vim with a directory tree listing that one can browse and open files for editing
- Comments in .vimrc start with the ” character
- :setfiletype followed by a space and Ctrl-d will reveal the filetypes that vim supports
- :help quickref will launch VIM quick reference with more on VIM for advanced users and those seeking more comprehensive information. One of the strengths of vim is the help documentation in vim being extensive, so please remember to make good use of the free resource with :help _____
- $vimtutor fr and $vimtutor gr will launch french and german versions respectively from the terminal command prompt.
Basic notes on vim basic usage
There are some basic modes in vim, including Normal (Text manipulation and navigation), Insert (Editor), Visual (For selected text), and Command (For the execution of commands) modes. We can manipulate the document in Normal mode, but we can do the same in Editor mode just as normal word processing. Therefore, those who just wish to start using VIM for document editing without learning too much about it can just type $vim FILENAME from the correct directory in the terminal prompt, type ‘i’ to start editing as per normal, and :wq to save and quit. Below are some commands I learned that should be more useful. Bolded ones are emphasized for more practical importance.
Vim starts in Normal mode
- ESC will return to Normal mode
- Ctrl+w, then press v will create a new vertical window, or s for a horizontal window
- Ctrl+w twice to switch between the windows
- h,j,k,l, arrow keys, and PgUp & PgDn to move around
- $ means the end of line
- w means move to next word. Vim shortcuts can be intuitive. That means 3w will move to the third word
- x will delete the letter
- dd will delete the whole line; 2dd for 2 lines
- d + arrow keys for deletions
- 0 to move the cursor to start of a line
- e to move the cursor to end of current or next word
- u to undo
- Shift-g will go to end of the document
- gg to go to the start of the current file and then a line number (specified near screen bottom e.g. 30) and enter for the cursor to go. Or type the line number and Shift-g
- Type / followed by a search term, enter and n or N to move around. Insert \ before / to escape it if your search string contains / or it will not work
- For programmers: Teleport between matching parentheses with ‘%‘
- ma to create a bookmark with the name ‘a’ at current cursor location and return to this location by typing `a. This can be useful when working on large files that needs multiple frequent access at certain locations
Visual mode
- Type v to enter visual mode to start highlighting text (:’<,’>w new_file to save into a new file)
- Type y to copy
- c to cut
- p (in normal mode) to put or paste
Insert mode
- Type i from Normal mode enter editor mode to start editing the document
- Type o to start editing at new line below. O to start editing at new line above current position.
- ESC will return to Normal Mode
Command mode with ‘:’
- <strong>:q! will quit without saving and :qa! will quit all buffers to close VIM.
- :w Filename will create a new non-existing file
- :saveas filename will save to a new file
- :wq will write and quit
- :%s/old/new/gc to change all old occurrences to new. ‘g’ instead of ‘gc’ to skip the confirmation
- :! followed by external commands for execution e.g. ls or pwd
- :set ic will ignore cases in searches
- :nohlsearch will remove all search highlights. :hls will show again.
- For programmers, this will execute a python file :!python test.py
- : and Ctrl-d will reveal possible commands
- Tab to show next possible commands and help complete commands
- :e and space, then (Ctrl-d to view files) filename to open or Tab for available selections
- :w !pbcopy and enter for selected text in visual mode will copy the text in a buffer that can be pasted in Mac desktop applications with Cmd+v
- ESC will cancel or return to normal mode
Tips:
- F1 will show help
- $vim . (vim with a dot from the terminal prompt) will launch a directory tree listings for easy browsing and file open.
- $vim filename to create new or edit file
- Press : and the up arrow will access your last commands and history, this can be very useful to avoid repetitions
More tips:
- If you wish to learn Vim basics at a more casual pace or in shorter sessions or in a video teaching format, please consider Vim essentials Udemy course (This course is free the last checked).
- Another user-friendly online resource to learn basic Vim commands interactively is Open Vim.
Install Vundle (Plugins Manager)
Vim users need to figure out how plugins work to customize and add functionalities to VIM according to our needs. Vundle (please install according to the guide) is a good plugins manager that enables users to just insert and save at least one line (according to the requirements of that plugin) into .vimrc file, quit and restart VIM and :PluginInstall to install a plugin.
Basically, we have to execute the below line from the terminal prompt and copy the recommended .vimrc settings from Vundle Github (or just use TNG .vimrc)
git c
lone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Are you wondering what plugins are available for installation? Vimawsome has a repository of plugins with users’ votes for your perusal. Beginners may do well to select only plugins with a high and inordinate amount of votes; Not all plugins are equal in terms of quality and deliverance.
Goyo


Looking for a good plugin for minimalistic writing and reading in vim? Goyo (on Vimawesome) is excellent in setting up a distraction-free reading and writing vim environment. The design is so simplistic with ample neat margin space; Goyo is uncluttered for creativity and inspires freedom of artistic expression.
You may notice the document top and side are comfortably spaced for readability. There are options for resizing but I found the default to be good. Just save this line into a new or use this .vimrc file, before restarting, run :PluginInstall and restart again:
Plugin R
16;junegunn/goyo.vim’To easily use Goyo, just toggle on or off with this command:
:Goyo
Below line in .vimrc file will easily activate or deactivate Goyo with F8:
map <F8&
gt; :Goyo<cr>To launch Goyo with vim startup, insert or enable these into the .vimrc file:
“Launch Goyo at startup (This is a comment starting with a “)
autocmd vimenter * Goyo
Tips:
- For writers in vim: Counting of words, characters, lines, cursor position, and bytes can be displayed by typing g and followed by Ctrl-g (A built-in vim function). This is a convenient way of displaying word count information for seconds without the airline status bar.
- Pre-selection of words with ‘v‘ and mouse for counting is also supported.
- Goyo mode will (understandably so) disable Airline status bar which includes word counts and line information.
- Spellcheck is enabled in TNG theme. Type :set nospell to turn it off until vim restart.
Airline


Airline is the status bar that shows information (or beyond) about the document we are working on. For example, word counts and line numbers are displayed.
Airline buffer tabs
Buffers (or files loaded in memory for editing, much like the different hidden windows behind the current one or the tabs on physical file pages) are useful when you work on multiple files and numerous split windows are not helpful.
With these lines in a .vimrc file, we can traverse the tabs easily with the Tab (go to next tab) key or Shift-Tab (to open Startify to quickly choose recent files in new tab) and Ctrl-x to quit or close that tab (modified, gratitude and you can read more in this post):
:nnoremap <Tab> :bnext<CR>
:nnoremap <
;S-Tab> :Startify<CR>:nnoremap <C-X> :bdelete<CR>
Tips:
- Airline does not work in minimalistic Goyo mode
- Adjusting the width of the terminal window with click-and-drag can change the airline display
- Play around with different airline theme with :AirlineTheme random (added to TNG)
- View existing open buffers in vim with :buffers
- Add a new buffer manually with :badd filename (Shift-Tab or :Startify is easier from TNG)
- One can still browse the directory with command :e, space and a dot from vim
- I have modified the airline to include date and time with this line in TNG: let g:airline_section_b = ‘%{strftime(“%F %H:%M”)}’


Startify


Have you ever wondered how you can save time from remembering and typing repeatedly to open your last recent files? Startify (on Github) solves that easily with just one plugin without the need for complicated steps e.g. re-compile source codes just to load the last saved session. All you need to do is to select from the start list of files by typing the number or click to open. If you wish to open this list again for selection, just type :Startify and enter. Plus the user-friendly interface should appeal to vim beginners, creative writers, and art students alike.
The default should be sufficient for basic usage, but for the curious, there are more optional settings to customize our Startify start screen in the .vimrc file, such as bookmarks and commands as well. For example, to assign a character ‘v’ to bookmark the .vimrc file or just include the filename for auto-number assignment:
let g:startify_bo
okmarks = [ {‘v’: ‘~/.vimrc’}, ‘~/.zshrc’ ]To assign commands with names, just follow the format below each line for one command:
let g:startify_commands = [ \ [‘Directory’, ‘e .’], \ [‘Vim Tutor’, ‘! vimtutor’], \ [‘Vim Reference’, ‘h ref’], \ [‘Vim Script Intro’, ‘h vim-script-intro’], \ ]
Tips:
- The above commands include one for launching a directory listing with ease from a number selection in Startify. Can you identify it?
- Startify bookmarks can be very useful to launch familiar files by just typing an assigned alphabet as shown above.
- Please note the default Session 0 may not work before re-compiling the source codes. A work-a-round may be to save into a new session manually with :SSave Session_name. Upon vim startup, load the same session from Startify session section selection or with :SLoad Session_name.
Color schemes
How to change and set a color scheme for vim?
In VIM, type :col
orscheme followed with space and CTRL-d to view what color schemes are available for command completion. This setting will last for the current session. To set a persistent color scheme for future sessions, add this line into the ~/.vimrc file:colorscheme murphy
(Replace murphy with any other existing or installed color schemes via plugin e.g. Iceberg). You may need to also add this line to the same .vimrc file to view syntax colors:
syntax on
Note: I have tested some color schemes. These should be fine for basic writing e.g. Seoul256, Default, Iceberg and murphy (in order of preference).
margin-top:0em; margin-bottom:1em;">