ts setup
This commit is contained in:
parent
29c77cd7e5
commit
4cc1aa7a15
87
README.md
87
README.md
|
@ -20,57 +20,35 @@ Distribution Alternatives:
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
> **NOTE**
|
* Backup your previous configuration (if any exists)
|
||||||
> [Backup](#FAQ) your previous configuration (if any exists)
|
|
||||||
|
|
||||||
Requirements:
|
### Archive Installation
|
||||||
* Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
|
* On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP.
|
||||||
* [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
|
* Extract the archive to:
|
||||||
* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
|
`~/.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.
|
||||||
|
|
||||||
Neovim's configurations are located under the following paths, depending on your OS:
|
### Git Clone Installation
|
||||||
|
* From a terminal cd/dir to:
|
||||||
|
`~/.config/nvim` (Linux)
|
||||||
|
`~/.config/nvim` (MacOS)
|
||||||
|
`%userprofile%\AppData\Local\nvim\` (Windows)
|
||||||
|
|
||||||
| OS | PATH |
|
* 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.
|
||||||
| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
* Once the setup is complete, restart Neovim.
|
||||||
| MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
* **You're ready to go!**
|
||||||
| Windows | `%userprofile%\AppData\Local\nvim\` |
|
|
||||||
|
|
||||||
Clone kickstart.nvim:
|
* (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
|
||||||
|
|
||||||
```sh
|
Additional system requirements:
|
||||||
# on Linux and Mac
|
- Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
- [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`
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
# on Windows
|
|
||||||
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
|
|
||||||
```
|
|
||||||
|
|
||||||
### Post Installation
|
|
||||||
|
|
||||||
Start Neovim
|
|
||||||
|
|
||||||
```sh
|
|
||||||
nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
The `Lazy` plugin manager will start automatically on the first run and install the configured plugins - as can be seen in the introduction video. After the installation is complete you can press `q` to close the `Lazy` UI and **you are ready to go**! Next time you run nvim `Lazy` will no longer show up.
|
|
||||||
|
|
||||||
If you would prefer to hide this step and run the plugin sync from the command line, you can use:
|
|
||||||
|
|
||||||
```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
|
||||||
|
|
||||||
|
@ -149,28 +127,11 @@ Each PR, especially those which increase the line count, should have a descripti
|
||||||
* You should back it up, then delete all files associated with it.
|
* You should back it up, then delete all files associated with it.
|
||||||
* This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/`
|
* This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/`
|
||||||
* You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide)
|
* You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide)
|
||||||
* Can I keep my existing configuration in parallel to kickstart?
|
|
||||||
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create a script `~/bin/nvim-kickstart`:
|
|
||||||
```
|
|
||||||
#!/bin/sh
|
|
||||||
exec env NVIM_APPNAME=nvim-kickstart nvim "$@"
|
|
||||||
```
|
|
||||||
When you run Neovim with `nvim-kickstart` it will use the alternative config directory and the matching local directory: `~/.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:
|
* What if I want to "uninstall" this configuration:
|
||||||
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
|
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
|
||||||
* Are there any cool videos about this plugin?
|
* Are there any cool videos about this plugin?
|
||||||
* Current iteration of kickstart (coming soon)
|
* Current iteration of kickstart (coming soon)
|
||||||
* Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works as specified. Please follow the install instructions in this file instead as they're up to date.
|
* Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works as specified. Please follow the install instructions in this file instead as they're up to date.
|
||||||
* 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 `git clone` as a basis for their own.
|
|
||||||
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
|
|
||||||
into smaller parts. A fork of kickstart that does this while maintaining the exact
|
|
||||||
same functionality is available here:
|
|
||||||
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
|
|
||||||
* Discussions on this topic can be found here:
|
|
||||||
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
|
|
||||||
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
|
|
||||||
|
|
||||||
### Windows Installation
|
### Windows Installation
|
||||||
|
|
||||||
|
|
227
init.lua
227
init.lua
|
@ -65,8 +65,10 @@ vim.opt.rtp:prepend(lazypath)
|
||||||
-- You can also configure plugins after the setup call,
|
-- You can also configure plugins after the setup call,
|
||||||
-- as they will be available in your neovim runtime.
|
-- as they will be available in your neovim runtime.
|
||||||
require('lazy').setup({
|
require('lazy').setup({
|
||||||
-- NOTE: First, some plugins that don't require any configuration
|
'nvim-tree/nvim-tree.lua',
|
||||||
|
'nvim-tree/nvim-web-devicons',
|
||||||
|
|
||||||
|
-- NOTE: First, some plugins that don't require any configuration
|
||||||
-- Git related plugins
|
-- Git related plugins
|
||||||
'tpope/vim-fugitive',
|
'tpope/vim-fugitive',
|
||||||
'tpope/vim-rhubarb',
|
'tpope/vim-rhubarb',
|
||||||
|
@ -81,12 +83,12 @@ 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',
|
{ 'williamboman/mason.nvim', config = true },
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
|
||||||
-- Useful status updates for LSP
|
-- Useful status updates for LSP
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||||
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
|
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
|
||||||
|
|
||||||
-- Additional lua configuration, makes nvim stuff amazing!
|
-- Additional lua configuration, makes nvim stuff amazing!
|
||||||
'folke/neodev.nvim',
|
'folke/neodev.nvim',
|
||||||
|
@ -110,7 +112,7 @@ 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 related 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',
|
||||||
|
@ -124,28 +126,10 @@ require('lazy').setup({
|
||||||
changedelete = { text = '~' },
|
changedelete = { text = '~' },
|
||||||
},
|
},
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' })
|
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk,
|
||||||
|
{ buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
|
||||||
-- don't override the built-in and fugitive keymaps
|
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
|
||||||
local gs = package.loaded.gitsigns
|
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
|
||||||
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,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -153,6 +137,7 @@ require('lazy').setup({
|
||||||
{
|
{
|
||||||
-- Theme inspired by Atom
|
-- Theme inspired by Atom
|
||||||
'navarasu/onedark.nvim',
|
'navarasu/onedark.nvim',
|
||||||
|
-- 'rose-pine/neovim',
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
config = function()
|
config = function()
|
||||||
vim.cmd.colorscheme 'onedark'
|
vim.cmd.colorscheme 'onedark'
|
||||||
|
@ -177,9 +162,11 @@ 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 ibl`
|
-- See `:help indent_blankline.txt`
|
||||||
main = 'ibl',
|
opts = {
|
||||||
opts = {},
|
char = '┊',
|
||||||
|
show_trailing_blankline_indent = false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- "gc" to comment visual regions/lines
|
-- "gc" to comment visual regions/lines
|
||||||
|
@ -218,8 +205,8 @@ require('lazy').setup({
|
||||||
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
||||||
-- These are some example plugins that I've included in the kickstart repository.
|
-- These are some example plugins that I've included in the kickstart repository.
|
||||||
-- Uncomment any of the lines below to enable them.
|
-- Uncomment any of the lines below to enable them.
|
||||||
-- require 'kickstart.plugins.autoformat',
|
require 'kickstart.plugins.autoformat',
|
||||||
-- require 'kickstart.plugins.debug',
|
require 'kickstart.plugins.debug',
|
||||||
|
|
||||||
-- NOTE: The import below can automatically add 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
|
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
||||||
|
@ -227,7 +214,7 @@ require('lazy').setup({
|
||||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
-- 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
|
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||||
-- { import = 'custom.plugins' },
|
{ import = 'custom.plugins' },
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
-- [[ Setting options ]]
|
||||||
|
@ -239,6 +226,7 @@ vim.o.hlsearch = false
|
||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
vim.wo.number = true
|
vim.wo.number = true
|
||||||
|
vim.wo.relativenumber = true
|
||||||
|
|
||||||
-- Enable mouse mode
|
-- Enable mouse mode
|
||||||
vim.o.mouse = 'a'
|
vim.o.mouse = 'a'
|
||||||
|
@ -262,7 +250,7 @@ vim.o.smartcase = true
|
||||||
vim.wo.signcolumn = 'yes'
|
vim.wo.signcolumn = 'yes'
|
||||||
|
|
||||||
-- Decrease update time
|
-- Decrease update time
|
||||||
vim.o.updatetime = 250
|
vim.o.updatetime = 100
|
||||||
vim.o.timeoutlen = 300
|
vim.o.timeoutlen = 300
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Set completeopt to have a better completion experience
|
||||||
|
@ -325,82 +313,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`
|
||||||
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
|
require('nvim-treesitter.configs').setup {
|
||||||
vim.defer_fn(function()
|
-- Add languages to be installed here that you want installed for treesitter
|
||||||
require('nvim-treesitter.configs').setup {
|
-- ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' },
|
||||||
-- Add languages to be installed here that you want installed for treesitter
|
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim',
|
||||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' },
|
'markdown', 'bash', 'html', 'css', 'fennel' },
|
||||||
|
|
||||||
-- 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,
|
||||||
|
|
||||||
highlight = { enable = true },
|
highlight = { enable = true },
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
incremental_selection = {
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
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 = {
|
||||||
init_selection = '<c-space>',
|
-- You can use the capture groups defined in textobjects.scm
|
||||||
node_incremental = '<c-space>',
|
['aa'] = '@parameter.outer',
|
||||||
scope_incremental = '<c-s>',
|
['ia'] = '@parameter.inner',
|
||||||
node_decremental = '<M-space>',
|
['af'] = '@function.outer',
|
||||||
|
['if'] = '@function.inner',
|
||||||
|
['ac'] = '@class.outer',
|
||||||
|
['ic'] = '@class.inner',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
textobjects = {
|
move = {
|
||||||
select = {
|
enable = true,
|
||||||
enable = true,
|
set_jumps = true, -- whether to set jumps in the jumplist
|
||||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
goto_next_start = {
|
||||||
keymaps = {
|
[']m'] = '@function.outer',
|
||||||
-- You can use the capture groups defined in textobjects.scm
|
[']]'] = '@class.outer',
|
||||||
['aa'] = '@parameter.outer',
|
|
||||||
['ia'] = '@parameter.inner',
|
|
||||||
['af'] = '@function.outer',
|
|
||||||
['if'] = '@function.inner',
|
|
||||||
['ac'] = '@class.outer',
|
|
||||||
['ic'] = '@class.inner',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
move = {
|
goto_next_end = {
|
||||||
enable = true,
|
[']M'] = '@function.outer',
|
||||||
set_jumps = true, -- whether to set jumps in the jumplist
|
[']['] = '@class.outer',
|
||||||
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',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
swap = {
|
goto_previous_start = {
|
||||||
enable = true,
|
['[m'] = '@function.outer',
|
||||||
swap_next = {
|
['[['] = '@class.outer',
|
||||||
['<leader>a'] = '@parameter.inner',
|
},
|
||||||
},
|
goto_previous_end = {
|
||||||
swap_previous = {
|
['[M'] = '@function.outer',
|
||||||
['<leader>A'] = '@parameter.inner',
|
['[]'] = '@class.outer',
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
swap = {
|
||||||
end, 0)
|
enable = true,
|
||||||
|
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' })
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next 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.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.open_float, { desc = 'Open floating diagnostic message' })
|
||||||
|
-- vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
||||||
|
|
||||||
-- [[ Configure LSP ]]
|
-- [[ Configure LSP ]]
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
-- This function gets run when an LSP connects to a particular buffer.
|
||||||
|
@ -420,14 +407,14 @@ local on_attach = function(_, bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
nmap('<leader>la', vim.lsp.buf.code_action, '[L]sp [A]ction')
|
||||||
|
|
||||||
nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||||
nmap('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
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>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')
|
-- nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||||
|
|
||||||
-- See `:help K` for why this keymap
|
-- See `:help K` for why this keymap
|
||||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||||
|
@ -435,11 +422,11 @@ local on_attach = function(_, bufnr)
|
||||||
|
|
||||||
-- Lesser used LSP functionality
|
-- Lesser used LSP functionality
|
||||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
-- nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
-- nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||||
nmap('<leader>wl', function()
|
-- nmap('<leader>wl', function()
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
end, '[W]orkspace [L]ist Folders')
|
-- end, '[W]orkspace [L]ist Folders')
|
||||||
|
|
||||||
-- Create a command `:Format` local to the LSP buffer
|
-- Create a command `:Format` local to the LSP buffer
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||||
|
@ -447,22 +434,6 @@ local on_attach = function(_, bufnr)
|
||||||
end, { desc = 'Format current buffer with LSP' })
|
end, { desc = 'Format current buffer with LSP' })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 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.
|
||||||
--
|
--
|
||||||
|
@ -471,6 +442,15 @@ require('mason-lspconfig').setup()
|
||||||
--
|
--
|
||||||
-- If you want to override the default filetypes that your language server will attach to you can
|
-- 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.
|
-- define the property 'filetypes' to the map in question.
|
||||||
|
local function organize_imports()
|
||||||
|
local params = {
|
||||||
|
command = "_typescript.organizeImports",
|
||||||
|
arguments = { vim.api.nvim_buf_get_name(0) },
|
||||||
|
title = ""
|
||||||
|
}
|
||||||
|
vim.lsp.buf.execute_command(params)
|
||||||
|
end
|
||||||
|
|
||||||
local servers = {
|
local servers = {
|
||||||
-- clangd = {},
|
-- clangd = {},
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
|
@ -485,6 +465,14 @@ local servers = {
|
||||||
telemetry = { enable = false },
|
telemetry = { enable = false },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
-- tsserver = {
|
||||||
|
-- commands = {
|
||||||
|
-- OrganizeImports = {
|
||||||
|
-- organize_imports,
|
||||||
|
-- description = "Organize Imports"
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
-- },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Setup neovim lua configuration
|
-- Setup neovim lua configuration
|
||||||
|
@ -508,8 +496,9 @@ mason_lspconfig.setup_handlers {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
settings = servers[server_name],
|
settings = servers[server_name],
|
||||||
filetypes = (servers[server_name] or {}).filetypes,
|
filetypes = (servers[server_name] or {}).filetypes,
|
||||||
|
-- commands = (servers[server_name] or {}).commands,
|
||||||
}
|
}
|
||||||
end,
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- [[ Configure nvim-cmp ]]
|
-- [[ Configure nvim-cmp ]]
|
||||||
|
|
|
@ -2,4 +2,48 @@
|
||||||
-- I promise not to create any merge conflicts in this directory :)
|
-- I promise not to create any merge conflicts in this directory :)
|
||||||
--
|
--
|
||||||
-- See the kickstart.nvim README for more information
|
-- See the kickstart.nvim README for more information
|
||||||
|
|
||||||
|
vim.opt.guicursor =
|
||||||
|
"n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175"
|
||||||
|
|
||||||
|
-- vim.opt.guicursor = ""
|
||||||
|
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.softtabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
|
vim.opt.smartindent = true
|
||||||
|
vim.opt.wrap = false
|
||||||
|
|
||||||
|
vim.opt.swapfile = false
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||||
|
vim.opt.undofile = true
|
||||||
|
|
||||||
|
-- vim.opt.hlsearch = false
|
||||||
|
vim.opt.incsearch = true
|
||||||
|
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
|
vim.opt.scrolloff = 8
|
||||||
|
vim.opt.signcolumn = "yes"
|
||||||
|
-- vim.opt.isfname:append("@_@")
|
||||||
|
|
||||||
|
vim.opt.colorcolumn = "80"
|
||||||
|
|
||||||
|
vim.opt.showtabline = 2
|
||||||
|
|
||||||
|
function my_tabline()
|
||||||
|
local s = ''
|
||||||
|
for i = 1, vim.fn.tabpagenr('$') do
|
||||||
|
local bufnr = vim.fn.tabpagebuflist(i)[vim.fn.tabpagewinnr(i)]
|
||||||
|
local bufname = vim.fn.fnamemodify(vim.fn.bufname(bufnr), ':p')
|
||||||
|
s = s .. '%' .. i .. 'T' .. (bufnr == vim.fn.bufnr('%') and '%1*' or '%2*') .. bufname .. ' '
|
||||||
|
end
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.o.tabline = [[%!v:lua.my_tabline()]]
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|
Loading…
Reference in New Issue