For example, I use 3 split windows to open 3 different files:
+---------------+-----------+
| | |
| window 1 | |
| | |
+---------------+ |
| | window 3 |
| | |
| window 2 | |
| | |
| | |
+---------------+-----------+
Now, I want to open them with 3 different tabs and vice versa
Is there any trick to achieve this? Or do I need any plugin?
Besides, if I want to display 3 buffers in 3 full screen windows (as opposed to a split window), what should I do?
Not sure if there is a plugin, which will do all splits at once. But there is a way to do it one at a time
For moving the current split into a new tab use
ctrl + w, T (shift + t)
repeat the above process for all splits.
Now for getting the tab in to split, you can make use of a plugin call "Tabmerge", download Tabmerge.vim from http://www.vim.org/scripts/script.php?script_id=1961 to ~/.vim/plugin
then to merge the tab use :Tabmerge [tab number] [top|bottom|left|right]
If you are careful with your buffer list, you can use :sball and :tab sball to open in windows or tabs, respectively.
Related
I want to tell Resharper that if I have anything like
if (foo) { bar(); }
to turn it into
if (foo)
{
bar();
}
But I can't find the setting nor info on their support site.
Thanks!
Open your R# settings, go to ReSharper | Options | Code Editing | C# | Syntax Style and set Braces | In "if" statement to Enforce always:
Furthermore you have to go to ReSharper | Options | Code Editing | C# | Formatting Style | Line Breaks and Wrapping and disable Arrangement of embedded blocks | Keep existing arrangement of embedded blocks:
Recently I've started discovering "deeper" vim and now I want to create a simple table without using any external plugins (I know it's bad, but I want to have some "know-how").
Let's say I want to have a table like this:
| name | address | phone |
|---------------------------------------------------------|
| John Adams | 1600 Pennsylvania Avenue | 0123456789 |
|---------------------------------------------------------|
| Sherlock Holmes | 221B Baker Street | 0987654321 |
|---------------------------------------------------------|
But how do I manage to make underscores till the end of the longest line and seperate columns with equal width? (In short way, no typing all by hand)
If you know the amount of the dashes needed then you can do:
{number}i-<ESC>
Where {number} is the amount of dashes needed. If you want to "learn" that automatically then you need to use VimL and strlen() function to first learn how many dashes are needed and then you can use append() to insert text below provided line.
I just noticed that entering :q1 closes the file I currently have open (I found this by typo-ing :q!)
Based on commands like 2dd (delete two lines) or 2j (move down two lines), I would have expected :2q to "quit two files" (although, if I open two files with vi -O testfile1 testfile2, :2q only closes one of them - and so does :q2).
Is the number after :q simply discarded? Or is it having some effect that I haven't been able to determine?
And, more generally - how could I answer this question for myself? I checked usr_21.txt| Go away and come back in Vim help, but found nothing about this behaviour. I even checked the famous question, but no-one had mentioned anything about this.
The q command with number closes the given split in that position.
:q<split position> or :<split position>q will close the split in that position.
Lets say your vim window layout is as follows:
-------------------------------------------------
| | | |
-------------------------------------------------
| | | |
| | | |
| Split 1 | Split 2 | Split 3 |
| | | |
-------------------------------------------------
If you run q1 command it will close the first split. q2 will close the second split and vice versa.
The order of split position in the quit command does not matter. :2q or :q2 will close the second split.
If the split position you pass to the command is greater than the number of current splits, it will simply close the last split.
For example, if you run the q100 on the above window setup where there are only 3 splits, it will close the last split (Split 3).
This is whats listed in the vim documentation. You can find the documentation by typing :help :close then scroll up to find the Closing a window section.
If [count] is greater than the last window number the last
window will be closed:
¦ ¦ :1quit " quit the first window
¦ ¦ :$quit " quit the last window
¦ ¦ :9quit " quit the last window
" if there are fewer than 9 windows opened
¦ ¦ :-quit " quit the previous window
¦ ¦ :+quit " quit the next window
¦ ¦ :+2quit " quit the second next window
Usually NERDTree doesn't get resized when I do this. But when I am working with a bunch of horizontal and vertical splits for a while, it can happen.
I don't know what the change in state of within the instance of Vim is that makes this issue happen during a vim session. I'm not sure if the number of splits makes a difference.
Usually I set up 4 splits, along with the NERDTree window on the left like this...
|--|-----|-----|
| | | |
|NT|-----|-----|
| | | |
|--|-----|-----|
When I do the equal split resize I end up with this when things go wrong...
|-----|-----|-----|
| | | |
| NT |-----|-----|
| | | |
|-----|-----|-----|
That's not the end of the world. The real problem is when I close a couple of splits it ends up like this...
|--------|--------|
| | |
| NT |--------|
| | |
|--------|--------|
... which is just silly and I have to exit Vim and start over.
I use Ctrl-w followed by = to carry out the equal resizing of vim splits.
I think this is a bug, perhaps in NERDTree. There is a "change of state" that causes this problem to start happening. It is when you do a Ctrl-w followed by 'o' to maximize one of the splits. I've reported this as an issue in the NERDTree github project at https://github.com/scrooloose/nerdtree/issues/644
I use Pandoc (http://johnmacfarlane.net/pandoc/README.html) and its Markdown processor. When I convert the grid below to PDF (directly via LaTeX) using Pandoc, there are no vertical lines in PDF. How to obtain them?
+---------------+---------------+--------------------+
| Fruit | Price | Advantages |
+===============+===============+====================+
| Bananas | $1.34 | - built-in wrapper |
| | | - bright color |
+---------------+---------------+--------------------+
| Oranges | $2.10 | - cures scurvy |
| | | - tasty |
+---------------+---------------+--------------------+
There is currently no way to add vertical lines, other than postprocessing pandoc's latex output, according to this bug https://github.com/jgm/pandoc/issues/922#issuecomment-38586467
I don't know of any way to do this directly. The only solution I know is to use pandoc to convert to LaTeX, then edit the table formatting in LaTeX.