|
|
|
@ -110,7 +110,11 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- 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
|
|
|
|
|
'lewis6991/gitsigns.nvim',
|
|
|
|
@ -183,7 +187,7 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- "gc" to comment visual regions/lines
|
|
|
|
|
{ 'numToStr/Comment.nvim', opts = {} },
|
|
|
|
|
{ 'numToStr/Comment.nvim', opts = {} },
|
|
|
|
|
|
|
|
|
|
-- Fuzzy Finder (files, lsp, etc)
|
|
|
|
|
{
|
|
|
|
@ -218,8 +222,8 @@ require('lazy').setup({
|
|
|
|
|
-- 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.
|
|
|
|
|
-- Uncomment any of the lines below to enable them.
|
|
|
|
|
-- require 'kickstart.plugins.autoformat',
|
|
|
|
|
-- require 'kickstart.plugins.debug',
|
|
|
|
|
require 'kickstart.plugins.autoformat',
|
|
|
|
|
require 'kickstart.plugins.debug',
|
|
|
|
|
|
|
|
|
|
-- 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
|
|
|
|
@ -227,7 +231,7 @@ require('lazy').setup({
|
|
|
|
|
-- 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' },
|
|
|
|
|
}, {})
|
|
|
|
|
|
|
|
|
|
-- [[ Setting options ]]
|
|
|
|
@ -241,13 +245,32 @@ vim.o.hlsearch = false
|
|
|
|
|
vim.wo.number = true
|
|
|
|
|
|
|
|
|
|
-- Enable mouse mode
|
|
|
|
|
vim.o.mouse = 'a'
|
|
|
|
|
vim.o.mouse = false
|
|
|
|
|
|
|
|
|
|
-- Sync clipboard between OS and Neovim.
|
|
|
|
|
-- Remove this option if you want your OS clipboard to remain independent.
|
|
|
|
|
-- See `:help 'clipboard'`
|
|
|
|
|
vim.o.clipboard = 'unnamedplus'
|
|
|
|
|
|
|
|
|
|
-- vim.o.clipboard = 'unnamedplus'
|
|
|
|
|
--- Copy-paste
|
|
|
|
|
vim.keymap.set('v', '<leader>p', '"_dP')
|
|
|
|
|
vim.keymap.set('n', '<leader>y', '"+y')
|
|
|
|
|
vim.keymap.set('v', '<leader>y', '"+y')
|
|
|
|
|
vim.keymap.set('n', '<leader>Y', 'gg"+yG')
|
|
|
|
|
vim.keymap.set('n', '<leader>d', '"_d')
|
|
|
|
|
vim.keymap.set('v', '<leader>d', '"_d')
|
|
|
|
|
|
|
|
|
|
vim.g.clipboard = {
|
|
|
|
|
name= 'WslClipboard',
|
|
|
|
|
copy= {
|
|
|
|
|
['+'] = 'clip.exe',
|
|
|
|
|
['*'] = 'clip.exe',
|
|
|
|
|
},
|
|
|
|
|
paste = {
|
|
|
|
|
['+'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
|
|
|
|
|
['*'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
|
|
|
|
|
},
|
|
|
|
|
cache_enabled= 0,
|
|
|
|
|
}
|
|
|
|
|
-- Enable break indent
|
|
|
|
|
vim.o.breakindent = true
|
|
|
|
|
|
|
|
|
@ -296,6 +319,8 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|
|
|
|
-- See `:help telescope` and `:help telescope.setup()`
|
|
|
|
|
require('telescope').setup {
|
|
|
|
|
defaults = {
|
|
|
|
|
path_display = { shorten = { len = 3, exclude = { 1, 2, 3, -3, -2, -1 } } },
|
|
|
|
|
|
|
|
|
|
mappings = {
|
|
|
|
|
i = {
|
|
|
|
|
['<C-u>'] = false,
|
|
|
|
@ -333,7 +358,7 @@ vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc =
|
|
|
|
|
vim.defer_fn(function()
|
|
|
|
|
require('nvim-treesitter.configs').setup {
|
|
|
|
|
-- 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' },
|
|
|
|
|
ensure_installed = { 'java', 'go', 'lua', 'python', 'rust', 'javascript', 'vimdoc', 'vim', 'bash' },
|
|
|
|
|
|
|
|
|
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
|
|
|
|
auto_install = false,
|
|
|
|
@ -403,50 +428,7 @@ vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open float
|
|
|
|
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
|
|
|
|
|
|
|
|
|
-- [[ Configure LSP ]]
|
|
|
|
|
-- This function gets run when an LSP connects to a particular buffer.
|
|
|
|
|
local on_attach = function(_, bufnr)
|
|
|
|
|
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
|
|
|
|
-- to define small helper and utility functions so you don't have to repeat yourself
|
|
|
|
|
-- many times.
|
|
|
|
|
--
|
|
|
|
|
-- In this case, we create a function that lets us more easily define mappings specific
|
|
|
|
|
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
|
|
|
|
local nmap = function(keys, func, desc)
|
|
|
|
|
if desc then
|
|
|
|
|
desc = 'LSP: ' .. desc
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
|
|
|
|
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
|
|
|
|
|
|
|
|
|
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
|
|
|
|
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
|
|
|
|
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')
|
|
|
|
|
|
|
|
|
|
-- See `:help K` for why this keymap
|
|
|
|
|
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
|
|
|
|
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
|
|
|
|
|
|
|
|
|
-- Lesser used LSP functionality
|
|
|
|
|
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>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
|
|
|
|
nmap('<leader>wl', function()
|
|
|
|
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
|
|
|
end, '[W]orkspace [L]ist Folders')
|
|
|
|
|
|
|
|
|
|
-- Create a command `:Format` local to the LSP buffer
|
|
|
|
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
|
|
|
|
vim.lsp.buf.format()
|
|
|
|
|
end, { desc = 'Format current buffer with LSP' })
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local lsp_settings = require('lsp.keymap')
|
|
|
|
|
-- document existing key chains
|
|
|
|
|
require('which-key').register {
|
|
|
|
|
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
|
|
|
@ -478,7 +460,6 @@ local servers = {
|
|
|
|
|
-- rust_analyzer = {},
|
|
|
|
|
-- tsserver = {},
|
|
|
|
|
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
|
|
|
|
|
|
|
|
|
lua_ls = {
|
|
|
|
|
Lua = {
|
|
|
|
|
workspace = { checkThirdParty = false },
|
|
|
|
@ -498,14 +479,22 @@ capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
|
|
|
|
local mason_lspconfig = require 'mason-lspconfig'
|
|
|
|
|
|
|
|
|
|
mason_lspconfig.setup {
|
|
|
|
|
ensure_installed = vim.tbl_keys(servers),
|
|
|
|
|
ensure_installed = vim.list_extend(vim.tbl_keys(servers), { "jdtls" })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mason_lspconfig.setup_handlers {
|
|
|
|
|
function(server_name)
|
|
|
|
|
if server_name == 'jdtls' then
|
|
|
|
|
-- disable jdtls config from lspconfig. jdtls will be configured by nvim-jdtls since it much more powerful
|
|
|
|
|
require('lspconfig')[server_name].setup = function()
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- enable language servers for all other
|
|
|
|
|
require('lspconfig')[server_name].setup {
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
on_attach = on_attach,
|
|
|
|
|
on_attach = lsp_settings.on_attach,
|
|
|
|
|
settings = servers[server_name],
|
|
|
|
|
filetypes = (servers[server_name] or {}).filetypes,
|
|
|
|
|
}
|
|
|
|
|