4 ms·
Can vim do the following? I'm editing some project with 10000 C++ files. There is some C++ file I currently don't have open, say "palette.cpp" which is in a s
by Aardwolf 14y ago
Can vim do the following?
I'm editing some project with 10000 C++ files.
There is some C++ file I currently don't have open, say "palette.cpp" which is in a subdirectory "project/graphics/algorithms/color/".
Now I want to open palette.cpp without ever having to type, not even with tab autocompletion, that path.
IntelliJ (which I do use for C++ ;)) can do this easily: just press CTRL+R, then palette.cpp, ENTER, and there you are in that file.
Another thing: Some IDE's and editors have this feature where if you change lines, it marks it with some color on the left, as well as colors in the scrollbar, to immediately see which parts of the file were changed compared to git and/or the last time you opened it. Can Vim do this?
Thanks!
- shuzchen 14y agore: git changes, after seeing such a plugin for sublime (https://github.com/jisaacks/GitGutter https://github.com/jisaacks/GitGutter) I went ahead and implemented the same thing for Vim (https://bitbucket.org/sirpengi/iwilldiffer https://bitbucket.org/sirpengi/iwilldiffer). The plugin is still in beta status yet with compatibility, and I should make it easier to install with the various plugin managers as well as make the feature async (right now, the UI blocks waiting on the diff command). But otherwise, I'm using it daily and it supports mercurial as well as git.
- SeoxyS 14y agoThe CtrlP plugin will make opening these files a breeze. If you just trigger it and type palette.cpp, it should be the first match.
- tomsthumb 14y agowith your cursor on a filename that is a legitimate relative path, you can just press 'gf' to open the file from command mode. there is also a mirrored command of '^xf' in insert mode. slightly different work flow... ^o and ^i get used a lot in conjunction with 'gf', and are also pretty handy in general.
- Symmetry 14y agoBetter, you can type palete.cpp and it should still be the first match.
- manaskarekar 14y agoIt seems "find" will do you what you need. Source: http://stackoverflow.com/a/3407288 http://stackoverflow.com/a/3407288 Not sure if this helps but FuzzyFinder: http://www.vim.org/scripts/script.php?script_id=1984 http://www.vim.org/scripts/script.php?script_id=1984 Source: http://stackoverflow.com/a/573097 http://stackoverflow.com/a/573097
- johncoltrane 14y ago1. It is done like this: :e **/palette.cpp<CR> 2. You can try http://www.vim.org/scripts/script.php?script_id=3052 http://www.vim.org/scripts/script.php?script_id=3052 but I'm positive there are other implementations.
- deleted 14y ago[deleted]
- deleted 14y ago[deleted]
- wfn 14y agoMost of the things of such kind are available as vim plugins (for the 'open file without path' thing, see e.g. http://www.vim.org/scripts/script.php?script_id=858 http://www.vim.org/scripts/script.php?script_id=858) - you can then remap those new commands to keys/shortcuts.
- jlgreco 14y agoI do a large amount of my developing in vimdiff which, coupled with version control, does what you ask.
- jablan 14y ago> if you change lines, it marks it with some color on the left This is the feature that I miss the most in Vim, after working 5+ years in IDEs like Visual Studio. There are some Vim plugins addressing this (at least a year or so ago, when I searched), but nothing as elegant and seamless as in IDEs.
- mzs 14y agoI have vim as my EDITOR, then cscope does this and more.
- reyan 14y agoCtrlP takes care of that. Ctrl+P and then Ctrl+F (cycle to buffers list—you can also map this to anything you want) and it will list buffers with a + next to the buffers with local edits. Ctrl+D and it will change from full path to file name search. You can cycle between buffers, files, mru files and even more (tags, etc.) with extensions.
- fphilipe 14y agoI've mapped Ctrl+T to open CtrlP in tag mode.
- zer 14y ago> IntelliJ (which I do use for C++ ;)) If I may ask, how do you use it? The C/C++ plugin was unusable, last time I tried it.
- Aardwolf 14y agoThe C++ plugin is totally unusable and I uninstalled it immediately after trying. But I just made a manual set of syntax highlighting rules for C++, and that's good enough for me. The git integration and other IntelliJ features make up for the missing C++ navigation and refactoring features for me. I do everything related to compiling, debugging, and stuff (as well as all git committing and stuff, the IntelliJ git integration is about showing changed lines) from a terminal.
- njharman 14y agoYes.
- airblade 14y ago> Some IDE's and editors have this feature where if you change lines, it marks it with some color on the left, as well as colors in the scrollbar, to immediately see which parts of the file were changed compared to git and/or the last time you opened it. This does that: https://github.com/airblade/vim-gitgutter https://github.com/airblade/vim-gitgutter