Skip to content

Latest commit

 

History

History
275 lines (200 loc) · 11.4 KB

README.md

File metadata and controls

275 lines (200 loc) · 11.4 KB

Ben-vim

Haha, get it ... get it?

image


Welcome to my neovim setup. This isn't really intended for other people to use, it's more something that you can look through and take ideas from. This is what it generally looks like ^

File Structure

├── after
│   ├── ftplugin
│   └── queries
├── ftplugin
├── lua
│   ├── benlubas
│   │   ├── telescope           # custom telescope layouts
│   │   ├── hydra               # hydras that are loaded with other plugins
│   │   ├── set.lua             # setting vim options
│   │   ├── remap.lua           # keymaps
│   │   └── ... others          # other various code
│   ├── plugins                 # lazy plugin specs
│   └── snippets                # luasnip snippets
├── data                        # I keep telescope sources here
├── templates                   # neorg templates
└── init.lua                    # entry point

Plugins

Categorized somewhat arbitrarily:

Theme and Visual Elements

No borders (or invisible looking borders) on floating windows unless they need a title, Molten floats are the exception.

I have a noice config in here too, but I don't currently use it. It's caused too many problems and I'm not able to configure it quite the way that I want to, but I'm definitely keeping my eye on it.

Base - simple but powerful plugins

image

Auto Completion and Snippets

image

  • benlubas/nvim-cmp
    • I use my own fork of nvim-cmp that adds two features:
      • Select-nth item; used for mapping <A-n> to select the nth item in the completion menu.
      • Numbering the options; aid for the <A-n> keybinds
    • There's a branch called up_to_date that I sync with upstream every few months if you'd like to use this feature as well, and here's the PR to add this functionality to cmp.
  • L3MON4D3/LuaSnip
    • custom snippets in lua/snippets/, there are a lot of react test library snippets and some other random ones
  • windwp/nvim-autopairs

Completion sources:

Jupyter Notebook Workflow

This setup is documented in the molten-nvim docs and lets me:

  • open .ipynb files like normal, they're displayed as plaintext, outputs are loaded automatically and shown, including images
  • run code cell by cell, and view and interact with output in editor (again including images)
  • easily add new cells, delete them, move them around
  • :w to save to .ipynb format with output chunks saved as well
Telescope

All of my telescope pickers make use of telescope.nvim#2572, opting for custom layouts using MunifTanjim/nui.nvim instead of using builtin telescope themes. Layouts are located at /lua/benlubas/telescope/layouts.

  • default: the default layout that's used for all of my file pickers image

  • ivy: a custom ivy-like layout that sits at the bottom of the screen. Used for tmux-sessionizer image

  • spelling: a tiny little window used for spelling suggestions, positioned to match the start of the word so that spelling suggestions line up as if you were seeing completion menu suggestions
    image

I have mappings for all the normal ones, like project files, current buf fuzzy find, etc. I have custom pickers (located here /lua/benlubas/telescope/) for:

  • Importing Harpoon marks that were used on other branches
  • Switching between workspaces with tmux and tmux-sessionizer (a bash script that's also in these dotfiles)

I also have a custom action that lets me harpoon a file from the telescope results page with <c-s>

Harpoon

image

I use a fork that enables some better highlights, and git branch caching, as I use git branch specific keys, and fetching them on an M2 Mac is slow enough to be noticeable.

Integrations:

I'll switch to harpoon 2 when it's more feature complete

Treesitter and related
Hydras

I have a few hydras:

  • Telescope <leader>f just a fancy way to see my telescope binds
  • Options <leader><leader>o easily change common options
  • Windows <C-w> easily repeat window navigation, movement, resize actions
  • Quarto Navigator <localleader>j quickly move around markdown notebooks and run code

image

Firenvim

I have configuration for firenvim, which makes it easier to edit markdown for web fields. TL;DR: textwidth off, wrap on. These slightly altered settings are also used for editing prs and issues with gh

IDE type stuff

This stuff is great when I need to use it. But it mostly just sits there.

Best dap configuration option:

vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DapBreakpoint", numhl = "DapBreakpoint" })

Neat Custom Stuff

View `:messages` in a buffer

You can view the output of :messages in a floating buffer with M or :M. The function that does this is exposed as :lua B() and you can use it like :lua B("highlight") to see the output of the highlight command in a buffer (doesn't support highlighting though, ironically)

Search count

image

I have an in house solution for the search count problem. By default, / to search will only show [n/99] items. This is a royal pain for when I just want to count the number of times something shows up in a file, so I have written this. I put the search count in my status line when there's an active search.

Yank to clipboard cleans leading whitespace

I can't think of the last time I've wanted to copy code to my clipboard and preserve the leading whitespace. So I wrote a function that removes it. code and usage

Remove duplicates from lsp go to definition

I use a custom go to definition handler from @ seblj which removes results that are on the same line as each other (luals does this a lot).