Search Results

Search found 1329 results on 54 pages for 'vim'.

Page 7/54 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Different background color for multiple filetypes in vim

    - by puk
    Is it possible to have different background colors in vim (ie. one light, one dark) when dealing with files with multiple filetypes (ie. :set ft=html.php)? In PHP code with HTML embedded, it can be difficult to see one single PHP statement amongst dozens of HTML lines, see below. I'll settle for anything, be it different bg color, a marker in the margin, a second left margin (one vim plugin does this for marks), maybe highlighting the <?php tag for example (although that's less than ideal) EDIT: I don't think this is possible at the syntax level as the syntax appears to use a limited number of elements (String, Function, Identifier...). This is no doubt to allow for the easy integration with colorschemes. SyntaxAttr is a good plugin to demonstrate this. Put it over any part of the code and it will tell you what syntax group it belongs to.

    Read the article

  • Fix YAML syntax highlighting in VIM

    - by Kevin Burke
    The YAML syntax highlighting in Vim 7.3 isn't great. Putting an apostrophe in a line of text triggers quote highlighting even when there's no quote. The same thing happens in other files sometimes too. I've posted a screenshot below. Is there any way to fix this behavior, or is there a different YAML syntax file I can use that won't trigger this behavior? This occurs in both MacVim and Vim in the Terminal. I'm running v7.3. Thanks for your help, Kevin

    Read the article

  • vim on Windows -Turn syntax highlighting OFF

    - by sandro
    I have downloaded Vim 7.4 on Windows 7 64 bit, and would like to turn off syntax highlighting. I have been using Vim for a long time on Unix, so I know to place "syntax off" in my vimrc. However, even though "syntax off" is in my vimrc, for some reason when I edit my vimrc the syntax highlighting is always on. I have deleted every other vimrc on my system (listed in the output of :version) except for my $HOME\_vimrc, but the syntax highlighting is still there (even after creating new cmd's). Any help would be greatly appreciated.

    Read the article

  • Multiple foldmethods in vim

    - by bjarkef
    I use the folding option of vim quite a lot, and have usually set foldmethod to syntax. Recently I discovered that it is possible to add custom folds, such that I can put whole blocks in /*{{{*/ and /*}}}*/ which is very useful for grouping large sections of a source file together. However to use that feature I need to set foldmethod to marker, and I loose the syntax folding. Is it possible to have two active foldmethods at the same time in vim? set foldmethod=syntax,marker does not work.

    Read the article

  • State variables in VIM

    - by dotancohen
    Is there any way to have a state variable in VIM? Consider: " Relative line numbers in Normal mode, absolute in Insert mode. Ctrl-N to toggle set relativenumber autocmd InsertEnter * :set number autocmd InsertLeave * :set relativenumber inoremap <C-n> <C-o>:call NumberToggle()<cr> nnoremap <C-n> :call NumberToggle()<cr> function! NumberToggle() if(useRelNums != 1) let useRelNums=1 set number else let useRelNums=0 set relativenumber endif endfunc Of course, useRelNums is undefined. I would like to keep this variable defined between calls to the NumberToogle() function, i.e. a state variable. How is this done? I'm sure that I could repurpose some other VIM variable as a workaround (such as the state of paste for a bad example) but I would prefer a real solution. Thanks.

    Read the article

  • CentOS-Like configuration of Vim on Ubuntu

    - by matejkramny
    Whenever I use a CentOS System, there's always a pleasant configuration of vim which mainly does the following: Remembering position of closed files Colour mode (!!!) Bash has colours There's lots more, just not something i can recall on the spot. Then, i go to ubuntu and its all black and white, no nice vim config etc. I have to use Ubuntu, and I hate ubuntu because of this. I know I can all configure it by myself, so my question is: How can I configure the Ubuntu system to behave (aesthetically) like CentOS? PS to future self: I will be stoned to death for asking such a question.

    Read the article

  • setup vim so that it searches the python path

    - by Dave
    I'm using vim as my primary editor with python files; I'd like to be able to easily open python files. As an example: I'm looking at a particular module A.py, in it I see the line import funkyModule, I want to edit that module so I just type in the command :pyed funkyModule and the pyed vim-command automatically finds the file funkyModule.py (or funkyModule/__init__.py) where ever it occurs on the python path. This capability is modeled on the capabilities if the ipython shell, where In [#]: edit funkyModule does what I've just described.

    Read the article

  • Vim Misbehaving

    - by zchtodd
    I'm not sure what changed, but lately Vim has been driving me nuts. Whenever I try to do a column mode insert, vim takes my current character and adds to the last character I inserted. For example, the first time I do a block comment by inserting # on multiple lines, it works fine. The next time, however, I end up with ## inserted on every line, and the problem just compounds from there. To do this, I'm hitting Ctrl-V, down or up arrow, Shift-I, #, and then Esc. This worked for months, but now it seems to be pasting extra stuff in. I've tried disabling all .vimrc files, but the behavior remains the same. Any ideas?

    Read the article

  • Dump vim screen into a file

    - by user18151
    I need to dump whatever is seen on the vim screen as it is, with colors and everything. Is there a way do to id. I am hoping that ncurses uses the same escape sequence for colors as bash. So when I'll do cat on the file that I've dumped the screen to, I should get the same output as the vim file. I want to use it in the scenario when I am doing a side by side colorful diff of files and need to print them. If anyone knows of any other side-by-side colorful diff programs, please feel free to mention in the comments (not answers because I am hoping that this question will be answered so that it can be used by others).

    Read the article

  • Vim: Bind <C-Enter>

    - by mtkoan
    Using vim for editing latex; how can I bind C-Enter? I tried the following, which does not work: imap <C-Enter> \\<CR> and imap <C-Return> \\<CR> However, something like: imap <C-i> \\<CR> Does work. Any ideas are suggestions for vim latex-addons?

    Read the article

  • Vim equivalent to Emacs C-i?

    - by Culip
    Does Vim have a command equivalent to Emacs' Ctrl-I? Emacs has an extremely useful shortcut "C-I" which fixes indentation of the current line (or selected lines.) For example, suppose you write this tiny code on Emacs: def foo print "boo" end and you are selecting the whole 3 lines. You press "C-I" then the code becomes def foo print "boo" end I can use this in quiet mode i.e. ignoring. Emacs as well. Does anyone know how to do this on Vim?

    Read the article

  • Vim - show diff on commit in mercurial;

    - by JackLeo
    In my .hgrc I can provide an editor or a command to launch an editor with options on commit. I want to write a method or alias that launches $ hg ci, it would not only open up message in Vim, but also would split window and there print out $ hg diff. I know that I can give parameters to vim by using +{command} option. So launching $ vim "+vsplit" does the split but any other options goes to first opened window. So I assume i need a specific function, yet I have no experience in writing my own Vim scripts. The script should: Open new vertical split with empty buffer (with vnew possibly) In empty buffer launch :.!hg diff Set empty buffer file type as diff :set ft=diff I've written such function: function! HgCiDiff() vnew :.!hg diff set ft=diff endfunction And in .hgrc I've added option: editor = vim "+HgCiDiff()" It kind of works, but I would like that splited window would be in right side (now it opens up in left) and mercurial message would be focused window. Also :wq could be setted as temporary shortcut to :wq<CR>:q! (having an assumption that mercurial message is is focused). Any suggestions to make this a bit more useful and less chunky? UPDATE: I found vim split guide so changing vnew with rightbelow vnew opens up diff on the right side.

    Read the article

  • Vim: Custom Folding function done, custom highlighting required

    - by sixtyfootersdude
    I have defined a function in vim to properly indent folds. Ie so they look like this: Unfolded this is text also text indented text indented text not indented text folded with default function this is text also text +-- 2 lines: indented text ---------------------------- not indented text folded with my new function this is text also text ++- 2 lines: indented text ---------------------------- not indented text The only problem is the the highlighting is still like this: folded with my new function (highlighting shown with tag) this is text also text <hi> ++- 2 lines: indented text ----------------------------</hi> not indented text I would like the highlighting to start at the ++ and not at the beginning of the line. I have looked in the vim manual but could not find anything like that. One so-so solution I found was to make the background black. highlight Folded ctermbg=black ctermfg=white cterm=bold But this make folds less visible. I have tried several variations of: syn keyword Folded lines syn region Folded ... But I don't think that this is the way that folds are selected. Can anyone offer a suggestion? By the way this is my function to indent the folds: set foldmethod=indent function! MyFoldText() let lines = 1 + v:foldend - v:foldstart let ind = indent(v:foldstart) let spaces = '' let i = 0 while i < ind let i = i+1 let spaces = spaces . ' ' endwhile let linestxt = 'lines' if lines == 1 linestxt = 'line' endif return spaces . '+' . v:folddashes . ' '. lines . ' ' . linestxt . ': ' . getline(v:foldstaendfunction endfunction au BufWinEnter,BufRead,BufNewFile * set foldtext=MyFoldText() By the way thanks to njd for helping me get this function setup.

    Read the article

  • Hard wrapping in vim without joining

    - by Miles
    Vim newbie here. How can I hard wrap plain text in vim (inserting actual linebreaks), respecting word boundaries, without joining existing lines? For example, given this: Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nulla cursus accumsan faucibus. - Donec dapibus dignissim ullamcorper. Integer nec malesuada diam. I'd like to get (with textwidth=30): Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nulla cursus accumsan faucibus. - Donec dapibus dignissim ullamcorper. Integer nec malesuada diam. instead of this (which I can get with gggqG) Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Nulla cursus accumsan faucibus. - Donec dapibus dignissim ullamcorper. Integer nec malesuada diam. Also, for bonus points: when I create a brand new buffer, I get different wrapping behavior (lines beginning with - aren't wrapped specially) than when I open a file ending in .txt. What controls this? I don't notice any difference in the output of :set filetype? or :filetype.

    Read the article

  • Vim autocommand on BufDelete prevents opening help window

    - by Kyle Strand
    I have the autocommand described here in my .vimrc: http://superuser.com/a/669463/199803 EDIT: Copied into body of question for convenience: function CountListedBuffers() let cnt = 0 for nr in range(1,bufnr("$")) if buflisted(nr) && ! empty(bufname(nr)) let cnt += 1 endif endfor return cnt endfunction function QuitIfLastBuffer() if CountListedBuffers() == 1 :q endif endfunction autocmd BufDelete * :call QuitIfLastBuffer() Bizarrely, though, it seems that if I have exactly one listed buffer, and I try to use the :help command, the help window fails to open (or perhaps opens and is immediately closed). If I comment out that autocommand line in my .vimrc, this behavior no longer occurs. Why is this happening, and how can I fix it? Why would :h even trigger the BufDelete event? EDIT: setting verbosity to level 12, I can see that the BufDelete event is indeed occurring. Here's the portion of the output that looks relevant to me: Executing BufAdd Auto commands for "*" autocommand call <SID>BMAdd() calling function <SNR>6_BMAdd calling function <SNR>6_BMAdd..<SNR>6_BMFilename calling function <SNR>6_BMAdd..<SNR>6_BMFilename..<SNR>6_BMMunge calling function <SNR>6_BMAdd..<SNR>6_BMFilename..<SNR>6_BMMunge..<SNR>6_BMTruncName function <SNR>6_BMAdd..<SNR>6_BMFilename..<SNR>6_BMMunge..<SNR>6_BMTruncName returning '/usr/local/share/vim/vim74/doc' continuing in function <SNR>6_BMAdd..<SNR>6_BMFilename..<SNR>6_BMMunge function <SNR>6_BMAdd..<SNR>6_BMFilename..<SNR>6_BMMunge returning 'help\.txt\ (4)\^I/usr/local/share/vim/vim74/doc' continuing in function <SNR>6_BMAdd..<SNR>6_BMFilename calling function <SNR>6_BMAdd..<SNR>6_BMFilename..<SNR>6_BMHash function <SNR>6_BMAdd..<SNR>6_BMFilename..<SNR>6_BMHash returning #340582286 continuing in function <SNR>6_BMAdd..<SNR>6_BMFilename function <SNR>6_BMAdd..<SNR>6_BMFilename returning #0 continuing in function <SNR>6_BMAdd function <SNR>6_BMAdd returning #0 continuing in BufAdd Auto commands for "*" Executing BufDelete Auto commands for "*" autocommand :call QuitIfLastBuffer()

    Read the article

  • Vim: auto-comment in new line

    - by padde
    Vim automatically inserts a comment when I start a new line from a commented out line, because I have set formatoptions=tcroql. For example (cursor is *): // this is a comment* and after hitting <Enter> (insert mode) or o (normal mode) i am left with: // this is a comment // * This feature is very handy when writing long multi-line comments, but often I just want a single line comment. Now if I want to end the comment series I have several options: hit <Esc>S hit <BS> three times Both of these afford three keystrokes, taken together with the <Enter> this means four keystrokes for a new line, which I think is too much. Ideally, I would like to just hit <Enter> a second time to be left with: // this is a comment * It is important that the solution will also work with different indentation levels, i.e. int main(void) { // this is a comment* } hit <Enter> int main(void) { // this is a comment // * } hit <Enter> int main(void) { // this is a comment * } I think I have seen this feature in some text editor a few years ago but I do not recall which one it was. Is anyone aware of a solution that will do this for me in Vim? Pointers in the right direction on how to roll my own solution are also very welcome.

    Read the article

  • Vim-like keyboard input in all text fields in all programs.

    - by vgm64
    So, I'm addicted to vim and often add lots of garbage to regular text fields when I try to use vim commands and am not in vim. I thought to myself, why can't vim be EVERYWHERE?! Then it struck me. Why not? Has anyone written a program that could redirect input/current text fields into a vim buffer so that one could use vim-style editing in things other than terminals and gVim? Redirect keyboard input? Alter a key-logger? Any thougts as to how it could be done?$wdw thoughtsA I did it again. I need serious help. Ideas, anyone?

    Read the article

  • Vim: change the quick fix title

    - by romeovs
    I'm using following makeprg to get my tex files compiled in vim: setlocal makeprg=pdflatex\ \-file\-line\-error\ \-shell\-escape\ \-interaction=nonstopmode\ $*\\\|\ tee\ \/dev\/tty\ \\\|\ grep\ \-P\ ':\\d{1,5}:\ ' which yields great results (errors displayed properly, tex compilation shown while busy,...) Yet, when there are errors and the quickfix window pops up, its status bar is cluttered up with the makeprg string: pdflatex\ \-file\-line\-error\ \-shell\-escape\ \-interaction=nonstopmode\ $*\\\|\ tee\ \/dev\/tty\ \\\|\ grep\ \-P\ ':\\d{1,5}:\ ' Is there a way of changing the quickfix title/statusbar?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >