Hide (or fold) columns of text in (g)Vim (horizontally) - vim

is there a way to hide columns of a buffer (text file, you know what I mean) while editing it in Vim? e.g. text visible in the buffer before hiding column 2&3:
abbcccccc
accdddddd
And after hiding them:
acccccc
adddddd
(Not to mention I'm working with really huge files (sometimes over 200 gb).)
And yeah, I had found foldcol.vim, but it requires a patch, and I don't have gcc to compile it as a user on a server.
Thanks in advance.

Cannot be done in stock vim; there is a conceal patch that has not been accepted. The most recent version is only for vim7, and not 7.2 (much less 7.2+patches), so it's probably best considered dead.

Is foldcol.vim maybe what you need? No clue if it works on your huge files though. 200 gb! Impressive in a geeky kind of way. =)

The best version I have seen so far is following:
https://github.com/paulhybryant/foldcol
this github project is based on
http://vim.sourceforge.net/scripts/script.php?script_id=1161
however it has some improvements - it actually shows hidden column as '*'
it needs vim-maktaba plugin, so in order to install this in your vim, then do following:
add to your ~/.vimrc file :
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Install vim-maktaba plugin for plugin developers - used in foldcol
Plugin 'google/vim-maktaba'
" Install foldcol - folding columns using <ctrl-v> visual mark, then :VFoldCol
Plugin 'paulhybryant/foldcol'
" All of your Plugins must be added before the following line
call vundle#end() " required
Notice the two plugins added in the vundle.begin -> vundle.end section ; the vim-maktaba and the foldcol
After adding this to your ~/.vimrc file then start vim as administrator or if you are running on ubuntu then write sudo vim
then write :PluginInstall and if needed then write your user and password for your GitHub account - this will give you access to downloading and installing vim plugins from github
example usage in terminal vim started; use <ctrl-v> and mark column :
it may seem cumbersome, however it is actually just adding two lines to your ~/.vimrc file and running :PluginInstall
enjoy

Related

Vim not recognizing some commands from vim-latex

I have vim-latex installed via Vundle and I'm trying to disable some annoying mapping that it sets up by default. From the docs I know that, for example, I can use the following command to unmap FEM:
call IUNMAP('FEM','tex')
But when I type that I get the error E117: Unknown function: IUNMAP.
I have installed vim-latex with Vundle by including Plugin 'LaTeX-Suite-aka-Vim-LaTeX' in my vimrc and I have just used the PluginUpdate command to update everything, which runs with no error, so I should have the latest version of the package.
Am I missing something here?
Actually, the problem you're having is related to where you're getting your vim-latex from.
With:
Plug 'LaTeX-Suite-aka-Vim-LaTeX'
You're getting it from here, which you'll notice hasn't been updated since 2010. Looking at the plugin/imaps.vim file in that repository, you'll see there's a definition for function IMAP(), but not for IUNMAP(), which was probably introduced after the last date that repository was synced...
Use this source instead:
Plug 'vim-latex/vim-latex'
Which will get it from here which is an official maintained location for this plug-in.
If you look at plugin/imaps.vim in that source tree, you'll notice function! IUNMAP is defined there.
Updating to the correct plug-in location should fix this problem for you (together with probably quite a few fixes from the last 10 years!)
The functions IMAP() and IUNMAP() are loaded by the vim-latex plug-in only after your vimrc is processed. So you need to execute them from a context where they're available.
Furthermore, in order to have your unmapping succeed, you need to actually execute it after the mapping was created, and mappings are typically created when the filetype is set.
The documentation mentions that these overriding rules should be done in specific files:
An important thing to note is that if you wish to over-ride macros created by Latex-Suite rather than merely create new macros, you should place the IMAP() (or IUNMAP()) calls in a script which gets sourced after the files in Latex-Suite.
A good place typically is as a file-type plugin file in the ~/.vim/after/ftplugin/ directory. [...]
For example, to delete a mapping, you can use
call IUNMAP('FEM', 'tex')
in ~/.vim/after/ftplugin/tex_macros.vim.
The documentation mentions that you should use a file in ftplugin after the filetype you use. Check :set ft? to confirm yours is indeed tex, in which case you can use tex.vim, tex_something.vim (like the suggested tex_macros.vim) or tex/something.vim (a subdirectory.)

How to organize content .vimrc in multiple files

Is there any methodology to organize the content of .vimrc in multiple files?
Currently my .vimrc has everything: Plugs statement, remaps, sets,functions,mapleader, custom plugins configuration, autogroup, etc.
I would like to organize in multiple files, perhaps by language.
Thank you!
You could split the contents of .vimrc into different files. Then source those files from within vimrc. Example:
" File: vimrc
" Author: Jonh Doe
" Options, commands, and auto commands
runtime settings.vim
" Maps
runtime maps.vim
" Functions
runtime functions.vim
" Plugin settings
runtime plug-settings.vim
Filetype-specific settings should be stored under ~/.vim/ftplugin, or less commonly, under ~/.vim/after/ftplugin. For example, html settings should be in ~/.vim/ftplugin/html.vim.
I suggest to take a look at vimrcs of experienced vim users. This repository should be a good starting point.
After your ~/.vimrc, Vim starts sourcing the plugin/ scripts. For your own mappings and custom commands, you can just place them anywhere in there, e.g. ~/.vim/plugin/MySuperCommand.vim and ~/.vim/plugin/MyLifeSaverMappings.vim.
For customization of other plugins, or Vim options that influence the behavior of plugins, it is crucial that these execute before the plugin(s). By using the ~/.vimrc (the general recommendation), this is ensured automatically. You can explicitly :runtime the scripts from your ~/.vimrc, as per #Sergio's answer, or define them as plugin scripts, too, but ensure that they run first:
If you install plugins the traditional way (in ~/.vim/plugin/), you can use the script naming (e.g. 00MyStuff.vim) to influence loading order.
If you use pack plugins, or a package manager, just ensure that your own plugin directory comes first in the 'runtimepath'.
The :scriptnames command is a valuable troubleshooting tool to verify that the script loading order is correct.

Enable extensions that come with vim-airline

After I installed vim-airline, I found that there are a variety of plugins in the path
vim-airline\autoload\airline\extensions
but only a part of them are loaded every time I start Vim.
How can I enable extensions such as syntastic, tagbar, unite, ctrlp and so on?
A possible way is to copy the .vim file to 'plugins' folder that vim provides. However, I want a solution that airline provides so that I don't have to manipulate files and can just configure them by a few commands.
Here's what I have in my old vimrc, it still seems to work:
let g:airline#extensions#tabline#enabled = 1
"" Whitespace Machine
" enable/disable detection of whitespace errors.
let g:airline#extensions#whitespace#enabled = 1
I'd imagine you can enable other extensions with the same syntax.
(If you like a more fully-featured vim development enviroment -- check out Spacemacs.)
I have been confused with how those extensions work for a few days.
It turns out that I have misunderstood what those extensions are.
Extensions come with airline are not plugins themselves, but some additional features related to those plugins to be displayed in the statusline.
That is to say, one has to install those plugins first before he enables those extensions. And after the installation of plugins, airline can work perfectly with them, providing cool style to display their status.

PyCharm Vim plugin line wrapping

In PyCharm with the Vim plugin, how do I make it so that the cursor will wrap lines (go from beginning of one line to the end of the previous or vice versa)?
The .vimrc is:
set whichwrap=<,>,h,l,[,]
but there's no way to configure a .vimrc in PyCharm.
IdeaVim plug-in already reads .vimrc, but it doesn't support all the options as it emulates only a part of the vim functionality. If certain option is not supported, submit a feature request to the IdeaVim issue tracker.
Note that it's an open source plug-in, if you really need this feature, try adding it yourself and send a pull request or a patch to the vendors.

Latex and Vim usage

How can I use Latex effectively in VIM?
Is there a way to configure compile errors by highlighting the line in vim?
I have syntax highlight. What are other recommended add-ons? Is a makefile the recommended way to compile a latex file to pdf?
TexWorks lets you open and replace the opened pdf everytime it's recompiled. Is there a plugin to do something similar in vim?
I've just begun playing around with LaTeX-Box. It seems like a good plugin. I, also used VIM-LaTeX for a while, but I didn't really like the key mappings, and it seemed a bit to heavyweight as Jeet described.
I like LaTeX-Box so far because it used latexmk to compile, which is what I was using anyway. Latexmk will sit in the background and watch your .tex file for changes, and then automatically compile for you. And if you use a pdf viewer which refreshed changes (such as evince on Linux) you can see updates every time you change. Adding
let g:LatexBox_latexmk_options = "-pvc -pdfps"
to my .vimrc got latexmk working properly. You also need the latexmk script somewhere on you PATH. The key mapping to start latexmk is the same as Vim-Latex's compile: '\ll' (that's lowercase LL).
I also use SuperTab plugin for completions, which is great. And I took the dictionary files from Vim-LaTeX so I have a ton of auto completion words to use. This dictionary file is: ftplugin/latex-suite/dictionaries/dictionary in the vim-latex files. What I did was copy this file into ~/.vim/dictionaries/ and renamed it 'tex' then I added these lines to my .vimrc file:
set filetype on
au FileType * exec("setlocal dictionary+=".$HOME."/.vim/dictionaries/".expand('<amatch>'))
set complete+=k
Then if I type the beginning of a latex command and hit 'tab' I will get a list of completions. Pretty handy. BTW that 'au' command in the vimrc will also load dictionaries for any other filetypes if you want. A useful trick.
check out vim latex
If you use vim latex put the following in your .vimrc:
let g:Tex_DefaultTargetFormat='pdf'
and it should compile to pdf by default. (I think the default compilation key
is \ll).
You can also check AutomaticLatexPlugin, it has many nice features (see the features list).
Its main point is to compile the document in the background using autocommands, so that you are free from compilation cycle. This works nicely on Linux and MacOs. It contains (extended version of) Latex-Box.
vim-latex is great. But I found it too heavyweight for my tastes. I prefer more of a "Vim with LaTeX compile & view" approach, rather than "A LaTeX IDE with Vim key-bindings". So I rolled my own: 'TeX-PDF: Lightweight "stay-out-of-your-way" TeX-to-PDF development support'.
Also check out: "LaTeX Help : Help for LaTeX in vim.help format" for calling up help of LaTeX from within Vim.
I personally can get by on:
autocmd BufNewFile,BufRead *.tex set makeprg=pdflatex\ %\ &&\ open\ %:r.pdf
where open is Mac OS X specific. Linux users will want a different command to view their compiled file after running make. This works best if you have mapped a key to write and then run make (and you should - once you have single key save and compile, you'll never go back).

Resources