Quickly accessable buffer from anywhere. Simple and minimal.
Idea
Picker
Install & Configuration
Positions
Keymap
Styling
Tip
The above images have markdown rendered with markview.nvim
You can press a keybind or type :Qb and a buffer will open which will be of a markdown file that you created and linked to in your config. If you aren't in a specified project directory, it will show a default file (target_file). You can register project_folders that will show specific files if your current working directory is inside of it.
you can open a picker with a keybind of your choosing which shows you all of the notes that you have in different project folders and you can quickly switch and edit them
"buffer" means your current open note and "picker" is the window that lets you pick the notes You will want to change the notes section of the config so that it works for you
Note
You must have a default file for quickbuffer to show. this is done by adding an item in notes with target_file set to the location of your default note and default set to true. The default file is used when you are not in any specific project directory.
| Setting | Meaning | Values |
|---|---|---|
show_default_mark |
show a * next to the default note in the picker | true/false |
show_modified_times |
show the modified times next to each note in the picker | true/false |
border |
what type of border should the window have | single/double/rounded/solid/shadow |
width |
percentage of the width on the neovim screen that the note and picker should be | 0.1-1.0 |
height |
percentage of the height on the neovim screen that the note and picker should be | 0.1-1.0 |
buffer_position |
the position of the buffer on the neovim screen | center/center-left/center-right/top-left/top-center/top-right/bottom-left/bottom-center/bottom-right |
picker_position |
the position of the picker on the neovim screen | center/center-left/center-right/top-left/top-center/top-right/bottom-left/bottom-center/bottom-right |
note:target_file |
the actual note file that will be displayed and used | path/to/file |
note:path |
if it is not the default note, you use this to tell Quickbuffer in which folder you want to show this note as the default | path/to/folder |
note:on_modified_command |
this is used to run a command when the specific note is saved (and has been modified since previous save). This could be used to run git syncs or even open apps | <shell command> |
note:default |
can only be used on one note. It is to specify that this note should be displayed by default if not in a specific directory for another note | true/false |
keybinds:gotobuffer |
the keybind to be used inside of quickbuffer (not when it isn't already open), to switch to the buffer | <keybind> |
keybinds:gotopicker |
the keybind to be used inside of quickbuffer (not when it isn't already open), to switch to the picker | <keybind> |
keybinds:closepicker |
the keybind to be used inside of quickbuffer (not when it isn't already open), to close the picker. Only applies in normal mode | <keybind> |
keybinds:closebuffer |
they keybind to be used inside of quickbuffer (not when it isn't already open), to close the buffer. Only applies in normal mode | <keybind> |
The following is the Lazy.nvim install.
{
"BobdaProgrammer/quickbuffer.nvim",
config = function()
require("quickbuffer").setup({
show_default_mark = true, -- show * next to the default note in the picker
show_modified_times = false, -- show the time of modification next to the files in the picker
border = "single", -- single, rounded, etc
width = 0.8, -- width of window in % of screen size
height = 0.8, -- height of window in % of screen size
buffer_position = "center", -- top-left, top-right, bottom-left, bottom-right
pickerposition = "center-right"
notes = { -- specific notes for if you are in specific folders
{
target_file = "~/notes/note.md", -- your default note
default = true,
},
{
path = "~/projects/project1", -- if your cwd is in ~/projects/project1, then it will display the note: ~/projects/project1/notes.md
target_file = "~/projects/project1/notes.md"
on_modified_command = "git add . && git commit && git push" -- This
},
{
path = "~/project2/",
target_file = "~/notes/project2notes.md"
},
},
keybinds = { -- default keybindings
gotobuffer = "b",
gotopicker = "p",
closepicker = "<Esc>",
closebuffer = "<Esc>"
}
})
end
},- center
- top-center
- top-left
- top-right
- center-left
- center-right
- bottom-left
- bottom-center
- bottom-right
I recommend that you set a keymap to quickly access quickbuffer.nvim
-- quickbuffer
vim.api.nvim_set_keymap('n', '<Leader>b',":Qb<CR>" ,opts)Quickbuffer exposes highligh groups that allow you to set foreground and background colors for both the viewr and the picker aswell as their borders. You can also style small things like the look of the default note file text in the picker aswell as the look of the modified time text
Note
You do not have to specify any of these if you don't like, it is just there if you want to style
vim.api.nvim_set_hl(0, "QuickBufferNormal", {
fg = "<text foreground for buffer>",
bg = "<background for buffer>",
})
vim.api.nvim_set_hl(0, "QuickBufferBorder", {
fg = "<foreground for buffer border>",
bg = "<background for buffer border>",
})
vim.api.nvim_set_hl(0, "QuickBufferPickerNormal", {
fg = "<text foreground for picker>",
bg = "<background for picker>",
})
vim.api.nvim_set_hl(0, "QuickBufferPickerBorder", {
fg = "<foreground for picker border>",
bg = "<background for picker border>",
})
vim.api.nvim_set_hl(0, "QuickBufferDefaultFileMark", {
fg = "<foreground color for the default file in the picker>",
bg = "<background color for the default file in the picker>",
})
vim.api.nvim_set_hl(0, "QuickBufferModifiedTime", {
fg = "<foreground color for the modified time in the picker>",
bg = "<background color for the modified time in the picker>",
})
