.vimrc มีอะไรกันบ้าง

  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 1005 is not allowed to access /tmp owned by uid 0 in /var/www/sites/sugree/codenone.com/subdomains/www/html/includes/file.inc on line 190.
  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 1005 is not allowed to access /tmp owned by uid 0 in /var/www/sites/sugree/codenone.com/subdomains/www/html/includes/file.inc on line 190.

เห็นขา emacs เค้าถกกันยาวเฟื้อย ผมยังศรัทธาใน Vim อยู่เลยรู้สึกว่ายอมไม่ได้แล้ว ต้องไม่น้อยหน้า ดังนั้นขา Vim มาแลกเปลี่ยนเทคนิคกันบ้างดีกว่า เริ่มจาก .vimrc ของแต่ละคนดีกว่า

ของผม (มีไม่ค่อยเยอะ)

syntax on # ไว้ไฮไลท์สี
filetype on # ตรวจสอบไฟล์จากนามสกุล ไว้ใช้กับข้อข้างบน
set tabstop=2 # เอาเล็กๆ พอ ไม่งั้นเวลาแก้ html ซ้อนกันเยอะๆ แล้วมันจะตกขอบ
set number # เลขบรรทัด
set hlsearch # เวลาสั่งหาด้วย / แล้วเน้นสี
set incsearch # ค้นหาแบบ incremental (เหมือนใน firefox)
set autoindent # ตามชื่อ 
set laststatus=2 # ให้ last line เป็น 2 บรรทัด 
set ruler # แสดง column ที่เคอร์เซอร์อยู่
map <F2> :call ToggleNumber()<CR><CR>
function! ToggleNumber()
  if &number 
    set nonumber 
  else
    set number
  endif
endfunction
pittaya's picture
syn on
set nu
set tabstop=2
set et
set hlsearch

et คือะไร,
nu คืออะไร
(นิสัยเสีย ขี้เกียจเปิดคู่มือ)

sugree's picture

et น่าจะเป็น expandtab เหมือนผม ส่วน nu ก็คือ number ครับ อืม เหมือนๆ กันเลยแฮะ

set nocompatible
 
syntax on
set tabstop=4
set expandtab
set shiftwidth=4
 
augroup JumpCursorOnEdit
  au!
  autocmd BufReadPost *
    \ if expand("<afile>:p:h") !=? $TEMP |
    \   if line("'\"") > 1 && line("'\"") <= line("$") |
    \     let JumpCursorOnEdit_foo = line("'\"") |
    \     let b:doopenfold = 1 |
    \     if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) |
    \        let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 |
    \        let b:doopenfold = 2 |
    \     endif |
    \     exe JumpCursorOnEdit_foo |        
    \   endif |
    \ endif
  " Need to postpone using "zv" until after reading the modelines.
  autocmd BufWinEnter *
    \ if exists("b:doopenfold") |
    \   exe "normal zv" |
    \   if(b:doopenfold > 1) |
    \       exe  "+".1 |
    \   endif |
    \   unlet b:doopenfold |
    \ endif
augroup END
syntax on
filetype on
set hlsearch
set ruler
set ts=4
set sw=4
set autoindent
set expandtab
filetype indent on

ดูธรรมดา ๆ แหะ

veer's picture
set ts=4
syntax on
set shiftwidth=4
set ai
set cindent shiftwidth=4
set nu

cindent นี่มันจะซ้ำกับ shiftwidth ธรรมดาปะ งงๆ จำไม่ได้แล้วด้วยว่าใส่ไปทำไมกันแน่ :-P

:color desert
:sy on
:set cindent shiftwidth=4
:set guifont=TlwgTypewriter\ 11
:set hlsearch
nnoremap :TlistToggle

//ลง taglist ไว้ด้วยครับ เอาไว้ browse code นิดนึงสวยดี
// ปกติใช้ gvim เพราะสีมันสวย แต่ถ้า remote ก็ต้อง vim

set autoindent
set showmatch " โชว์คู่ปีกกา
set number
set shiftwidth=4
set tabstop=4
set expandtab " แทนที่ space ด้วย tab
set softtabstop=4 " ใช้ tab แทน space ได้

syntax enable
map - w " ไว้กดเปลี่ยนไฟล์ง่ายๆ

ย้าย Codenone

ประกาศย้าย Codenone ไปใช้ Forum ของ Blognone แทนครับ ตามไปตั้งกระทู้ต่อได้ที่ Codenone Forum (รายละเอียดอ่านจากกระทู้ ย้าย Codenone ไปรวมกับ Blognone)

กระทู้เก่าๆ จะย้ายตามไปในภายหลัง ตอนนี้ปิดการโพสต์กระทู้ไว้ เหลือไว้เฉพาะอ้างอิงเท่านั้น