Fork me on GitHub
#vim
<
2022-06-30
>
emilaasa07:06:41

When I'm already using vim-projectionist, is there a way to create the alternate file if it doesn't exist?

nbardiuk08:06:30

:A command either switches to the alternative file or prompts to create one

nbardiuk08:06:11

if see the no alternate file it means that projectionist does know what should be alternate file for the current buffer

nbardiuk08:06:13

for clojure and java projects I've configured them manually

(set vim.g.projectionist_heuristics
     {"project.clj|deps.edn" {"src/*.clj"           {:alternate "test/{}_test.clj"}
                              "test/*_test.clj"     {:alternate "src/{}.clj"}}
      "pom.xml"              {"src/main/*.java"     {:alternate "src/test/{}Test.java"}
                              "src/test/*Test.java" {:alternate "src/main/{}.java"}}})

practicalli-johnny08:06:19

Is there a simple configuration (or lua / fennel code) for removing trailing whitespace on a file when saving that file? So it would remove additional spaces at the end of every line and optionally more than one line at the end of the file. (I am afraid I understand very little of what the neovim docs are saying, although they are very detailed)

dharrigan08:06:00

I use this little plugin to do all whitespace highlighting and removal for me:

Aleksander08:06:43

This is Lua auto-command that removes end of line whitespace on each save

vim.api.nvim_create_autocmd(
"BufWritePre",
{ pattern = "*", command = "%s/\\s\\+$//e" }
)

lispyclouds08:06:55

I use https://github.com/lispyclouds/dotfiles/blob/main/nvim/lua/whitespace.lua for my nvim 0.7+. Seems to work pretty well for my simple use cases 😄

practicalli-johnny08:06:02

@U11EL3P9U vim-better-whitespace looks interesting, although it may take me a while to translate that to my fennel config. Thanks

practicalli-johnny09:06:47

It seems there is no escape from adding those patterns in the config. I’ll just use a theme that hides the whitespace / indicators until I understand what those things mean Thanks

lispyclouds09:06:41

mine are essentially substitution patterns being executed as commands. like :%s/\s\+$//e. the patterns are taken from https://github.com/cappyzawa/trim.nvim/blob/master/lua/trim/config.lua

lispyclouds09:06:30

when the buffer saves, it executes those commands in order

emilaasa10:06:48

nnoremap <leader>tw :%s/\s\+$//e is what I use since the before-times

emilaasa10:06:19

So not fully automagic 🙂

reborg16:06:25

Help for debugging problem. Every once in a while, during a copy paste or opening a large file, nvim freezes. The CPU goes 100%, I wait a few minutes hoping for a time out, but normally I have to kill it. I just copy pasted a small json fragment into a markdown file. Should I look at the markdown plugin? Or perhaps is there a thread-dump facility I can see what nvim is doing?

dave19:06:43

Could it be clojure-lsp? I've noticed that running up my CPU at times

sheluchin21:06:07

You could try nvim --clean to run with no plugins or configuration and see if it still happens. If it doesn't, disable half of your plugins and try again. Repeat until you find it. Or start with the ones you suspect first. I'm not aware of a detailed resource monitor for nvim.

nbardiuk06:07:51

I've used :h profile once, the profile output can help to figure out which plugin is slow. I've used this guide http://vimcasts.org/episodes/profiling-vimscript-performance/

reborg09:07:21

Thanks all, will try a few options and report back