LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 12-20-2004, 10:32 AM   #1
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Rep: Reputation: 30
Question vi Behaviour!


Hey Everybody!

I have a funny sort of question!

I have SuSe 9.0 (oh no! I am out of date!)

The program used most often by me is vi. (For interfacing anyway). I write all my scripts in vi (I am such a nerd! ). I have noticed something in the last few months.


On some systems, vi will do syntax colouring for PHP scripts, and many other things too.

On my machine it does not. How do I get it to do syntax colouring?

Secondly, I noticed that on some systems you can use the backspace key.

For me, I can only use the backspace key on text I just wrote. When I am in insert mode, I want to be able to backspace any character(including line feed!!!!!) It seems that after writing text, if I hit any other key (esc, arrow keys etc....), the backspace key does not work and I have to use arrow key and delete. I do not like this. And if I hit enter, that is it, there is no way to get my text back to the previous line, without crazy cutting and pasting (which I have not quite got a handle on).

Also, it seems I have misplace some commands such as startproc, init and shutdown. I do not know where they went....(embarassed look on my face) I think I may have inadvertantly deleted them. So my system has now been up for:
11:30am up 29 days 5:05, 4 users, load average: 0.02, 0.04, 0.01

Important question is syntax colouring and backspace key.

Thanks

David
 
Old 12-20-2004, 11:07 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Try using vim instead of vi... On many modern day machines vi is just a symbol link to vim in /bin.

I'll copy my .vimrc file in here so you can see what my options look like:

Code:
set cindent
set shiftwidth=8
set tabstop=8
" set textwidth=80
set expandtab
set ruler
" some colors:  "white on black"
hi normal   ctermfg=white  ctermbg=black guifg=white  guibg=black
hi nontext  ctermfg=blue   ctermbg=black guifg=blue   guibg=black
" Syntax Hilighting
syntax on
set nowrap

" enables real tabs for Makefiles only
augroup Makefile
au!
au BufReadPre Makefile set noexpandtab
augroup END

" vim -b : edit binary using xxd-format!
augroup Binary
au!
au BufReadPre  *.bin let &bin=1
au BufReadPost *.bin if &bin | %!xxd
au BufReadPost *.bin set ft=xxd | endif
au BufWritePre *.bin if &bin | %!xxd -r
au BufWritePre *.bin endif
au BufWritePost *.bin if &bin | %!xxd
au BufWritePost *.bin set nomod | endif
augroup END
 
Old 12-20-2004, 11:13 AM   #3
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Original Poster
Rep: Reputation: 30
Thanks

I had no idea where to look..

To do what I wanted with the backspace key

add

set backspace=eol,start,indent


to the .vimrc file


Thanks again!!

Last edited by dlublink; 12-20-2004 at 11:18 AM.
 
Old 09-20-2006, 08:45 AM   #4
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Original Poster
Rep: Reputation: 30
Alright, I just moved from suse to gentoo. I copied my .vimrc. But syntax colouring only does white. (Cyan for folded code).

What am I missing?

David

set ignorecase
set cindent
set shiftwidth=5
set tabstop=5
" set textwidth=80
set expandtab
set ruler
" some colors: "white on black"
hi normal ctermfg=white ctermbg=black guifg=white guibg=black
hi nontext ctermfg=blue ctermbg=black guifg=blue guibg=black
" Syntax Hilighting
syntax on

" enables real tabs for Makefiles only
augroup Makefile
au!
au BufReadPre Makefile set noexpandtab
augroup END

" vim -b : edit binary using xxd-format!
augroup Binary
au!
au BufReadPre *.bin let &bin=1
au BufReadPost *.bin if &bin | %!xxd
au BufReadPost *.bin set ft=xxd | endif
au BufWritePre *.bin if &bin | %!xxd -r
au BufWritePre *.bin endif
au BufWritePost *.bin if &bin | %!xxd
au BufWritePost *.bin set nomod | endif
augroup END
set backspace=indent,eol,start
set foldmethod=marker
 
Old 09-20-2006, 08:53 AM   #5
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Original Poster
Rep: Reputation: 30
I did emerge --search syntax, and found lots of options but non are for php.

I found that php.vim exists in /usr/share/vim/vim70/syntax.

I have syntax on in .vimrc. What am I missing?

I just realized what I am missing. My php scripts are not named php. They have a different extension. Where do I tell vim that this special extension is really just php files?

David

Last edited by dlublink; 09-20-2006 at 09:06 AM.
 
Old 09-20-2006, 09:14 AM   #6
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Original Poster
Rep: Reputation: 30
I figured it out. Trouble was in the file extension. Here we name our php files. .coolness. So I went into /usr/share/vim/vim70/.

filetype.old is a backup of filetype.vim. I made the changes in filetype.vim.

Hope this helps someone.

--- filetype.old 2006-09-20 10:09:16.000000000 -0400
+++ filetype.vim 2006-09-20 10:09:23.000000000 -0400
@@ -1153,7 +1153,7 @@
au BufNewFile,BufRead *.pod setf pod

" Php, php3, php4, etc.
-au BufNewFile,BufRead *.php,*.php\d setf php
+au BufNewFile,BufRead *.coolness,*.php,*.php\d setf php

" Phtml
au BufNewFile,BufRead *.phtml setf phtml
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
9.3 weird behaviour ????? bigjohn SUSE / openSUSE 9 07-06-2005 05:44 AM
slow behaviour cs-cam Linux - Newbie 4 03-24-2005 05:30 PM
Is this behaviour normal? Manuel-H Linux - General 2 01-20-2005 09:20 AM
Viewport-like behaviour in X Itzac Linux - Hardware 4 05-09-2004 04:49 AM
Strange Behaviour mikeyt_3333 Linux - General 4 08-06-2001 03:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 10:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration