sync with remote and resolve conflict

This commit is contained in:
Micah Effiong 2023-10-22 01:17:01 +01:00
commit 991edd4b59
2 changed files with 170 additions and 105 deletions

View File

@ -20,42 +20,56 @@ Distribution Alternatives:
### Installation ### Installation
* Backup your previous configuration (if any exists) > **NOTE**
> [Backup](#FAQ) your previous configuration (if any exists)
### Archive Installation Requirements:
* On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP. * Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
* Extract the archive to: * [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
`~/.config/nvim` (Linux) * See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
`~/.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.
### Git Clone Installation Neovim's configurations are located under the following paths, depending on your OS:
* From a terminal cd/dir to:
`~/.config/nvim` (Linux)
`~/.config/nvim` (MacOS)
`%userprofile%\AppData\Local\nvim\` (Windows)
* run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: `gh repo clone nvim-lua/kickstart.nvim` | OS | PATH |
* 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. | Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
* **You're ready to go!** | MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
| Windows | `%userprofile%\AppData\Local\nvim\` |
* (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify). Clone kickstart.nvim:
* 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
Additional system requirements: ```sh
- Make sure to review the readmes of the plugins if you are experiencing errors. In particular: # on Linux and Mac
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
- See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` ```
```
# 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
```
### Recommended Steps
[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.
> **NOTE**
> Your fork's url will be something like this: `https://github.com/<your_github_username>/kickstart.nvim.git`
### Configuration And Extension ### Configuration And Extension
* Inside of your copy, feel free to modify any file you like! It's your copy! * 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. * 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: * 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. * Modify `init.lua` with additional plugins.
* Include the `lua/kickstart/plugins/*` files in your configuration. * Include the `lua/kickstart/plugins/*` files in your configuration.

211
init.lua
View File

@ -17,7 +17,9 @@ Kickstart.nvim is a template for your own configuration.
a guide. One possible example: a guide. One possible example:
- https://learnxinyminutes.com/docs/lua/ - https://learnxinyminutes.com/docs/lua/
And then you can explore or search through `:help lua-guide` And then you can explore or search through `:help lua-guide`
- https://neovim.io/doc/user/lua-guide.html
Kickstart Guide: Kickstart Guide:
@ -86,7 +88,7 @@ require('lazy').setup({
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
dependencies = { dependencies = {
-- Automatically install LSPs to stdpath for neovim -- Automatically install LSPs to stdpath for neovim
{ 'williamboman/mason.nvim', config = true }, 'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
-- Useful status updates for LSP -- Useful status updates for LSP
@ -115,9 +117,9 @@ require('lazy').setup({
}, },
-- Useful plugin to show you pending keybinds. -- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} }, { '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', 'lewis6991/gitsigns.nvim',
opts = { opts = {
-- See `:help gitsigns.txt` -- See `:help gitsigns.txt`
@ -129,10 +131,28 @@ require('lazy').setup({
changedelete = { text = '~' }, changedelete = { text = '~' },
}, },
on_attach = function(bufnr) on_attach = function(bufnr)
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git 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' }) -- don't override the built-in and fugitive keymaps
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) 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, end,
}, },
}, },
@ -164,30 +184,33 @@ require('lazy').setup({
-- Add indentation guides even on blank lines -- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim` -- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt` -- See `:help ibl`
opts = { main = 'ibl',
char = '', opts = {},
show_trailing_blankline_indent = false,
},
}, },
-- "gc" to comment visual regions/lines -- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} }, { 'numToStr/Comment.nvim', opts = {} },
-- Fuzzy Finder (files, lsp, etc) -- 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', 'nvim-telescope/telescope.nvim',
-- NOTE: If you are having trouble with this installation, branch = '0.1.x',
-- refer to the README for telescope-fzf-native for more instructions. dependencies = {
build = 'make', 'nvim-lua/plenary.nvim',
cond = function() -- Fuzzy Finder Algorithm which requires local dependencies to be built.
return vim.fn.executable 'make' == 1 -- Only load if `make` is available. Make sure you have the system
end, -- 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,
},
},
}, },
{ {
@ -247,7 +270,6 @@ vim.wo.signcolumn = 'yes'
-- Decrease update time -- Decrease update time
vim.o.updatetime = 250 vim.o.updatetime = 250
vim.o.timeout = true
vim.o.timeoutlen = 300 vim.o.timeoutlen = 300
-- Set completeopt to have a better completion experience -- Set completeopt to have a better completion experience
@ -310,73 +332,81 @@ 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>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>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>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
-- [[ Configure Treesitter ]] -- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter` -- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup { -- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
-- Add languages to be installed here that you want installed for treesitter vim.defer_fn(function()
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim', 'markdown', require('nvim-treesitter.configs').setup {
'markdown_inline' }, -- Add languages to be installed here that you want installed for treesitter
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim',
'bash', 'markdown', 'markdown_inline' },
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false, auto_install = false,
sync_install = true,
ignore_install = {},
modules = {},
highlight = { enable = true },
indent = { enable = true }, highlight = { enable = true },
incremental_selection = { indent = { enable = true },
enable = true, incremental_selection = {
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
},
},
textobjects = {
select = {
enable = true, enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = { keymaps = {
-- You can use the capture groups defined in textobjects.scm init_selection = '<c-space>',
['aa'] = '@parameter.outer', node_incremental = '<c-space>',
['ia'] = '@parameter.inner', scope_incremental = '<c-s>',
['af'] = '@function.outer', node_decremental = '<M-space>',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
}, },
}, },
move = { textobjects = {
enable = true, select = {
set_jumps = true, -- whether to set jumps in the jumplist enable = true,
goto_next_start = { lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
[']m'] = '@function.outer', keymaps = {
[']]'] = '@class.outer', -- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
}, },
goto_next_end = { move = {
[']M'] = '@function.outer', enable = true,
[']['] = '@class.outer', set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
}, },
goto_previous_start = { swap = {
['[m'] = '@function.outer', enable = true,
['[['] = '@class.outer', swap_next = {
}, ['<leader>a'] = '@parameter.inner',
goto_previous_end = { },
['[M'] = '@function.outer', swap_previous = {
['[]'] = '@class.outer', ['<leader>A'] = '@parameter.inner',
},
}, },
}, },
swap = { }
enable = true, end, 0)
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}
-- Diagnostic keymaps -- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
@ -384,17 +414,37 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
-- document existing key chains
require('which-key').register {
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
['<leader>h'] = { name = 'More git', _ = 'which_key_ignore' },
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
}
-- mason-lspconfig requires that these setup functions are called in this order
-- before setting up the servers.
require('mason').setup()
require('mason-lspconfig').setup()
-- Enable the following language servers -- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
-- --
-- Add any additional override configuration in the following tables. They will be passed to -- 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. -- 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 = { local servers = {
-- clangd = {}, -- clangd = {},
-- gopls = {}, -- gopls = {},
-- pyright = {}, -- pyright = {},
-- rust_analyzer = {}, -- rust_analyzer = {},
-- tsserver = {}, -- tsserver = {},
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
lua_ls = { lua_ls = {
Lua = { Lua = {
@ -424,6 +474,7 @@ mason_lspconfig.setup_handlers {
capabilities = capabilities, capabilities = capabilities,
on_attach = require('custom.utils'), on_attach = require('custom.utils'),
settings = servers[server_name], settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes,
} }
end, end,
} }