💾 Archived View for pwshnotes.flounder.online › gemlog › 2024-01-18-opensuse-vim.gmi captured on 2024-08-31 at 12:07:16. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-02-05)
-=-=-=-=-=-=-
I use the command-line editor Vim. And, when I switched to openSuSE, I was stuck with a bunch of default Vim options I didn't like. For example, pressing Esc takes a second to work where doing the same thing on Manjaro worked immediately. Using the :scriptnames Vim command, I could see that $VIMRUNTIME/suse.vimrc was being run. But it wasn't clear how to disable it. I assume that any updates to the package would overwrite any changes made directly to suse.vimrc
I contacted a SuSE developer and asked about this. I was told that suse.vimrc was hardcoded into Vim's initialization via a patch. And I should open a bug to get suse.vimrc fixed. But, when I looked, there were already some bugs open. And they were a few years old.
So, I decided to switch to Flatpak instead. The Flatpak won't reference suse.vimrc And the bothersome options should go away.
I'm using PowerShell. So, I'll need a Flatpak alias there.
Let me uninstall the Vim RPMs.
sudo zypper remove vim gvim vim-data vim-data-common Reading installed packages... Resolving package dependencies... The following 4 packages are going to be REMOVED: gvim vim vim-data vim-data-common 4 packages to remove. After the operation, 45.3 MiB will be freed. Continue? [y/n/v/...? shows all options] (y): (1/4) Removing gvim-9.1.0000-1.1.x86_64 ..................................[done] (2/4) Removing vim-9.1.0000-1.1.x86_64 ...................................[done] (3/4) Removing vim-data-9.1.0000-1.1.noarch ..............................[done] (4/4) Removing vim-data-common-9.1.0000-1.1.noarch .......................[done] Running post-transaction scripts .........................................[done]
Let's install the Vim Flatpak.
sudo flatpak install flathub org.vim.Vim Looking for matches… org.vim.Vim permissions: ipc network x11 file access [1] dbus access [2] [1] /tmp, /var/tmp, host [2] org.freedesktop.Flatpak ID Branch Op Remote Download 1. [✓] org.vim.Vim stable i flathub 9.3 MB / 14.8 MB Installation complete.
The PowerShell alias is a bit of a pain.
Function vim { /usr/bin/flatpak run org.vim.Vim @Args }
Remember, you need an alias in your shell or you have to type the full Flatpak command each time.
In PowerShell, you cannot create an alias with parameters as you can in Bash, Zsh, and Fish. Instead, you have to use a function. Then, the function won't pass parameters through to Vim. So, you have to include @Args. The PowerShell documentation doesn't give a complete example in one place. And, I had to bounce around before I collected the necessary pieces.
Place the function in your PowerShell profile or run it once at the command line. Then you can call Vim with parameters (vim -p *.txt), and that should work.
If you want to remove the Flatpak in the future, you can use this command.
sudo flatpak uninstall org.vim.Vim ID Branch Op 1. [-] org.vim.Vim stable r Uninstall complete.
How to install Flatpak applications from Flathub | PragmaticLinux
Example 5: Create an alias for a command with parameters | Microsoft Learn
Using @Args to Pass Parameters | Microsoft Learn
PowerShell Profiles | Microsoft Learn
Created: Thursday, January 18, 2024
Updated: Thursday, January 18, 2024