How to hide these annoying gutters in MacVim? - vim

I scoured Google and SO for an answer but really couldn't find one, probably because I don't know the real name of these things.
annoying gutter
These gutters indicate nesting levels and folding options with little pluses and minuses and are completely useless to me, and take up a lot of spaces especially when working in split viewports.
Do you know how to get rid of them?
FYI I'm using the Janus distribution

That "gutter" is the fold column. You can turn it off via
:set foldcolumn=0
However, this usually is set by a plugin or a filetype plugin, so it will probably reoccur. You can find out who did this via
:verbose set foldcolumn?
If it's been set up by a filetype plugin foo, you can put the command to turn it off into .vim/after/ftplugin/foo.vim. If it's a plugin, read up on its documentation. (That's the downside of pre-made Vim distributions like Janus!)

Related

Vim indent folding dependencies

I'm trying to enable vim indent folding.
From what I can see online, setting :set fdm=indentshould just work. For me, it doesn't do anything. I can fold manually, but I'm quite strict about indenting code, so indent-folding is ideal. I use spaces to indent (two spaces per level)
My ~/.vimrc looks like this:
set foldmethod=indent
and is definitely being loaded (according to :scriptnames)
Is vim folding in some way dependent on the file type? I'm writing C CUDA, so the extension is .cu.
Do I have to install some sort of plugin for indent folding? I know it's a broad question, but this seems like basic functionality and I have no idea why it's not working.
set nofoldenable turns off folding, it should be set foldenable to enable it
Also set foldlevel=2 sets how many levels of the identified folds should be visible. If you want to specify the depth of indent to use for folding, the setting to use is shiftwidth (e.g., set shiftwidth=2)
Another register I found that needs to be looked at if the fold behavior is "ignoring" what is clearly indented: make sure foldminlines is set to 1 to generate all the folds you might expect.
This, in addition to the shiftwidth setting to something like 2, or even 1 to generate a new fold level with every single space difference.
- E

How do I customize three letter sequences in Vim Latex-Suite?

I installed Latex-Suite for Vim, and I like it very much, but I'd like to be able to customize the environment mappings that came by default, and add new ones. For example I want to edit the equation environment that appears typing EEQ and move around some elements, like the \label{} command. How can I do this? I've been scanning everything inside my /usr/share/vim/vimfiles/ftplugin but I can't find a way to do it (or I just don't understand what those files are).
You want to check out the documentation on Macro Customisation, specifically the Tex_Env_{name} bit.
In short, if you want your theorem snippet to look like
\begin{theorem}
<++>
\end{theorem}<++>
then you want a line like
let g:Tex_Env_theorem = "\\begin{theorem}\<CR><++>\<CR>\\end{theorem}"
in your vimrc.
Note the backslashes to escape carriage-return, and double-backslash for normal backslashes.
The <F5> functionality (press F5 after typing an environment name, i.e. figure<F5>) should work out of the box, but you may need to refresh the three-letter code. This is more hassle than it needs to be, but something like
autocmd BufNewFile,BufRead *.tex call IMAP('EFI', g:Tex_Env_figure,'tex')
will do the job.
The answer to the question you asked comes with a caveat, which is that Latex-Suite is an enormous amount of code that is very hard and annoying to modify, and which does not play nicely with other plugins. This falls into Latex-Suite's philosophy that it's the only plugin you need for editing latex within vim.
That said, you want to look in /path/to/ftplugin/latex-suite/envmacros.vim. Searching for EEQ will lead you on the path to understanding the set of calls that latex-suite performs. I would like to reiterate that many functions are deeply intertwined.
On the other hand, there is a very easy way to have very easily customizable environments, which are snippets. See the UltiSnips page for a good example of how this works. These are designed for customization and extremely easy to write.

Is there a way to move within a file in Vim similar to Emacs' Isearch?

I've been using Vim for some time and I feel that I'm finally becoming somehow 'fluent' with it, but some of the feature listings, videos and other stuff I've seen (particularly Tim Visher's Vimgolf in Emacs series) really convinced me to give Emacs a try.
So for the past week, I've been using Emacs almost exclusively. I really miss some concepts I'm familiar with from Vim (mostly the action-movement style, things like ci" etc.), but one thing I really learned to love in Emacs is the way to move around a file with Isearch.
For example, if I wanted to move to a line where a function fn is called, and there were 2 other instances of 'fn' between the point and the position I want to move to, I'd do C-s fn C-s C-s. If I wanted to do the same in Vim, I'd have to do something like /fn <CR> n n :noh <CR>, which is nowhere as nice, so I'd probably just check the line number and do #G wwwww....
So my question is: is there a way to emulate the efficiency of Emacs' movement with search in Vim? It doesn't have to use search, I'm just looking for something other than the cumbersome go-to-line and forward several words I described above.
Edit: Item 4 in Effective Emacs describes nicely what I'm trying to accomplish.
What is described in your link is exactly my primary mean of movement in Vim: /foo<CR>nn for incremental forward search and ?bar<CR>nn for incremental backward search.
I don't see what is more efficient in <C-s>foo<C-s><C-s> and <C-r>foo<C-r><C-r>: that's even more keystrokes!
Anyway, I think that :set hlsearch is your problem. If all the matches are contained in the viewport that's OK but, as soon as some matches are hidden it becomes useless. I don't have set hlsearch so /foo<CR> is quite the opposite of inneficient for me.
Well, another problem is having (at least) three functions with the same name in the same fileā€¦
Vim has wonderful text-ojects: } or ]m that are very useful when looking at some code for the first time.
You can emulate Emacs with this keymap: cnoremap <C-s> <Cr>/<C-p>.
Though Vim has better ways for moving around than searching. Have you tried ctags?
I also recommend the EasyMotion plugin for quickly moving around in the visible area of the text.
I think you're looking for
set incsearch
you can couple it with
set hlsearch
for even better results.
Also check out "*", it's pretty awesome.

Configure tab to show list of variants instead of cycling through in VIM

When opening new buffer it VIM, I type:
new /path/to/fi
If I hit "tab" at this point it cycles through files. How to configure VIM to show list of variants instead of going for the first one?
set wildmenu
Is all you need to add to your .vimrc. Read :help wildmenu.
Set your wildmode setting to something different, for example
set wildmode=list:longest
If I misunderstood the question completely, yell ... :)
(This is not a direct answer to your question, but I think it's even better :)
You should check out the Command-T plugin, inspired by TextMate's 'Go To File'. It filters out possible combinations very intelligently, just type a few characters of each subdirectory enough to distinguish it and it 'gets' it, the characters don't have to be at the beginning and can don't have to be sequential. It also shows you a list of options left.
I realize this is a terrible explanation so check out this video to see how it works.
The downside is it requires Vim to be compiled with Ruby support.
Control-P (ctrlp.vim) is a replacement for Command-T written in VimScript, so it doesn't require Ruby.

How do I combine two features of vim wiki plugins?

Sorry in advance for the newbie question. I've been trying to use vim for keeping a personal wiki, but I can't quite seem to decide on a good plugin. Vimwiki is great, and I really like the way it does checkboxes and uses the enter key to follow links. Notes.vim is simpler but I like it a lot better: it dynamically makes names of notes into links like Tomboy Notes, makes pretty bullet points, and has a search function built in. I can't get vimwiki to use files with no extension, but notes.vim does that automatically.
What I want to know is: is there an easy way (calling a vimscript file or something?) to combine some features of both of these plugins? I've tried doing some cutting-and-pasting but so far nothing has been working.
I doubt whether tbere is any simple automated way to do it. Both Vimwiki and notes.vim are "filetype" plugins. Generally in Vim any file (or buffer) can be set to just a single filetype.
It would depend on how the ftplugins were written, but it may be possible to apply them both to same buffer by making sure that the buffer is set to both filetypes, sequentially. That is, the buffer can be set to one filetype at a time, but setting it to both one after the other may do part of what you need.
For example, opening a notes.vim file will automatically set the buffer to a notes.vim filetype. Once open you could issue the command :setlocal filetype=vimwiki to change it to a vimwiki buffer. If vimwiki filetype initialization doesn't wipe out crucial notes.vim settings or have conflicting operation then you may then be able to access some functionality from both ftplugins. Not likely to get you very far, but maybe worth a try. Better would be to combine sections of their code into a single ftplugin.

Resources