LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-11-2008, 04:07 PM   #1
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374

Rep: Reputation: 47
Strange Vim behavior in ubuntu, # goes to start of line.


The cursor jumps to the start of the line whenever I try to type a comment on an empty line while indented.

new line, go to insert mode, tab over any amount, type '#', and the cursor jumps.

I use the same vimrc fiel in gentoo w/o this problem, so I think it is probably an ubuntu setting.

My vimrc file:
Code:
:set number
:set incsearch
:set hidden
:set tabstop=4
:set shiftwidth=4
:set expandtab
:set list
:set listchars=tab:>.,trail:_
:map <F11> :w<cr>:! provep6 %<CR>
:imap <F11> <ESC>:w<cr>:! provep6 %<CR>
:map <F10> :w<cr>:! perl t/harness --fudge --keep-exit-code %<CR>
:imap <F10> <ESC>:w<cr>:! perl t/harness -v --fudge --keep-exit-code %<CR>
:map <F9> :w<cr>:! prove -v -I. -Ilib -It %<CR>
:imap <F9> <ESC>:w<cr>:! prove -v -I. -Ilib -It %<CR>
:map <F5> :w<cr>:! svn diff %<CR>
:imap <F5> <ESC>:w<cr>:! svn diff %<CR>
:map <F6> :w<cr>:! svn ci %<CR>
:imap <F6> <ESC>:w<cr>:! svn ci %<CR>
:map <F7> :w<cr>:! perldoc %<CR>
:imap <F7> <ESC>:w<cr>:! perldoc %<CR>
:map <delete> xi
:map <space> i 
:map <tab> i<tab>
:map <return> a<CR>
:set autoindent
:set smartindent
:set foldmethod=marker
:set wildmenu
:set wildmode=list:longest
:set scrolloff=5
:set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
:set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp


syntax on
filetype on
set exrc            " execute all found .vimrc files
" :setlocal spell spelllang=en

if has("autocmd")
  " Drupal *.module files.
  augroup module
    autocmd BufRead *.module set filetype=php
  augroup END
endif
 
Old 11-26-2008, 09:59 PM   #2
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849

Rep: Reputation: 552Reputation: 552Reputation: 552Reputation: 552Reputation: 552Reputation: 552
Quote:
The cursor jumps to the start of the line whenever I try to type a comment on an empty line while indented.

new line, go to insert mode, tab over any amount, type '#', and the cursor jumps.

I use the same vimrc fiel in gentoo w/o this problem, so I think it is probably an ubuntu setting.
You never mentioned what sort of file you were working on (shell script, C code, etc.) but there are language-specific syntax files that are probably different between your Ubuntu and Gentoo systems. (Does this signal a resumption of the "indent style" wars of long ago?) These aren't the same as your .vimrc file.

Look at the vim(1) manpage near the bottom in the FILES section for the location of these files. (On my SuSE system they're in /usr/share/vim/vim71/syntax/.) For what it's worth, us Emacs users have the same trouble; some systems have Emaces that have different ideas how far to indent for, say, Perl scripts. (Drives me crazy sometimes when I move a script from one flavor of UNIX to another.)

I'm not sure if it's possible to move those files from the system that behaves the way you prefer onto the system that has the odd pound-sign behavior. Worth a try but I'd tar up the exiting "syntax" subdirectory in case the files are, for some reason, incompatible. (Then just untar to restore the "syntax" subdirectory.)

Hope this helps...

--
Rick
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Strange behavior of Network Manager in Ubuntu 7.10 depam Linux - Software 3 01-13-2008 06:29 PM
annoying vim behavior pauloco Linux - Software 0 09-27-2005 01:10 PM
Very Strange Behavior raysr Mandriva 4 08-31-2004 03:06 PM
Strange Behavior andrewb758 Linux - Hardware 5 08-31-2003 03:42 PM
strange behavior abhijit Linux - General 3 07-10-2003 12:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:24 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