Skip to content

A Vim mode to edit QB64 BASIC files, including commands to opens/compiles/run them with QB64 IDE.

License

Notifications You must be signed in to change notification settings

caglartoklu/qb64dev.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

qb64dev.vim

A Vim mode to edit QB64 BASIC files, including commands to opens/compiles/run them with QB64 IDE.

See the commands section below for screenshots and features.

Quoting from QB64 on Wikipedia; QB64 is a self-hosting BASIC compiler for Microsoft Windows, Linux and Mac OS X, designed to be compatible with Microsoft QBasic and QuickBASIC. QB64 is a C++ emitter, which is integrated with a C++ compiler to provide compilation via C++ code and GCC optimization.

QB64 implements most QBasic statements, and can run many QBasic programs, including Microsoft's QBasic Gorillas and Nibbles games.

Furthermore, QB64 has been designed to contain an IDE resembling the QBASIC IDE.

See more on QB64 on Wikipedia.

Requirements

  • QB64 : Simply download and install QB64 to a directory of your choice. QB64 is available for Windows, Linux and Mac OS X.

Installation

For Vundle users:

Plugin 'caglartoklu/qb64dev.vim'

For all other users, simply drop the plugin/qb64dev.vim file to your plugin directory.

Configuration

g:qb64dev_qb64_directory

The installation directory of QB64.

Default :

unavailable.

example:

g:qb64dev_qb64_directory = 'C:\bin\qb64'

g:qb64dev_autofind_qb64

If g:qb64dev_qb64_directory is not defined, and g:qb64dev_autofind_qb64 is 1, which is the default, then qb64dev.vim will check a few paths to locate QB64 directory.

Note that g:qb64dev_qb64_directory will override this setting if defined.

Default:

let g:qb64dev_autofind_qb64 = 1

Commands

QB64Compile

Compiles the .bas file in Vim buffer with QB64. The executable file will be in the same path as the .bas file.

qb64compile

QB64Run

Runs the compiled executable file. The executable file must be in the same path as the .bas file.

qb64run

QB64CompileAndRun

Compiles the .bas file in Vim buffer with QB64 and executes it. The executable file must be in the same path as the .bas file.

QB64Open

Opens the current buffer in QB64 IDE. This can be useful to squash a bug or use the inline help system in QB64 IDE.

qb64open

Recommended Settings

Map F5 for Run and F11 for Make Exe Only

au BufEnter,BufNew *.bas nnoremap <F5> : call qb64dev#QB64CompileAndRun()<cr>
au BufEnter,BufNew *.bas nnoremap <F11> : call qb64dev#QB64Compile()<cr>

Tab Completion for Dictionary

Note that qb64dev.vim only provides the dictionary.

That dictionary can be used with Vim's standard dictionary completion keys (CTRL X CTRL K) or any other compatible Vim completion plugin.

The following code sample is for VimCompletesMe.

au BufEnter,BufNew *.bas let b:vcm_tab_complete = 'dict'

In the following animated gif, TAB key makes the completion:

qb64_code_completion

FAQ

Do I really need QB64 to use this plugin?

Technically no, but, without QB64 itself, this plugin would be pointless.

Why would I use qb64dev.vim instead of official QB64 IDE?

First of all, QB64 IDE is retro-classic, and nothing beats that :)

Moreover, QB64 IDE has its own advantages like code formatting, showing errors, and built-in help as in QuickBASIC.

But, if you use Vim for all your coding, you may want to use it for QuickBASIC as well. And, qb64dev.vim provides a way to use it.

In addition, qb64dev.vim provides a dictionary to use with Vim's dictionary completion.

What is the name of the colorscheme in screenshots?

It is qbcolor.vim and it can be found here here.

It is a separate plugin. It must be installed separately and used as follows:

Plugin 'caglartoklu/qbcolor.vim'

colorscheme qbcolor

What is the syntax file you are using for screenshots?

That is FreeBASIC syntax file.

It is a separate plugin. It must be installed separately and used as follows:

Plugin 'vim-scripts/Freebasic-vim-syntax-file'

autocmd BufNewFile,BufRead *.bas set ft=freebasic
autocmd BufNewFile,BufRead *.bi set ft=freebasic

To Do

  • Compile, Run features.
  • Code completion.
  • Test on Windows.
  • Test on Linux.
  • Test on macOS.
  • Embedding help files.
  • A script to automatically download keywords list from QB64 wiki.
  • QB64 specific syntax file.
  • QB64 specific snippets for vim-snipmate.
  • Passing external arguments when running.
  • Passing external complation options when compiling.
  • vim-quickui integration (maybe?).

License

Licensed with 2-clause license ("Simplified BSD License" or "FreeBSD License"). See the LICENSE.txt file.

About

A Vim mode to edit QB64 BASIC files, including commands to opens/compiles/run them with QB64 IDE.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published