From 9920d08bb1c19240ffbf5984d4018cac760a0adf Mon Sep 17 00:00:00 2001 From: Henrik Bakken Date: Mon, 6 Mar 2023 01:51:10 +0100 Subject: [PATCH] nvim fixups --- nvim/init.lua | 60 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/nvim/init.lua b/nvim/init.lua index e9b4b46..0f4b1a6 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -13,7 +13,6 @@ opt.updatetime = 300 opt.timeoutlen = 200 vim.g.BASH_Ctrl_j = "off" vim.g.BASH_Ctrl_l = "off" -vim.g.python3_host_prog = "/usr/bin/python3.10" -- looks opt.termguicolors = true @@ -93,6 +92,7 @@ vim.api.nvim_command [[augroup MYAU]] vim.api.nvim_command [[autocmd!]] vim.api.nvim_command [[autocmd BufWritePost * %s/\s\+$//e]] vim.api.nvim_command [[autocmd BufWritePost *.py silent! execute ':Black']] +vim.api.nvim_command [[autocmd FileType *.py setlocal indentkeys-=<:>]] vim.api.nvim_command [[autocmd BufReadPost quickfix nmap ]] vim.api .nvim_command [[autocmd TextYankPost * "lua vim.highlight.on_yank {on_visual = false}"]] @@ -214,6 +214,15 @@ require("packer").startup { "iberianpig/tig-explorer.vim", requires = {"rbgrouleff/bclose.vim"}, config = function() + vim.tig_explorer_keymap_edit_e = 'e' + vim.tig_explorer_keymap_edit = '' + vim.tig_explorer_keymap_tabedit = '' + vim.tig_explorer_keymap_split = '' + vim.tig_explorer_keymap_vsplit = '' + vim.tig_explorer_keymap_commit_edit = 'o' + vim.tig_explorer_keymap_commit_tabedit = 't' + vim.tig_explorer_keymap_commit_split = 's' + vim.tig_explorer_keymap_commit_vsplit = 'v' vim.g.tig_explorer_use_builtin_term = 0 local map = vim.api.nvim_set_keymap map("", "gg", ":TigOpenProjectRootDir", {}) @@ -408,18 +417,6 @@ require("packer").startup { end } - use { - "numtostr/FTerm.nvim", - config = function() - require("FTerm").setup {} - local map = vim.api.nvim_set_keymap - local opts = {noremap = true, silent = true} - map("n", "", [[lua require("FTerm").toggle()]], opts) - map("t", "", [[lua require("FTerm").toggle()]], - opts) - end - } - use {"psf/black", config = function() vim.g.black_fast = 1 vim.g.black_preview = 1 end} -- treesitter @@ -545,16 +542,17 @@ require("packer").startup { "hrsh7th/nvim-cmp", requires = { {"hrsh7th/cmp-path", after = "nvim-cmp"}, + {"hrsh7th/cmp-nvim-lsp", after = "nvim-cmp"}, {"hrsh7th/cmp-buffer", after = "nvim-cmp"}, - {"hrsh7th/cmp-calc", after = "nvim-cmp"} + {"hrsh7th/cmp-cmdline", after = "nvim-cmp"} }, config = function() local cmp = require("cmp") cmp.setup({ - sources = { - {name = "nvim_lsp"}, {name = "buffer"}, {name = "path"}, - {name = "nvim_lua"} - }, + sources = cmp.config.sources({ + {name = "nvim_lsp"}, + {name = "buffer"} + }), mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), @@ -565,6 +563,32 @@ require("packer").startup { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({{name = 'path'}}, {{name = 'cmdline'}}) }) + -- Set configuration for specific filetype. + cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. + }, { + { name = 'buffer' }, + }) + }) + + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) + }) end }