Logo

dev-resources.site

for different kinds of informations.

Create A Vim Plugin For Your Next Programming Language, Indentation and Autocomplete

Published at
6/14/2024
Categories
vim
extension
Author
ezpzdevelopement
Categories
2 categories in total
vim
open
extension
open
Author
16 person written this
ezpzdevelopement
open
Create A Vim Plugin For Your Next Programming Language, Indentation and Autocomplete

Create A Vim Plugin For Your Next Programming Language, Indentation and Autocomplete

In the previous post, i discussed how to structure our vim plugin, and how we can add the beautiful syntax highlight feature.

In this short post, i will explain how to add a simple auto-complete in addition to indentation, if you want to see a full example of a working vim extension for a new programming language, please check this GitHub repository

Indentation

So first we need to create a new file in ftplugin directory, if you want to know more about autoload and other vim extension folders make sure to check the first part of this blog post here

The name of the new file is iop.vim, we will show a short example of how we handled indentation in our extension, you can check the full file here

:inoremap { {<CR><tab><CR><bs><bs><bs><bs>}<up><tab>
Enter fullscreen mode Exit fullscreen mode

Essentially, we are telling our IDE that if a user opens a bracket and then hits enter, and of course, when we press enter, we will jump to a new line with this command above the cursor will not begin at the beginning of the line but will left some space behind, the space here is represented by the .

In our case, we defined the space in the fifth line of our file as you can see below

set tabstop=4
Enter fullscreen mode Exit fullscreen mode

Autocomplete

It is time to discuss autocomplete, so we can end this blog post.

You will need to create two new folders text and autoload in the text folder we will put all the possible worlds in our new programming language, in our case we created 4 files, one for decorators, another one for types, values, and iop.text file is for identifiers.

These four files are imported in autoload/iopcomplete.vim file, this last-mentioned file contains the autocomplete logic you can check the full file here at this link .

This was just a general description of what we did to create a new simple vim extension, for this new programming language, you can understand more by reading the code in theGithub repository.

extension Article's
30 articles in total
Favicon
Avoiding a "Host Permission" Review Delay When Publishing a Chrome Extension
Favicon
Unlock Cleaner Code with Dexter.ai: A must have VS Code extension for Python Development
Favicon
Export LinkedInβ„’ Profile to CV using Browser Extension
Favicon
Learn Spanish Chrome extension
Favicon
A "New Way" to Pay Creators
Favicon
Chrome Extension Boilerplate with Popup Interaction (Manifest V3)
Favicon
How to Build a Simple Chrome Extension to Search Selected Text on YouTube
Favicon
Creating a Chrome extension
Favicon
Create A Vim Plugin For Your Next Programming Language, Indentation and Autocomplete
Favicon
Creating a browser extension for Chrome / Edge
Favicon
Create A Vim Plugin For Your Next Programming Language, Structure, and syntax highlight.
Favicon
Build your own VS Code extension
Favicon
Get Affordable and Non Surgical Hair Patching and Hair Extension In Kolkata
Favicon
Introducing Shell Command 2: The Ultimate Shell Command Runner for VSCode
Favicon
How do ad blockers work in the browser?
Favicon
How to test a browser extension locally
Favicon
Explore the Best VSCode Themes for a Stylish Coding Experience 🌈
Favicon
GPT 4 and Why it is Good for Chrome to Crumble
Favicon
Streamline Your WPF Development with Syncfusion: Introducing the WPF Template Studio for Visual Studio
Favicon
VSCode Extension - Doc Tab: edit the doc comments in a new tab
Favicon
Using External Weather Data In A Custom Panel Extension
Favicon
[AWS] Using API Gateway for S3 Uploads to Trigger Lambda Functions
Favicon
Chrome side panel: Simulate close event
Favicon
Data Storage & Retrieval Troubles with Bookmark Decay
Favicon
Diving into Chrome Extension Development: 3 Essential Resources
Favicon
Developing a Chrome Extension for Bookmark Decay
Favicon
"Bookmark Decay": A Project for Learning
Favicon
Twitch Mention Notifier web extension
Favicon
Looking to partner with a chrome extension partner.
Favicon
How to add a progress bar to terraform cli

Featured ones: