People who code: we want your input. Take the Survey

Hot answers tagged

5

From discussion in comments I learned that OP has a custom vimgrep call and would like to run it asynchronously. The utility of this is pretty clear, especially if you run a lot of searches that take a while: by moving the execution into a separate/background thread you free up Vim's UI so you can continue working without waiting for the result. As I ...


4

You mention in the comments, that the file Python.h is located in the directory $LOCAL_INSTALL/include/python3.8. This directory is not in the search path for include files. So it has to be added manually. export CFLAGS="-I$LOCAL_INSTALL/include/python3.8" ./configure ... The configure script adds the compiler flags from the environment variable ...


4

Terminal buffer is special: When the job has finished and no changes were made to the buffer: closing the window will wipe out the buffer. Change buffer type will stop this. Manual After job finished, clear buffer type: setlocal buftype= This also works: setlocal modifiable " make any change, the 1st change will convert terminal buffer to be a normal ...


3

Is there a reason you open each file in a different tab with -p? The standard way to open multiple files is to open them in different buffers. See this answer for more about buffers vs windows vs tabs. You can cycle through the buffer displayed in the top window with :bnext and similar. The workflow I would suggest to achieve what you want would be ...


3

You can use any of the popup_* functions that open popups with a buffer number, so, let bufnr = bufadd(expand('<cfile>')) let popup_id = popup_create (bufnr, {})


3

how to debug it? You can use the :verbose command to increase verbosity of a specific command. In this particular case, you need verbosity level above 3 to see the actual shell command executed by Vim, so this should work: :4verbose make Calling shell to execute: "pylint --output-format=text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {...


2

(Thanks to @d-ben-knoble) makeprg does not include filename, so :make % should be used to lint the current file


2

Without newish packages feature you can use ~/.vim/plugin/ folder. All vim files you have in this folder are auto sourced using :h :runtime: I do exactly this for my settings: main vimrc is ~45 lines having only core options separate ~/.vim/plugin/mappings.vim file for mappings and commands other separate vim files (foldtext setup, terminal setup etc) ...


2

This question is largely addressing some follow-up questions OP had in response to an answer I gave to another question that they posted. This one also talks about a solution involving lambda functions and closures that is valid but more complicated than needed for most use cases. For both those reasons I recommend you check out that Q&A first: How to ...


2

I've done something similar before. I was learning Vim's fold commands. I just stuffed my cheat sheet in a string that separated each line with a comma... let g:foldcmds = split("zf (Plus a motion) Operator to create a fold.,zF Create a fold for [count] lines. Works like zf.,zd Delete one fold at the cursor.,zD Delete folds recursively at the ...


1

Sadly, no, it is not possible. If you look at :help windows-intro, the following (among other) is said: A buffer is the in-memory text of a file. A window is a viewport on a buffer. ...


1

You could open the terminal in a new tab page (:tab terminal) and then use :tabnext / :tabprevious to switch between them.


1

Option 1 (not in Gvim): Use CTRL-Z to suspend Vim. That will give you Vim's parent shell. To go back to Vim, enter fg in the command line. Option 2: Spawn a terminal in a Vim window with :ter (or :terminal). Now, go back to the original window with CTRL-W CTRL-W and press CTRL-W _ to maximize its height. Note that the terminal window will still occupy one ...


1

To detect afk you can use CursorHold and CursorHoldI events. If you want to run it once: augroup afk | au! autocmd CursorHold,CursorHoldI * ++once echo "Run my timer here" augroup END Or everytime user is AFK : augroup afk | au! autocmd CursorHold,CursorHoldI * echo "Run my timer here" augroup END Both events are fired after ...


1

Tested on Vim Version: 8.2.1537 Response: A timer's resources will be freed on one of three conditions: the timer_stop() function in Vim is called, invoking it's counterpart stop_timer() in the C source.1 after invoking the callback function, there are no repetitions left for the timer, upon which free_timer() is invoked.2 the timer has encountered an ...


1

Is it possible to call a vim script function with the help of job_start? Not directly. I guess you would need Vim to be multithreaded, which might be possible in the future. In fact I've used the command :vimgrep to make my custom grep. It worked. Now I starts to use vim 8 so I'm thinking if it's possible to make my custom grep async. FWIW, I wrote some ...


1

My problem was I was trying to source my vimrc file within gvim/vim and my changes were not being applied in the session. I would have to reopen gvim/vim to see the changes. Adding the $HOME user environment variable: C:\Users\<username> resolved this. For my setup I am using Windows 10 and vim/gvim 8.2. Instead of using the user vimrc file: $HOME\...


1

I presume you run (g)Vim with a shortcut. there is current working directory in vim :lcd to see it and :lcd dir to change it. (if you run (g)vim.exe or shortcut it would be path to (g)vim executable) depending on how your python script is implemented, it might read this json file from current working directory (it is inherited by :!) not from your script ...


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