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

Wednesday, June 4, 2014

vim split window

Working with multiple files

  • :e filename - Edit a file in a new buffer
  • :bnext (or :bn) - go to next buffer
  • :bprev (of :bp) - go to previous buffer
  • :bd - delete a buffer (close a file)
  • :sp filename - Open a file in a new buffer and split window
  • ctrl+ws - Split windows
  • ctrl+ww - switch between windows
  • ctrl+wq - Quit a window
  • ctrl+wv - Split windows vertically



http://www.worldtimzone.com/res/vi.html

Tuesday, October 25, 2011

spell checking on VIM

http://edwinux.blogspot.com/2011/03/vim-usage-spell-checking.html

Tuesday, October 11, 2011

Basic Unix Command and VIM tutorial

Source: http://freeengineer.org/learnUNIXin10minutes.html

Tuesday, October 4, 2011

VIM on Mac

Page up and down of
Ctrl + b
Ctrl + f

mouse activate in VIM on Mac
just press the alt key.
http://superuser.com/questions/125102/mac-os-x-terminal-mouse-support

Friday, April 1, 2011

Vim Tips

1. How to slip two window
$vim file1
:vsp file2(or do tab)  vertical split
:sp file2(or do tab) horizontal split
use Ctr+w to switch between windows

2. go the end of line and beginning of line
VI go to the end of line
$
VI go the beginning of the line
0
go to a specific line when your file is very large
$  vim filename 99999



3. another website taks about VIM tip


http://edwinux.blogspot.com/search/label/vim

4.To re-format a paragraph in VIM, type gqap in command mode

5. How to search
/search-keyword
 n: forward
shift+n: back

Friday, March 25, 2011

Settings for Vim on Linux or Mac

set nocompatible        " use vim defaults
set tabstop=8           " numbers of spaces of tab character
set shiftwidth=4        " numbers of spaces to (auto)indent
set showcmd             " display incomplete commands
set nobackup            " do not keep a backup file
set number              " show line numbers
set ignorecase          " ignore case when searching
set autoindent          " always set autoindenting on
set sm                  " show matching braces
syn on                  " syntax highlighing
set syn=auto            " syntax auto
set bkc=no

if has("autocmd")
         " Restore cursor position
         au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe(    "norm '\"")|else|exe "norm $"|endif|endif
endif

" Show line numbers
set number

" Make text wrap automatically at 70 columns
" when you type long lines
set textwidth=70

" Automatic indenting
set autoindent
set shiftwidth=4

" Buffer switching using Alt-Left/Right
" (or Command-Left/Right in Mac OS X)
:nnoremap <D-Right> :bnext<CR>
:nnoremap <M-Right> :bnext<CR>
:nnoremap <D-Left> :bprevious<CR>
:nnoremap <M-Left> :bprevious<CR>

Thursday, March 24, 2011

copy/paste from one file to another file in vim

if you open one file using: $vim file1, and open another file using: $vim file2
there is no way to copy the content from file1 to file2

but you could open two files by using on vim app, then you could do copy/paste

vim file1 file2
mark with ctrl+v and hit y to yank.
:n or :next to switch to the next file
p to paste
:prev and :previous will switch to the previous file.
you can also use :first and :last