VIM - Vi IMproved

973 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 1 year ago
MODERATORS
1
 
 

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.

2
 
 

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.

3
 
 

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.

4
 
 

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?

5
8
submitted 2 months ago* (last edited 2 months ago) by [email protected] to c/[email protected]
 
 

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>> {...}
6
 
 

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 🙂

7
 
 

The first major version update without Bram.

8
 
 

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?

9
 
 

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

10
 
 

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!

11
5
submitted 10 months ago* (last edited 10 months ago) by dafunkkk to c/[email protected]
 
 

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

12
44
The future of Vim (groups.google.com)
submitted 10 months ago by Ardms to c/[email protected]
13
1
[Deleted] (groups.google.com)
submitted 10 months ago* (last edited 10 months ago) by [email protected] to c/[email protected]
 
 

This post has been deleted.

14
 
 

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.

15
 
 

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.

16
 
 

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

17
 
 

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?

18
 
 

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 !

19
 
 

Hi fellow vimmers (and neo-vimmers).

Since “The Great Reddit Rebellion” I’ve found myself not wanting to go back to Reddit, together with Twitter blocking anonymous scrolling it was the push I needed to finally move to the Fediverse and get rid of corporate social media.

After a few days of being a nomad and trying different instances I found SDF and immediately felt home (I even opened a shell and became an ARPA member).

I am posting this here as I’m an avid (neo-)vimmer myself and the author of a few neovim lua plugins.

Something which irked me a bit on Reddit is the animosity between the vim and neovim subs, doesn’t make a lot of sense IMHO given we’re already a very small and niche community.

Would really love to see this place flourish and become the new home to both vim and neovim reddit refugees.

Content is important, I’m gonna try to do my part, in the meantime I’ve attached a link to a fairly popular vim cheatsheet, being the author I’m a bit biased but it’s pretty pretty good :)

To a decentralized, non-commercial internet, cheers!

20
 
 

Does anyone have experience using GNU Stow for managing dot files? I'm especially interested in using it to build a git repo to include my .vimrc file so I can sync it between hosts.

I know I've seen other methods, such as making your home directory a bare git repo, so you can check-in your config files without moving them. There is also the chezmoi golang project.

How do others sync .vimrc between hosts?

21
10
submitted 11 months ago* (last edited 11 months ago) by [email protected] to c/[email protected]
 
 

TL;DR: I use a vim like editor which tackles Vim's greatest weakness: vis.

22
 
 

Has anyone ever tried to use vim on a non qwerty layout? I've always been interested in colemak but having to possibly re-bind every single key for vim is daunting.

23
 
 

Wow, I'm surprised that there is not a single post in here yet. Let's this to be the first one. I'm using NeoVIM tbh but we all know where we came from, right ?

24
 
 

Generalize Orgmode to Markdown and any Folding structure in Vim and Neovim. Supports Org, Markdown and any Folded file.

See the repo for more information.

Features :

  • folding based on headings in org and markdown files
  • headings based on folding in folded files
    • you can handle your folds like headings in orgmode
  • navigate in headings or list items hierarchy
    • next, previous : any level
    • forward, backward : same level as current one
    • parent heading, upper level
    • child heading, lower level :
      • loosely speaking : first headline of level + 1, forward
      • strictly speaking : must be in the current subtree
    • go to another headline with prompt completion of full path
  • modify headings or list items
    • new headline or list item
    • select, yank, delete subtree
    • promote, demote heading or list item
    • move subtree up or down
    • move current subtree in another one (aka org-refile)
    • cycle todo status
  • headlines
    • tags
  • lists
    • cycle list item prefix
    • toggle checkbox
    • checked boxes ratio on parent item
  • tables
    • inside of table : align columns
      • also works with multibyte characters
    • outside of table : align following a pattern
    • go to next or previous cell
    • go to beginning or end of cell
    • duplicate above cell content to current one
    • select cell content
    • add new row, colum
    • delete row, colum
    • move row up or down
    • move column left or right
  • links
    • store url at cursor
    • create link with url completion
    • goto link under or close to cursor
    • goto next/previous link
  • expand shortcut to template (aka org-structure-template)
    • markdown support limited to code blocks
  • insert timestamp
  • insert unicode character
    • refer to autoload/organ/unicode.vim to see available chars
  • insert result of vim or python expression
  • export in another format using
    • pandoc
    • emacs
    • asciidoc or asciidoctor
    • view exported document
  • convert headings and links org <-> markdown
25
 
 

Vim actually feels natural...

... to people who use vim.

view more: next ›