Search Results

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

Page 20/54 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • Vimrc: how to reuse code and definitions for differnt file types?

    - by sixtyfootersdude
    I have defined my own file types using vim. For example I have: .classNotes .reportJotNotes .homework These file types are defined in .vim files: ~/.vim/syntax/homework.vim ~/.vim/syntax/reportJotNotes.vim ~/.vim/syntax/homework.vim Many of these things have several of the same code in them. Ie they all have this for titles: syn region JakeTitle start=+=== + end=+===+ oneline highlight JakeTitle ctermbg=black ctermfg=Yellow syn region JakeMasterTitle start=+==== + end=+====+ oneline highlight JakeMasterTitle cterm=bold term=bold ctermbg=black ctermfg=LightBlue Instead of having this in all three .vim files I would rather have it in one file and then in each file could source it. How can I do this?

    Read the article

  • Vim Register Use in Ex Mode

    - by Peck
    Potentially 2 questions in one. I would like to know how to reference a register in Ex mode. For instance, I'm editing a file and I want to save the file with a timestamp (or just datestamp really) appended to it. I know I can set register to the value of a shell commands output using: :let @a = system("date +\"%Y-%m-%d\"") Is there any to dereference this register and insert its value into an Ex command? Something like: :w testfile.<value of "a register> Copying to the system clipboard and pasting would be nice, but doing it in a more generic/programitic way for building on other commands in the future would be nice.

    Read the article

  • VI/VIM file handling

    - by Abhimanyu
    Nowa days I'm working with the Vi editor with the positive approach that you can do most things using it - unlike other editors. I came across one problem: Let's assume I have open a folder with vi <folder name> so it opens the folder in Vi and lists the files in that folder. I select a file and read the content, then I want to go back to the previous view which has filenames listed so it is easy to choose another file. But don't know how to achieve this. I'm hoping some method should be there to achieve this.

    Read the article

  • How to detect the position of window in vim

    - by Yogesh Arora
    I am trying to customize the mappings for vimdiff and make them similar to winmerge In a vertical 2 way split, I want to map alt-left <a-left> to move current diff to left side and alt-right <a-right> to move current diff to right side. For merging i can use :diffg and :diffp. But I need to know which split i am in so that i can use :diffg/:diffp in that. Is there any way by which i can detect which split i am in. Specifically is there is any way by which i can know whether the cursor is in left split or right split

    Read the article

  • vim how to comma align

    - by anon
    I have a bunch of code of the form: someVector.push_back(Foo("some name", 1.0, 3.1415926); someVector.push_back(Foo("different length name", 89.0, 2.717); ... 20 more entries I want sufficient space to be inserted so that my code is comma aligned, i.e. the "1.0," 's comma and the "89.0"'s comma are aligned -- is there builtins to do this?

    Read the article

  • [VIM] How to restrict operations to certain lines?

    - by Ayman
    I have to work some relatively huge code files. How do I restrict some operations like find-next normal-n and others to a certain function / block? How would I visually know if I'm within that block or outside it? Looking and line numbers seems awkward, specially that the line numbers I need to work with are generally 5 digits long!

    Read the article

  • vim: wrap question

    - by remio
    I would like to wrap the text 5 characters before the end of window (without breacking the line). I don't know how to do this without putting an EOL character in the text (wrapmargin/textwidth).

    Read the article

  • Vim syntax highlighting: make region only match on one line

    - by sixtyfootersdude
    Hello I have defined a custom file type with these lines: syn region SubSubtitle start=+=+ end=+=+ highlight SubSubtitle ctermbg=black ctermfg=DarkGrey syn region Subtitle start=+==+ end=+==+ highlight Subtitle ctermbg=black ctermfg=DarkMagenta syn region Title start=+===+ end=+===+ highlight Title ctermbg=black ctermfg=yellow syn region MasterTitle start=+====+ end=+====+ highlight MasterTitle cterm=bold term=bold ctermbg=black ctermfg=LightBlue I enclose all of my headings in this kind of document like this: ==== Biggest Heading ==== // this will be bold and light blue ===Sub heading === // this will be yellow bla bla bla // this will be normally formatted However right now when ever I use an equals sign in my code it thinks that it is a title. Is there anyway that I can force a match to be only on one line?

    Read the article

  • vim regular expression

    - by chappar
    I have following text in a file 23456789 When i tried to replace the above text using command 1,$s/\(\d\)\(\d\d\d\)\(\d\d\)*\>/\3\g I am getting 89. Should't it be 6789? Can anyone tell me why it is 89.

    Read the article

  • Vim + OmniCppComplete: Completing on Class Members which are STL containers

    - by Robert S. Barnes
    Completion on class members which are STL containers is failing. Completion on local objects which are STL containers works fine. For example, given the following files: // foo.h #include <string> class foo { public: void set_str(const std::string &); std::string get_str_reverse( void ); private: std::string str; }; // foo.cpp #include "foo.h" using std::string; string foo::get_str_reverse ( void ) { string temp; temp.assign(str); reverse(temp.begin(), temp.end()); return temp; } /* ----- end of method foo::get_str ----- */ void foo::set_str ( const string &s ) { str.assign(s); } /* ----- end of method foo::set_str ----- */ I've generated the tags for these two files using: ctags -R --c++-kinds=+pl --fields=+iaS --extra=+q . When I type temp. in the cpp I get a list of string member functions as expected. But if I type str. omnicppcomplete spits out "Pattern Not Found". I've noticed that the temp. completion only works if I have the using std::string; declaration. How do I get completion to work on my class members which are STL containers? Edit I found that completion on members which are STL containers works if I make the follow modifications to the header: // foo.h #include <string> using std::string; class foo { public: void set_str(const string &); string get_str_reverse( void ); private: string str; }; Basically, if I add using std::string; and then remove the std:: name space qualifier from the string str; member and regenerate the tags file then OmniCppComplete is able to do completion on str.. It doesn't seem to matter whether or not I have let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"] set in the .vimrc. The problem is that putting using declarations in header files seems like a big no-no, so I'm back to square one.

    Read the article

  • Vim + OmniCppComplete and completing members of class members

    - by Robert S. Barnes
    I've noticed that I can't seem to complete members of class members using OmniCppComplete. For example, given the following files: // foo.h #include <string> class foo { public: void set_str(const std::string &); std::string get_str_reverse( void ); private: std::string str; }; // foo.cpp #include "foo.h" using std::string; string foo::get_str_reverse ( void ) { string temp; temp.assign(str); reverse(temp.begin(), temp.end()); return temp; } /* ----- end of method foo::get_str ----- */ void foo::set_str ( const string &s ) { str.assign(s); } /* ----- end of method foo::set_str ----- */ I've set up tags for stdlibc++ and generated the tags for these two files using: ctags -R --c++-kinds=+pl --fields=+iaS --extra=+q . When I type temp. in the cpp I get a list of string member functions as expected. But if I type str. omnicomplete spits out "Pattern Not Found". I've noticed that the temp. completion only works if I have the using std::string; declaration. How do I get completion to work on my class members?

    Read the article

  • Vim OmniCppComplete on vectors of pointers

    - by Alex
    Hi, I might have done something wrong in the set up but is OmniCppComplete supposed to provide the members/functions of classes when doing this? vectorofpointers[0]-> At the moment all I get when trying that are things relating to the vector class itself, which obviously isn't very useful. I think it might have been working before I tagged /usr/include/ but I could be wrong. Also, is it possible to disable the preview window? I find it just clutters up my workspace. And since I enabled ShowPrototypeInAbbr I don't really need it. Thanks, Alex

    Read the article

  • Vim: Delete Buffer When Quitting Split Window

    - by Rafid K. Abdullah
    I have this very useful function in my .vimrc: function! MyGitDiff() !git cat-file blob HEAD:% > temp/compare.tmp diffthis belowright vertical new edit temp/compare.tmp diffthis endfunction What it does is basically opening the file I am currently working on from repository in a vertical split window, then compare with it. This is very handy, as I can easily compare changes to the original file. However, there is a problem. After finishing the compare, I remove the split window by typing :q. This however doesn't remove the buffer from the buffer list and I can still see the compare.tmp file in the buffer list. This is annoying because whenever I make new compare, I get this message: Warning: File "temp/compare.tmp" has changed since editing started. Is there anyway to delete the file from buffers as well as closing the vertical split window?

    Read the article

  • Run a macro in all buffers in vim

    - by Caleb Huitt - cjhuitt
    I know about the :bufdo command, and was trying to combine it with a macro I had recorded (@a) to add a #include in the proper spot of each of the header files I'd loaded. However, I couldn't find an easy way to run the macro on each buffer. Is there a way to execute a macro through ex mode, which is what :bufdo requires? Or is there another command I'm missing?

    Read the article

  • Smart search/replace in Vim

    - by Amir Rachum
    I have a file with the following expressions: something[0] Where instead of 0 there could be different numbers. I want to replace all these occurances with somethingElse0 Where the number should be the same as in the expression I replaced. How do I do that?

    Read the article

  • Vim: different key mapping for different window

    - by rahul
    My .vimrc file has filetype mappings for different filetypes such as : autocmd FileType sh map gf ... autocmd FileType ruby map gf ... While rewriting a program from one language to another, I have 2 splits, one with a shell script and one with ruby. I would assume that "gf" would take on its mapping based on filetype. However, it can only hold one mapping at a time. Is there any way to declare a mapping only for the existing file/window. I tried ":windo" and ":bufdo" but they work for all windows or buffers.

    Read the article

  • how to adjust the default width of taglist window in vim

    - by Haiyuan Zhang
    The default width of taglist window is too narrow for me and sometimes I can't see the whole function name in the window so I'd like to adujct the width of the window. I know use ctr-w > or ctr-w < I can adjust the window manually , but really want to change the default value of the taglisst window. so how I can actually do it ? thansk in advance.

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >