Compare commits
23 Commits
feoh_add_l
...
master
Author | SHA1 | Date | |
---|---|---|---|
931c6a48bf | |||
257a9e465d | |||
93ce0fa005 | |||
565f387a8b | |||
|
8df3deb6fe | ||
|
942b26184c | ||
|
81f270a704 | ||
|
f92fb11d68 | ||
|
2e68a2c253 | ||
|
9f5176fc2a | ||
|
931ec5c226 | ||
|
b07176aef6 | ||
|
f5c9fe8e15 | ||
|
5e258d276f | ||
|
5540527fab | ||
|
6d6b3f38c1 | ||
|
fabeb86d8b | ||
|
e2bfa0c66f | ||
|
23773900d9 | ||
|
c4363e4ad8 | ||
|
19afab1641 | ||
|
d605b840a2 | ||
|
1175f6d25a |
8
.github/pull_request_template.md
vendored
Normal file
8
.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
***************************************************************************
|
||||
**NOTE**
|
||||
Please verify that the `base repository` above has the intended destination!
|
||||
Github by default opens Pull Requests against the parent of a forked repository.
|
||||
If this is your personal fork and you didn't intend to open a PR for contribution
|
||||
to the original project then adjust the `base repository` accordingly.
|
||||
**************************************************************************
|
||||
|
103
README.md
103
README.md
@ -21,9 +21,6 @@ If you are experiencing issues, please make sure you have the latest versions.
|
||||
|
||||
### Install External Dependencies
|
||||
|
||||
> **NOTE**
|
||||
> [Backup](#FAQ) your previous configuration (if any exists)
|
||||
|
||||
External Requirements:
|
||||
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
|
||||
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
|
||||
@ -38,6 +35,11 @@ External Requirements:
|
||||
> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes
|
||||
> and quick install snippets
|
||||
|
||||
### Install Kickstart
|
||||
|
||||
> **NOTE**
|
||||
> [Backup](#FAQ) your previous configuration (if any exists)
|
||||
|
||||
Neovim's configurations are located under the following paths, depending on your OS:
|
||||
|
||||
| OS | PATH |
|
||||
@ -46,16 +48,12 @@ Neovim's configurations are located under the following paths, depending on your
|
||||
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
|
||||
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
|
||||
|
||||
### Install Kickstart
|
||||
|
||||
#### Recommended Step
|
||||
|
||||
[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, then install by cloning the
|
||||
fork to your machine using one of the commands below, depending on your OS.
|
||||
|
||||
|
||||
|
||||
> **NOTE**
|
||||
> Your fork's url will be something like this:
|
||||
> `https://github.com/<your_github_username>/kickstart.nvim.git`
|
||||
@ -101,71 +99,10 @@ That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
|
||||
current plugin status. Hit `q` to close the window.
|
||||
|
||||
Read through the `init.lua` file in your configuration folder for more
|
||||
information about extending and exploring Neovim.
|
||||
information about extending and exploring Neovim. That also includes
|
||||
examples of adding popularly requested plugins.
|
||||
|
||||
|
||||
#### Examples of adding popularly requested plugins
|
||||
|
||||
NOTE: You'll need to uncomment the line in the init.lua that turns on loading custom plugins.
|
||||
|
||||
<details>
|
||||
<summary>Adding autopairs</summary>
|
||||
|
||||
This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs)
|
||||
and enable it on startup. For more information, see documentation for
|
||||
[lazy.nvim](https://github.com/folke/lazy.nvim).
|
||||
|
||||
In the file: `lua/custom/plugins/autopairs.lua`, add:
|
||||
|
||||
```lua
|
||||
-- File: lua/custom/plugins/autopairs.lua
|
||||
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
-- Optional dependency
|
||||
dependencies = { 'hrsh7th/nvim-cmp' },
|
||||
config = function()
|
||||
require("nvim-autopairs").setup {}
|
||||
-- If you want to automatically add `(` after selecting a function or method
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
local cmp = require('cmp')
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
||||
end,
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary>Adding a file tree plugin</summary>
|
||||
|
||||
This will install the tree plugin and add the command `:Neotree` for you.
|
||||
For more information, see the documentation at
|
||||
[neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim).
|
||||
|
||||
In the file: `lua/custom/plugins/filetree.lua`, add:
|
||||
|
||||
```lua
|
||||
-- File: lua/custom/plugins/filetree.lua
|
||||
|
||||
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",
|
||||
},
|
||||
config = function ()
|
||||
require('neo-tree').setup {}
|
||||
end,
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Getting Started
|
||||
|
||||
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
|
||||
@ -255,23 +192,37 @@ sudo apt install make gcc ripgrep unzip neovim
|
||||
```
|
||||
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
||||
sudo apt update
|
||||
sudo apt install make gcc ripgrep unzip neovim
|
||||
sudo apt install make gcc ripgrep unzip git neovim
|
||||
```
|
||||
</details>
|
||||
<details><summary>Debian Install Steps</summary>
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install make gcc ripgrep unzip git
|
||||
echo "deb https://deb.debian.org/debian unstable main" | sudo tee -a /etc/apt/sources.list
|
||||
sudo apt update
|
||||
sudo apt install -t unstable neovim
|
||||
sudo apt install make gcc ripgrep unzip git curl
|
||||
|
||||
# Now we install nvim
|
||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
|
||||
sudo rm -rf /opt/nvim-linux64
|
||||
sudo mkdir -p /opt/nvim-linux64
|
||||
sudo chmod a+rX /opt/nvim-linux64
|
||||
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 neovim
|
||||
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
|
||||
```
|
||||
</details>
|
||||
|
||||
<details><summary>Arch Install Steps</summary>
|
||||
|
||||
```
|
||||
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
|
||||
```
|
||||
</details>
|
||||
|
||||
|
69
init.lua
69
init.lua
@ -90,7 +90,7 @@ P.S. You can delete this when you're done too. It's your config now! :)
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Set to true if you have a Nerd Font installed
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = false
|
||||
|
||||
-- [[ Setting options ]]
|
||||
@ -160,6 +160,13 @@ vim.opt.scrolloff = 10
|
||||
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
||||
vim.opt.hlsearch = true
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
vim.keymap.set('n', '<F5>', vim.cmd.UndotreeToggle)
|
||||
|
||||
vim.keymap.set('n', '<C-M>', ':lua require("harpoon.mark").add_file()<CR>')
|
||||
vim.keymap.set('n', '<C-n>', ':lua require("harpoon.mark").rm_file()<CR>')
|
||||
vim.keymap.set('n', '<C-o>', ':lua require("harpoon.ui").toggle_quick_menu()<CR>')
|
||||
vim.keymap.set('n', '<C-p>', ":call fzf#run({'source': 'find . ! -name *.o ! -path \"./.*\"', 'sink': 'e'})<CR>")
|
||||
vim.keymap.set('n', '<tab>', '<C-n>')
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
||||
@ -227,6 +234,12 @@ vim.opt.rtp:prepend(lazypath)
|
||||
require('lazy').setup({
|
||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||
'nvim-lua/plenary.nvim',
|
||||
'ThePrimeagen/harpoon',
|
||||
'neoclide/coc.nvim',
|
||||
'junegunn/fzf',
|
||||
'xiyaowong/transparent.nvim',
|
||||
'mbbill/undotree',
|
||||
|
||||
-- NOTE: Plugins can also be added by using a table,
|
||||
-- with the first argument being the link and the following
|
||||
@ -286,7 +299,13 @@ require('lazy').setup({
|
||||
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
|
||||
['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
|
||||
}
|
||||
-- visual mode
|
||||
require('which-key').register({
|
||||
['<leader>h'] = { 'Git [H]unk' },
|
||||
}, { mode = 'v' })
|
||||
end,
|
||||
},
|
||||
|
||||
@ -406,7 +425,7 @@ require('lazy').setup({
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||
'williamboman/mason.nvim',
|
||||
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
|
||||
@ -508,16 +527,37 @@ require('lazy').setup({
|
||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.server_capabilities.documentHighlightProvider then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
|
||||
-- The following autocommand is used to enable inlay hints in your
|
||||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
|
||||
map('<leader>th', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspDetach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
||||
callback = function(event)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event.buf }
|
||||
end,
|
||||
})
|
||||
|
||||
@ -600,6 +640,17 @@ require('lazy').setup({
|
||||
|
||||
{ -- Autoformat
|
||||
'stevearc/conform.nvim',
|
||||
lazy = false,
|
||||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_fallback = true }
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[F]ormat buffer',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
@ -693,6 +744,12 @@ require('lazy').setup({
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||
|
||||
-- If you prefer more traditional completion keymaps,
|
||||
-- you can uncomment the following lines
|
||||
--['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
--['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
|
||||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
-- completions whenever it has completion options available.
|
||||
@ -806,6 +863,8 @@ require('lazy').setup({
|
||||
config = function(_, opts)
|
||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||
|
||||
-- Prefer git instead of curl in order to improve connectivity in some environments
|
||||
require('nvim-treesitter.install').prefer_git = true
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require('nvim-treesitter.configs').setup(opts)
|
||||
|
||||
@ -830,6 +889,9 @@ require('lazy').setup({
|
||||
-- require 'kickstart.plugins.debug',
|
||||
-- require 'kickstart.plugins.indent_line',
|
||||
-- require 'kickstart.plugins.lint',
|
||||
-- require 'kickstart.plugins.autopairs',
|
||||
-- require 'kickstart.plugins.neo-tree',
|
||||
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
|
||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||
-- This is the easiest way to modularize your config.
|
||||
@ -861,3 +923,6 @@ require('lazy').setup({
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
|
16
lua/kickstart/plugins/autopairs.lua
Normal file
16
lua/kickstart/plugins/autopairs.lua
Normal file
@ -0,0 +1,16 @@
|
||||
-- autopairs
|
||||
-- https://github.com/windwp/nvim-autopairs
|
||||
|
||||
return {
|
||||
'windwp/nvim-autopairs',
|
||||
event = 'InsertEnter',
|
||||
-- Optional dependency
|
||||
dependencies = { 'hrsh7th/nvim-cmp' },
|
||||
config = function()
|
||||
require('nvim-autopairs').setup {}
|
||||
-- If you want to automatically add `(` after selecting a function or method
|
||||
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
||||
local cmp = require 'cmp'
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
61
lua/kickstart/plugins/gitsigns.lua
Normal file
61
lua/kickstart/plugins/gitsigns.lua
Normal file
@ -0,0 +1,61 @@
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
-- NOTE: gitsigns is already included in init.lua but contains only the base
|
||||
-- config. This will add also the recommended keymaps.
|
||||
|
||||
return {
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = require 'gitsigns'
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { ']c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'next'
|
||||
end
|
||||
end, { desc = 'Jump to next git [c]hange' })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { '[c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'prev'
|
||||
end
|
||||
end, { desc = 'Jump to previous git [c]hange' })
|
||||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function()
|
||||
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'stage git hunk' })
|
||||
map('v', '<leader>hr', function()
|
||||
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'reset git hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||
map('n', '<leader>hD', function()
|
||||
gitsigns.diffthis '@'
|
||||
end, { desc = 'git [D]iff against last commit' })
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
25
lua/kickstart/plugins/neo-tree.lua
Normal file
25
lua/kickstart/plugins/neo-tree.lua
Normal file
@ -0,0 +1,25 @@
|
||||
-- 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' } },
|
||||
},
|
||||
opts = {
|
||||
filesystem = {
|
||||
window = {
|
||||
mappings = {
|
||||
['\\'] = 'close_window',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user