|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
|
Thread Tools | Display Modes |
|
|||
Vim9 Script - worth learning?
Vim 9.0, the new version of my favorite text editor has been released.
They replaced the old VimScript with new Vim9 Script, breaking compatibility with older versions of Vim and broke the compatibility with Vi text editor. I have 2 options: 1. Learn the new Vim9 Script and rewrite my Vim config. 2. Learn Lua programming language, switch from Vim to NeoVim and rewrite my config in Lua. Which one should I do? |
|
|||
roddierod, if my old config will work in Vim9, then I have nothing to worry about, thanks!
Prevet, ed scripts? Sounds interesting! |
|
||||
Quote:
Code:
# Go to the last cursor location when a file is opened unless this is a git commit. au BufReadPost * { if line("'\"") > 1 && line("'\"") <= line("$") && &filetype != 'gitcommit' exe 'normal! g`"' endif } # Convert buffer to and from scratch. command S { if &buftype == 'nofile' setl swapfile buftype= bufhidden= else setl noswapfile buftype=nofile bufhidden=hide endif echo printf('swapfile=%s buftype=%s bufhidden=%s', &swapfile, &buftype, &bufhidden) } Code:
" Go to the last cursor location when a file is opened unless this is a git commit. au BufReadPost * \ if line("'\"") > 1 && line("'\"") <= line("$") && &filetype != 'gitcommit' \| exe 'normal! g`"' \| endif " Convert buffer to and from scratch. command! S \ if &buftype is# 'nofile' | setl swapfile buftype= bufhidden= \| else | setl noswapfile buftype=nofile bufhidden=hide | endif \| echo printf('swapfile=%s buftype=%s bufhidden=%s', &swapfile, &buftype, &bufhidden) My vimrc is in Vim9Script (over here, if anyone's interested) and I've written some small plugins with it. It's not all that different from the old VimScript, but with a few "obvious" fixes and typing. In general I prefer it over the Lua stuff Neovim did; I don't think Lua is a terrible language, but it's not a great language either IMHO, and if I look at what people need to do to call "nnoremap" in Lua then it's doesn't strike me as a great improvement. Is it worth rewriting your vimrc in Vim9Script or Lua? Probably not; VimScript still works and isn't going away. The main reason I did last year was so that I had some real-world code to try Vim9Script out on so I could provide some feedback to Bram based on that. Also worth pointing out you can mix VimScript and Vim9Script (by using "function" or "def" for function definitions).
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
|
|||
While Vim9script has quite a few advantages over Vimscript (including performance improvements), Vim supports other languages just fine. If your script does not mostly contain editing commands, try Perl instead.
__________________
There is a copious amount of noise on Linux fora. |
|
|||
Thanks!
Now I think I like Vim9Script more than Lua. |
Tags |
vim9 script |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Learning to script... | RJPugh | Programming | 7 | 9th November 2014 08:04 PM |
Apache: Old, out of touch, but worth it... : GitHub who? | J65nko | News | 1 | 3rd December 2011 01:21 PM |
ZFS, is it worth for my fileserver? | gkontos | FreeBSD General | 7 | 21st November 2009 04:41 PM |
Is it worth upgrading this laptops RAM | TerryP | General Hardware | 4 | 17th January 2009 04:56 AM |
Is such a course worth the time/money? | TerryP | Off-Topic | 21 | 4th November 2008 08:05 PM |