Where is _vimrc

gVimPortable.exe

If you start gvim with gVimPortable.exe, it will load the file XX\gVimPortable\Data\settings_vimrc.

gvim.exe

If you start gvim with gvim.exe, it will load the file C:\Users\XXUSER_vimrc.

How to create a new file in commnad mode

The file will create after you save it with :w. It will locate to the directory gVimPortable\ex.tcl.

:e ex.tcl

Search for an exact word in command mode

/\<word\>

Enable auto save function

  1. Download and extract the latest vim-auto-save plugin.
  2. Copy vim-auto-save-x.x.x\plugin* to your vim directory vim80\plugin.
  3. Copy vim-auto-save-x.x.x\doc* to your vim directory vim80\doc.
  4. Append the content of file vim-auto-save-x.x.x\doc\tags to vim80\doc\tags.
  5. Place 'let g:auto_save = 1' to your vimrc.
  6. Restart vim.

Previewing markdown files

Add this to vimrc file. If you want to a live preview, you need to install Markdown Preview Plus extension to Chrome. Then set allow access to file URLs option enabled in the extension’s details page.

" Open markdown files with Chrome.
autocmd BufEnter *.md,*.markdown exe 'noremap <F5> :!start "C:\Users\tomas\AppData\Local\Google\Chrome\Application\chrome.exe" "%:p"<CR>'

How to sort

:sort -n

Save and run python script at the same time

Add bellow lines to vimrc file. You need to add double quotes in Windows.

map <F5> <Esc>:w<CR>:!"%:p"<CR>

How to change the temp directory

Add bellow lines to vimrc file.

" store backup, undo, and swap files in temp directory
set directory=~\tmp
set backupdir=~\tmp
set undodir=~\tmp

How to use template in gVimPortable

  1. Create you skeleton files to the directory XX\gVimPortable\Data\settings\templates\skeleton.txt.
  2. Add bellow lines to your vimrc file.
    augroup templates
      au!
      " read in templates files
      autocmd BufNewFile *.* silent! execute '0r ~\templates\skeleton.'.expand("<afile>:e")
    augroup END
    
  3. When you create a new file using :e xx.txt in command mode, it will auto load the skeleton file via the file extension.

Reference

how-to-use-a-template-in-vim