Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: vim...
Forum PHP.pl > Inne > Hydepark
sztosz
Ostatnio przerzuciłem sie z win2003 na Gentoo. I to jest chyba najmadrzejsza decyzja w ciągu ostatniego roku dotyczaca mojego kompa winksmiley.jpg. Odkryłem też vima i zacząłem go naprawdę lubic, na pewno kilkoro z was tez go używa. Nie chce sie przekopywać przez tony dokumentacji, więc mam pytanie czy zna ktoś jakies zasoby na temat "VIM Tips & Tricks" czyli jak uprzyjemnić sobie pracę z vimem? Chodzi mi o takie porady ustawienie kodowania na UTF-8 dlawszystkich plików(po godzinie w końcu do tego doszedlem winksmiley.jpg ) itp. Odpowiednie wyswietlanie składni, automatyczne numerowanie lini (zwijanie kodu worriedsmiley.gif )itd. Wszystko pod katem php... Uzywam GVIM'a i moge se poklikac aby to miec, ale wolałbym od razu...BEZ uczenia sie dokumentacji na pamiec rolleyes.gif
Jabol
Cytat
set nocompatible
set backspace=indent,eol,start
" zapamietywane w viminfo
set viminfo='20,\"50,h history=50
" linijka z dolu ekranu
set ruler
" sciezka szukania plikow dla ^Wf, gf itd.
set path=.,/usr/include,/usr/local/include

"set autoindent
filetype indent on
if has("autocmd")
  set nu
  " pliki HTML i php edytujemy z rozsadnym kodowaniem
  "autocmd FileType html,php e! ++enc=iso8859-2
  " w HTML dodajemy < i > jako nawiasy
  autocmd FileType html,php set matchpairs+=<:> indentexpr= autoindent
  autocmd FileType css set indentexpr=a
  autocmd FileType cpp set path+=/usr/include/g++-3

  " przywracanie pozycji w pliku
  "autocmd BufReadPost * if line("'\"") | exe "'\"" | endif

  " w plikach Makefile ustawiamy tabulator na 4 znaki itd.
  autocmd FileType make setlocal noet ts=4 sw=4 sts=4
  au FileType python source .vim/python.vim
endif

" Don't use Ex mode, use Q for formatting
map Q gq

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

function! Iso2win()
  %s/+-/^1/ge
  %s/P/*/ge
  %s/ 1/4/*/ge
  %s/!/YEN/ge
  %s/|/*/ge
  %s/NOT/*/ge
  set fileformat="dos"
endfunction
function! Win2iso()
  %s/^1/+-/ge
  %s/*/P/ge
  %s/*/ 1/4/ge
  %s/YEN/!/ge
  %s/*/|/ge
  %s/*/NOT/ge
  set fileformat="unix"
endfunction
function! DelIso()
  %s/ae/c/ge | %s/e/e/ge | %s/^3/l/ge | %s/n/n/ge | %s/ó/o/ge | %s/?/z/ge
  %s/AE/C/ge | %s/E/E/ge | %s/-L-/L/ge | %s/N/N/ge | %s/Ó/O/ge | %s/-/Z/ge
  %s/+-/a/ge | %s/P/s/ge | %s/ 1/4/z/ge | %s/!/A/ge | %s/|/S/ge | %s/NOT/Z/ge
endfunction
function! DelWin()
  %s/ae/c/ge | %s/e/e/ge | %s/^3/l/ge | %s/n/n/ge | %s/ó/o/ge | %s/?/z/ge
  %s/AE/C/ge | %s/E/E/ge | %s/-L-/L/ge | %s/N/N/ge | %s/Ó/O/ge | %s/-/Z/ge
  %s/^1/a/ge | %s/*/s/ge | %s/*/z/ge | %s/YEN/A/ge | %s/*/S/ge | %s/*/Z/ge
endfunction

if has("autocmd")
  augroup gzip
    " Remove all gzip autocommands
    au!

    " Enable editing of gzipped files
    "    read: set binary mode before reading the file
    "          uncompress text in buffer after reading
    "    write: compress file after writing
    "  append: uncompress file, append, compress file
    autocmd BufReadPre,FileReadPre      *.gz set bin
    autocmd BufReadPost,FileReadPost    *.gz let ch_save = &ch|set ch=2
    autocmd BufReadPost,FileReadPost    *.gz '[,']!gunzip
    autocmd BufReadPost,FileReadPost    *.gz set nobin
    autocmd BufReadPost,FileReadPost    *.gz let &ch = ch_save|unlet ch_save
    autocmd BufReadPost,FileReadPost    *.gz execute ":doautocmd BufReadPost " . expand("%:r")

    autocmd BufWritePost,FileWritePost  *.gz !mv <afile> <afile>:r
    autocmd BufWritePost,FileWritePost  *.gz !gzip <afile>:r

    autocmd FileAppendPre                      *.gz !gunzip <afile>
    autocmd FileAppendPre                      *.gz !mv <afile>:r <afile>
    autocmd FileAppendPost              *.gz !mv <afile> <afile>:r
    autocmd FileAppendPost              *.gz !gzip <afile>:r
  augroup END
endif

if &term=="xterm"
  set t_Co=8
  set t_Sb=^[4%dm
  set t_Sf=^[3%dm
  " pod xtermem brzydko wyglada podswietlanie skladni
  syntax off
endif

" some extra commands for HTML editing
nmap \m wbgueyei<<ESC>ea></<ESC>pa><ESC>bba
nmap \h1 _i<h1><ESC>A</h1><ESC>
nmap \h2 _i<h2><ESC>A</h2><ESC>
nmap \h3 _i<h3><ESC>A</h3><ESC>
nmap \h4 _i<h4><ESC>A</h4><ESC>
nmap \h5 _i<h5><ESC>A</h5><ESC>
nmap \h6 _i<h6><ESC>A</h6><ESC>
nmap \b wbi<b><ESC>ea</b><ESC>bb
nmap \i wbi<i><ESC>ea</i><ESC>bb
nmap \u wbi<u><ESC>ea</u><ESC>bb
nmap \r wbi<s><ESC>ea</s><ESC>bb
nmap \t wbi<tt><ESC>ea</tt><ESC>bb
nmap \e wbi<em><ESC>ea</em><ESC>bb
nmap \s wbi<strong><ESC>ea</strong><ESC>bb
nmap \x wbF<df>f<df>

noremap  <F5> :bN<CR>
inoremap <F5> <Esc>:bN<CR>
noremap  <F6> :bn<CR>
inoremap <F6> <Esc>:bn<CR>
noremap <C-w>l :ls
noremap <C-w><C-l> :ls!
inoremap <C-k> <C-O>D

nmap # #:noh
nmap * *:noh

" automatycznie przechodz do katalogu z plikiem
" ustawienia tabulatora
set shiftwidth=4 tabstop=4 expandtab softtabstop=4
" tekst na 78 kolumn, formatowanie komentarzy i tekstu
  autocmd FileType txt set textwidth=78 formatoptions=tcroql1 nojoinspaces
" opcje dla formatowania C/C++/Java
set cinoptions=>1s,n0,f0,{1s,}0,^-1s,:1s,g0,+1s,(0
" pokazywanie par nawiasow
set showmatch matchtime=3
set showfulltag virtualedit=block
" nowe okna pod spodem i na prawo
set splitbelow splitright
" opcje szukania
set incsearch noignorecase
" bez ekranu powitalnego
set shortmess+=I showcmd

" if we are in C/C++ file set browsed man sections to useful for programmist,
" if we are in SH/CSH file - set sections to useful for script-writter
if has("autocmd")
  autocmd FileType c,cpp  let $MANSECT="2:3:7:4"
  autocmd FileType sh,csh let $MANSECT="1:5:8:4"
endif
" load man plugin and let K letter to be "keyword man search" command
runtime ftplugin/man.vim
noremap K :exec 'Man ' . expand("<cword>")<CR>
mój .vimrc - nie ja go pisałem i go nie rozumiem w większości, ale działa ok winksmiley.jpg.
Strona domowa Dozziego (pamięta ktoś stare Linuxweb? winksmiley.jpg ). Stamtąd mam tą konfigurację i stronka też jest ogólne fajna
VimWiki A tutaj taki mały dodatek
sztosz
Dzieki Jabol smile.gif Zwłaszcza linki mi pomogły smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.