My julia setup for vim with ycm on linux

Julia is a high-level, high-performance programming language for technical computing. It is known for its speed and ease of use, making it a popular choice among data scientists and researchers. In this article, we will explore different ways to set up Julia for Vim with YCM (YouCompleteMe) on Linux.

Option 1: Using the Julia-Vim plugin

The Julia-Vim plugin is a powerful tool that provides syntax highlighting, indentation, and other useful features for editing Julia code in Vim. To install the plugin, follow these steps:


# Install the Julia-Vim plugin
git clone https://github.com/JuliaEditorSupport/julia-vim.git ~/.vim/bundle/julia-vim

# Add the following lines to your .vimrc file
syntax enable
filetype plugin indent on

After installing the plugin, you can open a Julia file in Vim and enjoy the enhanced editing experience. The plugin provides features like code folding, function and variable navigation, and automatic indentation.

Option 2: Using the LanguageClient-neovim plugin

The LanguageClient-neovim plugin is a language server protocol client for Neovim, which provides language-specific features like autocompletion, diagnostics, and documentation. To set up Julia with LanguageClient-neovim, follow these steps:


# Install the LanguageClient-neovim plugin
git clone https://github.com/autozimu/LanguageClient-neovim.git ~/.vim/bundle/LanguageClient-neovim

# Add the following lines to your .vimrc file
let g:LanguageClient_serverCommands = {
     'julia': ['julia', '--startup-file=no', '--history-file=no', '-e', 'using LanguageServer; server = LanguageServer.LanguageServerInstance(stdin, stdout, false); run(server)'],
     }

# Start Neovim and run the following command
:LanguageClientStart

After setting up LanguageClient-neovim, you can open a Julia file in Neovim and enjoy features like autocompletion, inline documentation, and diagnostics.

Option 3: Using the coc.nvim plugin

The coc.nvim plugin is a full-featured Vim and Neovim extension that provides language server protocol integration. To set up Julia with coc.nvim, follow these steps:


# Install the coc.nvim plugin
git clone https://github.com/neoclide/coc.nvim.git ~/.vim/bundle/coc.nvim

# Add the following lines to your .vimrc file
let g:coc_global_extensions = [
     'coc-julia',
     ]

# Start Neovim and run the following command
:CocInstall coc-julia

After installing coc.nvim and the coc-julia extension, you can open a Julia file in Neovim and enjoy features like autocompletion, signature help, and documentation.

Among the three options, the best choice depends on your personal preferences and requirements. If you prefer a lightweight solution with basic features, the Julia-Vim plugin is a good option. If you need more advanced features like autocompletion and diagnostics, the LanguageClient-neovim plugin is a great choice. Finally, if you want a full-featured extension with extensive language server protocol integration, the coc.nvim plugin is the way to go.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents