From 962e7238b7b446c27b4031cb29bab652b8e167a6 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Sun, 12 Feb 2023 14:33:38 +0100 Subject: [PATCH] nvim language server nvim peak code editing --- home/.config/nvim/init.vim | 99 +++++++----------------------------- home/.config/nvim/noplug.vim | 14 ++--- home/.tmux-server.conf | 1 + home/.tmux.conf | 1 + home/.vimrc | 14 ++--- 5 files changed, 34 insertions(+), 95 deletions(-) diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim index c9ae8ec..902510c 100644 --- a/home/.config/nvim/init.vim +++ b/home/.config/nvim/init.vim @@ -59,15 +59,6 @@ nnoremap yy "+yy " open terminal with F12 nnoremap :terminal -" automatically set closed braces aswell when making opened ones. -" inoremap " "" -inoremap ' '' -inoremap ( () -inoremap [ [] -inoremap { {} -inoremap { {}O -inoremap {; {};O - " vsplit with , then " map " :vsplit @@ -94,23 +85,23 @@ set completeopt=menuone,noinsert,noselect call plug#begin() Plug 'lambdalisue/suda.vim' -Plug 'preservim/nerdcommenter' +"Plug 'preservim/nerdcommenter' Plug 'mhinz/vim-startify' Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'nvim-tree/nvim-tree.lua' Plug 'psliwka/vim-smoothie' " scorll with STRG + d or STRG + u Plug 'nvim-lualine/lualine.nvim' " nicer status line -Plug 'neovim/nvim-lspconfig' " lsp config for easy setup of LSP +"Plug 'neovim/nvim-lspconfig' " lsp config for easy setup of LSP Plug 'romgrk/barbar.nvim' " tabs for buffers Plug 'EdenEast/nightfox.nvim' " Vim-Plug Plug 'numToStr/FTerm.nvim' " floating terminal, toggle with Plug 'kdheepak/lazygit.nvim' -Plug 'hrsh7th/cmp-nvim-lsp' +"Plug 'hrsh7th/cmp-nvim-lsp' Plug 'goolord/alpha-nvim' -Plug 'hrsh7th/cmp-buffer' -Plug 'hrsh7th/cmp-path' -Plug 'hrsh7th/cmp-cmdline' -Plug 'hrsh7th/nvim-cmp' +"Plug 'hrsh7th/cmp-buffer' +"Plug 'hrsh7th/cmp-path' +"Plug 'hrsh7th/cmp-cmdline' +"Plug 'hrsh7th/nvim-cmp' Plug 'nvim-tree/nvim-web-devicons' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' @@ -191,6 +182,17 @@ let g:lazygit_config_file_path = '' " custom config file path " setup mapping to call :LazyGit nnoremap gg :LazyGit + +" coc language server configs +inoremap coc#pum#visible() ? coc#_select_confirm() : "\u\" +inoremap coc#pum#visible() ? coc#pum#next(1) : "\" +inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" + +" do these commands manually, they dont like being scripted. +"CocInstall coc-clangd coc-cmake coc-css coc-floaterm coc-fzf-preview coc-git coc-html coc-json +"CocInstall coc-lists coc-lua coc-pyright coc-rust-analyzer coc-sh coc-snippets coc-sql +""""these may cause errors"""""CocInstall coc-symbol-line coc-toml coc-texlab coc-vimlsp coc-xml + "------------------------------------------------------ lua << END require('alpha').setup(require('alpha.themes.startify').config) @@ -205,9 +207,6 @@ vim.opt.termguicolors = true -- empty setup using defaults require("nvim-tree").setup() -require'lspconfig'.clangd.setup{} -require'lspconfig'.rust_analyzer.setup{} - require('lualine').setup { options = { icons_enabled = true, @@ -260,68 +259,6 @@ dimensions = { }, }) --- Set up nvim-cmp. -local cmp = require'cmp' - -cmp.setup({ -snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - -- require('snippy').expand_snippet(args.body) -- For `snippy` users. - -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. - end, - }, - window = { - -- completion = cmp.config.window.bordered(), - -- documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, -- For vsnip users. - -- { name = 'luasnip' }, -- For luasnip users. - -- { name = 'ultisnips' }, -- For ultisnips users. - -- { name = 'snippy' }, -- For snippy users. - }, { - { name = 'buffer' }, - }) - }) - --- 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' } - }) - }) - -- Example keybindings vim.keymap.set('n', '', 'lua require("FTerm").toggle()') vim.keymap.set('t', '', 'lua require("FTerm").toggle()') diff --git a/home/.config/nvim/noplug.vim b/home/.config/nvim/noplug.vim index 0cf108b..35cbcb2 100644 --- a/home/.config/nvim/noplug.vim +++ b/home/.config/nvim/noplug.vim @@ -60,13 +60,13 @@ nnoremap yy "+yy nnoremap :terminal " automatically set closed braces aswell when making opened ones. -" inoremap " "" -inoremap ' '' -inoremap ( () -inoremap [ [] -inoremap { {} -inoremap { {}O -inoremap {; {};O +"inoremap " "" +"inoremap ' '' +"inoremap ( () +"inoremap [ [] +"inoremap { {} +"inoremap { {}O +"inoremap {; {};O " vsplit with , then " map " :vsplit diff --git a/home/.tmux-server.conf b/home/.tmux-server.conf index 0321168..f9f7aa6 100644 --- a/home/.tmux-server.conf +++ b/home/.tmux-server.conf @@ -99,6 +99,7 @@ bind -n C-l if-shell "$is_shell" "bind -n C-l send-keys C-l ; run 'sleep 0.1' ; # use all colors set -g default-terminal "screen-256color" +set-option -sa terminal-overrides ',XXX:RGB' # theming, See https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-dark.conf diff --git a/home/.tmux.conf b/home/.tmux.conf index 7eab806..a112218 100644 --- a/home/.tmux.conf +++ b/home/.tmux.conf @@ -102,6 +102,7 @@ bind -n C-l if-shell "$is_shell" "bind -n C-l send-keys C-l ; run 'sleep 0.1' ; # use all colors set -g default-terminal "screen-256color" +set-option -sa terminal-overrides ',XXX:RGB' # theming, See https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-dark.conf diff --git a/home/.vimrc b/home/.vimrc index bb3dd4e..f50d72f 100644 --- a/home/.vimrc +++ b/home/.vimrc @@ -52,13 +52,13 @@ nnoremap yy "+yy nnoremap :terminal " automatically set closed braces aswell when making opened ones. -" inoremap " "" -inoremap ' '' -inoremap ( () -inoremap [ [] -inoremap { {} -inoremap { {}O -inoremap {; {};O +"inoremap " "" +"inoremap ' '' +"inoremap ( () +"inoremap [ [] +"inoremap { {} +"inoremap { {}O +"inoremap {; {};O " vsplit with , then " map " :vsplit