From 94c33a04ddce0eec59c7d549e99d5e255f216160 Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Tue, 15 Aug 2023 23:31:31 -0700 Subject: [PATCH] add dadbod and notify --- init.vim | 4 +- keybindings.vim | 11 ++++- lua/keybindings.lua | 2 +- lua/plugins.lua | 92 ++++++++++++++++++++++++++++++------ lua/settings.lua | 24 +++++----- plugin-confs/nvim-cmp.lua | 1 + plugin-confs/nvim-notify.lua | 17 +++++++ plugin-confs/whichkey.lua | 2 +- 8 files changed, 121 insertions(+), 32 deletions(-) create mode 100644 plugin-confs/nvim-notify.lua diff --git a/init.vim b/init.vim index 3e14814..49c010f 100755 --- a/init.vim +++ b/init.vim @@ -42,6 +42,7 @@ source ~/.config/nvim/plugin-confs/nvim-dap-ui.lua source ~/.config/nvim/plugin-confs/nvim-dap-virtual-text.lua " source ~/.config/nvim/plugin-confs/copilot.lua source ~/.config/nvim/plugin-confs/copilot-cmp.lua +source ~/.config/nvim/plugin-confs/nvim-notify.lua " source ~/.config/nvim/plugin-confs/lsp-signature.lua " source ~/.config/nvim/plugin-confs/nvim-docs-view.lua @@ -75,6 +76,7 @@ source ~/.config/nvim/plugin-confs/catppuccin.lua command! Reload execute "source ~/.config/nvim/init.vim" command! Config execute ":e ~/.config/nvim/init.vim" command! Plugins execute ":e ~/.config/nvim/lua/plugins.lua" +command! Keybindings execute ":e ~/.config/nvim/keybindings.vim" command! Settings execute ":e ~/.config/nvim/lua/settings.lua" command! Env execute ":Dotenv .env" command! MakeTags !ctags -R . @@ -90,4 +92,4 @@ highlight PmenuSel guifg=purple guibg=red " run code actions on cursor hold if lsp is attached "autocmd CursorHold,CursorHoldI * lua require('code_action_utils').code_action_listener() -autocmd CursorHold,CursorHoldI * lua if vim.tbl_isempty(vim.lsp.buf_get_clients()) then require('code_action_utils').code_action_listener() end +autocmd CursorHold,CursorHoldI * lua if vim.tbl_isempty(vim.lsp.buf_get_clients()) then require('code_action_utils').code_action_listener() end diff --git a/keybindings.vim b/keybindings.vim index 888f712..3ebfb97 100644 --- a/keybindings.vim +++ b/keybindings.vim @@ -98,11 +98,17 @@ nnoremap :lua require('dap').step_over() nnoremap :lua require('dap').step_into() nnoremap :lua require('dap').step_out() +nnoremap D :Dotenv .env + +nnoremap ec :e ~/.config/nvim/init.vim +nnoremap ek :e ~/.config/nvim/keybindings.vim +nnoremap ep :e ~/.config/nvim/lua/plugins.lua +nnoremap es :e ~/.config/nvim/lua/settings.lua + nnoremap fb :Telescope file_browser nnoremap ff :Telescope find_files nnoremap fg :Telescope live_grep -nnoremap fh :Telescope oldfiles -" nnoremap fd :e ~/.config/nvim/init.vim +nnoremap fr :Telescope oldfiles nnoremap gb :Gitsigns blame_line nnoremap gc :Telescope git_commits @@ -173,6 +179,7 @@ nnoremap tf :wa:FloatermToggle floatterm nnoremap tp :FloatermToggle ipython nnoremap tP :FloatermToggle ipython-full nnoremap tt :FloatermToggle split-term +nnoremap td :DBUIToggle nnoremap wa :lua vim.lsp.buf.add_workspace_folder() nnoremap wl :lua print(vim.inspect(vim.lsp.buf.list_workspace_folders())) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index dbae50f..3b9122d 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -1,3 +1,3 @@ local function map(m, k, v) - vim.keymap.set(m, k, v, {silent = true, noremap = true}) + vim.keymap.set(m, k, v, { silent = true, noremap = true }) end diff --git a/lua/plugins.lua b/lua/plugins.lua index 1beb664..52a343b 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,3 +1,5 @@ +local lsp_dev = {} + vim.cmd [[packadd packer.nvim]] require('packer').startup(function(use) use 'wbthomason/packer.nvim' @@ -87,6 +89,8 @@ require('packer').startup(function(use) use { "zbirenbaum/copilot-cmp" } -- }}} + -- CHATGPT {{{ + use({ "jackMort/ChatGPT.nvim", commit = "24bcca7", @@ -217,26 +221,28 @@ require('packer').startup(function(use) "nvim-telescope/telescope.nvim" } }) + + -- }}} use({ "iamcco/markdown-preview.nvim", run = function() vim.fn["mkdp#util#install"]() end }) - use { 'https://git.sr.ht/~whynothugo/lsp_lines.nvim' } use 'L3MON4D3/LuaSnip' - use { 'hrsh7th/nvim-cmp' } - use { 'hrsh7th/cmp-nvim-lsp' } - use { 'hrsh7th/cmp-nvim-lua' } - use { 'hrsh7th/cmp-nvim-lsp-signature-help' } - use { 'hrsh7th/cmp-path' } - use { 'hrsh7th/cmp-cmdline' } - use { 'hrsh7th/cmp-buffer' } + use 'folke/neodev.nvim' use 'saadparwaiz1/cmp_luasnip' + use { 'hrsh7th/cmp-buffer' } + use { 'hrsh7th/cmp-cmdline' } + use { 'hrsh7th/cmp-nvim-lsp' } use { 'hrsh7th/cmp-nvim-lsp-document-symbol' } + use { 'hrsh7th/cmp-nvim-lsp-signature-help' } + use { 'hrsh7th/cmp-nvim-lua' } + use { 'hrsh7th/cmp-path' } + use { 'hrsh7th/nvim-cmp' } + use { 'https://git.sr.ht/~whynothugo/lsp_lines.nvim' } + use { 'jose-elias-alvarez/null-ls.nvim' } use { 'neovim/nvim-lspconfig' } use { 'onsails/lspkind-nvim' } - use { 'jose-elias-alvarez/null-ls.nvim' } - use 'folke/neodev.nvim' -- DAP {{{ @@ -247,13 +253,64 @@ require('packer').startup(function(use) -- }}} + -- DADBOD {{{ + + use { 'tpope/vim-dadbod' } + use { 'kristijanhusak/vim-dadbod-ui' } + use { 'kristijanhusak/vim-dadbod-completion' } + + -- }}} + -- }}} -- UI {{{ use { - 'nvim-lualine/lualine.nvim', - requires = { 'kyazdani42/nvim-web-devicons', opt = true } + 'glepnir/dashboard-nvim', + -- event = 'VimEnter', + config = function() + require('dashboard').setup { + theme = 'doom', -- theme is doom and hyper default is hyper + disable_move = false, -- default is false disable move keymap for hyper + shortcut_type = 'number', -- shorcut type 'letter' or 'number' + change_to_vcs_root = false, -- default is false,for open file in hyper mru. it will change to the root of vcs + config = { + header = { "NVIM DASHBOARD" }, -- your header + center = { + { + icon = ' ', + icon_hl = 'Title', + desc = 'Find File ', + desc_hl = 'String', + key = 'b', + keymap = 'SPC f f', + key_hl = 'Number', + action = 'lua print(2)' + } + -- { + -- icon = ' ', + -- desc = 'Find Dotfiles', + -- key = 'f', + -- keymap = 'SPC f d', + -- action = 'lua print(3)' + -- } + }, + footer = {} -- your footer + }, + hide = { + statusline = true, -- hide statusline default is true + tabline = true, -- hide the tabline + winbar = true -- hide winbar + } + -- preview = { + -- command = "bat", -- preview command + -- file_path -- preview file path + -- file_height -- preview file height + -- file_width -- preview file width + -- }, + } + end, + requires = { 'nvim-tree/nvim-web-devicons' } } use { 'j-hui/fidget.nvim', @@ -264,14 +321,18 @@ require('packer').startup(function(use) } end } - use 'norcalli/nvim-colorizer.lua' + use { + 'nvim-lualine/lualine.nvim', + requires = { 'kyazdani42/nvim-web-devicons', opt = true } + } + use { 'kyazdani42/nvim-web-devicons' } + use { 'norcalli/nvim-colorizer.lua' } use { 'akinsho/nvim-bufferline.lua' } use { 'andweeb/presence.nvim' } use { 'folke/which-key.nvim' } - use { 'glepnir/dashboard-nvim' } use { 'kyazdani42/nvim-tree.lua' } - use 'kyazdani42/nvim-web-devicons' use { 'lewis6991/gitsigns.nvim' } + use { 'rcarriga/nvim-notify' } use { 'stevearc/dressing.nvim' } -- }}} @@ -299,6 +360,7 @@ require('packer').startup(function(use) use 'jiangmiao/auto-pairs' use 'pechorin/any-jump.vim' use 'tpope/vim-commentary' + use 'tpope/vim-dotenv' use 'tpope/vim-surround' use 'voldikss/vim-floaterm' use 'wakatime/vim-wakatime' diff --git a/lua/settings.lua b/lua/settings.lua index fdcab4d..d08ec8d 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -5,7 +5,8 @@ local l = vim.lsp g.mapleader = " " g.maplocalleader = ',' -g.fzf_command = 'fzf --height 90% --width=85% --layout=reverse --preview "bat --color=always {}"' +g.fzf_command = +'fzf --height 90% --width=85% --layout=reverse --preview "bat --color=always {}"' o.completeopt = "menu,menuone,noselect" o.showmode = false o.termguicolors = true @@ -30,7 +31,8 @@ o.cursorline = true o.scrolloff = 8 o.sidescrolloff = 8 o.wildmenu = true -o.wildignore = '.git,.hg,.svn,CVS,.DS_Store,.idea,.vscode,.vscode-test,node_modules' +o.wildignore = +'.git,.hg,.svn,CVS,.DS_Store,.idea,.vscode,.vscode-test,node_modules' o.showmatch = true o.list = true o.listchars = 'tab:»·,trail:·,nbsp:·,extends:>,precedes:<' @@ -43,17 +45,15 @@ o.updatetime = 300 o.timeoutlen = 500 o.pumwidth = 35 o.foldmethod = 'marker' +g.db_ui_use_nerd_fonts = 1 local border = { - { "╭", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╮", "FloatBorder" }, - { "│", "FloatBorder" }, - { "╯", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╰", "FloatBorder" }, - { "│", "FloatBorder" }, + { "╭", "FloatBorder" }, { "─", "FloatBorder" }, { "╮", "FloatBorder" }, + { "│", "FloatBorder" }, { "╯", "FloatBorder" }, { "─", "FloatBorder" }, + { "╰", "FloatBorder" }, { "│", "FloatBorder" } } -l.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border }) -l.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }) +l.handlers["textDocument/signatureHelp"] = + vim.lsp.with(vim.lsp.handlers.signature_help, { border = border }) +l.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, + { border = border }) diff --git a/plugin-confs/nvim-cmp.lua b/plugin-confs/nvim-cmp.lua index ad47ffc..f42cb0a 100644 --- a/plugin-confs/nvim-cmp.lua +++ b/plugin-confs/nvim-cmp.lua @@ -159,6 +159,7 @@ cmp.setup({ { name = 'nvim_lsp', group_index = 2 }, { name = 'nvim_lsp_signature_help', group_index = 2 }, { name = 'nvim_lsp_document_symbol', group_index = 2 }, + { name = 'vim-dadbod-completion', group_index = 2 }, { name = 'neorg', group_index = 2 }, -- For luasnip users. { name = 'luasnip', group_index = 2 }, -- For luasnip users. { diff --git a/plugin-confs/nvim-notify.lua b/plugin-confs/nvim-notify.lua new file mode 100644 index 0000000..b52a643 --- /dev/null +++ b/plugin-confs/nvim-notify.lua @@ -0,0 +1,17 @@ +require("notify").setup({ + background_colour = "NotifyBackground", + fps = 144, + icons = { + DEBUG = "", + ERROR = "", + INFO = "", + TRACE = "✎", + WARN = "" + }, + level = 2, + minimum_width = 50, + render = "default", + stages = "fade_in_slide_out", + timeout = 5000, + top_down = true +}) diff --git a/plugin-confs/whichkey.lua b/plugin-confs/whichkey.lua index 6fe1084..50d31f1 100755 --- a/plugin-confs/whichkey.lua +++ b/plugin-confs/whichkey.lua @@ -125,7 +125,7 @@ wk.register({ b = "File Browser", f = "Find in Current Directory", g = "Live Grep", - h = "File History" + r = "File Recent" }, g = { name = "Git",