Skip to content

Terminal Editor Integration

Mo Abualruz edited this page Dec 9, 2025 · 1 revision

Terminal Editor Integration

Status: ✅ Complete

Phase: Phase 2

Last Updated: December 9, 2025


Overview

RiceCoder provides native integration with popular terminal editors: vim, neovim, and emacs. These integrations enable seamless access to ricecoder's AI-powered features directly in your terminal editor, including code completion, diagnostics, hover information, and definition navigation.


Vim / Neovim Integration

Installation

Prerequisites

  • Vim 8.0+ or Neovim 0.5+
  • RiceCoder installed and running
  • Plugin manager (vim-plug, packer, lazy.nvim, etc.)

Using vim-plug

Add to your ~/.vimrc or ~/.config/nvim/init.vim:

Plug 'moabualruz/ricecoder-vim'

Then run:

:PlugInstall

Using packer.nvim (Neovim)

Add to your ~/.config/nvim/init.lua:

use {
  'moabualruz/ricecoder-vim',
  config = function()
    require('ricecoder').setup()
  end
}

Then run:

:PackerSync

Using lazy.nvim (Neovim)

Add to your ~/.config/nvim/init.lua:

{
  'moabualruz/ricecoder-vim',
  config = function()
    require('ricecoder').setup()
  end
}

Manual Installation

  1. Clone the repository:

    git clone https://github.com/moabualruz/ricecoder-vim.git
  2. Copy to vim plugins directory:

    cp -r ricecoder-vim ~/.vim/pack/plugins/start/

Configuration

Vim Configuration

Add to your ~/.vimrc:

" Enable ricecoder
let g:ricecoder_enabled = 1

" Set ricecoder host and port
let g:ricecoder_host = 'localhost'
let g:ricecoder_port = 8080

" Enable features
let g:ricecoder_completion = 1
let g:ricecoder_diagnostics = 1
let g:ricecoder_hover = 1
let g:ricecoder_definition = 1

" Set timeout (milliseconds)
let g:ricecoder_timeout = 5000

" Set max completion results
let g:ricecoder_max_results = 50

Neovim Configuration

Add to your ~/.config/nvim/init.lua:

require('ricecoder').setup({
  enabled = true,
  host = 'localhost',
  port = 8080,
  features = {
    completion = true,
    diagnostics = true,
    hover = true,
    definition = true,
  },
  timeout = 5000,
  max_results = 50,
})

Features and Usage

Code Completion

Intelligent code completion in vim/neovim.

How to Use:

  • Automatic: Completions appear as you type (if configured)
  • Manual: Press Ctrl+X Ctrl+O to trigger completion
  • Select: Use arrow keys to navigate, Enter to select
  • Dismiss: Press Escape to dismiss

Configuration:

" Enable automatic completion
set completeopt=menu,menuone,noselect
let g:ricecoder_auto_complete = 1

Example:

fn main() {
    let v = vec![1, 2, 3];
    v.  " Press Ctrl+X Ctrl+O
        " Completions: iter(), len(), push(), etc.
}

Diagnostics

Real-time error and warning detection.

How to Use:

  • Errors and warnings appear as signs in the gutter
  • Use :RiceCoder diagnostics to show all diagnostics
  • Navigate with :RiceCoder next-diagnostic and :RiceCoder prev-diagnostic

Configuration:

" Show diagnostics signs
let g:ricecoder_show_diagnostics = 1

" Show diagnostics in virtual text
let g:ricecoder_virtual_text = 1

Example:

let x: i32 = "string";  " Error sign in gutter
                        " Hover to see error message

Hover Information

Symbol information on hover.

How to Use:

  • Press K (or configured key) to show hover information
  • Information appears in a floating window
  • Press Escape to dismiss

Configuration:

" Set hover key
let g:ricecoder_hover_key = 'K'

Example:

let result = vec![1, 2, 3];
           " Press K to see: Vec<i32>

Definition Navigation

Navigate to symbol definitions.

How to Use:

  • Press gd to go to definition
  • Press Ctrl+] to jump to definition
  • Press Ctrl+T to go back

Configuration:

" Set definition key
nnoremap gd :RiceCoder definition<CR>

Keyboard Shortcuts

Default Shortcuts (Vim)

Shortcut Command Description
Ctrl+X Ctrl+O Completion Trigger completion
K Hover Show hover info
gd Definition Go to definition
Ctrl+] Definition Jump to definition
Ctrl+T Back Go back

Custom Shortcuts

Add to your ~/.vimrc:

" Custom shortcuts
nnoremap <leader>rc :RiceCoder<CR>
nnoremap <leader>rd :RiceCoder definition<CR>
nnoremap <leader>rh :RiceCoder hover<CR>
nnoremap <leader>rn :RiceCoder next-diagnostic<CR>
nnoremap <leader>rp :RiceCoder prev-diagnostic<CR>

Commands

Available Commands

Command Description
:RiceCoder Show ricecoder status
:RiceCoder completion Trigger completion
:RiceCoder hover Show hover info
:RiceCoder definition Go to definition
:RiceCoder diagnostics Show all diagnostics
:RiceCoder next-diagnostic Go to next diagnostic
:RiceCoder prev-diagnostic Go to previous diagnostic
:RiceCoder enable Enable ricecoder
:RiceCoder disable Disable ricecoder
:RiceCoder restart Restart ricecoder

Troubleshooting

Plugin Not Loading

Problem: Plugin is not loaded

Solutions:

  1. Verify plugin is installed:

    ls ~/.vim/pack/plugins/start/ricecoder-vim
  2. Check vim configuration:

    • Ensure ~/.vimrc is being loaded
    • Try :source ~/.vimrc to reload
  3. Check for errors:

    • Run :messages to see error messages
    • Check plugin logs
  4. Reinstall plugin:

    • Remove plugin directory
    • Reinstall using plugin manager

Completion Not Working

Problem: Code completions are not appearing

Solutions:

  1. Verify completion is enabled:

    :echo g:ricecoder_completion
  2. Check ricecoder is running:

    curl http://localhost:8080/health
  3. Try manual trigger:

    Ctrl+X Ctrl+O
  4. Check for errors:

    • Run :messages to see error messages
    • Check ricecoder logs
  5. Increase timeout:

    let g:ricecoder_timeout = 10000

Diagnostics Not Showing

Problem: Errors and warnings are not displayed

Solutions:

  1. Verify diagnostics are enabled:

    :echo g:ricecoder_diagnostics
  2. Show diagnostics:

    :RiceCoder diagnostics
  3. Check for errors:

    • Run :messages to see error messages
    • Check ricecoder logs
  4. Enable virtual text:

    let g:ricecoder_virtual_text = 1

Emacs Integration

Installation

Prerequisites

  • Emacs 26.0+
  • RiceCoder installed and running
  • Package manager (use-package, straight.el, etc.)

Using use-package

Add to your ~/.emacs.d/init.el:

(use-package ricecoder
  :ensure t
  :config
  (ricecoder-mode 1))

Using straight.el

Add to your ~/.emacs.d/init.el:

(use-package ricecoder
  :straight (ricecoder :type git :host github :repo "moabualruz/ricecoder-emacs")
  :config
  (ricecoder-mode 1))

Manual Installation

  1. Clone the repository:

    git clone https://github.com/moabualruz/ricecoder-emacs.git
  2. Add to your ~/.emacs.d/init.el:

    (add-to-list 'load-path "~/ricecoder-emacs")
    (require 'ricecoder)
    (ricecoder-mode 1)

Configuration

Add to your ~/.emacs.d/init.el:

(use-package ricecoder
  :ensure t
  :config
  (setq ricecoder-enabled t)
  (setq ricecoder-host "localhost")
  (setq ricecoder-port 8080)
  (setq ricecoder-timeout 5000)
  (setq ricecoder-max-results 50)
  
  ;; Enable features
  (setq ricecoder-completion-enabled t)
  (setq ricecoder-diagnostics-enabled t)
  (setq ricecoder-hover-enabled t)
  (setq ricecoder-definition-enabled t)
  
  ;; Enable mode
  (ricecoder-mode 1))

Features and Usage

Code Completion

Intelligent code completion in emacs.

How to Use:

  • Automatic: Completions appear as you type (if configured)
  • Manual: Press M-/ or C-M-i to trigger completion
  • Select: Use arrow keys to navigate, Enter to select
  • Dismiss: Press Escape to dismiss

Configuration:

(setq ricecoder-auto-complete t)
(setq ricecoder-completion-trigger-chars '("." "(" "[" "{"))

Example:

fn main() {
    let v = vec![1, 2, 3];
    v.  " Press M-/ for completions
        " Completions: iter(), len(), push(), etc.
}

Diagnostics

Real-time error and warning detection.

How to Use:

  • Errors and warnings appear as overlays in the buffer
  • Use M-x ricecoder-next-diagnostic to go to next diagnostic
  • Use M-x ricecoder-prev-diagnostic to go to previous diagnostic
  • Hover over diagnostic to see details

Configuration:

(setq ricecoder-show-diagnostics t)
(setq ricecoder-diagnostics-in-modeline t)

Example:

let x: i32 = "string";  " Error overlay
                        " Hover to see error message

Hover Information

Symbol information on hover.

How to Use:

  • Press C-c C-h to show hover information
  • Information appears in a popup or separate buffer
  • Press Escape to dismiss

Configuration:

(define-key ricecoder-mode-map (kbd "C-c C-h") 'ricecoder-hover)

Example:

let result = vec![1, 2, 3];
           " Press C-c C-h to see: Vec<i32>

Definition Navigation

Navigate to symbol definitions.

How to Use:

  • Press M-. to go to definition
  • Press M-, to go back
  • Press M-? to find references

Configuration:

(define-key ricecoder-mode-map (kbd "M-.") 'ricecoder-definition)
(define-key ricecoder-mode-map (kbd "M-,") 'ricecoder-pop-mark)
(define-key ricecoder-mode-map (kbd "M-?") 'ricecoder-references)

Keyboard Shortcuts

Default Shortcuts

Shortcut Command Description
M-/ Completion Trigger completion
C-M-i Completion Trigger completion
C-c C-h Hover Show hover info
M-. Definition Go to definition
M-, Back Go back
M-? References Find references

Custom Shortcuts

Add to your ~/.emacs.d/init.el:

(define-key ricecoder-mode-map (kbd "C-c r c") 'ricecoder-completion)
(define-key ricecoder-mode-map (kbd "C-c r d") 'ricecoder-definition)
(define-key ricecoder-mode-map (kbd "C-c r h") 'ricecoder-hover)
(define-key ricecoder-mode-map (kbd "C-c r n") 'ricecoder-next-diagnostic)
(define-key ricecoder-mode-map (kbd "C-c r p") 'ricecoder-prev-diagnostic)

Commands

Available Commands

Command Description
ricecoder-mode Toggle ricecoder mode
ricecoder-completion Trigger completion
ricecoder-hover Show hover info
ricecoder-definition Go to definition
ricecoder-references Find references
ricecoder-diagnostics Show all diagnostics
ricecoder-next-diagnostic Go to next diagnostic
ricecoder-prev-diagnostic Go to previous diagnostic
ricecoder-enable Enable ricecoder
ricecoder-disable Disable ricecoder
ricecoder-restart Restart ricecoder

Troubleshooting

Package Not Loading

Problem: Package is not loaded

Solutions:

  1. Verify package is installed:

    ls ~/.emacs.d/elpa/ricecoder*
  2. Check emacs configuration:

    • Ensure ~/.emacs.d/init.el is being loaded
    • Try M-x load-file ~/.emacs.d/init.el
  3. Check for errors:

    • Run M-x view-echo-area-messages to see error messages
    • Check emacs logs
  4. Reinstall package:

    • Run M-x package-delete ricecoder
    • Run M-x package-install ricecoder

Completion Not Working

Problem: Code completions are not appearing

Solutions:

  1. Verify completion is enabled:

    M-: ricecoder-completion-enabled
  2. Check ricecoder is running:

    curl http://localhost:8080/health
  3. Try manual trigger:

    M-/
    
  4. Check for errors:

    • Run M-x view-echo-area-messages to see error messages
    • Check ricecoder logs
  5. Increase timeout:

    (setq ricecoder-timeout 10000)

Diagnostics Not Showing

Problem: Errors and warnings are not displayed

Solutions:

  1. Verify diagnostics are enabled:

    M-: ricecoder-diagnostics-enabled
  2. Check for errors:

    • Run M-x view-echo-area-messages to see error messages
    • Check ricecoder logs
  3. Enable diagnostics display:

    (setq ricecoder-show-diagnostics t)

General Troubleshooting

Connection Issues

Problem: "Failed to connect to RiceCoder"

Solutions:

  1. Verify ricecoder is running:

    ricecoder --version
    ricecoder start
  2. Check port configuration:

    • Default port is 8080
    • Verify port is not in use: netstat -an | grep 8080
    • Change port in configuration if needed
  3. Check firewall:

    • Ensure firewall allows localhost connections
    • Try connecting from terminal: curl http://localhost:8080/health
  4. Check editor logs:

    • Vim: :messages
    • Emacs: M-x view-echo-area-messages
  5. Restart editor:

    • Close and reopen editor
    • Or restart ricecoder

Performance Issues

Problem: Completions or diagnostics are slow

Solutions:

  1. Check system resources:

    • Monitor CPU and memory usage
    • Close other applications if needed
  2. Increase timeout:

    • LSP server may be slow
    • Increase timeout in configuration
  3. Reduce max results:

    • Decrease max results in configuration
    • Fewer results = faster processing
  4. Check LSP server:

    • LSP server may be overloaded
    • Try restarting ricecoder
  5. Disable unused features:

    • Disable features you don't use
    • Reduces processing overhead

Language Not Supported

Problem: "Language not supported"

Solutions:

  1. Check supported languages:

    • Rust, TypeScript, Python are officially supported
    • Other languages may have limited support
  2. Install LSP server:

    • Install LSP server for your language
    • Ricecoder will use it automatically
  3. Configure custom rules:

    • Create custom rules in configuration
    • Ricecoder will use them as fallback
  4. Use generic fallback:

    • Generic fallback works for any language
    • Provides basic functionality

Performance Tips

Optimize Completion Performance

  1. Reduce max results:

    let g:ricecoder_max_results = 25
  2. Increase timeout for slow LSP servers:

    let g:ricecoder_timeout = 10000
  3. Disable unused features:

    let g:ricecoder_diagnostics = 0

Optimize Diagnostics Performance

  1. Disable real-time diagnostics:

    • Diagnostics will only run on save
  2. Increase diagnostic delay:

    • Diagnostics will run less frequently
  3. Disable for large files:

    • Diagnostics can be slow on large files

See Also


Last updated: December 9, 2025

Clone this wiki locally