Skip to content
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ nvim
spell/

# In your personal fork, you likely want to comment this, since it's recommended to track
# lazy-lock.json in version control - see https://lazy.folke.io/usage/lockfile
# nvim-pack-lock.json in version control - see :help vim.pack-lockfile
# For the official `nvim-lua/kickstart.nvim` git repository, we leave it ignored to avoid unneeded
# merge conflicts.
lazy-lock.json
nvim-pack-lock.json

.DS_Store
44 changes: 33 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ fork to your machine using one of the commands below, depending on your OS.
> Your fork's URL will be something like this:
> `https://github.com/<your_github_username>/kickstart-modular.nvim.git`

You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file
too - it's ignored in the kickstart repo to make maintenance easier, but it's
[recommended to track it in version control](https://lazy.folke.io/usage/lockfile).
You likely want to remove `nvim-pack-lock.json` from your fork's `.gitignore`
file too - it's ignored in the kickstart repo to make maintenance easier, but
it's recommended to track it in version control (see `:help vim.pack-lockfile`).

#### Clone kickstart.nvim

Expand Down Expand Up @@ -113,8 +113,10 @@ Start Neovim
nvim
```

That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
the current plugin status. Hit `q` to close the window.
That's it! `vim.pack` will install all the plugins from your config. Use
`:lua vim.pack.update(nil, { offline = true })` to inspect plugin state and
`:lua vim.pack.update()` to fetch updates (`:write` applies updates, `:quit`
cancels them).

#### Read The Friendly Documentation

Expand Down Expand Up @@ -148,7 +150,8 @@ examples of adding popularly requested plugins.
`~/.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
* Remove your config directory and local data directory (for example,
`~/.config/nvim` and `~/.local/share/nvim`).
* 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.
Expand All @@ -172,17 +175,36 @@ 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`
Kickstart's default config is make-only for `telescope-fzf-native.nvim`.
If `make` is unavailable, the plugin is skipped.

See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
Recommended: install `make` (see the chocolatey section below).

This requires:
If you want a CMake-only setup, customize `init.lua` in two places:

- Install CMake and the Microsoft C++ Build Tools on Windows
1. Include `telescope-fzf-native.nvim` when `cmake` is available:

```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' }
if vim.fn.executable 'make' == 1 or vim.fn.executable 'cmake' == 1 then
table.insert(plugins, gh 'nvim-telescope/telescope-fzf-native.nvim')
end
```

2. In the `PackChanged` hook, use CMake when `make` is unavailable:

```lua
if name == 'telescope-fzf-native.nvim' then
if vim.fn.executable 'make' == 1 then
run_build(name, { 'make' }, ev.data.path)
elseif vim.fn.executable 'cmake' == 1 then
run_build(name, { 'cmake', '-S.', '-Bbuild', '-DCMAKE_BUILD_TYPE=Release' }, ev.data.path)
run_build(name, { 'cmake', '--build', 'build', '--config', 'Release', '--target', 'install' }, ev.data.path)
end
return
end
```

See `telescope-fzf-native` documentation for [build details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation).
</details>
<details><summary>Windows with gcc/make using chocolatey</summary>
Alternatively, one can install gcc and make which don't require changing the config,
Expand Down
15 changes: 3 additions & 12 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,17 @@ I hope you enjoy your Neovim journey,
P.S. You can delete this when you're done too. It's your config now! :)
--]]

-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '

-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false

-- [[ Setting options ]]
require 'options'

-- [[ Basic Keymaps ]]
require 'keymaps'

-- [[ Install `lazy.nvim` plugin manager ]]
require 'lazy-bootstrap'
-- [[ Set up vim.pack ]]
require 'pack'

-- [[ Configure and install plugins ]]
require 'lazy-plugins'
require 'kickstart.plugins'

-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et
11 changes: 8 additions & 3 deletions lua/custom/plugins/init.lua
Comment thread
oriori1703 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
--
-- See the kickstart.nvim README for more information

---@module 'lazy'
---@type LazySpec
return {}
-- Iterate over all Lua files in the plugins directory and load them
local plugins_dir = vim.fs.joinpath(vim.fn.stdpath 'config', 'lua', 'custom', 'plugins')
for file_name, type in vim.fs.dir(plugins_dir) do
if type == 'file' and file_name:match '%.lua$' and file_name ~= 'init.lua' then
local module = file_name:gsub('%.lua$', '')
require('custom.plugins.' .. module)
end
end
19 changes: 15 additions & 4 deletions lua/keymaps.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-- ============================================================
-- SECTION 2: KEYMAPS
-- basic keymaps
-- ============================================================

-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`

Expand All @@ -6,7 +11,7 @@
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')

-- Diagnostic Config & Keymaps
-- See :help vim.diagnostic.Opts
-- See `:help vim.diagnostic.Opts`
vim.diagnostic.config {
update_in_insert = false,
severity_sort = true,
Expand All @@ -18,7 +23,15 @@ vim.diagnostic.config {
virtual_lines = false, -- Text shows up underneath the line, with virtual lines

-- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d`
jump = { float = true },
jump = {
on_jump = function(_, bufnr)
vim.diagnostic.open_float {
bufnr = bufnr,
scope = 'cursor',
focus = false,
}
end,
},
}

vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
Expand Down Expand Up @@ -63,5 +76,3 @@ vim.api.nvim_create_autocmd('TextYankPost', {
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function() vim.hl.on_yank() end,
})

-- vim: ts=2 sts=2 sw=2 et
2 changes: 1 addition & 1 deletion lua/kickstart/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local check_version = function()
return
end

if vim.version.ge(vim.version(), '0.11') then
if vim.version.ge(vim.version(), '0.12') then
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
else
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
Expand Down
9 changes: 2 additions & 7 deletions lua/kickstart/plugins/autopairs.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
-- autopairs
-- https://github.com/windwp/nvim-autopairs

---@module 'lazy'
---@type LazySpec
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
opts = {},
}
vim.pack.add { 'https://github.com/windwp/nvim-autopairs' }
require('nvim-autopairs').setup {}
97 changes: 0 additions & 97 deletions lua/kickstart/plugins/blink-cmp.lua

This file was deleted.

86 changes: 86 additions & 0 deletions lua/kickstart/plugins/completion.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
-- ============================================================
-- SECTION 8: AUTOCOMPLETE & SNIPPETS
-- blink.cmp and luasnip setup
-- ============================================================

---Because most plugins are hosted on GitHub, you can use the helper
---function to have less repetition in the following sections.
---@param repo string
---@return string
local function gh(repo) return 'https://github.com/' .. repo end

-- [[ Snippet Engine ]]

-- NOTE: You can also specify plugin using a version range for its git tag.
-- See `:help vim.version.range()` for more info
vim.pack.add { { src = gh 'L3MON4D3/LuaSnip', version = vim.version.range '2.*' } }
require('luasnip').setup {}

-- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets
--
-- vim.pack.add { gh 'rafamadriz/friendly-snippets' }
-- require('luasnip.loaders.from_vscode').lazy_load()

-- [[ Autocomplete Engine ]]
vim.pack.add { { src = gh 'saghen/blink.cmp', version = vim.version.range '1.*' } }
require('blink.cmp').setup {
keymap = {
-- 'default' (recommended) for mappings similar to built-in completions
-- <c-y> to accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
-- 'super-tab' for tab to accept
-- 'enter' for enter to accept
-- 'none' for no mappings
--
-- For an understanding of why the 'default' preset is recommended,
-- you will need to read `:help ins-completion`
--
-- No, but seriously. Please read `:help ins-completion`, it is really good!
--
-- All presets have the following mappings:
-- <tab>/<s-tab>: move to right/left of your snippet expansion
-- <c-space>: Open menu or open docs if already open
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
-- <c-e>: Hide menu
-- <c-k>: Toggle signature help
--
-- See `:help blink-cmp-config-keymap` for defining your own keymap
preset = 'default',

-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
},

appearance = {
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = 'mono',
},

completion = {
-- By default, you may press `<c-space>` to show the documentation.
-- Optionally, set `auto_show = true` to show the documentation after a delay.
documentation = { auto_show = false, auto_show_delay_ms = 500 },
},

sources = {
default = { 'lsp', 'path', 'snippets' },
},

snippets = { preset = 'luasnip' },

-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
-- which automatically downloads a prebuilt binary when enabled.
--
-- By default, we use the Lua implementation instead, but you may enable
-- the rust implementation via `'prefer_rust_with_warning'`
--
-- See `:help blink-cmp-config-fuzzy` for more information
fuzzy = { implementation = 'lua' },

-- Shows a signature help window while you type arguments for a function
signature = { enabled = true },
}
Loading