fiatjaf / neuron.vim

📝 Manage your Zettelkasten in {n}vim.
MIT License
83 stars 21 forks source link

Searching/linking functionality not working as expected #54

Closed butgit closed 3 years ago

butgit commented 3 years ago

What I did so far:

Install Neuron on my Amazon Lightsail instance:

OS: Debian 10.5 Instance type: 512 MB RAM, 1 vCPU, 20 GB SSD

curl -L https://nixos.org/nix/install | sh
. /home/admin/.nix-profile/etc/profile.d/nix.sh
nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use srid

#Turn on the aggressive garbage collector mode
sudo passwd
su
echo 1 > /proc/sys/vm/overcommit_memory 
exit

nix-env -if https://github.com/srid/neuron/archive/master.tar.gz

Check if it's working:

neuron --version

It's 1.1.6.3.

Build VIM from source

sudo apt update
sudo apt upgrade

Install prerequisites for VIM

sudo apt install libncurses5-dev libgtk2.0-dev libatk1.0-dev libcairo2-dev \
                          libx11-dev libxpm-dev libxt-dev python3-dev lua5.2 git

Remove old VIM and build a new one

sudo apt remove vim-tiny vim-common vim-gui-common vim-nox

cd ~
git clone https://github.com/vim/vim.git
cd vim

./configure --with-features=huge --enable-multibyte --enable-python3interp=yes \
                   --with-python3-config-dir=$(python3-config --configdir) --enable-gui=gtk2 \
                   --enable-cscope --prefix=/usr/local

make VIMRUNTIMEDIR=/usr/local/share/vim/vim82

cd ~/vim
sudo make install

Create symbolic links to VIM

sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/vim 1
sudo update-alternatives --set editor /usr/local/bin/vim
sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/vim 1
sudo update-alternatives --set vi /usr/local/bin/vim

To set VIM as default editor, open ~/.bashrc and add

export EDITOR=vim

Reload .bashrc

source ~/.bashrc

Install vim-plug

curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Open .vimrc

vim ~/.vimrc

Fill .vimrc with:

let g:neuron_dir=expand("~/zettelkasten/")

call plug#begin()
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'fiatjaf/neuron.vim'
call plug#end()

In the command mode of VIM, run:

source ~/.vimrc 
PlugInstall
PlugUpdate

Create my Zettelkasten folder and make a few Zettels

mkdir ~/zettelkasten
cd ~/zettelkasten
touch neuron.dhall
neuron new -e 
...
neuron new index -e

Now, ~/zettelkasten/ ├ 28176420.md
├ 943814ae.md
├ c95d9e66.md
├ index.md
└ neuron.dhall

The problem is that when I open a zettel, say index.md, I see the following errors:

"index.md" 3L, 31B
Error detected while processing function <SNR>13 refresh_cache_callback_vim:
line    1:
E484: Can't open file /tmp/neuronzettelsbuffer
Error detected while processing function <SNR>13_refresh_cache_callback_vim[3]..<SNR>13_refresh_cache_callback:
line    4:
E909: Cannot index a special variable
line    6:
E121: Undefined variable: l:zettels
E116: Invalid arguments for function sort
line    13:
E121: Undefined variable: l:zettels
line    20:
E121: Undefined variable: l:zettels

Also, when I try to open another zettel by typing gzz, it opens a search window but other zettels are not shown like the drawing below


               +---------------------------------------------------------------------+
               |                                                                     |
               |                                  +-------------------------------+  |
               |                                  |                               |  |
               |                                  |                               |  |
               |                                  |                               |  |
               |                                  |                               |  |
               |                                  |                               |  |
               |      0/0                         |                               |  |
               |                                  |                               |  |
               |   Search Zettel:|                |                               |  |
               |                                  +-------------------------------+  |
               |                                                                     |
               +---------------------------------------------------------------------+

Another issue is that if I create a link from a zettel like [[943814ae.md]], place text cursor on it, and gzo, it says Word under cursor is not a known zettel!

What am I missing something here? Have I skipped an important plugin?

butgit commented 3 years ago

Issue resolved. I re-read readme.md page, and found out that I didn't install silversearcher-ag. I installed it and rebooted my Lightsail instance. Now everything is working great as it's supposed to. Linking, backlinking, searching, you name it.

fiatjaf commented 3 years ago

Thank you for fixing this bug!

(I'm joking a little but at the same time really thankful.)

butgit commented 3 years ago

Thanks! In fact, the reported problem still happen though not often. The stop-gap measure for me is reboot my instance, and I'm ok with that.