Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update from kickstart (#1) #2

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 38 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# kickstart.nvim

https://github.com/kdheepak/kickstart.nvim/assets/1813121/f3ff9a2b-c31f-44df-a4fa-8a0d7b17cf7b

### Introduction

A starting point for Neovim that is:
Expand All @@ -9,7 +11,7 @@ A starting point for Neovim that is:
* Documented
* Modular

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

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.

Expand All @@ -18,42 +20,52 @@ Distribution Alternatives:

### Installation

* Backup your previous configuration (if any exists)
> **NOTE**
> [Backup](#FAQ) your previous configuration (if any exists)

Requirements:
* Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
* [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`

Neovim's configurations are located under the following paths, depending on your OS:

### Archive Installation
* On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP.
* Extract the archive to:
`~/.config/nvim` (Linux)
`~/.config/nvim` (MacOS)
`%userprofile%\AppData\Local\nvim\` (Windows)
* 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.
| OS | PATH |
| :- | :--- |
| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
| MacOS | `$XDG_CONFIG_HOME/nvim`, '~/.config/nvim` |
| Windows | `%userprofile%\AppData\Local\nvim\` |

### Git Clone Installation
* From a terminal cd/dir to:
`~/.config/nvim` (Linux)
`~/.config/nvim` (MacOS)
`%userprofile%\AppData\Local\nvim\` (Windows)
Clone kickstart.nvim:

```sh
# on Linux and Mac
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
# on Windows
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
```

### Post Installation

Run the following command and then **you are ready to go**!

```sh
nvim --headless "+Lazy! sync" +qa
```

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

* (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify).
* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\AppData\Local\nvim\` (Windows)
* 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
[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.

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

### Configuration And Extension

* Inside of your copy, feel free to modify any file you like! It's your copy!
* Feel free to change any of the default options in `init.lua` to better suit your needs.
* For adding plugins, there are 3 primary options:
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim`
* 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)
* Modify `init.lua` with additional plugins.
* Include the `lua/kickstart/plugins/*` files in your configuration.

Expand Down
65 changes: 44 additions & 21 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ require('lazy').setup({
-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
{
-- Adds git releated signs to the gutter, as well as utilities for managing changes
-- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
Expand All @@ -84,10 +84,20 @@ require('lazy').setup({
changedelete = { text = '~' },
},
on_attach = function(bufnr)
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk,
{ buffer = bufnr, desc = '[g]o to [p]revious Hunk' })
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[g]o to [n]ext Hunk' })
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[p]review [h]unk' })
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' })

-- don't override the built-in and fugitive keymaps
local gs = package.loaded.gitsigns
vim.keymap.set({'n', 'v'}, ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"})
vim.keymap.set({'n', 'v'}, '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"})
end,
},
},
Expand Down Expand Up @@ -131,19 +141,24 @@ require('lazy').setup({
{ 'numToStr/Comment.nvim', opts = {} },

-- Fuzzy Finder (files, lsp, etc)
{ 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } },

-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
{
'nvim-telescope/telescope-fzf-native.nvim',
-- NOTE: If you are having trouble with this installation,
-- refer to the README for telescope-fzf-native for more instructions.
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
{
'nvim-telescope/telescope-fzf-native.nvim',
-- NOTE: If you are having trouble with this installation,
-- refer to the README for telescope-fzf-native for more instructions.
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
},
},

{
Expand All @@ -161,12 +176,13 @@ require('lazy').setup({
require 'kickstart.plugins.autoformat',
require 'kickstart.plugins.debug',

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

-- import custom settings
Expand Down Expand Up @@ -219,11 +235,13 @@ vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[s]earch current [w]ord' })
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[s]earch by [g]rep' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[s]earch [d]iagnostics' })
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[s]earch [r]resume' })

-- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter

ensure_installed = { 'c', 'cpp', 'lua', 'python', 'rust', 'vimdoc', 'vim' },

-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
Expand Down Expand Up @@ -314,7 +332,7 @@ local on_attach = function(_, bufnr)

nmap('gd', vim.lsp.buf.definition, '[g]oto [d]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[g]oto [r]eferences')
nmap('gI', vim.lsp.buf.implementation, '[g]oto [I]mplementation')
nmap('gI', require('telescope.builtin').lsp_implementations, '[g]oto [I]mplementation')
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[d]ocument [s]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[w]orkspace [s]ymbols')
Expand Down Expand Up @@ -342,12 +360,16 @@ end
--
-- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself.
--
-- If you want to override the default filetypes that your language server will attach to you can
-- define the property 'filetypes' to the map in question.
local servers = {
clangd = {},
-- gopls = {},
pylsp = {},
rust_analyzer = {},
-- tsserver = {},
-- html = { filetypes = { 'html', 'twig', 'hbs'} },

lua_ls = {
Lua = {
Expand Down Expand Up @@ -377,8 +399,9 @@ mason_lspconfig.setup_handlers {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes,
}
end,
end
}

-- [[ Configure nvim-cmp ]]
Expand Down