switching telescope to folke snacks nvim

This commit is contained in:
hwu 2025-09-02 00:43:14 -04:00
parent 17b3d146d4
commit 1512c6fe94
8 changed files with 607 additions and 300 deletions

View File

@ -4,9 +4,9 @@
A starting point for Neovim that is:
* Small
* Single-file
* Completely Documented
- Small
- Single-file
- Completely Documented
**NOT** a Neovim distribution, but instead a starting point for your configuration.
@ -14,7 +14,7 @@ A starting point for Neovim that is:
### Install Neovim
Kickstart.nvim targets *only* the latest
Kickstart.nvim targets _only_ the latest
['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest
['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim.
If you are experiencing issues, please make sure you have the latest versions.
@ -22,6 +22,7 @@ If you are experiencing issues, please make sure you have the latest versions.
### Install External Dependencies
External Requirements:
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
- Clipboard tool (xclip/xsel/win32yank or other depending on platform)
@ -38,16 +39,15 @@ External Requirements:
### Install Kickstart
> **NOTE**
> [Backup](#FAQ) your previous configuration (if any exists)
> **NOTE** > [Backup](#FAQ) your previous configuration (if any exists)
Neovim's configurations are located under the following paths, depending on your OS:
| OS | PATH |
| :- | :--- |
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
| Windows (cmd)| `%localappdata%\nvim\` |
| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` |
| OS | PATH |
| :------------------- | :---------------------------------------- |
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
| Windows (cmd) | `%localappdata%\nvim\` |
| Windows (powershell) | `$env:LOCALAPPDATA\nvim\` |
#### Recommended Step
@ -64,6 +64,7 @@ too - it's ignored in the kickstart repo to make maintenance easier, but it's
[recommmended to track it in version control](https://lazy.folke.io/usage/lockfile).
#### Clone kickstart.nvim
> **NOTE**
> If following the recommended step above (i.e., forking the repo), replace
> `nvim-lua` with `<your_github_username>` in the commands below
@ -107,19 +108,18 @@ Read through the `init.lua` file in your configuration folder for more
information about extending and exploring Neovim. That also includes
examples of adding popularly requested plugins.
### Getting Started
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
### FAQ
* What should I do if I already have a pre-existing neovim configuration?
* You should back it up and then delete all associated files.
* This includes your existing init.lua and the neovim files in `~/.local`
- What should I do if I already have a pre-existing neovim configuration?
- You should back it up and then delete all associated files.
- This includes your existing init.lua and the neovim files in `~/.local`
which can be deleted with `rm -rf ~/.local/share/nvim/`
* Can I keep my existing configuration in parallel to kickstart?
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
- Can I keep my existing configuration in parallel to kickstart?
- Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
to maintain multiple configurations. For example, you can install the kickstart
configuration in `~/.config/nvim-kickstart` and create an alias:
```
@ -129,18 +129,18 @@ examples of adding popularly requested plugins.
config directory and the matching local directory
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
distribution that you would like to try out.
* What if I want to "uninstall" this configuration:
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
* The main purpose of kickstart is to serve as a teaching tool and a reference
- What if I want to "uninstall" this configuration:
- See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
- Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
- The main purpose of kickstart is to serve as a teaching tool and a reference
configuration that someone can easily use to `git clone` as a basis for their own.
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
into smaller parts. A fork of kickstart that does this while maintaining the
into smaller parts. A fork of kickstart that does this while maintaining the
same functionality is available here:
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
* Discussions on this topic can be found here:
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
- [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
- Discussions on this topic can be found here:
- [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
- [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
### Install Recipes
@ -150,35 +150,26 @@ After installing all the dependencies continue with the [Install Kickstart](#Ins
#### Windows Installation
<details><summary>Windows with Microsoft C++ Build Tools and CMake</summary>
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
This requires:
- Install CMake and the Microsoft C++ Build Tools on Windows
```lua
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
```
</details>
<details><summary>Windows with gcc/make using chocolatey</summary>
Alternatively, one can install gcc and make which don't require changing the config,
the easiest way is to use choco:
1. install [chocolatey](https://chocolatey.org/install)
either follow the instructions on the page or use winget,
run in cmd as **admin**:
either follow the instructions on the page or use winget,
run in cmd as **admin**:
```
winget install --accept-source-agreements chocolatey.chocolatey
```
2. install all requirements using choco, exit previous cmd and
open a new one so that choco path is set, and run in cmd as **admin**:
open a new one so that choco path is set, and run in cmd as **admin**:
```
choco install -y neovim git ripgrep wget fd unzip gzip mingw make
```
</details>
<details><summary>WSL (Windows Subsystem for Linux)</summary>
@ -189,9 +180,11 @@ sudo add-apt-repository ppa:neovim-ppa/unstable -y
sudo apt update
sudo apt install make gcc ripgrep unzip git xclip neovim
```
</details>
#### Linux Install
<details><summary>Ubuntu Install Steps</summary>
```
@ -199,6 +192,7 @@ sudo add-apt-repository ppa:neovim-ppa/unstable -y
sudo apt update
sudo apt install make gcc ripgrep unzip git xclip neovim
```
</details>
<details><summary>Debian Install Steps</summary>
@ -216,12 +210,14 @@ sudo tar -C /opt -xzf nvim-linux64.tar.gz
# make it available in /usr/local/bin, distro installs to /usr/bin
sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/
```
</details>
<details><summary>Fedora Install Steps</summary>
```
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
```
</details>
<details><summary>Arch Install Steps</summary>
@ -229,5 +225,5 @@ sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
```
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
```
</details>
</details>

144
init.lua
View File

@ -332,150 +332,6 @@ require('lazy').setup({
},
},
},
-- NOTE: Plugins can specify dependencies.
--
-- The dependencies are proper plugin specifications as well - anything
-- you do for a plugin at the top level, you can do for a dependency.
--
-- Use the `dependencies` key to specify the dependencies of a particular plugin
{ -- Fuzzy Finder (files, lsp, etc)
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
'nvim-telescope/telescope-fzf-native.nvim',
-- `build` is used to run some command when the plugin is installed/updated.
-- This is only run then, not every time Neovim starts up.
build = 'make',
-- `cond` is a condition used to determine whether this plugin should be
-- installed and loaded.
cond = function()
return vim.fn.executable 'make' == 1
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
-- Useful for getting pretty icons, but requires a Nerd Font.
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
},
config = function()
-- Telescope is a fuzzy finder that comes with a lot of different things that
-- it can fuzzy find! It's more than just a "file finder", it can search
-- many different aspects of Neovim, your workspace, LSP, and more!
--
-- The easiest way to use Telescope, is to start by doing something like:
-- :Telescope help_tags
--
-- After running this command, a window will open up and you're able to
-- type in the prompt window. You'll see a list of `help_tags` options and
-- a corresponding preview of the help.
--
-- Two important keymaps to use while in Telescope are:
-- - Insert mode: <c-/>
-- - Normal mode: ?
--
-- This opens a window that shows you all of the keymaps for the current
-- Telescope picker. This is really useful to discover what Telescope can
-- do as well as how to actually do it!
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
local actions = require 'telescope.actions'
require('telescope').setup {
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
--
-- defaults = {
-- mappings = {
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- },
-- },
-- pickers = {}
require('telescope').setup {
pickers = {
find_files = {
follow = true,
cache_picker = false,
},
buffers = {
cache_picker = false,
},
},
defaults = {
cache_picker = {
num_pickers = 8,
},
mappings = {
i = {
['<esc>'] = actions.close,
},
},
layout_strategy = 'horizontal',
layout_config = {
horizontal = {
prompt_position = 'top',
},
},
sorting_strategy = 'ascending',
},
},
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
},
}
-- Enable Telescope extensions if they are installed
pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select')
-- See `:help telescope.builtin`
local builtin = require 'telescope.builtin'
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<C-p>', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<C-b>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<C-n>', builtin.resume, { desc = '[S]earch [R]esume' })
-- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration po Telescope to change the theme, layout, etc.
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
-- It's also possible to pass additional configuration options.
-- See `:help telescope.builtin.live_grep()` for information about particular keys
vim.keymap.set('n', '<leader>s/', function()
builtin.live_grep {
grep_open_files = true,
prompt_title = 'Live Grep in Open Files',
}
end, { desc = '[S]earch [/] in Open Files' })
-- Shortcut for searching your Neovim configuration files
vim.keymap.set('n', '<leader>sn', function()
builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = '[S]earch [N]eovim files' })
end,
},
-- LSP Plugins
{
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins

View File

@ -1,39 +0,0 @@
local function miniDeleteBuffer()
local bd = require('mini.bufremove').delete
if vim.bo.modified then
local choice = vim.fn.confirm(('Save changes to %q?'):format(vim.fn.bufname()), '&Yes\n&No\n&Cancel')
if choice == 1 then -- Yes
vim.cmd.write()
bd(0)
elseif choice == 2 then -- No
bd(0, true)
end
else
bd(0)
end
end
return {
{
'echasnovski/mini.bufremove',
keys = {
{
'<leader>bd',
miniDeleteBuffer,
desc = 'Delete Buffer',
},
{
'œ',
miniDeleteBuffer,
desc = 'Delete Buffer',
},
{
'<M-q>',
miniDeleteBuffer,
desc = 'Delete Buffer',
},
-- stylua: ignore
{ "<leader>bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" },
},
},
}

View File

@ -1,6 +0,0 @@
return {
'FabijanZulj/blame.nvim',
config = function()
require('blame').setup()
end,
}

View File

@ -57,31 +57,6 @@ return {
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
-- Jump to the definition of the word under your cursor.
-- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-t>.
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
-- Find references for the word under your cursor.
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
-- Jump to the implementation of the word under your cursor.
-- Useful when your language has ways of declaring types without an actual implementation.
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
-- Jump to the type of the word under your cursor.
-- Useful when you're not sure what type a variable is and you want to see
-- the definition of its *type*, not where it was *defined*.
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
-- Fuzzy find all the symbols in your current document.
-- Symbols are things like variables, functions, types, etc.
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
-- Fuzzy find all the symbols in your current workspace.
-- Similar to document symbols, except searches over your entire project.
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- Rename the variable under your cursor.
-- Most Language Servers support renaming across files, etc.
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')

View File

@ -1,19 +0,0 @@
return {
'nvim-neo-tree/neo-tree.nvim',
branch = 'v3.x',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
},
opts = {
window = {
width = 34,
mappings = {
['<C-v>'] = 'open_vsplit',
['<C-x>'] = 'open_split',
},
},
},
}

View File

@ -0,0 +1,569 @@
return {
'folke/snacks.nvim',
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
bigfile = { enabled = true },
dashboard = { enabled = false },
explorer = { enabled = true },
indent = { enabled = true },
input = { enabled = true },
notifier = {
enabled = true,
timeout = 3000,
},
picker = { enabled = true },
quickfile = { enabled = true },
scope = { enabled = true },
scroll = { enabled = false },
statuscolumn = { enabled = true },
words = { enabled = true },
styles = {
notification = {
-- wo = { wrap = true } -- Wrap notifications
},
},
},
keys = {
-- Top Pickers & Explorer
{
'<leader><space>',
function()
Snacks.picker.smart()
end,
desc = 'Smart Find Files',
},
{
'<C-p>',
function()
Snacks.picker.smart()
end,
desc = 'Smart Find Files',
},
{
'<leader>/',
function()
Snacks.picker.grep()
end,
desc = 'Grep',
},
{
'<leader>s:',
function()
Snacks.picker.command_history()
end,
desc = 'Command History',
},
{
'<leader>n',
function()
Snacks.picker.notifications()
end,
desc = 'Notification History',
},
{
'<leader>ue',
function()
Snacks.explorer()
end,
desc = 'File Explorer',
},
{
',n',
function()
Snacks.explorer()
end,
desc = 'File Explorer',
},
-- find
{
'<leader>fb',
function()
Snacks.picker.buffers()
end,
desc = 'Buffers',
},
{
'<C-b>',
function()
Snacks.picker.buffers()
end,
desc = 'Buffers',
},
{
'<leader>fc',
function()
Snacks.picker.files { cwd = vim.fn.stdpath 'config' }
end,
desc = 'Find Config File',
},
{
'<leader>ff',
function()
Snacks.picker.files()
end,
desc = 'Find Files',
},
-- {
-- '<C-p>',
-- function()
-- Snacks.picker.files()
-- end,
-- desc = 'Find Files',
-- },
{
'<leader>fg',
function()
Snacks.picker.git_files()
end,
desc = 'Find Git Files',
},
{
'<leader>fp',
function()
Snacks.picker.projects()
end,
desc = 'Projects',
},
{
'<leader>fr',
function()
Snacks.picker.recent()
end,
desc = 'Recent',
},
-- git
{
'<leader>gb',
function()
Snacks.picker.git_branches()
end,
desc = 'Git Branches',
},
{
'<leader>gl',
function()
Snacks.picker.git_log()
end,
desc = 'Git Log',
},
{
'<leader>gL',
function()
Snacks.picker.git_log_line()
end,
desc = 'Git Log Line',
},
{
'<leader>gs',
function()
Snacks.picker.git_status()
end,
desc = 'Git Status',
},
{
'<leader>gS',
function()
Snacks.picker.git_stash()
end,
desc = 'Git Stash',
},
{
'<leader>gd',
function()
Snacks.picker.git_diff()
end,
desc = 'Git Diff (Hunks)',
},
{
'<leader>gf',
function()
Snacks.picker.git_log_file()
end,
desc = 'Git Log File',
},
-- Grep
{
'<leader>sb',
function()
Snacks.picker.lines()
end,
desc = 'Buffer Lines',
},
{
'<leader>sB',
function()
Snacks.picker.grep_buffers()
end,
desc = 'Grep Open Buffers',
},
{
'<leader>sg',
function()
Snacks.picker.grep()
end,
desc = 'Grep',
},
{
'<leader>sw',
function()
Snacks.picker.grep_word()
end,
desc = 'Visual selection or word',
mode = { 'n', 'x' },
},
-- search
{
'<leader>s"',
function()
Snacks.picker.registers()
end,
desc = 'Registers',
},
{
'<leader>s/',
function()
Snacks.picker.search_history()
end,
desc = 'Search History',
},
{
'<leader>sa',
function()
Snacks.picker.autocmds()
end,
desc = 'Autocmds',
},
{
'<leader>sb',
function()
Snacks.picker.lines()
end,
desc = 'Buffer Lines',
},
{
'<leader>sc',
function()
Snacks.picker.command_history()
end,
desc = 'Command History',
},
{
'<leader>sC',
function()
Snacks.picker.commands()
end,
desc = 'Commands',
},
{
'<leader>sd',
function()
Snacks.picker.diagnostics()
end,
desc = 'Diagnostics',
},
{
'<leader>sD',
function()
Snacks.picker.diagnostics_buffer()
end,
desc = 'Buffer Diagnostics',
},
{
'<leader>sh',
function()
Snacks.picker.help()
end,
desc = 'Help Pages',
},
{
'<leader>sH',
function()
Snacks.picker.highlights()
end,
desc = 'Highlights',
},
{
'<leader>si',
function()
Snacks.picker.icons()
end,
desc = 'Icons',
},
{
'<leader>sj',
function()
Snacks.picker.jumps()
end,
desc = 'Jumps',
},
{
'<leader>sk',
function()
Snacks.picker.keymaps()
end,
desc = 'Keymaps',
},
{
'<leader>sl',
function()
Snacks.picker.loclist()
end,
desc = 'Location List',
},
{
'<leader>sm',
function()
Snacks.picker.marks()
end,
desc = 'Marks',
},
{
'<leader>sM',
function()
Snacks.picker.man()
end,
desc = 'Man Pages',
},
{
'<leader>sp',
function()
Snacks.picker.lazy()
end,
desc = 'Search for Plugin Spec',
},
{
'<leader>sq',
function()
Snacks.picker.qflist()
end,
desc = 'Quickfix List',
},
{
'<leader>sR',
function()
Snacks.picker.resume()
end,
desc = 'Resume',
},
{
'<C-n>',
function()
Snacks.picker.resume()
end,
desc = 'Resume',
},
{
'<leader>su',
function()
Snacks.picker.undo()
end,
desc = 'Undo History',
},
{
'<leader>uC',
function()
Snacks.picker.colorschemes()
end,
desc = 'Colorschemes',
},
-- LSP
{
'gd',
function()
Snacks.picker.lsp_definitions()
end,
desc = 'Goto Definition',
},
{
'gD',
function()
Snacks.picker.lsp_declarations()
end,
desc = 'Goto Declaration',
},
{
'gr',
function()
Snacks.picker.lsp_references()
end,
nowait = true,
desc = 'References',
},
{
'gI',
function()
Snacks.picker.lsp_implementations()
end,
desc = 'Goto Implementation',
},
{
'gy',
function()
Snacks.picker.lsp_type_definitions()
end,
desc = 'Goto T[y]pe Definition',
},
{
'<leader>ss',
function()
Snacks.picker.lsp_symbols()
end,
desc = 'LSP Symbols',
},
{
'<leader>sS',
function()
Snacks.picker.lsp_workspace_symbols()
end,
desc = 'LSP Workspace Symbols',
},
-- Other
{
'<leader>tz',
function()
Snacks.zen()
end,
desc = 'Toggle Zen Mode',
},
{
'<leader>tZ',
function()
Snacks.zen.zoom()
end,
desc = 'Toggle Zoom',
},
{
',S',
function()
Snacks.scratch()
end,
desc = 'Toggle Scratch Buffer',
},
{
',s',
function()
Snacks.scratch.select()
end,
desc = 'Select Scratch Buffer',
},
{
'<leader>n',
function()
Snacks.notifier.show_history()
end,
desc = 'Notification History',
},
{
'<leader>bd',
function()
Snacks.bufdelete()
end,
desc = 'Delete Buffer',
},
{
'œ',
function()
Snacks.bufdelete()
end,
desc = 'Delete Buffer',
},
{
'<M-q>',
function()
Snacks.bufdelete()
end,
desc = 'Delete Buffer',
},
{
'<leader>cR',
function()
Snacks.rename.rename_file()
end,
desc = 'Rename File',
},
{
'<leader>gB',
function()
Snacks.gitbrowse()
end,
desc = 'Git Browse',
mode = { 'n', 'v' },
},
{
'<leader>gg',
function()
Snacks.lazygit()
end,
desc = 'Lazygit',
},
{
'<leader>un',
function()
Snacks.notifier.hide()
end,
desc = 'Dismiss All Notifications',
},
{
']]',
function()
Snacks.words.jump(vim.v.count1)
end,
desc = 'Next Reference',
mode = { 'n', 't' },
},
{
'[[',
function()
Snacks.words.jump(-vim.v.count1)
end,
desc = 'Prev Reference',
mode = { 'n', 't' },
},
{
'<leader>uN',
desc = 'Neovim News',
function()
Snacks.win {
file = vim.api.nvim_get_runtime_file('doc/news.txt', false)[1],
width = 0.6,
height = 0.6,
wo = {
spell = false,
wrap = false,
signcolumn = 'yes',
statuscolumn = ' ',
conceallevel = 3,
},
}
end,
},
},
init = function()
vim.api.nvim_create_autocmd('User', {
pattern = 'VeryLazy',
callback = function()
-- Setup some globals for debugging (lazy-loaded)
-- _G.dd = function(...)
-- Snacks.debug.inspect(...)
-- end
-- _G.bt = function()
-- Snacks.debug.backtrace()
-- end
-- vim.print = _G.dd -- Override print to use snacks for `:=` command
-- Create some toggle mappings
Snacks.toggle.option('spell', { name = 'Spelling' }):map '<leader>ts'
Snacks.toggle.option('wrap', { name = 'Wrap' }):map '<leader>tW'
Snacks.toggle.diagnostics():map '<leader>ud'
Snacks.toggle.option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map '<leader>uc'
Snacks.toggle.treesitter():map '<leader>uT'
Snacks.toggle.option('background', { off = 'light', on = 'dark', name = 'Dark Background' }):map '<leader>ub'
Snacks.toggle.inlay_hints():map '<leader>uh'
Snacks.toggle.indent():map '<leader>ug'
Snacks.toggle.dim():map '<leader>uD'
end,
})
end,
}

View File

@ -1,25 +0,0 @@
-- Neo-tree is a Neovim plugin to browse the file system
-- https://github.com/nvim-neo-tree/neo-tree.nvim
return {
'nvim-neo-tree/neo-tree.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
},
cmd = 'Neotree',
keys = {
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
},
opts = {
filesystem = {
window = {
mappings = {
['\\'] = 'close_window',
},
},
},
},
}