Coder Social home page Coder Social logo

notational-fzf-vim's Introduction

Looking for Maintainer

I don't have time to maintain this project anymore. If you are interested in taking over, please contact me in the GitHub issues.

Notational FZF

Loosen the mental blockages to recording information. Scrape away the tartar of convention that handicaps its retrieval.

--- Notational Velocity home page

Notational Velocity is a note-taking app where searching for a note and creating one are the same operation.

You search for a query, and if no note matches, it creates a new note with that query as the title.

Usage

See the following GIF or watch this asciinema:

Usage

Installation

" with vim-plug
Plug 'https://github.com/alok/notational-fzf-vim'

Changes

Read CHANGELOG.md.

Description

Vim is great for writing. But it isn't optimized for note-taking, where you often create lots of little notes and frequently change larger notes in a separate directory from the one you're working in. For years I used nvALT and whenever I had to do serious editing, I would open the file in Vim.

But some things about nvALT bugged me.

  • It's not meant for large text files, and opening them will cause it to lag a lot.

  • I can't use splits

  • I do most of my work in Vim, so why have another window open, wasting precious screen space with its inferior editing capabilities. Sorry Brett, but nvALT can't match Vim's editing speed.

  • I also disagree with some parts of Notational Velocity's philosophy.

Plugins like vim-pad didn't do it for me either, because:

  • I don't want to archive my notes. I should be able to just search for them.
  • I don't want to use the first line as the title since I have notes with duplicated titles in different directories, like README.md.
  • I just want to be able to search a set of directories and create notes in one of them, quickly.

When Junegunn created fzf, I realized that I could have all that, in Vim.

This plugin allows you to define a list of directories that you want to search. The first directory in the list is used as the main directory, unless you set g:nv_main_directory. If you press control-x after typing some words, it will use those words as the filename to create a file in the main directory. It will then open that file in a vertical split. If that file already exists, don't worry, it won't overwrite it. This plugin never modifies your files at any point. It can only read, open, and create them.

You can define relative links, so adding ./docs and ./notes will work. Keep in mind that it's relative to your current working directory (as Vim interprets it).

Dependencies

  • rg is required for its fast search.

  • fzf.

  • fzf Vim plugin. Install the Vim plugin that comes with fzf, which can be done like so if you use vim-plug.

    Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
    
  • Python 3.5 or higher, for the preview window and filepath shortening.

Optional dependencies

  • Pypy 3, for a potential speedup

Required Settings

You have to define a list of directories or files (which all must be strings) to search. This setting is named g:nv_search_paths.

Remember that these can be relative links.

" example
let g:nv_search_paths = ['~/wiki', '~/writing', '~/code', 'docs.md' , './notes.md']

Detailed Usage

This plugin unites searching and file creation. It defines a single command :NV, which can take 0 or more arguments, which are interpreted as regexes.

Type :NV or bind it to a mapping to bring up a fuzzy search menu. Type in your search terms and it will fuzzy search for them. Adding an exclamation mark to the command (:NV!), will run it fullscreen.

You can type :NV to see all results, and then filter them with FZF. You can type :NV python to restrict your initial search to lines that contain the phrase python. :NV [0-9] [0-9] will find all numbers separated by a space. You know, regexes.

It does not search in a fully fuzzy fashion because that's less useful for prose. It looks for full words, but they don't have to be next to each other, just on the same line. You can use the arrow keys or c-p and c-n to scroll through the search results, and then hit one of these keys to open up a file:

Note that the following options can be customized.

  • c-x: Use search string as filename and open in vertical split.
  • c-v: Open in vertical split
  • c-s: Open in horizontal split
  • c-t: Open in new tab
  • c-y: Yank the selected filenames
  • <Enter>: Open highlighted search result in current buffer

The lines around the selected file will be visible in a preview window.

Mappings

This plugin only defines a command :NV, and if you want a mapping for it, you can define it yourself. This is intentionally not done by default. You should use whatever mapping(s) work best for you.

For example,

nnoremap <silent> <c-s> :NV<CR>

Optional Settings and Their Defaults

You can display the full path by setting g:nv_use_short_pathnames = 0.

You can toggle displaying the preview window by pressing alt-p. This is handy on smaller screens. If you don't want to show the preview by default, set g:nv_show_preview = 0.

" String. Set to '' (the empty string) if you don't want an extension appended by default.
" Don't forget the dot, unless you don't want one.
let g:nv_default_extension = '.md'

" String. Default is first directory found in `g:nv_search_paths`. Error thrown
"if no directory found and g:nv_main_directory is not specified
"let g:nv_main_directory = g:nv_main_directory or (first directory in g:nv_search_paths)

" Dictionary with string keys and values. Must be in the form 'ctrl-KEY':
" 'command' or 'alt-KEY' : 'command'. See examples below.
let g:nv_keymap = {
                    \ 'ctrl-s': 'split ',
                    \ 'ctrl-v': 'vertical split ',
                    \ 'ctrl-t': 'tabedit ',
                    \ })

" String. Must be in the form 'ctrl-KEY' or 'alt-KEY'
let g:nv_create_note_key = 'ctrl-x'

" String. Controls how new note window is created.
let g:nv_create_note_window = 'vertical split'

" Boolean. Show preview. Set by default. Pressing Alt-p in FZF will toggle this for the current search.
let g:nv_show_preview = 1

" Boolean. Respect .*ignore files in or above nv_search_paths. Set by default.
let g:nv_use_ignore_files = 1

" Boolean. Include hidden files and folders in search. Disabled by default.
let g:nv_include_hidden = 0

" Boolean. Wrap text in preview window.
let g:nv_wrap_preview_text = 1

" String. Width of window as a percentage of screen's width.
let g:nv_window_width = '40%'

" String. Determines where the window is. Valid options are: 'right', 'left', 'up', 'down'.
let g:nv_window_direction = 'down'

" String. Command to open the window (e.g. `vertical` `aboveleft` `30new` `call my_function()`).
let g:nv_window_command = 'call my_function()'

" Float. Width of preview window as a percentage of screen's width. 50% by default.
let g:nv_preview_width = 50

" String. Determines where the preview window is. Valid options are: 'right', 'left', 'up', 'down'.
let g:nv_preview_direction = 'right'

" String. Yanks the selected filenames to the default register.
let g:nv_yank_key = 'ctrl-y'

" String. Separator used between yanked filenames.
let g:nv_yank_separator = "\n"

" Boolean. If set, will truncate each path element to a single character. If
" you have colons in your pathname, this will fail. Set by default.
let g:nv_use_short_pathnames = 1

"List of Strings. Shell glob patterns. Ignore all filenames that match any of
" the patterns.
let g:nv_ignore_pattern = ['summarize-*', 'misc*']

" List of Strings. Key mappings like above in case you want to define your own
" handler function. Most users won't want to set this to anything.

let g:nv_expect_keys = []

bat config

If bat is in the PATH then it will be used. It will use $BAT_THEME if it's set.

You can also define your own handler function, in case you don't like how this plugin handles input but like how it wraps everything else. It must be called NV_note_handler.

Potential Use Cases

  • Add ~/notes and ~/wiki so your notes are only one key binding away.
  • Add relative links like ./notes, ./doc, etc. to g:nv_search_paths so you can always see/update the documentation of your current project and keep up-to-date personal notes.

Philosophy

To quote scrod,

The reasoning behind Notational Velocity's present lack of multi-database support is that storing notes in separate databases would 1) Require the same kinds of decisions that category/folder-based organizers force upon their users (e.g., "Is this note going to be work-specific or home-specific?"), and 2) Defeat the point of instantaneous searching by requiring, ultimately, the user to repeat each search for every database in use.

  • By providing a default directory, we offer (one) fix to the first issue.

  • By searching the whole set of directories simultaneously, we handle the second.

It also handles Notational Velocity's issue with multiple databases. UNIX does not allow repeated filenames in the same folder, but often the parent folder provides context, like in workout/TODO.md and coding/TODO.md.

This plug-in attempts to abstract the operation of note-taking over all the notes you take, with priority given to one main notes directory.

Caveat Emptor

  • This plugin is just a wrapper over FZF that can view directories and open/create files. That's all it's ever meant to be. Anything else would be put into a separate plugin.

Feedback

Is always welcome. If you have any ideas or issues, let me know and I'll try to address them. Not all will be implemented, but if they fit into the philosophy of this plugin or seem really useful, I'll do my best.

License

Apache 2

notational-fzf-vim's People

Contributors

ahmedelgabri avatar alok avatar casonadams avatar danielwe avatar daturkel avatar johngodlee avatar laptop765 avatar martylake avatar michal-h21 avatar ploth avatar teto avatar yogen88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

notational-fzf-vim's Issues

Blank search box

I have installed notational-fzf-vim using Vundle and set the appropriate nv_search_paths in my .vimrc:

Plugin 'Alok/notational-fzf-vim' 

let g:nv_search_paths = ['/Users/user/Downloads/notes']

When I call the plugin in vim with :NV, while the fzf search and preview window appear, they are both empty and no files are found by fzf, displaying 0/0 in the search line.

A new file can be created with ctrl-x, and it successfully uses the path provided by nv_search_paths.

/Users/user/Downloads/notes contains two non-empty .md files called test.md and test2.md.

fzf and rg work in the shell with no issues.

Python 3.7.3 is installed. which python returns: /usr/local/opt/python/libexec/bin/python, which is included in my $PATH.

Running macOS Mojave 10.14.5.

Vim 8.1 compiled by Homebrew.

update to latest, now receiving error

Summary of Problem

  • updated plugin
  • upon invoking NV now receive:
Error running ( command rg --follow  --smart-case  --line-number --color never --no-messages  --glob !'summarize-*' --glob !'misc*' --no-heading --with-filename "\S" '/Users/dgudermu/Library/A
pplication Support/Notational Data' '/Users/dgudermu/scripts' '/Users/dgudermu/Notes'  |  python3 -S '/Users/dgudermu/.vim/pack/plugins/start/notational-fzf-vim/shorten_path_for_notational_fzf
.py' 2>/dev/null )|'/usr/local/Cellar/fzf/0.18.0/bin/fzf'  --print-query --ansi --multi --exact --inline-info --delimiter=":" --with-nth=3,5.. --tiebreak=length,begin --expect= --bind=alt-a:se
lect-all,alt-q:deselect-all,alt-p:toggle-preview,alt-u:page-up,alt-d:page-down,ctrl-w:backward-kill-word --preview='python3 -S /Users/dgudermu/.vim/pack/plugins/start/notational-fzf-vim/print_
lines.py {2} {1}  2>/dev/null' --preview-window=right:96:wrap --height=8 > /tmp/vS1ifQg/256

Remove paths completely from displayed results and only display the filename

Loving what you've done with this (was using https://github.com/cwoac/nvim before) but would love this to be just a tweak more like nvAlt or emacs Deft like.

Is there the possibility to remove filepaths entirely from the returned fzf results, so that only unique filenames are simply returned that match the title and content search string?

As an example: typing quotes 2016 returns

  /Users/daryl/Dropbox/Apps/nvim/Quotes 2016.md:8:- Morgan Housel                                                                                             
  /Users/daryl/Dropbox/Apps/nvim/Quotes 2016.md:44:โ€” Jason Fried                                                                                              
  /Users/daryl/Dropbox/Apps/nvim/Quotes 2016.md:27:- Elif Shafak                                                                                              
  /Users/daryl/Dropbox/Apps/nvim/Quotes 2016.md:1:## Quotes 2016                                                                                              
  /Users/daryl/Dropbox/Apps/nvim/Quotes 2016.md:86:โ€” Bill Gates                                                                                               
  /Users/daryl/Dropbox/Apps/nvim/Quotes 2016.md:76:- Ash Mauyra                                                                                               
  /Users/daryl/Dropbox/Apps/nvim/Quotes 2016.md:17:- Carl Sagan                                                                                               
  /Users/daryl/Dropbox/Apps/nvim/Quotes 2016.md:30:โ€”โ€ŠKent Beck                                                                                                
  /Users/daryl/Dropbox/Apps/nvim/Quotes 2016.md:54:โ€” Cassius                                                                                                  
> /Users/daryl/Dropbox/Apps/nvim/Quotes 2016.md:40:- Ma Jian                                                                                                  
  65/5330                                                                                                                                                     
> quotes 2016    

Whereas I would deeply prefer it just to return Quotes 2016. In the case of text inside a markdown document it would simply return the filenames that had search string within.
(admittedly, this is mostly because I use one single directory for my notes.).

In any case, great work!

`:NV word` doesn't search filenames for `word`

I have dozens of notes that contain the word bash. I want to filter by notes that are about bash (instead of simply containing the word); unfortunately, I can't filter for titles (#9) and all the other notes (esp those with multiple mentions of bash) end up taking all of the screen real estate (#22).

I've followed a convention of using # in my filenames to indicate a tag / subject, so I figured I could just use :NV #bash, but for some reason this gives me 0 results. If I instead do e.g. :NV bash -> (in fzf) #bash, I see 32 results.

I suspect this may be a bug in escaping somewhere, but not sure. :echo shellescape('#bash') works as intended.

Question: How to debug when NV brings up no results?

Checklist

  • I updated.
  • NV_note_handler cannot fix my issue.

Summary of Problem

  1. I updated the plugin and set let g:nv_search_paths = ['~/real_path_here'].

  2. I do have rg installed

    > which rg
    

/usr/local/bin/rg

  1. I have the fzf vim plugin installed

    Plugin 'junegunn/fzf'
    Plugin 'junegunn/fzf.vim'
    let g:fzf_layout = {'up': '~20%'}
    

When invoking :NV the results window is open but there is nothing in there. There are 792 files in directory though. How can I understand what's going on?

fzf colors and preview

Checklist

  • [ x ] I updated.
  • [ x ] NV_note_handler cannot fix my issue.

Summary of Problem

Hi, I was just wondering if there was a way to customize fzf colors or at least use the system fzf or fzf.vim settings already configured.

There is nothing critical about colors of course, but when it comes to the preview window, I think it dramatically increases readability. So, mainly, is there a way to use the bat preview that is already working with fzf.vim when invoking NV?

Thank you for your time.

E117: Unknown function: fzf#wrap, E116: Invalid arguments for function fzf#run

When I do :NV and hit return in vim I get the errors

E117: Unknown function: fzf#wrap
E116: Invalid arguments for function fzf#run

I'm not 100% certain I'm using the plugin as intended, as I found the README a little opaque ("Just type in keywords and it will search for them"? Where?) Am I simply using the plugin wrongly? Or is this a real error?

As far as I can tell, I've installed and satisfied the dependencies and configured correctly:

$ ls ~/.vim/plugged/notational-fzf-vim/
CHANGELOG.md  README.md  plugin/  screenshots/  shorten_path_for_notational_fzf.py*
$ fzf --version
0.16.5
$ ag --version
ag version 1.0.2
Features:
  +jit +lzma +zlib
$ tail -1 ~/.vimrc
let g:nv_directories = ['~/Dropbox/notes']

Zsh Prompt

Sorry for the unrelated noise, but which zsh prompt and terminal colors are you using? I like the look.

I also like the look of this plugin as well and will probably be using it shortly :)

g:nv_use_short_pathnames must be declared

This problem has probably gone unnoticed because who wouldn't set it on :) otherwise a vim error occurs on execution.

On a side note, any chance of re-implementing ag and allowing a choice of using ag or rg? For some reason I have found ag more reliable than rg on my systems -- rg seems to omit scanning certain subdirectories from what I can tell, don't know why. To get around that I have had to add redundant subdirectory entries in my g:nv_search_paths.

Great plugin by the way!

Windows Support

Per the README:

plugin may not work on Windows. I only have a Mac to test it on. It works for sure on Mac with Neovim, and should work in terminal Vim, since it's just a wrapper over fzf.

Hoping this will be helpful in getting NV working on Windows.

rg/fzf versions are current:
image

And fzf is working in vim:
image

Once :NV is opened it quickly gives an error:
The system cannot find the path specified.
image

And then gives a blank nv split:
image

I have tried using both relative and absolute paths. And I have tried windows and nix paths. ("~/folder", "C:\\Users\\$USER\\folder", etc)

Let me know if there is any other information that would be helpful with this.

[suggestion] custom bindings for new notes in multiple directories

First of all thanks for providing this plugin, it is very useful to my note taking workflow.

I was going to write my own handler that did the following (might take a bit, as I have only recently started using vimscript) but before I do, I was wondering if maybe you yourself would consider enhancing the plugin in the following ways:

  • allow binding the new note functionality in nv_keymap so it could be tied to a specific location. I mean allowing nv_keymap to support something like new <directory> where if that binding is set, the note is created in <directory>. This would enable creating a new note in different directories easily, so if one has say 'work' / 'public' / 'private' etc. in nv_search_paths one could easily decide where to file the new note.

  • have the option to append/prepend a date/timestamp to the filename of the created note, this could also be added to nv_keymap maybe making the extended form of that new <directory> <datepre/datepost> and probably would be appreciated by anybody using a Zettelkasten type of workflow (you could have also "dateonly" to make created notes just have a timestamp.md filename)

having the above would enable you to make nv_create_note_key redundant (although probably would be good to check it in the handler for backwards compatibility) and would extend the binding flexibility you have already for split etc. to creating new notes.

Make it case insensitive

Summary of Problem

Fzf has an option -i to make it Case-insensitive.
Can this be done using this plugin?

Sanitize/adjust file name on create_note_key

Checklist

  • I updated.
  • NV_note_handler cannot fix my issue.

Summary of Feature

It would be great to make file name creation from search query configurable.
Current state:

:NV
Enter query: this is my query
--> ~/notes/this is my query.md

Goal state (example):

:NV
Enter query: this is my query
--> ~/notes/2020-10_this_is_my_query.md

Currently the final file name is build like this:

   " Handle creating note.
   if keypress ==? s:create_note_key
     let candidates = [fnameescape(s:main_dir  . '/' . query . s:ext)]

I'm proposing to have a query_to_filename function that can be overwritten by the user.

(This feature can be implemented by overwriting and adjusting the NV_note_handler. With the proposed solution it would be easier.)

Create note outside main directory

Is there a quick way to create a note in a given directory if it doesn't exist? E.g. my search paths are: let g:nv_search_paths = ['~/notes', './notes', './notes.md'] so i would like to be able to do: :NV ./notes/new_note <c-x> and have that create ./notes/new_note.md and open for editing. Of course you can just do :e ./notes/new_note.md but it feels slightly clunky/discordant.

This is a great tool, thank you!

Local ./notes folder

It would be great if I could store per-project notes in ./notes folder.

I have tried to do it like this:

let g:nv_directories = ['~/notes', './notes']

But it didn't work. Maybe some function that would run expand and overwrite g:nv_directories when vim starts would help?

Option to disable reecursive search

Checklist

  • [x ] I updated.
  • NV_note_handler cannot fix my issue.

Summary of Problem

Not sure if NV_note_handler can do this, or how.

Is it possible to ad an option to disable recursive searches, so that notational-fzf only looks at files directly in the directories listed in g:nv_search_paths?

Feature request: change height

It seems like the height of the entire interface is always around 40% of the window. Would it be possible to add the ability to change the height like in fzf? It would be great to use this in fullscreen mode.

Improve short path names

  • Replacing /home/user with ~ would be nice.

  • When there's only one note folder display file names only.

  • When there are multiple folders strip common parent folder for all note folders and replace it with ../ eg. if my note folders look like this:

    /home/user/Documents/Notes/private
    /home/user/Documents/Notes/work
    /home/user/Documents/Notes/wiki

display them as:

../private
../work
../wiki

Idea: writing content first and then save

The idea is sometimes you have things you want to write about but don't have a title/filename in mind yet.

So the workflow I'm thinking about is this:

  1. open empty buffer in vim
  2. write some notes in it
  3. call a command or key-binding to save the buffer in the notes directory taking the first line (or number of characters) as the title of the note. (Or pass a title to the command)

This can be done by writing a simple vim function/command, but just putting the idea out there if this can be part of the plugin instead.

Feature request: add command to only search open buffers

I am ueing notational-fzf differently than you intended: basically everywhere by dynamically setting the search directories on vim launch based on the file list to work not only on notes but on project code.

notational-fzf works great but on big source trees you can get a lot of "match" noise. 5ometimes all that is necessary is to search on the open buffers (files).

Problems when rg enters the .git folder

The plugin passes the --hidden flag to rg, which means that when used in a git repo it will enter the .git folder. This folder often contains binary files that cannot be identified as such (i.e., that don't contain NUL bytes), and are therefore searched by rg. Besides giving fzf much more work than necessary, this sometimes breaks the search completely and prevents fzf from finding any matches at all (perhaps due to the control characters emitted when rendering the binary files as text; when I execute the offending search in the terminal it screws up the colors).

I can think of the following possible solutions:

  • Add flags for rg to explicitly skip vcs folders, i.e., --glob '!.git' --glob '!.hg' --glob '!.svn';
  • Remove the --hidden flag altogether (or make it configurable, preferably off by default). Do people actually store their notes in hidden files and folders?

As for reproducibility, this turns out to be difficult (it only breaks in one of my repos, which happens to be the one where I need this plugin the most), but try something like :NV #\S with a git repo in g:nv_search_paths.

Show selected entry in the preview window.

Checklist

  • I updated.
  • NV_note_handler cannot fix my issue.

Summary of Problem

The selected entry is highlighted but not always visible in the preview window (I am not sure if this should more be a feature request).

:read note into current file

The software works great, but I am trying to figure a way to :read the note directly into my current file instead of having to open it, copy all, and then insert it.

Thoughts? Thanks

hangs vim with large files, filling up disks

Now, when I filter I can see the files filter as expected. When I hit 'enter' to open the file under the cursor, the bottom split clears but doesn't close and the file doesn't open, and I have to kill -9 on vim.

I have a ~14GB dictionary file it may have been searching (I've moved it to obviate the issue). Interestingly the issue only happens after I try to open another file.

It seems to quickly fill up my disk (swap files? I don't know).

It's an avoidable issue by keeping huge files out of the config path, but at the same time it probably shouldn't be writing to disk.

Happy to help root cause.

Searching is very difficult as nv_directories full path is too long and uses whole window width

My nv_directories points to something like this:

/usr/local/home/user/googledrive/notes/

Everytime when performing a search, the full path of the files are shown in the result window.
Unfortunately that means that I cannot see any of the results shown from the markdown files picked up by notational-fzf-vim

Is there a way to fix that, i.e, avoid showing the full path?
Maybe replacing the above mentioned path with nv_directories/ ?

Thanks

let g:nv_use_short_pathnames = 1 throws Ag error with tmux/neovim on OSX 10.13.1

I have this set in my config and using the_silver_searcher installed via brew.

Using in tmux 2.6, neovim 0.2.2 and standard Terminal.app in OSX 10.13.1. fzf installed as vim plugin.

fzf works as expected without use_short_pathnames set showing both long path and preview.

if config option set, on triggering :NV (not as much detail with C-n hotkey I have :NV set to) you get this (sorry for errors in screen capture, was not quite sure how to pipe the error output to a file on triggering).

Seems like something to do with Ag but not running anything special with it. Straight up Ag near as I can tell.

screen shot 2017-11-25 at 7 16 55 pm

index out of range error when closing fzf terminal buffer with notational-fzf-vim

Hi @alok,

With this minimal config, I'm getting this error when quitting fzf terminal buffer:

nnoremap <silent> <LocalLeader>n :NV<CR>
" fzf-nv directories
let g:nv_directories = ['~/repos/.wiki', './doc', './docs', './note', './notes']

I found out this problem when I was trying to create a note, but I changed my mind as I was typing and decided to quit the fzf buffer. For example, to reproduce the issue:

1 - fire up :NV
2 - hit escape " (the user changed his mind, he wants to quit)
3 - :q " to quit the fzf buffer
4 - note the following error:

Error detected while processing function 31[30]..<SNR>43_callback:                                                                                                                             
line   33:                                                                                                                                                                                     
Vim(let):E684: list index out of range: 0  

BTW, I'm running neovim 0.2, a normal fzf buffer doesn't not result in this error, so I believe it has to do with the way your plugin exits. I tried looking up into the code, but I'm a beginner with vim/neovim so I barely know VimScript.

Thanks for this plugin! It's awesome!

Sort initial results by last edit time

I'm bad at vimscript and not very familiar with fzf/rg, or I would just submit a PR.

Is there any way to make the initial results sorted by modification time rather than alphabetically by filename? Sometimes I just want to edit something I know I recently edited, and it would be much faster if it just showed up in the initial :NV results.

Once I start typing a search, the order that fzf/rg choose would be fine. Just the initial ordering with no search should be affected.

avoid showing the same note multiple times

when what i typed matches the name of a note, that note appears multiple times as a result.
it would make sense to only appear once.
screenshot 2018-10-16 at 10 24 37
is there a way to configure that that im missing?
thank you.

Fuzzy search word order not respected

Summary of Problem

From the docs:

It does not search in a fully fuzzy fashion because that's less useful for prose. It looks for full words, but they don't have to be next to each other, just in the right order.

I noticed this feature doesn't seem to be working? As an example, I created a file with the text "word another hello" and then search for "another hello word" (i.e. backwards) and it still comes up.

Screenshot 2019-06-10 10 28 15

I happen to actually like this functionality since it means I can add a list of tags to the top of my file and don't have to remember the order of the tags, so maybe there should be an option to either force respecting search term order, or else ignore order?

edit: also thank you for making this amazing tool :) i'm a huge vim and fzf fan, and used to be a big nvalt use too, so this is a great solution for me

Keyword search in sub directories

Checklist

  • [ x ] I updated.
  • [ x ] NV_note_handler cannot fix my issue.

Summary of Problem

Sorry if it is not right place to ask. I like this plugin for it's fast search. However I have problems regarding directories, sub directories and keyword search. Lets say here is my notes directory structure:
~/Desktop/Notes/Study/Semester/biology
And in my config I have the :nv_search_paths set to: ~/Desktop/Notest/Study
And the thing is, that I have several topics (thus directories) ex. biology, art, etc. The problem I have is every time I run this plugin I get different amount of results (sometimes 1500, sometimes 3000) and I know that not every file is searched.

My question:

Do you know perhaps why this happens (different amount of results and some files are not included, even though the parent directory is listed)?

Feature Request: Changing main directory at runtime

Summary of Problem

I have multiple Wiki folders and I'd like to change which one <C-x> saves to. I created a quick command for this on my local machine and wanted to offer it to others. I didn't want to create a PR to add functionality out of nowhere and figured I'd leave it up to you whether it should be merged to the main plugin.

Can't find g:nv_search_paths even though it is set

Summary of Problem

I get this error:

Error detected while processing /Users/salar.rahmanian/.vim/plugged/notational-fzf-vim/plugin/notational_fzf.vim:
line   18:
`g:nv_search_paths` is not defined.

my config:

"notational-fzf-vim
let g:nv_main_directory=['~/notes']
let g:nv_search_paths=['~/notes']
let g:nv_default_extension='.md'
let g:nv_create_note_key='ctrl-x'
let g:nv_keymap={
                  \ 'ctrl-s': 'split ',
                  \ 'ctrl-v': 'vertical split ',
                  \ 'ctrl-t': 'tabedit ',
                  \ })
let g:nv_create_note_window='vertical split'

Any ideas?

Improvements

  • Modify lines displayed to fix #3
  • add option for short path
  • only show file once for matching keywords rather than each matching line to reduce noise
  • allow adding files like ./notes.md to g:nv_directories and rename to something more appropriate.

No notes appear even though folder exists

Summary of Problem

After running, I see no notes when python3 is not in PATH but no error is printed whatsover. With python3 in PATH it works fine. Ideally I would like it to use g:python3_host_prog when available (might be neovim specific).

I would like to have some hints about why it didn't work, for instance provide a checkhealth script (for neovim, see :h health-dev.

Open new file in current window

Summary of Problem

I do not want the new file to be created in a vertical split.
The docs show: let g:nv_create_note_window = 'vertical split'
But, what do I input in order to tell it to not vertically split?

Thx!

Apply the search string to the whole file, not only to the lines

Checklist

  • I updated.
  • NV_note_handler cannot fix my issue.

Summary of Problem

Currently, when starting fzf the files are split up into their lines.

If a file contains e.g. the terms foo and bar, they can only be found if they appear in the same line.
I think it would be better if the search string was applied to the whole file at once, and not each line seperately.

add directory to exclude

Summary of Problem

There should be a way to add a directory to exclude from the search results.

usecase: I get a lot of results from my .git directory. There should be a way to either exclude all hidden directories from search by default unless explicitly specified, or let me specify that my .git directory should not be included in the search results.

Prioritize filenames in search

Checklist

  • I updated.
  • NV_note_handler cannot fix my issue.

Summary of Problem

If I know the filename of a file I'm searching for, entering it at the NV search line will often show dozens of other files which contain the sought term before the file with the verbatim name. This makes it much harder to find known files than it does to create them.

This forces the user to use the filename within the note somewhere, which may be arbitrary to the note itself and only necessary to satisfy the tool (today's tool. changing tools would leave these artifacts in the notes unnecessarily).

Sort results by recent file access

Checklist

  • [X ] I updated.
  • [X ] NV_note_handler cannot fix my issue.

Summary of Problem

It would be very convenient if the most recently accessed files were sorted first in the search resuls. Is that hard to do? I'm not sure what the current sort is based on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.