Browse Source

Add dadbod and noice to nvim

master
parent
commit
898bde9931
11 changed files with 90 additions and 85 deletions
  1. +3
    -0
      .config/nvim/lua/config/dadbod.lua
  2. +0
    -3
      .config/nvim/lua/config/general/colorscheme.lua
  3. +0
    -3
      .config/nvim/lua/config/general/init.lua
  4. +0
    -3
      .config/nvim/lua/config/general/remaps.lua
  5. +7
    -7
      .config/nvim/lua/config/lsp.lua
  6. +18
    -0
      .config/nvim/lua/config/noice.lua
  7. +0
    -32
      .config/nvim/lua/config/null-ls.lua
  8. +31
    -29
      .config/nvim/lua/config/telescope.lua
  9. +0
    -4
      .config/nvim/lua/config/tmux.lua
  10. +0
    -1
      .config/nvim/lua/config/treesitter.lua
  11. +31
    -3
      .config/nvim/lua/packer-plugins.lua

+ 3
- 0
.config/nvim/lua/config/dadbod.lua View File

@ -0,0 +1,3 @@
vim.cmd[[ let g:db_ui_winwidth = 30 ]]
vim.keymap.set('n', '<leader>db', ':DBUIToggle<CR>', { noremap = true })

+ 0
- 3
.config/nvim/lua/config/general/colorscheme.lua View File

@ -1,3 +0,0 @@
vim.cmd [[colorscheme gruvbox]]

+ 0
- 3
.config/nvim/lua/config/general/init.lua View File

@ -1,6 +1,3 @@
require('config.general.options') require('config.general.options')
require('config.general.remaps') require('config.general.remaps')
require('config.general.autocmd') require('config.general.autocmd')
require('config.general.colorscheme')

+ 0
- 3
.config/nvim/lua/config/general/remaps.lua View File

@ -37,9 +37,6 @@ vim.api.nvim_set_keymap('n',
options options
) )
-- Replace all is aliased to S.
vim.api.nvim_set_keymap('n', '<C-s>', '<cmd>%s//g<Left><Left>', options)
-- Navigating with guides -- Navigating with guides
vim.api.nvim_set_keymap('n', vim.api.nvim_set_keymap('n',
'<leader><leader>', '<leader><leader>',


+ 7
- 7
.config/nvim/lua/config/lsp.lua View File

@ -3,9 +3,13 @@ lsp.preset('recommended')
local luasnip = require("luasnip") local luasnip = require("luasnip")
lsp.ensure_installed({ lsp.ensure_installed({
'lua_ls',
'tsserver', 'tsserver',
'eslint', 'eslint',
'gopls'
'gopls',
'intelephense',
'jsonls',
'volar',
}) })
local has_words_before = function() local has_words_before = function()
@ -37,7 +41,7 @@ local cmp_mappings = lsp.defaults.cmp_mappings({
i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false }, i = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false },
c = function(fallback) c = function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false }
cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false }
else else
fallback() fallback()
end end
@ -89,6 +93,7 @@ lsp.on_attach(function(client, bufnr)
-- Key mappings -- Key mappings
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
vim.keymap.set("n", "[e", function () vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR}) end, opts) vim.keymap.set("n", "[e", function () vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR}) end, opts)
@ -98,12 +103,7 @@ lsp.on_attach(function(client, bufnr)
vim.keymap.set("n", "<leader>ka", vim.lsp.buf.code_action, opts) vim.keymap.set("n", "<leader>ka", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>of", vim.diagnostic.open_float, opts) vim.keymap.set("n", "<leader>of", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
-- vim.keymap.set("n", "gr", function() vim.lsp.buf.references({ includeDeclaration = false }) end, opts)
vim.keymap.set("n", "gh", vim.lsp.buf.signature_help, opts) vim.keymap.set("n", "gh", vim.lsp.buf.signature_help, opts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition, opts)
end) end)
lsp.setup() lsp.setup()

+ 18
- 0
.config/nvim/lua/config/noice.lua View File

@ -0,0 +1,18 @@
require("noice").setup({
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = false, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
})

+ 0
- 32
.config/nvim/lua/config/null-ls.lua View File

@ -1,32 +0,0 @@
local null_ls = require("null-ls")
local group = vim.api.nvim_create_augroup("lsp_format_on_save", { clear = false })
local event = "BufWritePre" -- or "BufWritePost"
local async = event == "BufWritePost"
null_ls.setup({
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.keymap.set("n", "<Leader>ff", function()
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
end, { buffer = bufnr, desc = "[lsp] format" })
-- format on save
vim.api.nvim_clear_autocmds({ buffer = bufnr, group = group })
vim.api.nvim_create_autocmd(event, {
buffer = bufnr,
group = group,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr, async = async })
end,
desc = "[lsp] format on save",
})
end
if client.supports_method("textDocument/rangeFormatting") then
vim.keymap.set("x", "<Leader>f", function()
vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() })
end, { buffer = bufnr, desc = "[lsp] format" })
end
end,
})

+ 31
- 29
.config/nvim/lua/config/telescope.lua View File

@ -1,24 +1,26 @@
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local previewers = require("telescope.previewers")
local action_state = require("telescope.actions.state")
local conf = require("telescope.config").values
local actions = require("telescope.actions")
local pickers = require('telescope.pickers')
local finders = require('telescope.finders')
local previewers = require('telescope.previewers')
local action_state = require('telescope.actions.state')
local conf = require('telescope.config').values
local builtin = require('telescope.builtin')
local sorters = require('telescope.sorters')
local actions = require('telescope.actions')
require("telescope").setup({
require('telescope').setup({
defaults = { defaults = {
file_sorter = require("telescope.sorters").get_fzy_sorter,
prompt_prefix = " >",
file_sorter = sorters.get_fzy_sorter,
prompt_prefix = ' >',
color_devicons = true, color_devicons = true,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
file_previewer = previewers.vim_buffer_cat.new,
grep_previewer = previewers.vim_buffer_vimgrep.new,
qflist_previewer = previewers.vim_buffer_qflist.new,
mappings = { mappings = {
i = { i = {
["<C-x>"] = false,
["<C-q>"] = actions.send_to_qflist,
['<C-x>'] = false,
['<C-q>'] = actions.send_to_qflist,
}, },
}, },
}, },
@ -27,7 +29,7 @@ require("telescope").setup({
local M = {} local M = {}
function git_branches () function git_branches ()
require("telescope.builtin").git_branches({
builtin.git_branches({
attach_mappings = function(_, map) attach_mappings = function(_, map)
map("i", "<c-d>", actions.git_delete_branch) map("i", "<c-d>", actions.git_delete_branch)
map("n", "<c-d>", actions.git_delete_branch) map("n", "<c-d>", actions.git_delete_branch)
@ -38,37 +40,37 @@ end
function files () function files ()
local ran, errorMessage = pcall(function() local ran, errorMessage = pcall(function()
require('telescope.builtin').git_files({ show_untracked = true })
builtin.git_files({ show_untracked = true })
end) end)
if not ran then if not ran then
require('telescope.builtin').find_files()
builtin.find_files()
end end
end end
local options = { noremap = true } local options = { noremap = true }
vim.keymap.set('n', '<C-g>', require('telescope.builtin').live_grep, options)
vim.keymap.set('n', '<C-g>', builtin.live_grep, options)
vim.keymap.set('n', '<C-p>', files, options) vim.keymap.set('n', '<C-p>', files, options)
vim.keymap.set('n', '<A-p>', function()
require('telescope.builtin').find_files()
end, options)
vim.keymap.set('n', '<leader>df', function() vim.keymap.set('n', '<leader>df', function()
require("telescope.builtin").find_files({
builtin.find_files({
prompt_title = "< VimRC >", prompt_title = "< VimRC >",
cwd = vim.fn.expand('~/.config/nvim'), cwd = vim.fn.expand('~/.config/nvim'),
hidden = true, hidden = true,
}) })
end, options) end, options)
vim.keymap.set('n', '<leader>fb', require('telescope.builtin').buffers, options)
vim.keymap.set('n', '<leader>fo', require('telescope.builtin').oldfiles, options)
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, options)
vim.keymap.set('n', '<leader>fb', builtin.buffers, options)
vim.keymap.set('n', '<leader>fo', builtin.oldfiles, options)
vim.keymap.set('n', 'gr', builtin.lsp_references, options)
vim.keymap.set("n", 'gd', builtin.lsp_definitions, options)
vim.keymap.set("n", 'gi', builtin.lsp_implementations, options)
vim.keymap.set("n", 'gT', builtin.lsp_type_definitions, options)
vim.keymap.set('n', '<leader>m', require('telescope.builtin').marks, options)
vim.keymap.set('n', '<leader>ch', require('telescope.builtin').command_history, options)
vim.keymap.set('n', '<leader>m', builtin.marks, options)
vim.keymap.set('n', '<leader>ch', builtin.command_history, options)
vim.keymap.set('n', '<leader>gb', git_branches, options) vim.keymap.set('n', '<leader>gb', git_branches, options)
vim.keymap.set('n', '<leader>gs', require('telescope.builtin').git_status, options)
vim.keymap.set('n', '<leader>gs', builtin.git_status, options)

+ 0
- 4
.config/nvim/lua/config/tmux.lua View File

@ -1,9 +1,5 @@
require("tmux").setup({ require("tmux").setup({
-- overwrite default configuration
-- here, e.g. to enable default bindings
copy_sync = { copy_sync = {
-- enables copy sync and overwrites all register actions to
-- sync registers *, +, unnamed, and 0 till 9 from tmux in advance
enable = true, enable = true,
}, },
navigation = { navigation = {


+ 0
- 1
.config/nvim/lua/config/treesitter.lua View File

@ -1,5 +1,4 @@
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup {
-- A list of parser names, or "all"
ensure_installed = { 'go', 'dart', 'php', 'javascript' }, ensure_installed = { 'go', 'dart', 'php', 'javascript' },
-- Install parsers synchronously (only applied to `ensure_installed`) -- Install parsers synchronously (only applied to `ensure_installed`)


+ 31
- 3
.config/nvim/lua/packer-plugins.lua View File

@ -3,7 +3,13 @@ return require('packer').startup(function()
use { 'wbthomason/packer.nvim' } use { 'wbthomason/packer.nvim' }
-- colorschemes -- colorschemes
use { 'gruvbox-community/gruvbox' }
use {
'gruvbox-community/gruvbox',
config = function ()
vim.cmd [[colorscheme gruvbox]]
end
}
use { 'bluz71/vim-moonfly-colors' } use { 'bluz71/vim-moonfly-colors' }
use { use {
@ -165,13 +171,35 @@ return require('packer').startup(function()
use { use {
'MunifTanjim/prettier.nvim', 'MunifTanjim/prettier.nvim',
requires = { requires = {
'jose-elias-alvarez/null-ls.nvim',
-- 'jose-elias-alvarez/null-ls.nvim',
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
}, },
config = function() config = function()
require('config.null-ls')
-- require('config.null-ls')
require('config.prettier') require('config.prettier')
end end
} }
use {
'folke/noice.nvim',
requires = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
config = function ()
require('config.noice')
end
}
use {
'kristijanhusak/vim-dadbod-ui',
requires = {
'tpope/vim-dadbod',
},
config = function()
require('config.dadbod')
end
}
end) end)

Loading…
Cancel
Save