Skip to content

Commit 61aab76

Browse files
eratemkdheepakandres-lowriefeohsrcrip
authored
Update from kickstart (#1)
* Make init.lua copy-paste friendly * docs: Update README.md 📚 * correct typo Hey y'all 👋 I think there may have been a typo? * Remove timeout * Add hint to uncomment line to autodetect plugins * Remove fixed line number and describe line * setup more language servers i use + allow customizing filetypes * Fix bug when server not explicitely defined in configuration but installed * Fix typo in init.lua releated -> related * fix(init): turn telescope-fzf-native into a dependecy * fix: fix brackets * fix: missing comma * Update init.lua added a URL to the lua-guide may help others who miss the :help lua-guide * Fix typo in README.md * Use telescope for goto implementation * Update init.lua Fix typo in original. Co-authored-by: Luis G Estrades <[email protected]> * Revert gitsigns keymaps but fix vimdiff and fugitive conflict Originally, the keymaps for jumping to next and previous git hunks were ]c and [c. This was changed in nvim-lua#323 (83b65a1) because they overwrote the built-in vimdiff keymaps. However, the more traditional solution is to have ]c and [c *extend* the built-in keymap. This is what fugitive and gitgutter have been doing for years. Gitsigns doesn't do this by itself, but it has a recommended keymap configuration on which the present patch is based: https://github.com/lewis6991/gitsigns.nvim#keymaps The only thing I've added is to have the keymaps work in visual mode as well, which is the same behavior as the built in vimdiff keymaps. * treesitter: ensure 'javascript' installed along with typescript and tsx This parser is actually needed for some *JSX* parsing, and since typescript and tsx are already getting installed, it makes sense to also install the javascript parser. * Add telescope search resume key binding * docs: restructure README * docs: remove archive installation --------- Co-authored-by: Dheepak Krishnamurthy <[email protected]> Co-authored-by: Andres Lowrie <[email protected]> Co-authored-by: Chris Patti <[email protected]> Co-authored-by: Andrew Stewart <[email protected]> Co-authored-by: Dennis-Rall <[email protected]> Co-authored-by: Numkil <[email protected]> Co-authored-by: Ikko Eltociear Ashimine <[email protected]> Co-authored-by: Peter Benjamin <[email protected]> Co-authored-by: daan <[email protected]> Co-authored-by: Smig <[email protected]> Co-authored-by: Erik <[email protected]> Co-authored-by: E. Aakash <[email protected]> Co-authored-by: Luis G Estrades <[email protected]> Co-authored-by: George Angelopoulos <[email protected]> Co-authored-by: Dilshod Temirkhodjaev <[email protected]> Co-authored-by: Luca Saccarola <[email protected]>
1 parent 6967424 commit 61aab76

File tree

2 files changed

+84
-48
lines changed

2 files changed

+84
-48
lines changed

README.md

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# kickstart.nvim
22

3+
https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b
4+
35
### Introduction
46

57
A starting point for Neovim that is:
@@ -9,7 +11,7 @@ A starting point for Neovim that is:
911
* Documented
1012
* Modular
1113

12-
This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss.
14+
This repo is meant to be used by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss.
1315

1416
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.
1517

@@ -18,42 +20,52 @@ Distribution Alternatives:
1820

1921
### Installation
2022

21-
* Backup your previous configuration (if any exists)
23+
> **NOTE**
24+
> [Backup](#FAQ) your previous configuration (if any exists)
25+
26+
Requirements:
27+
* Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
28+
* [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
29+
* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
30+
31+
Neovim's configurations are located under the following paths, depending on your OS:
2232

23-
### Archive Installation
24-
* On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP.
25-
* Extract the archive to:
26-
`~/.config/nvim` (Linux)
27-
`~/.config/nvim` (MacOS)
28-
`%userprofile%\AppData\Local\nvim\` (Windows)
29-
* Ensure your extraction method did not extract with a parent folder. For example in ~/.config/nvim you should have init.lua not another folder called kickstart.nvim.
33+
| OS | PATH |
34+
| :- | :--- |
35+
| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
36+
| MacOS | `$XDG_CONFIG_HOME/nvim`, '~/.config/nvim` |
37+
| Windows | `%userprofile%\AppData\Local\nvim\` |
3038

31-
### Git Clone Installation
32-
* From a terminal cd/dir to:
33-
`~/.config/nvim` (Linux)
34-
`~/.config/nvim` (MacOS)
35-
`%userprofile%\AppData\Local\nvim\` (Windows)
39+
Clone kickstart.nvim:
40+
41+
```sh
42+
# on Linux and Mac
43+
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
44+
# on Windows
45+
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
46+
```
47+
48+
### Post Installation
49+
50+
Run the following command and then **you are ready to go**!
51+
52+
```sh
53+
nvim --headless "+Lazy! sync" +qa
54+
```
3655

37-
* run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: `gh repo clone nvim-lua/kickstart.nvim`
38-
* Run Neovim (from terminal or shortcut) and allow lazy.nvim to download files and set up the basics.
39-
* Once the setup is complete, restart Neovim.
40-
* **You're ready to go!**
56+
### Recommended Steps
4157

42-
* (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify).
43-
* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\AppData\Local\nvim\` (Windows)
44-
* If you don't want to include it as a git repo, you can just clone it and then move the files to this location
58+
[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above.
4559

46-
Additional system requirements:
47-
- Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
48-
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
49-
- See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
60+
> **NOTE**
61+
> Your fork's url will be something like this: `https://github.com/<your_github_username>/kickstart.nvim.git`
5062
5163
### Configuration And Extension
5264

5365
* Inside of your copy, feel free to modify any file you like! It's your copy!
5466
* Feel free to change any of the default options in `init.lua` to better suit your needs.
5567
* For adding plugins, there are 3 primary options:
56-
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim`
68+
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this)
5769
* Modify `init.lua` with additional plugins.
5870
* Include the `lua/kickstart/plugins/*` files in your configuration.
5971

init.lua

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ Kickstart.nvim is a template for your own configuration.
1717
a guide. One possible example:
1818
- https://learnxinyminutes.com/docs/lua/
1919
20+
2021
And then you can explore or search through `:help lua-guide`
22+
- https://neovim.io/doc/user/lua-guide.html
2123
2224
2325
Kickstart Guide:
@@ -110,7 +112,7 @@ require('lazy').setup({
110112
-- Useful plugin to show you pending keybinds.
111113
{ 'folke/which-key.nvim', opts = {} },
112114
{
113-
-- Adds git releated signs to the gutter, as well as utilities for managing changes
115+
-- Adds git related signs to the gutter, as well as utilities for managing changes
114116
'lewis6991/gitsigns.nvim',
115117
opts = {
116118
-- See `:help gitsigns.txt`
@@ -122,9 +124,20 @@ require('lazy').setup({
122124
changedelete = { text = '~' },
123125
},
124126
on_attach = function(bufnr)
125-
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
126-
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
127-
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
127+
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' })
128+
129+
-- don't override the built-in and fugitive keymaps
130+
local gs = package.loaded.gitsigns
131+
vim.keymap.set({'n', 'v'}, ']c', function()
132+
if vim.wo.diff then return ']c' end
133+
vim.schedule(function() gs.next_hunk() end)
134+
return '<Ignore>'
135+
end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"})
136+
vim.keymap.set({'n', 'v'}, '[c', function()
137+
if vim.wo.diff then return '[c' end
138+
vim.schedule(function() gs.prev_hunk() end)
139+
return '<Ignore>'
140+
end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"})
128141
end,
129142
},
130143
},
@@ -167,19 +180,24 @@ require('lazy').setup({
167180
{ 'numToStr/Comment.nvim', opts = {} },
168181

169182
-- Fuzzy Finder (files, lsp, etc)
170-
{ 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } },
171-
172-
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
173-
-- Only load if `make` is available. Make sure you have the system
174-
-- requirements installed.
175183
{
176-
'nvim-telescope/telescope-fzf-native.nvim',
177-
-- NOTE: If you are having trouble with this installation,
178-
-- refer to the README for telescope-fzf-native for more instructions.
179-
build = 'make',
180-
cond = function()
181-
return vim.fn.executable 'make' == 1
182-
end,
184+
'nvim-telescope/telescope.nvim',
185+
branch = '0.1.x',
186+
dependencies = {
187+
'nvim-lua/plenary.nvim',
188+
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
189+
-- Only load if `make` is available. Make sure you have the system
190+
-- requirements installed.
191+
{
192+
'nvim-telescope/telescope-fzf-native.nvim',
193+
-- NOTE: If you are having trouble with this installation,
194+
-- refer to the README for telescope-fzf-native for more instructions.
195+
build = 'make',
196+
cond = function()
197+
return vim.fn.executable 'make' == 1
198+
end,
199+
},
200+
},
183201
},
184202

185203
{
@@ -197,12 +215,13 @@ require('lazy').setup({
197215
-- require 'kickstart.plugins.autoformat',
198216
-- require 'kickstart.plugins.debug',
199217

200-
-- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
218+
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
201219
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
202220
-- up-to-date with whatever is in the kickstart repo.
221+
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
203222
--
204223
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
205-
{ import = 'custom.plugins' },
224+
-- { import = 'custom.plugins' },
206225
}, {})
207226

208227
-- [[ Setting options ]]
@@ -238,7 +257,6 @@ vim.wo.signcolumn = 'yes'
238257

239258
-- Decrease update time
240259
vim.o.updatetime = 250
241-
vim.o.timeout = true
242260
vim.o.timeoutlen = 300
243261

244262
-- Set completeopt to have a better completion experience
@@ -301,12 +319,13 @@ vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc
301319
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
302320
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
303321
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
322+
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' })
304323

305324
-- [[ Configure Treesitter ]]
306325
-- See `:help nvim-treesitter`
307326
require('nvim-treesitter.configs').setup {
308327
-- Add languages to be installed here that you want installed for treesitter
309-
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' },
328+
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' },
310329

311330
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
312331
auto_install = false,
@@ -396,7 +415,7 @@ local on_attach = function(_, bufnr)
396415

397416
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
398417
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
399-
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
418+
nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
400419
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
401420
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
402421
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
@@ -424,12 +443,16 @@ end
424443
--
425444
-- Add any additional override configuration in the following tables. They will be passed to
426445
-- the `settings` field of the server config. You must look up that documentation yourself.
446+
--
447+
-- If you want to override the default filetypes that your language server will attach to you can
448+
-- define the property 'filetypes' to the map in question.
427449
local servers = {
428450
-- clangd = {},
429451
-- gopls = {},
430452
-- pyright = {},
431453
-- rust_analyzer = {},
432454
-- tsserver = {},
455+
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
433456

434457
lua_ls = {
435458
Lua = {
@@ -459,8 +482,9 @@ mason_lspconfig.setup_handlers {
459482
capabilities = capabilities,
460483
on_attach = on_attach,
461484
settings = servers[server_name],
485+
filetypes = (servers[server_name] or {}).filetypes,
462486
}
463-
end,
487+
end
464488
}
465489

466490
-- [[ Configure nvim-cmp ]]

0 commit comments

Comments
 (0)