updated config, dadbod plugins breaks the luasnip
This commit is contained in:
parent
1ea4e128bb
commit
c684629b40
4 changed files with 236 additions and 183 deletions
119
init.lua
119
init.lua
|
|
@ -25,7 +25,9 @@ vim.opt.showmode = false
|
|||
vim.opt.swapfile = false
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
end)
|
||||
|
||||
-- Enable break indent
|
||||
vim.opt.breakindent = true
|
||||
|
|
@ -59,7 +61,10 @@ vim.opt.inccommand = 'split'
|
|||
|
||||
-- Show which line your cursor is on
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.cursorlineopt = { 'number' } --remove cursorline color, required for hl-CursorLineNr with cursorline true.
|
||||
|
||||
--remove cursorline color, required for hl-CursorLineNr with cursorline true.
|
||||
vim.opt.cursorlineopt = { 'both' }
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
|
|
@ -67,18 +72,14 @@ vim.opt.scrolloff = 10
|
|||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
||||
vim.opt.hlsearch = true
|
||||
-- vim.opt.hlsearch = true
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
vim.keymap.set('n', '<leader><F5>', vim.cmd.UndotreeToggle)
|
||||
-- Move line up or down after highlight
|
||||
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||
|
|
@ -111,80 +112,12 @@ vim.keymap.set('i', 'kj', '<ESC>')
|
|||
-- Open Neotree
|
||||
vim.keymap.set('n', '<leader>nt', '<cmd>:Neotree<CR>')
|
||||
|
||||
-- LSP and Telescope Shortcut
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||
callback = function(event)
|
||||
-- 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 map = function(keys, func, desc)
|
||||
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||
end
|
||||
-- Oil nvim
|
||||
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' })
|
||||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-T>.
|
||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
--Undo Tree
|
||||
vim.keymap.set('n', '<leader><F5>', vim.cmd.UndotreeToggle)
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
|
||||
-- Jump to the type of the word under your cursor.
|
||||
-- Useful when you're not sure what type a variable is and you want to see
|
||||
-- the definition of its *type*, not where it was *defined*.
|
||||
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace
|
||||
-- Similar to document symbols, except searches over your whole project.
|
||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- Rename the variable under your cursor
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
-- Opens a popup that displays documentation about the word under your cursor
|
||||
-- See `:help K` for why this keymap
|
||||
map('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
||||
-- The following two autocommands are used to highlight references of the
|
||||
-- word under your cursor when your cursor rests there for a little while.
|
||||
-- See `:help CursorHold` for information about when this is executed
|
||||
--
|
||||
-- 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
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = event.buf,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
|
|
@ -199,10 +132,14 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|||
})
|
||||
|
||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||
if vim.v.shell_error ~= 0 then
|
||||
error('Error cloning lazy.nvim:\n' .. out)
|
||||
end
|
||||
end ---@diagnostic disable-next-line: undefined-field
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
|
|
@ -213,9 +150,9 @@ require('lazy').setup({
|
|||
'mbbill/undotree',
|
||||
|
||||
-- Database
|
||||
'tpope/vim-dadbod',
|
||||
'kristijanhusak/vim-dadbod-ui',
|
||||
'kristijanhusak/vim-dadbod-completion',
|
||||
-- 'tpope/vim-dadbod',
|
||||
-- 'kristijanhusak/vim-dadbod-ui',
|
||||
-- 'kristijanhusak/vim-dadbod-completion',
|
||||
|
||||
{
|
||||
'microsoft/vscode-js-debug',
|
||||
|
|
@ -429,12 +366,15 @@ require('lazy').setup({
|
|||
|
||||
{
|
||||
'folke/tokyonight.nvim',
|
||||
priority = 1000, -- make sure to load this before all the other start plugins
|
||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
init = function()
|
||||
require('tokyonight').setup {
|
||||
transparent = false,
|
||||
terminal_colors = true,
|
||||
}
|
||||
-- Load the colorscheme here.
|
||||
-- Like many other themes, this one has different styles, and you could load
|
||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||
-- vim.cmd.colorscheme 'tokyonight-night'
|
||||
|
||||
-- You can configure highlights by doing something like:
|
||||
-- vim.cmd.hi 'Comment gui=none'
|
||||
end,
|
||||
},
|
||||
|
||||
|
|
@ -487,5 +427,4 @@ require('lazy').setup({
|
|||
},
|
||||
})
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue