Feature request: Searching from normal mode can create a new note #39

Trevoke opened this Issue Dec 1, 2012 · 7 comments


None yet

2 participants

Trevoke commented Dec 1, 2012

It would be nice to be able to do that from normal mode instead of only from inside the note pane with Shift-F

@fmoralesc fmoralesc closed this Dec 1, 2012
@fmoralesc fmoralesc reopened this Dec 1, 2012

OK (the plugin obviously lacks this), but I need some input on how this should behave. On the long term, I want to support the API I have outlined in issue #37 (#37), but for now adding this will need either a change in the :OpenPad command or the creation of a new command, perhaps :NewPad. I'm not sure which is best.

In any case, I would also add the ability for :OpenPad to take an argument so it is possible to open a not by matching the filename (it should also support autocompletion), so in the first case I would have to incorporate the same logic the list searches use, that is, create a new note only if there is not a matching note. But this could not answer to user intent (if somehow I want to create a note with a title that already exists, which is possible with vim-pad). In the second case I could keep those behaviors separate (this solves that difficulty, but I'm not too fond on creating a new command, just for simplicity's sake). What do you think is best?


OK, I've been looking at how to implement this and found the simpler way for now will be to modify the OpenPad command, so

:OpenPad #this is a new note

will create a new note with the line "#this is a new note" already in it (I already have this working). To modify the search mapping (<leader>s) to support what the plugin does in the list (both searching and creation of new pads), I would have to decouple the padlib.list_local.incremental_search function from the list, and that will require some redesign.

@fmoralesc fmoralesc added a commit that referenced this issue Dec 1, 2012
@fmoralesc OpenPad can take an argument now.
Should acomodate the use-case of issue #39.

A fuller fix could require some mayor changes.
Trevoke commented Dec 3, 2012

How hard would it be to add a new mapping for this new functionality instead, while you do the redesign you mention in the API Proposal?


You can use the mapping

:noremap <leader>ss :OpenPad 

(with a space at the end).

Trevoke commented Dec 3, 2012

I added this to my .vimrc :

noremap <leader>ss :OpenPad 

(with a space at the end)

Then I closed vim, reopened it, and used the shortcut. It created a note twice. That is what I expected it to do, but not what I had asked.

What I suggested was a new mapping / a new function that does in normal mode what Shift-F does (search or add) in the vim-pad window, while you are working on the redesign. Is that possible?

@fmoralesc fmoralesc added a commit that referenced this issue Dec 3, 2012
@fmoralesc Implementing solution for issue #39
Adds a prompt that can search or create notes in normal mode
without opening the list.

I see now. I copied the function that handles the prompt in the list buffer and modified it to support this use-case. It is mapped to <leader>ss.

Trevoke commented Dec 13, 2012

Sorry about how long it took me to check this out. It works great! :-) Good luck with the refactor.

@Trevoke Trevoke closed this Dec 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment