Latest versions:
Notes from discussion in Slack with Conjure author - https://clojurians.slack.com/archives/CK143P6D7/p1598474458020800
A guide to installing and first time use of Conjure and Neovim, using vim-plug as a plugin manager. This guide builds on getting started with clojure neovim by Oliver Caldwell and assumes no experience with neovim.
For a more automated approach, try https://github.com/liuchengxu/space-vim (not yet tested with conjure)
Install pip3 package manager for python3 (the default in Ubuntu 20.04).
sudo apt install python-pip3
Add msgpack
package via pip3 (required for the deoplete plugin for neovim)
Shougo/deoplete.nvim#1073
pip3 install --upgrade msgpack
Use Ubuntu apt command to install neovim version: 0.4.3-3
sudo apt install neovim
Set nvim as the default vim command
sudo update-alternatives --config vim
Follow instructions for neovim install on Ubuntu at: https://github.com/junegunn/vim-plug
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
This created the following tree structure under ~/.local/share/nvim
├── shada
│ └── main.shada
├── site
│ └── autoload
│ └── plug.vim
└── swap
Create a directory for the neovim init file
mkdir ~/.config/nvim
Create a new init.vim file
nvim ~/.config/nvim/init.vim
Add plugins for conjure and a few supporting plugins
call plug#begin(stdpath('data') . '/plugged')
" Conjure
Plug 'Olical/conjure', {'tag': 'v4.3.1'}
" Conjure support - jack-in with nrepl dependencies
Plug 'tpope/vim-dispatch'
Plug 'clojure-vim/vim-jack-in'
" Only in Neovim:
Plug 'radenling/vim-dispatch-neovim'
call plug#end()
The plugins will be saved to the ~/.local/share/nvim/plugged/
directory.
A long list of suggested plugins can be found in the Conjure authors neovim configuration
Run neovim and run :PlugInstall
to install all the packages defined in the ~/.config/nvim/init.vim
file.
Use :PlugUpdate
to update packages managed by vim-plug.
Use :PlugUpgrade
to update the vim-plug package itself.
:help conjure
opens the conjure documentation in neovim. Use j
to scroll down, k
to scroll up.
:ConjureSchool
command will start an interactive tutorial and introduce Conjure's workflow and key mappings
Using practicalli/clojure-deps-edn
aliases, run a REPL with nrepl
and cider-nrepl
clojure -X:middleware/nrepl
Then open a Clojure file and Conjure will (magically) connect to the running REPL and pop-up a connect message in the top right corner.
Start neovim with a Clojure file, nvim src/practialli/playground.clj
or run nvim
and then open a file to edit :e src/practicalli/playground.clj
. A Clojure file is any ending in *.clj
, *.cljc
or .edn
.
Start a REPL from within neovim
:Clj
command to start a REPL using Clojure CLI Tools
:Lein
command to start a REPL using Leiningen
Neovim switches to a terminal state, use
C-\ C-n
to leave the terminal state. Use:N
or:previous
to switch back to the source code buffer
, c f
to connect to the REPL from Conjure, or simply open a Clojure file. Automated connection will be added in a future version on Conjure.
The vim-jack-in plugin enables Neovim to call out to Clojure tools or Leiningen to start a REPL and connect to it once its started.
A full screen REPL log is displayed. , l q
to close the log window and return to the Clojure file.
, l v
to create a vertical split between code and REPL log, , l h
for a horizontal split.
With the maplocalleader key set to ,
, e b
evaluates the current buffer
, e f
evaluate the code in the file (from the file system)
, e e
evaluate the current expression
, e r
evaluate top level form (root)
, e !
evaluate current form and replace with result
NOTE: Conjure results appear in a pop-up panel which displays until the cursor is moved. Whilst the pop-up is displaying, it is not possible to quit a file with
:q
. Move the cursor or useg t
to change tabs to remove the popup.
:
in Vim normal mode to start entering a command
q:
to popup a list of recent commands
https://neovim.io/doc/user/usr_07.html
nvim src.clj deps.edn readme.org
will open three files
:n
or :next
to switch to the next file, :2next
to jump 2 files, :last
for the last file.
:N
or :previous
to switch to the previous file
C-^
to toggle to last shown file
g d
go to definition of current symbol
:cd
changes the current working directory, use by :e
:lcd
^ but local to the current window
:windo
lcd ^ for all windows in the current tab
:pwd
prints the current working directory
:e!
reloads the current buffer, discarding unsaved changes
:find
to search for file names relative to the path option (set path?) and open them.
Install the Deoplete plugin (from Olical configuration) https://github.com/Shougo/deoplete.nvim
" Completion support
Plug 'Shougo/deoplete.nvim' | Plug 'ncm2/float-preview.nvim'
"
Quit neovim to load the updted configuration (unless there is someway to reload the configuration)
Run neovim and :PlugInstall
to install all plugins defined in the ~/.config/nvim/init.vim
configuration
?
?
?
Matches the theme used for Spacemacs https://github.com/morhetz/gruvbox
Add following to vim-plug section
" Plug 'morhetz/gruvbox'
After vim-plug section, configure the specific Gruvbox theme settings, in this case to use the light theme and use powerline fonts (not sure that makes a difference)
let g:airline_solarized_bg='light'
let g:airline_powerline_fonts = 1
https://github.com/lifepillar/vim-solarized8
Plug 'lifepillar/vim-solarized8'
set background=light
colorscheme solarized8
Themes to try
- https://github.com/rakr/vim-one - has light theme
https://github.com/hardcoreplayers/spaceline.vim
Plug 'hardcoreplayers/spaceline.vim'
Plug 'ryanoasis/vim-devicons'
Config The one colorscheme seems to render consistently, the space colorscheme does not render consistently (tested with gruvbox theme)
let g:spaceline_colorscheme = 'one'
statusline themse to try
Spacemacs like mappings for window interactions using SPC w
prefix.
https://github.com/Olical/dotfiles/blob/master/stowed/.config/nvim/fnl/dotfiles/module/mapping.fnl#L20 stowed/.config/nvim/fnl/dotfiles/module/mapping.fnl:20
Configured with a combination of:
- https://github.com/Olical/dotfiles/blob/master/stowed/.config/nvim/fnl/dotfiles/module/mapping.fnl
- https://github.com/liuchengxu/vim-better-default
Useful keybinding reference: https://github.com/liuchengxu/vim-better-default/wiki/a-brief-introduction-to-key-bindings
wrt running tests, the Clojure specific help (
:help clojure-client-clojure-nrepl
) lists the testing mappings such as, t n
to test the current namespace. There's nothing in the way of formatting and refactoring yet but solutions for those will arrive eventually. I normally use==
or=-
to use Neovim's built in indentation of forms. (I think this might require vim-sexp` although I'm not 100% sure)