From 292483234d430ad8c8bfdffe8ed8f1bdb984e712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20Fussing=20M=C3=B8rk?= Date: Wed, 12 Oct 2022 09:33:11 +0200 Subject: [PATCH] Many changes --- neovim/.config/nvim/init.lua | 5 +- neovim/.config/nvim/lua/development.lua | 60 +++++++++++ neovim/.config/nvim/lua/handling.lua | 3 + neovim/.config/nvim/lua/keybindings.lua | 133 +++++++++++++++++++++++- neovim/.config/nvim/lua/plugins.lua | 68 ++++++++++-- neovim/.config/nvim/lua/python.lua | 6 -- neovim/.config/nvim/lua/visuals.lua | 11 +- 7 files changed, 266 insertions(+), 20 deletions(-) create mode 100644 neovim/.config/nvim/lua/development.lua create mode 100644 neovim/.config/nvim/lua/handling.lua delete mode 100644 neovim/.config/nvim/lua/python.lua diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua index 76beec5..f66cff1 100644 --- a/neovim/.config/nvim/init.lua +++ b/neovim/.config/nvim/init.lua @@ -1,7 +1,8 @@ require('plugins') require('visuals') +require('handling') require('completion') -require('python') +require('development') require('keybindings') vim.opt.tabstop = 2 @@ -10,3 +11,5 @@ vim.opt.number = true vim.opt.relativenumber = true vim.opt.clipboard = 'unnamedplus' vim.opt.smartindent = true +vim.opt.swapfile = false +vim.opt.signcolumn = "yes" diff --git a/neovim/.config/nvim/lua/development.lua b/neovim/.config/nvim/lua/development.lua new file mode 100644 index 0000000..8db13d8 --- /dev/null +++ b/neovim/.config/nvim/lua/development.lua @@ -0,0 +1,60 @@ +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) + +require'lspconfig'.pyright.setup{ + capabilities = capabilities, +} + +require('dap-python').setup('~/.local/share/virtualenvs/debugpy/bin/python') +require('dap-python').test_runner = 'pytest' + +require("neotest").setup({ + output = { + enabled = true, + open_on_run = "yes", + }, + adapters = { + require("neotest-python")({ + dap = { justMyCode = false }, + args = {"--cov=src", "--cov-report=term-missing"}, + runner = 'pytest', + }), + require("neotest-plenary"), + }, +}) + +require("dapui").setup({ +layouts = { + { + elements = { + -- Elements can be strings or table with id and size keys. + { id = "scopes", size = 0.25 }, + "breakpoints", + "watches", + }, + size = 40, -- 40 columns + position = "right", + } + }, +}) +require("nvim-dap-virtual-text").setup() +require("coverage").setup({ + commands = true, -- create commands + highlights = { + -- customize highlight groups created by the plugin + covered = { fg = "#C3E88D" }, -- supports style, fg, bg, sp (see :h highlight-gui) + uncovered = { fg = "#F07178" }, + }, + signs = { + -- use your own highlight groups or text markers + covered = { hl = "CoverageCovered", text = "▎" }, + uncovered = { hl = "CoverageUncovered", text = "▎" }, + }, + summary = { + -- customize the summary pop-up + min_coverage = 80.0, -- minimum coverage threshold (used for highlighting) + }, + lang = { + -- customize language specific settings + }, +}) diff --git a/neovim/.config/nvim/lua/handling.lua b/neovim/.config/nvim/lua/handling.lua new file mode 100644 index 0000000..00bbc84 --- /dev/null +++ b/neovim/.config/nvim/lua/handling.lua @@ -0,0 +1,3 @@ +require('leap').set_default_keymaps() +require('litee.lib').setup() +require('litee.gh').setup() diff --git a/neovim/.config/nvim/lua/keybindings.lua b/neovim/.config/nvim/lua/keybindings.lua index 87d0d17..db7cd8a 100644 --- a/neovim/.config/nvim/lua/keybindings.lua +++ b/neovim/.config/nvim/lua/keybindings.lua @@ -1,12 +1,141 @@ +vim.g.mapleader = "½" + +--FILEHANDLING + vim.api.nvim_set_keymap('n', '', - "lua require('fzf-lua').files()", + "lua require('telescope.builtin').find_files()", { noremap = true, silent = true } ) vim.api.nvim_set_keymap('n', '', - "lua require('fzf-lua').buffers()", + "lua require('telescope.builtin').buffers()", + { noremap = true, silent = true } +) + +--TESTING +vim.api.nvim_set_keymap('n', '', + "lua require('neotest').output.open()", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('neotest').summary.toggle()", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('neotest').run.run()", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('neotest').run.run(vim.fn.expand('%'))", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('neotest').run.run('tests/')", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('coverage').load(true)", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('coverage').summary()", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('coverage').toggle()", + { noremap = true, silent = true } +) + + +--DEBUGGING +vim.api.nvim_set_keymap('n', '', + "lua require('dap').toggle_breakpoint()", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('dapui').toggle()", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('dap').continue()", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('dap-python').test_method()", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('dap').step_over()", + { noremap = true, silent = true } +) +vim.api.nvim_set_keymap('n', '', + "lua require('dap').step_into()", { noremap = true, silent = true } ) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + +vim.keymap.set('n', '', '', { noremap = true, silent = true }) +vim.keymap.set('n', '', '', { noremap = true, silent = true }) +vim.keymap.set('n', '', '', { noremap = true, silent = true }) +vim.keymap.set('n', '', '', { noremap = true, silent = true }) + +vim.keymap.set("n", "", "TroubleToggle document_diagnostics", + {silent = true, noremap = true} +) + +vim.keymap.set('n', '', "lua require('github-notifications.menu').notifications()", { noremap = true, silent = true }) + +-- WHICH KEY +local wk = require("which-key") +wk.register({ + g = { + name = "+Git", + h = { + name = "+Github", + c = { + name = "+Commits", + c = { "GHCloseCommit", "Close" }, + e = { "GHExpandCommit", "Expand" }, + o = { "GHOpenToCommit", "Open To" }, + p = { "GHPopOutCommit", "Pop Out" }, + z = { "GHCollapseCommit", "Collapse" }, + }, + i = { + name = "+Issues", + p = { "GHPreviewIssue", "Preview" }, + }, + l = { + name = "+Litee", + t = { "LTPanel", "Toggle Panel" }, + }, + r = { + name = "+Review", + b = { "GHStartReview", "Begin" }, + c = { "GHCloseReview", "Close" }, + d = { "GHDeleteReview", "Delete" }, + e = { "GHExpandReview", "Expand" }, + s = { "GHSubmitReview", "Submit" }, + z = { "GHCollapseReview", "Collapse" }, + }, + p = { + name = "+Pull Request", + c = { "GHClosePR", "Close" }, + d = { "GHPRDetails", "Details" }, + e = { "GHExpandPR", "Expand" }, + o = { "GHOpenPR", "Open" }, + p = { "GHPopOutPR", "PopOut" }, + r = { "GHRefreshPR", "Refresh" }, + t = { "GHOpenToPR", "Open To" }, + z = { "GHCollapsePR", "Collapse" }, + }, + t = { + name = "+Threads", + c = { "GHCreateThread", "Create" }, + n = { "GHNextThread", "Next" }, + t = { "GHToggleThread", "Toggle" }, + }, + }, + }, +}, { prefix = "" }) diff --git a/neovim/.config/nvim/lua/plugins.lua b/neovim/.config/nvim/lua/plugins.lua index 35b7023..401e008 100644 --- a/neovim/.config/nvim/lua/plugins.lua +++ b/neovim/.config/nvim/lua/plugins.lua @@ -3,17 +3,52 @@ return require('packer').startup(function(use) use 'wbthomason/packer.nvim' -- Visuals - use 'shaunsingh/nord.nvim' use 'kyazdani42/nvim-web-devicons' use { 'nvim-lualine/lualine.nvim', requires = { 'kyazdani42/nvim-web-devicons', opt = true } } - - -- File Handling - use { 'ibhagwan/fzf-lua', - requires = { 'kyazdani42/nvim-web-devicons' } + use 'cocopon/iceberg.vim' + use { + "folke/trouble.nvim", + requires = "kyazdani42/nvim-web-devicons", + config = function() + require("trouble").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } + end } + use { + 'rlch/github-notifications.nvim', + config = [[require('config.github-notifications')]], + requires = { + 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope.nvim', + }, + } + + -- Handling + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.0', + requires = { {'nvim-lua/plenary.nvim'} } + } + use 'ggandor/leap.nvim' + use { + 'ldelossa/gh.nvim', + requires = { { 'ldelossa/litee.nvim' } } + } + use { + "folke/which-key.nvim", + config = function() + require("which-key").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } + end + } -- Completion use 'github/copilot.vim' @@ -34,6 +69,27 @@ return require('packer').startup(function(use) } use 'hrsh7th/cmp-nvim-lsp' - -- Python + -- Development use 'neovim/nvim-lspconfig' + use 'mfussenegger/nvim-dap' + use 'mfussenegger/nvim-dap-python' + use 'rcarriga/nvim-dap-ui' + use 'theHamsta/nvim-dap-virtual-text' + use { + "nvim-neotest/neotest", + requires = { + "nvim-neotest/neotest-python", + "nvim-neotest/neotest-plenary", + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "antoinemadec/FixCursorHold.nvim" + } + } + use({ + "andythigpen/nvim-coverage", + requires = "nvim-lua/plenary.nvim", +-- config = function() +-- require("user.coverage") +-- end, + }) end) diff --git a/neovim/.config/nvim/lua/python.lua b/neovim/.config/nvim/lua/python.lua deleted file mode 100644 index de00ec6..0000000 --- a/neovim/.config/nvim/lua/python.lua +++ /dev/null @@ -1,6 +0,0 @@ -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) - -require'lspconfig'.pyright.setup{ - capabilities = capabilities, -} diff --git a/neovim/.config/nvim/lua/visuals.lua b/neovim/.config/nvim/lua/visuals.lua index 1580a49..3edaffa 100644 --- a/neovim/.config/nvim/lua/visuals.lua +++ b/neovim/.config/nvim/lua/visuals.lua @@ -1,10 +1,10 @@ vim.opt.termguicolors = true -vim.cmd[[colorscheme nord]] +vim.cmd[[colorscheme iceberg]] require('lualine').setup { options = { - icons_enabled = false, - theme = 'nord', + icons_enabled = true, + theme = 'iceberg_dark', component_separators = { left = '', right = ''}, section_separators = { left = '', right = ''}, disabled_filetypes = { @@ -22,9 +22,9 @@ require('lualine').setup { }, sections = { lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_b = {'branch', 'diff', 'diagnostics', require('github-notifications').statusline_notification_count}, lualine_c = {'filename'}, - lualine_x = {'encoding', 'filetype'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, lualine_y = {'progress'}, lualine_z = {'location'} }, @@ -41,3 +41,4 @@ require('lualine').setup { inactive_winbar = {}, extensions = {} } +require('telescope').load_extension('ghn')