Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

To edit configuration files, I'm using Vim. In order to move the cursor upwards or downwards to other configuration entries, I'm using Ctrl+d or Ctrl+u, respectively. Large blocks of commented lines with few configuration lines messes it all up, and I often oversee non-commented lines.

Is there a a kind of motion to move the cursor down to the next non-commented line without using hard to type regular expressions?

share|improve this question
    
There's this plugin for programming languages: vim.org/scripts/script.php?script_id=4581 –  slm Jun 28 at 16:16

2 Answers 2

up vote 3 down vote accepted

You can use the regexp just once (something like /^[^#], i.e. find a line which starts with other than # character) and then search for next occurence with simple n command.

share|improve this answer

to answer your question:

Is there a a kind of motion to move the cursor down to the next non-commented line without using hard to type regular expressions?

No there isn't any direct way to do this beyond using a regular expression such as :/^[^#]. There are other plugins to Vim which you can use such as vim-identifier-movement, which allow you to move the cursor in other ways but they do not give you the ability to skip over comments directly.

excerpt

description

vim plugin, one way to improve move using "w W b B", smartly move between language identifier, skip language keywords,comment,strings

default key mapping: <C-n> next language identifier <C-p> previous language identifier

current support language: c, c++, vim, python

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.