Hot answers tagged

2

In Vim, if you look at the source code for buflist_new() which adds a filename to the buffer list you'll find the part where the b: dictionary is initialized // init b: variables buf->b_vars = dict_alloc(); if (buf->b_vars == NULL) { vim_free(ffname); vim_free(buf); return NULL; } init_var_dict(buf->b_vars, &buf->b_bufvar, ...


2

You have several ways to do it: You can use <bar> which is the key code for | to be used in a mapping (Do not use | directly in your mapping): nnoremap <leader>a :echo "fizz" <bar> echo "buzz"<CR> This is the equivalent of running :echo "fizz" | echo "buzz" in the command line. You can also ...


1

Mapping the escape key like this tends to break things because of the way certain special characters are handled (references needed/appreciated). I would also recommend avoiding <C-t> and <C-]> as they are pretty useful commands (:help CTRL-T, :help CTRL-]). You might want to know about gt and gT for navigating tabs. They also take a count. Here'...


1

A substitution like this works for all scenarios: %s/print(\(.*\))/log.info(" ".join([\1]))/ Grab everything within print brackets (.*) using regex replace the match with a join statement surrounding the match replace the print with log.info (or whatever is required) Here is the test script if anyone wants to try it for themselves: import logging,...


1

Building uppon Lie Ryan's answer and the code provided above (it is described here) . Change your function parsing the git branch as follows: let g:gitparsedbranchname = ' ' function! UpdateGitBranch() let l:string = system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") let g:gitparsedbranchname = strlen(l:string) > 0?'['.l:...


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