VIM - Linux Slackware

Kilka porad odnośnie edytora VIM Poniżej zamieszczam kilka przydatnych informacji odnośnie edytora VIM. W zasadzie to są one przydatne głównie dla mnie a ta strona jest po to, abym niczego nie zgubił w przyszłości ;) Może jednak komuś z Was się coś przyda.

Nowe rozszerzenie w kolorowaniu składni Problem: mamy jakieś nowe rozszerzenie pliku (np.lib) i chcemy, aby pliki tego rodzaju używały kolorowania składni z wybranego języka (np.php). Znam trzy rozwiązania. W pierwszych dwóch należy najpierw znaleźć plik filetype.vim:
# locate filetype.vim
/usr/share/vim/vim63/filetype.vim
Teraz przystępujemy do edycji powyższego pliku. Pierwsza metoda:
  1. Szukamy ciągu au BufNewFile,BufRead *.php,*.php3 setf php (jeśli nie znajdziemy to szukamy po prostu php i czegoś w rodzaju owej linii)
  2. Dodajemy tutaj nasze rozszerzenie: au BufNewFile,BufRead *.php,*.php3,*.lib setf php
  3. Upewniamy się, iż nie ma konfliktów - to rozszerzenie może być przypisane do innego rodzaju pliku! Czyli szukamy ciągu lib w pliku filetype.vim, i w linijce postaci au BufNewFile,BufRead *.lib setf cobol usuwamy nasze *.lib


Metoda druga: na samym końcu pliku filetype.vim dodajemy taki wpis (zmieniając oczywiście rozszerzenia tak aby pasowały do tego co chcemy otrzymać):

" my filetype file
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile *.lib setfiletype php
augroup END


No i ostatnia metoda (thx Frogu) - najprostsza... edytujemy bezpośrednio plik .vimrc dodając na jego końcu:

augroup filetypedetect
        au! BufRead,BufNewFile *.lib setfiletype php
augroup END
	

plik konfiguracyjny .vimrc
colorscheme elflord
highlight Comment ctermfg=darkgreen
set history=1000
set mouse-=a
:syntax enable
augroup filetypedetect
        au! BufRead,BufNewFile *.lib setfiletype php
augroup END
set nobackup
set nowritebackup

Dodaj swój komentarz
Aby dodać komentarz wystarczy podać jego treść - pozostałe pola nie są obowiązkowe. Zaznaczenie zapamiętania nicka i adresu e-mail spowoduje, iż w każdej chwili gdy wrócisz do tej strony i będziesz chciał(a) wpisać kolejny komentarz pola nick oraz e-mail zostaną automatycznie wypełnione:
 
Nick:    E-mail:

Zapamiętaj mój nick i email    Ukryj mój adres email

Wasze komentarze
 ukryj komentarze 
::mikejohnsonrules (johnsonjones20@gmail.com) 2010-03-11 06:36:00
Hello. My wife and I bought our house about 6 months ago. It was a
foreclosure and we were able to get a great deal on it. We also took
advantage of the 8K tax credit so that definitely helped. We did an
extensive remodeling job and now I want to refinance to cut the term
to a 20 or 15 year loan. Does anyone know any good sites for mortgage
information? Thanks!

Mike
::Jannonepouddy (astromicheals@yahoo.co.uk) 2010-03-10 06:21:00
Howdy im a newb here. Hopefully i mighnt be able to contribute to this
website, Just though id pop in and say hi!

thanks alot.
::fharefinanceallacrosstheus (juicemasterb40@gmail.com) 2010-03-05 18:52:00
Hello. I am sorry if this may be off topic. I have been in the
mortgage business for the last 10 years. I have certainly seen a lot
of ups and downs. I am certainly in this for the long haul. If you
need honest, sound mortgage information, I am your guy. Lets be
honest, it is not getting any easier for any of us. It is important
that you work with a company that knows the current guidelines and can
steer you in the right direction. My customers come back to me time
and time again because of this. Please visit the link in my profile
for up to date rates, gudelines, and programs. I hope to hear from you
soon.
::fharefinanceallacrosstheus (juicemasterb40@gmail.com) 2010-03-05 14:59:00
Hello. I am sorry if this may be off topic. I have been in the
mortgage business for the last 10 years. I have certainly seen a lot
of ups and downs. I am certainly in this for the long haul. If you
need honest, sound mortgage information, I am your guy. Lets be
honest, it is not getting any easier for any of us. It is important
that you work with a company that knows the current guidelines and can
steer you in the right direction. My customers come back to me time
and time again because of this. Please visit the link in my profile
for up to date rates, gudelines, and programs. I hope to hear from you
soon.
::XRumerTest (yourmail@gmail.com) 2010-03-05 08:22:00
Hello. And Bye.
::Occugssof (appeltexhal@atlantmail.com) 2010-03-03 23:27:00
Hello, Good Website i hope be able to contribute here.
Thanks.
::mskhirakutwo (vinay.javia@gmail.com) 2010-03-03 14:40:00
"...one of the strongest motives that lead men to art and science
is escape from everyday life with its painful crudity and hopeless
dreariness, from the fetters of one's own ever-shifting desires. A
finely tempered nature longs to escape from the personal life into the
world of objective perception and thought." - Albert Einstein !



what is the point of this quote ?
::DannyPK (ShifferserryKar@ma1l.bij.pl) 2010-02-28 03:33:00
I bring about your blog on google and read a scarcely any of your
other posts. I nothing but added you to my Google News Reader. Curb
up the good work. Look pushy to reading more from you in the future.
::ashmichaelss (ashmichaelss@gmail.com) 2010-02-25 09:53:00
Hello. I just moved to the Miami area. I am looking for a solid
company to help me with a refinance. I purchased the house from a
short sale and had to do business over the phone because I was living
in Az. I dont think that I got a good deal. My interest rate in now
6.99 percent. I think that I can refinance and get a much better deal.
Please point me in the right direction.
::ashmichaelss (ashmichaelss@gmail.com) 2010-02-25 06:01:00
Hello. I just moved to the Miami area. I am looking for a solid
company to help me with a refinance. I purchased the house from a
short sale and had to do business over the phone because I was living
in Az. I dont think that I got a good deal. My interest rate in now
6.99 percent. I think that I can refinance and get a much better deal.
Please point me in the right direction.
::dembimanuel (debbi.manuel@mail.ru) 2010-02-18 20:08:00
myself kinda like this website
discovered this website via bing
::XRumerTest (yourmail@gmail.com) 2010-02-17 17:54:00
Hello. And Bye.
::chkbse (andreykozyavkin@gmail.com) 2010-02-16 02:46:00
Hello. Please delete this message.
::butred (butred@gmail.com) 2010-02-10 20:01:00
Âńĺ ó Âŕń őîđîřî, ŕ âîň ĺńëč áű ńäĺëŕëč đŕńńűëęó íŕ ńŕáńęđŕéáĺ , ňî
âîîáůĺ âńĺ çŕěĺ÷ŕňĺëüíî!
::differeture (differeture@gmail.com) 2010-02-09 18:11:00
Őîđîřî čçëŕăŕĺňĺ ěűńëč, đĺńďĺęň!
::miller bennett (millerbennett@mail.ru) 2010-02-09 15:26:00
Nice work! Why cant we just keep it simple and talk about the
superbowl?
::miller bennett (millerbennett@mail.ru) 2010-02-09 10:37:00
Nice work! Why cant we just keep it simple and talk about the
superbowl?
::zeanetg (zeanet.g@mail.ru) 2010-02-07 22:05:00
i am new in the site
came while looking something.
i like this site
::Mobiokid (mobiokid@mail.ru) 2010-02-07 02:36:00
Один из
самых
крупны&
;#1093; на
сегодн&
;#1103;шний
день
видеоп&
;#1086;ртало&#10
74;, у нас
есть
все
самые
популя&
;#1088;ные
фильмы,
записи,
подбор&
;#1082;и и так
далее!
Заходи&
;#1090;е к нам
и
убедит&
;#1077;сь
сами!
::mens sandals (jonesjosh@mail.ru) 2010-02-06 15:46:00
Nice work! I can't get Welcome to the Jungle out of my head! ''Welcome
to The Jungle, We've Got Fun And Games"
::mens sandals (jonesjosh@mail.ru) 2010-02-06 12:56:00
Nice work! I can't get Welcome to the Jungle out of my head! ''Welcome
to The Jungle, We've Got Fun And Games"
::debbiemcleen (debbie.mcleen@gmail.com) 2010-02-03 09:26:00
shalom

just got my account approved on the forum

this is a good place
::elenahambright (amanda.hambright@gmail.com) 2010-01-21 08:36:00
shalom

just registered on the forum

this is a good place
::emeliajines (emeliajines@mail.ru) 2010-01-18 09:28:00
So Come on? Is that really the best that you can do?
::emeliajines (emeliajines@mail.ru) 2010-01-18 06:10:00
So Come on? Is that really the best that you can do?
::elena.walker (elena.walker@mail.ru) 2010-01-17 09:35:00
howdy-do

just got my account approved on the forum

I already like it here
::jamesjonesy (jamesjonesy@mail.ru) 2010-01-17 03:06:00
Thats right! Don't be afraid to speak your mind. This is the 21st
century, right?
::rickybobby (rickybobby@mail.ru) 2010-01-16 13:01:00
Hello. With all the misinformation that is out there, I figured that I
would start a new forum to help anyone with mortgage advice. I have
been in the mortgage business for 10 years and am happy to answer your
questions. If you need help with an fha or debt consolidation
refinance. Please let me know. Dont be shy!
::CocoChanels (cocochanelske@gmail.com) 2009-07-01 15:58:00
Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on
the Internet, this is the best program!
::johnronni (alextestik@gmail.com) 2009-02-24 08:57:00
HI all,
where i find drivers for Minolta CF2002?
this is wery important for me, please hlp
If I wrote is not in the correct section, please move to the
appropriate section.
sorry my bad english, i use translator
::Valeria2009-02-01 23:47:00
Very useful and informative article! Thanks the author!
::docent (docent.net@gmail.com) 2008-10-08 09:58:00
Hmm. read http://dev.mysql.com, http://www.mysqlperformanceblog.com
and practise.. a lot :)
::werutzb (werutzb@gawab.com) 2008-10-08 05:31:00
Hi!

I would like extend my SQL capabilities.
I red that many SQL resources and would like to
get more about SQL for my work as mysql database manager.

What would you recommend?

Thanks,
Werutz
::docent (docent.net@gmail.com) 2008-02-12 13:32:00
Ehh - pokolenie GG i Pokemonów - nic dodać, nic ująć.
::exeMan2008-02-12 13:08:00
linuks to kiszka tylko jakieś pisanie, zero klikania
::docent (docent.net@gmail.com) 2007-11-16 13:21:00
Ha - widzisz Frogu - nie wpadłem na to :D Dzięki ;)
::frogu (proszek@gmail.com) 2007-11-16 09:49:00
Wszystko fajnie jak masz roota, a tak poza tym, to grzebanie w plikach
systemowych jest niekoszerne :P

dopisz sobie do ~/.vimrc

augroup filetypedetect
au! BufRead,BufNewFile *.lib setfiletype php
augroup END

Nie łatwiej?
 ukryj komentarze