New answers tagged

0

Note that there is an almost duplicate question: How to read/get the number of lines of code in the buffer or a directory? Now, if you want that number in the statusline... As @D. Ben Knoble said, this will be really slow. I would be tempted to to do it in vimscript, but even there, filtering all the comments out the buffer, is not exactly something fast as ...


1

Got it working and found two solutions. Reinstall bash and set Neovim as a default editor during the installation (Git has a test feature to make sure your editor is working even during installation) in $home find .gitconfig and add the path to your editor, but use two escapes \\ when there is space, e.g. C:/Program\\ Files/...


0

At the time this question was posted in 2016, this was a bug in UltiSnips. This issue was also reported on github here, and it has since been fixed in 2017. (There was a separate, but related issue: neovim would freeze when a function key is pressed. In that issue, the solution was to update pynvim.)


0

I ditched NERDTree in favour of the netrw and the workflow described here. Make sure you watch them video casts too, they were super helpful.


2

You can call the action jumpDefinition with a command as argument: nmap <silent> gs :call CocAction('jumpDefinition', 'split')<CR> nmap <silent> gd :call CocAction('jumpDefinition', 'vsplit')<CR> nmap <silent> gt :call CocAction('jumpDefinition', 'tabe')<CR> To get more information: :h coc-action-jumpDefinition


0

Thanks for the comments; the problem was that I had ~/.config/git/config as a directory, not as a file. To fix it, I made it a regular file and copied the contents of ~/.config/git/config/.gitconfig.


0

You could use the following to reimplement a mechanism similar to <c-a> but for multiplication: function! MultiplyInPlace(count) abort " Get the word under the cursor let current_word = expand('<cword>') " If we don't match a number return if (current_word !~ '\d\+') return endif " Calculate the ...


0

There's no magic, single operation for arithmetic. You can use substitution with sub-replace expression. This will replace all numbers on the current line with their value multiplied by 5. s/\d\+/\=submatch(0)*5/ The \= operator tells Vim to treat everything that follows as an expression, evaluate it, and use the result as the replacement of the final ...


1

I've answered this before, but the general strategy is this: globally join from the start of a paragraph to the end (given by /^$/-). But we have to handle the last line of the document specially. The easiest version is :$put ='' :global/./,/^$/-join :$delete where we make a blank line at the end, do our join (which doesn't fail on the last line, now), and ...


2

Short answer: use :terminal {command} for interactive stuff. Long answer: neovim’s :! actually communicates via subprocesses and the commands are not directly interactive due to the way the IO streams are handled. :terminal is envisioned as the replacement for this, since it does use a TTY and is interactive.


0

I would just stick to pathogen until you get familiarized with how things work. I started moving things to the 'pack/yourname/start' one day and things started breaking. That being said I am working on a plugin and 'pack/myname/start' seems to work fine. Pack is a great way to separate your plugins. If you notice tpope plugins usually go in there.


0

If you are using neovim 0.4 and vim 8.0 there are no visible differences from a user's perspective. However, neovim 0.5 is usable already which has great integration with lua, a built-in language client, and treesitter support. This means an emerging set of lua plugins that are neovim only (like telescope, luatree) and native lsp support (and plugins like ...


0

I couldn't deal with the hassle. So I just installed neovim and installed standalone vim. I figured most online articles and documentation will refer to standalone vim too. Things worked straight away.


2

You need this map: inoremap <expr> <TAB> pumvisible() ? "<C-y>" : "<TAB>" If PUM (complete menu) is visible, then execute <C-y> (which selects an item), otherwise, do a normal tab.


0

Linux does not provide any system clipboard. Therefore you can't make use of it. See, for example, Access Unix Clipboard for explanation.


0

Oops, sorry guys - I did write I'm a new user. I figured out the problem, after I realized I could get some kind of "debug" output with ":CocInfo". The solution was just to: cd ~/.config/nvim ln -s ~/.vim/coc-settings.json . I means that the set runtimepath^=~/.vim runtimepath+=~/.vim/after let &packpath=&runtimepath source ~/....


3

The whole point of Black is that it is not configurable. It calls itself "the uncompromising code formatter". Its name comes from the Henry Ford quote about the Model T: "any color you want, so long as it is Black". In other words, you can indent any number of spaces that you want, so long as you want four. Black is meant to eliminate ...


2

I found out what the solution is. vim was falsely assuming my background was light, while neovim found out that it was actually dark. Due to this neovim made all the colors brighter to compensate refer to https://neovim.io/doc/user/usr_06.html for more detail. So the solution is running the command: set background=light or put the command in the vimrc.


2

About :match With the match command, you only get 3 match ids: :match noteHi /\[\cNOTE:[^=]*\]/ :2match todoHi /\[\cTODO:[^=]*\]/ :3match what /ever/ Each time you call these commands for a particular id (1,2,3) you replace whatever was there before. So you can have 3 different ones but that's it, only 3. If you need more, use matchadd(). About matchadd() ...


5

They are tag synonyms. That is, any of them can be used to reach the same point whether by way of :help {tagname}, typing Ctrl+] when the cursor is over text of the form *{tagname}* or any of the handful of other ways you can navigate tags. So, for example, :h v_i) and :h i( will both take you to the same place. Note that the particular entry chosen as an ...


2

The video shows Vim, not Neovim. In Neovim the output of "bang" is not colorized. If you like long stories you can read this and this and so on. TL;DR they think it's not a big deal, but fixing "bang" may be too hard, so just use :terminal instead.


2

You can just press Ctrl + D in terminal to close it. But if you don't want to close it, just want to switch windows you can do Ctrl-W w (if you have multiple panes you can specify to which you switch with the seccond letter (h,j,k,l), W just switches vim windows.


Top 50 recent answers are included