linuxusers.in is a Fediverse instance that uses the ActivityPub protocol. In other words, users at this host can communicate with people that use software like Mastodon, Pleroma, Friendica, etc. all around the world.
This server runs the snac software and there is no automatic sign-up process.
I need help again with #vim scripting.
For some particular files (you can probably guess it from the minimal example to reproduce the problem) I want to set swap directory (the vim directory setting) to a particular location.
So, I have a function:
function SetLocalSwapForRemoteFilesystems()
call mkdir("/tmp/swapfiles","p","0o700")
setlocal directory=/tmp/swapfiles//
echo "Swapdir: " . &directory
endfunction
which I call from autocommand:
autocmd BufRead * call SetLocalSwapForRemoteFilesystems()
The function is being called, as for any existing file being opened, I see the message:
Swapdir: /tmp/swapfiles//
but the swapfile is still created in the . directory, which is based on the original (default) version of swapfile setting.
I thought, that perhaps the swapfile location is being established before BufRead event, so I've tried to replace the autocommand with:
autocmd BufReadPre * call SetLocalSwapForRemoteFilesystems()
But right now my function is not even being called.
Any idea where is the problem and how to solve it?
@b0rk I am absolutely not telling you what to do. I'm giving you a datapoint. I am a #Vim / #NeoVim expert. I have used Vim for ... hmm, maybe it's decades. Not sure. I use Vim key-bindings everywhere that I can. I have given talks and made YouTube videos about Vim.
I’m always trying new things. For instance, #RustLang. One thing I thought I'd try is the #HelixEditor. For a lot of people, and you may well be one, Vim/NeoVim is the right choice. If it is, I won't try to convert you. But my experience so far with Helix has been so positive, that even after decades of Vim being my favorite, it has been replaced by Helix.
I still use Vim wherever that's the right choice, for instance remote machines I don't control. But editing actual code in Helix using that language's LSP and with tree-sitter is absolutely delightful. Even the fact that Helix isn't a “finished” editor doesn't dissuade me.
At work, #Python is our main language, and we all have PyCharm. I use the Vim bindings via #IdeaVim. I prefer Helix even to that.
So there's your datapoint. Maybe someone you know well and trust has an opinion that sheds more light on the two editors.
I feel sorry for people who believe VSCode / Visual Studio / JetBrains are the best ways to edit code. Those tools are so bloated and wasteful and busy, but more to my point, they're so dry and "professional" for lack of a better word. They aren't fun in any sense of the word.
#Vim and especially #Emacs on the other hand have ecosystems full of playful, fun functionality. Using them, to me, is like playing a game. I have fun editing text. I find joy in it.
Maybe I'm just autistic.
Vim Language, Motions, and Modes Explained (2023)
Link: https://www.ssp.sh/blog/why-using-neovim-data-engineer-and-writer-2023/
Discussion: https://news.ycombinator.com/item?id=43780682
Understanding the Origins and the Evolution of Vi and Vim
Link: https://pikuma.com/blog/origins-of-vim-text-editor
Discussion: https://news.ycombinator.com/item?id=43691020
Editor market share via Stackoverflow:
https://survey.stackoverflow.co/2024/
VS Code 73.6%
…
Vim 21.6%
Neovim 12.5%
…
Nano 9.2% (dorks!)
Emacs 4.2%
Spacemacs 0.4%
ed, the standard text editor, is not reported, but we all know it should be #1.
Show HN: Zxc – Rust TLS proxy with tmux and Vim as UI, BurpSuite alternative
Link: https://github.com/hail-hydrant/zxc
Discussion: https://news.ycombinator.com/item?id=43568771
Show HN: Searchable Vim Cheat Sheet with Favorites (Open-Source)
Link: https://nvim-cheatsheet.vercel.app/
Discussion: https://news.ycombinator.com/item?id=43307745
Normally I do all filtering in external scripts, even things like comments or snippets, mostly Python or awk, but repeated regexp in place makes more sense as vim9script.
You: I need emacs to process this file!
Me: We have emacs ^[dba vim at home.
vim9script
# Changes all leading '\t' to ' '
def g:Detab()
while 1
try
execute ":%s/\\v^( *)\t/\\1 /g"
catch /Pattern not found/
break
endtry
endwhile
echo "Detabbed!"
enddef
nnoremap <F6> :call Detab()<CR>
(put this in your .vimrc, reload, or in a file and :so FILE )
Augment.vim: AI Chat and completion in Vim and Neovim
Link: https://github.com/augmentcode/augment.vim
Discussion: https://news.ycombinator.com/item?id=43097814
Vim after Bram: a core maintainer on how they've kept it going
Link: https://thenewstack.io/vim-after-bram-a-core-maintainer-on-how-theyve-kept-it-going/
Discussion: https://news.ycombinator.com/item?id=43068884
~/.vim/vimrc
using vim-plug for plugin support.https://codeberg.org/JustineSmithies/qtile-x-dotfiles/src/branch/master/.config/nvim/init.vim
Show HN: VimLM – A Local, Offline Coding Assistant for Vim
Link: https://github.com/JosefAlbers/VimLM
Discussion: https://news.ycombinator.com/item?id=43054244
In the age of GenAI and privacy abuse, open-source software and everyone who is contributing to building, maintaining, and supporting FLOSS are real heroes. Today, I thank all of them on this #ilovefs day.
I appreciate keeping software free so everyone can afford and use it. I love #Vim, #Linux, and #FreeBSD very much.
Thank you.
PS: Please share your gratitude with the #ilovefs tag.
Automating the Vim Workplace (2020)
Link: https://sharats.me/posts/automating-the-vim-workplace/
Discussion: https://news.ycombinator.com/item?id=42990801
@dougmerritt
I completely lost the scheme article I was planning to talk about after tagging all the schemers x_x I found and wrote another #vim/#emacs personal at least x_x
in eshell, issuing vi drops you into this interesting fantasy mode. It’s quite funny to use !! within vi within emacs. Consider using it instead of #vim or #doom.
@screwtape I never thought to try that! So I checked it out, Eshell actually has a vi
aliased to the command eshell-exec-visual
, which goes through the trouble of creating a Term-mode buffer running a terminal process of whatever command you specify (e.g. “vi”) and titling it the name of the process (e.g. “*vi*
“) for you. You can do the same thing with less
, or top
, probably also fish
shell, though I haven’t tried it.
You know what would be really funny? If you modified the find-file
command to open every file in a Vi process via eshell-exec-visual
!
But ultimately, it is like running the man
command in Emacs, which runs Less in a similar way. I usually prefer my applications to be written in Emacs Lisp (like viper
or woman
), and not run a compiled C program in a separate process controlling Emacs with ANSI terminal control codes.
Instead of working on my parser I wrote a silly #vi #emacs #eshell useage #medium post.
#development #environment #lisp #programming
https://medium.com/@screwlisp/executing-common-lisp-in-vi-in-emacs-shell-023177e0fb13
The gist is that in eshell, issuing vi drops you into this interesting fantasy mode. It's quite funny to use !! within vi within emacs. Consider using it instead of #vim or #doom.