VIM - Vi IMproved

1147 readers
1 users here now

For Vim enthusiasts and anyone interested in Vim/Neovim!

"VIM is the greatest editor since the stone chisel." - Dr. Jose Unpingco

#HJKL

founded 2 years ago
MODERATORS
1
 
 

I'm using the following snipped in my .vimrc to restore the cursor position when closing and opening a file:

au BufReadPost * \ if line("'"") > 0 && line("'"") <= line("$") && &filetype != "gitcommit" | \ execute("normal `"") | \ endif

This works fine in regular vim, but not when using sudoedit, which I just got myself used to using when editing root files. I understand it is because sudoedit creates temporary files and therefore will not restore the position because it sees it as a different file, but is there any workaround? Or should i just use sudo -E instead as it works fine there?

2
 
 

I would like to manage plugins in the lowest-touch way possible, and ideally one that's easy to migrate to other machines.

I like the idea of the internal plugin manager, but that generally means that I need to manually all the git repos on all machines. It also makes tracking plugins that I'm testing a bit annoying.

The alternative seems to be vundle or vim-plug, which do the git management, but don't use the internal plugin system.

Are there other options? What's the easiest these days?

3
4
5
6
 
 

Hey guys, I just wanted to say that Vim is charityware. This means that if you like the software and want to pay for it, you can donate to charity instead of to the developers of Vim. Vim recommends donating to ICCF Holland to pay for the software. ICCF Holland is a charity that focuses on supporting Ugandan children whose parents have passed from HIV. They provide healthcare and education to children who need it. Donation is critical to keep this organization active. There are a few different ways to help this organization, from directly donating money to sponsoring a child, by paying monthly for them to go to school and receive medical care. Work is all volunteer, so your money goes strictly to children. Your donation can make a difference in a kid's life. You can donate at Vim's website or ICCF Holland

7
27
submitted 8 months ago* (last edited 8 months ago) by ExtremeDullard to c/vim
 
 

When I was a student a few decades ago, everybody I knew pronounced it as "vee-eye". Then in the late nineties / early aughts, I heard the first people pronounced it as "vie" in a different city I had found employment in. It sounded odd to me, and it seemed to come from people who in fact didn't use it much. But the pronounciation I was used to still applied, mostly.

Nowadays, I almost never talk about VI to anyone anymore, nor do I hear anyone say the name. It's become mostly a typed thing for me. But - coincidence? - this week I heard three people talk about it (younger, non VI users) and they all said "vie".

And now I'm watching this video from the reasonably famous and definitely not young and not VI newbie NCommander and he too says "vie" in the video.

I'm beginning to worry that I'm the one who's been saying it wrong all this time because of my misguided college buddies and teachers way back when 🙂

So I'm curious: how do YOU say it? VEE-EYE or VIE?

8
 
 

So I'm very happy with vim, and have been for the past quarter century (I used Elvis before that. Remember Elvis? It was awesome! - But I digress...)

I have to admit though, while I pity the fools in my company who use VSCode and mock me for using vim in the terminal, yet in fact produce code much slower than I do, I envy their IDE that suggests function and variable names in other project files.

So I've been looking for a nice, easy-to-install solution to get some of that goodness in vim. Nothing fancy, just autocomplete suggestions to avoid having to grep names I forgot or having to yank/put text manually to prevent typos. And mostly easy, because for some reason, I'm properly allergic to any sort of vi configuration - be it vim or any other vi flavor.

So I gave Neovim a shot. My plan was to ensure Neovim was at least as good as Vim, then try to install Treesitter. But that plan immediately went south, then kept on being a proper pain in the ass until I finally realized this was going nowhere fast and I didn't want to spend countless hours configuring that awful thing, so I gave up. I wasn't asking for much but Neovim totally failed to deliver.

And then I found the solution I was looking for all along: YouCompleteMe. It's as simple as installing the handy vim-youcompleteme .deb for my distro (Linux Mint), running vam to install it and voila: a working autocompleter that actually works in 3 minutes flat and doesn't get in my way.

9
28
submitted 9 months ago by moreeni@lemm.ee to c/vim
10
 
 

cross-posted from: https://lemmy.world/post/16310027

Help disabling "Possible spelling mistake found" in vimtex

Hi everyone,
could someone help a desperate student to turn off the 'Possible spelling mistake found' in LaTeX files with the vimtex plugin. It's been 3h now and I still dont have any idea on how to turn this off (or at least change the language, but knowing how to do both would be really cool). I tried everything I could, still don't kow where this is from.
Help would be really appreciated.
Thanks in advance.

11
 
 

I've been using vim-lsp, it's great for the most part. Only thing I'd like to be able to do is change the default view of errors and warnings to be hidden except for a red or yellow line under the affected text that I can expand using :LspHover or something. Is this a possibility at all?

The docs only mention about turning of diagnostics completely.

12
 
 

Hello!

I like experimenting with vim's features and one of those is omni completion. This type of completion can be fed by plugins but vim also comes shipped with some included omni completion functions. Those are documented in compl-omni-filetypes, the according scripts are found in $VIMRUNTIME/autoload/.

One of the included scripts is for C which I tried the most. But I was never really satisfied with it. It requires the usage of ctags which is fine as I also need this for using tags to navigate.

But the completion of the fields in structs which would be its most handy feature in C just never seems to work in a satisfying way. Sometimes it just fails entirely and when it does not, it always adds a . after the completed fields even though the completed field is not even a structure. Same applies for [ characters that are completed at times that I do not want them.

Also, the popup that should show some information about the completed object is not really helpful but rather confusing. It shows what kind of object this is, but only with one letter, so you have to guess what that letter means. It always show if it is static using 1 and 0 which I do not find an elegant solution then it prints something like

struct    __anon0d38083b0108

which comes directly from the tags file and contains no information at all that I find useful.

There are also other omni completion functions which I briefly had contact with. It seems like the HTML completion is for HTML 4, which is out of use for more than 10 years now...

The documentation of the JavaScript completion (ft-javascript-omni) states the following:

At the moment (beginning of 2006) there are two main browsers - MS Internet Explorer and Mozilla Firefox. These two applications are covering over 90% of market.

I will let that one speak for itself.

So to sum up I do not find this feature of vim particularly helpful. Especially when we look to the language server based completion options that other editors have built in, but can also be brought to vim with some tinkering.

Do you have a similar or different experience with omni completion?

13
8
submitted 1 year ago* (last edited 1 year ago) by mac@infosec.pub to c/vim
 
 

Vim9Script Types Help

I'm trying to add types to a language list in my vimrc file, the variable looks like this:

var languages = {
  'c': ['c', 'h'],
  'shell': ['sh'],
  'python': ['py'],
  'json': ['json'],
  'typescript': ['tsx', 'jsx', 'js', 'ts'],
}

I've tried adding types like this:

var languages: dict<string, list<string>> {...}

Which should work I think but I'm getting this error:

E488: Trailing characters: , list<string>> = {

I can't figure out which characters are trailing and AI has no idea either.

Solution

I was being a moron and defining a type for the key in the dictionary which makes no sense because the key name would always be a string so therefore only the value type is required:

var languages: dict<list<string>> {...}
14
41
CAD modeling in VI (lemmy.sdf.org)
submitted 1 year ago by ExtremeDullard to c/vim
 
 

I'm playing with OpenSCAD, which is a text-based parametric 3D modeler. It comes with its own built-in editor, but you can also open the source file in your favorite editor and when the file is saved, OpenSCAD recompiles and re-renders the model.

I know it's nothing particularly novel, but it's kind of awesome to type :w and see the 3D object immediately show what you just typed. There's even a degree of rendering control from within the editor: for example to highlight a feature, like an subtracted volume, simply type # in front of the corresponding operation, :w and hey-presto, the feature appears in the model.

And sure enough, there is OpenSCAD syntax highlighing for vim. How cool is that!

If someone had told me 40 years ago that I'd be doing 3D modeling in VI one day, I would never have believed it 🙂

15
 
 

The first major version update without Bram.

16
 
 

Recent versions of Vim include a built-in auto-complete feature, and of course there are a half-billion other auto-complete plugins available through GitHub.

What's your setup? Plugins, or vanilla? Suggested tweaks?

17
 
 

crosspostato da: https://lemmy.world/post/8063065

Hi, how can I associate to a var a path with both env variable and text? something like this for example: let trial=$HOME/dir1/dir2/$env1/dir3 I saw that let trial=$HOME works when I echo it, but if I add $HOME/dir1 it doesn't anymore....any help? Thanks

18
 
 

Vim's core is the amazing command mappings and text objects that allow for countless combinations to define precise edits. Learn how to master the built-in commands, motions, and text objects, and even how to extend the Vim language for even more power!

19
5
Custom tab name? (lemmy.world)
submitted 2 years ago* (last edited 2 years ago) by dafunkkk@lemmy.world to c/vim
 
 

I want to assign a name to a new tab where I'v opened the :tab term cmd....I'v looked inside the guide but I need a real example of what I'v to put in vimrc. Thanks

20
42
The future of Vim (groups.google.com)
submitted 2 years ago by Ardms@lemmy.world to c/vim
21
164
submitted 2 years ago by rickumali to c/vim
 
 

I received an email from on the vim_announce mailng list that Bram Moolenaar, VIM creator, died August 3 2023. RIP Bram and condolences to his family and friends.

22
 
 

I'm aware that you can "edit" binary files with :%!xxd but seriously, am I the only one to think it's totally pathetic? Vim should be better than that.

I use Hexer myself. It's binary editing done right and it should be merged into vim - as in, type :hex or something and the edition mode switches to that editor's layout.

23
 
 

He didn't say anything, but his email had the telltale :wq from someone with unshakable VI muscle memory at the end :)

24
 
 

cross-posted from: https://latte.isnot.coffee/post/288501

ALE gives me a warning when I use gtk

#include <gtk/gtk.h> /* E: gtk/gtk.h: No such file or directory

This is probably happening because ALE isn't using my compiler flags gcc $( pkg-config --cflags gtk4 ) -o program main.c $( pkg-config --libs gtk4 ) that I stole from the gtk documentation. These compiler flags allow gcc to find gtk/gtk.h even though it is in gtk-4.0/gtk/gtk.h

How do I make ALE aware of my compiler flags?

25
17
submitted 2 years ago by DammN to c/vim
 
 

TJ made a nice video about how to start with neovim and its configuration. I hope that this link is not against the rules since it's about neovim and not about vim .... Personally I find those 2 very very alike and with the features that I need for my daily work, I can use either one of them without noticing any difference.

https://www.youtube.com/watch?v=stqUbv-5u2s

Enjoy !

view more: next ›