Skip to content
 
 

Latest commit

 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Quickbuffer

Quickly accessable buffer from anywhere. Simple and minimal.

Contents

Idea
Picker
Install & Configuration
Positions
Keymap
Styling

Tip

The above images have markdown rendered with markview.nvim

Idea

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.

Picker

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

Install and Configuration

"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
},

Positions

  • center
  • top-center
  • top-left
  • top-right
  • center-left
  • center-right
  • bottom-left
  • bottom-center
  • bottom-right

Keymap

I recommend that you set a keymap to quickly access quickbuffer.nvim

-- quickbuffer
vim.api.nvim_set_keymap('n', '<Leader>b',":Qb<CR>" ,opts)

Styling

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>",
})

About

quick buffers for notes, to dos etc. accessible quickly from anywhere. with project specific buffers and a buffer picker

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages