6

You can use :[range]w >> file to append the given range to the given file. If the file does not yet exist, use the ! argument to the :w command to force writing the new file. So this means you can use :2400w >> my_custom.txt to write line 2400 to my_custom.txt file, or if your cursor is on the current line already, you can simply use :.w >>...


5

As I have written about extensively, the vim technique for this type of thing is called an ftplugin, which stands for filetype-plugin. What that means is that certain filetypes have different settings than others. make is one such filetype. Vim comes with a set of filetype detecters that are enabled when you do :filetype on However, you can ask vim to ...


4

Full restore If you want to restore layout with multiple termina buffers, you must restore other windows and buffers too, so it's in fact a full buffer layout restore, it's usage is not limited to terminal buffers. Three things must be done to achive that: Split windows according to saved layout. We can use result of winlayout() to do this. Load buffer in ...


3

When vim encounters ^[Or it interprets it as some kind of special key, for instance a function key. Which specific one vim thinks it is I'm not sure, but for comparison the <f3> key is often ^[OR. These escape codes are interpreted in insert mode as keys to allow using function keys and arrow keys. Ordinarily, it's not an issue because one types ...


2

The error you see, comes from the plugin matchparen, that is distributed with vim and which does highlight the matching parenthesis as you edit them. Internally is uses the searchpairpos() function. Starting with Vim patch 8.1.0112, Vim will throw an error, if the skip argument for the functions searchpair() and searchpairpos() is not a string argument. ...


2

The actual behavior occurs because of the vim-airline plugin and can be removed adding the following property to your vimrc: let g:airline#extensions#tabline#tabs_label = '' So there will be no more leading "tabs>" in the tabline.


2

As discussed in the comments, YouCompleteMe is overwriting your mapping with its own. Normally, you can overwrite a setting that a plugin has made by using the .vim/after directory but in this instance, YouCompleteMe is actually creating the mapping even later on, via an autoload function. You might like to check the YouCompleteMe documentation to see if ...


1

You can use autocmd for this. First run the following command to know the FileType (while your makefile is open) - :set filetype? This will show you the filetype. Then you can put the following in your vimrc to set settings for specifice fitetype like this - augroup makefilesettings autocmd! autocmd FileType makefile setlocal noexpandtab augroup ...


1

I would like to stay on console You have to press : then. Make sure you also read the corresponding Vim's help topic :h hit-enter Also, you can switch into Ex mode ("console") permanently with gQ (enter :vi to get back).


1

Invoke vim as view on the command line: view myfile.c This will automatically set the appropriate “readonly” flags.


1

We need more details. Header files aren't supposed to contain function definitions, in C. Function declaration, yes, but definitions, unless they are inlined, no. Could it be related to YCM? YCM isn't able to jump to a function definition that isn't in the same translation unit as the current file. For this, you'll need to index the files in your project. ...


1

There is a dedicated plugin for switching to header files: https://www.vim.org/scripts/script.php?script_id=31


1

Yup, they are the same (but getcwd() can accepts some arguments so it is useful for Vim scripting), both return the current working directory. By default it is the directory where you executed Vim. To change it you need to execute :cd.


1

As others have pointed out your intended way of using netrw as a project drawer is not very well supported, designed for or a good fit in general for editors which use splits. I hope you find the time to read the mentioned article Oil and vinegar – split windows and the project drawer. Despite this, netrw tries to provide some functionality to behave like a ...


1

NERDTree (#1658) is a plugin that does those things by default, and much more. If you're using vim 8, just enter $ git clone https://github.com/scrooloose/nerdtree ~/.vim/pack/my-plugins/start/nerdtree You can also look through the included manual with :h NerdTree. You might need to update the help tags with :helptags ALL.


Only top voted, non community-wiki answers of a minimum length are eligible