From 59e7ee298127e69c8472bb6a0930c5a105f5d12e Mon Sep 17 00:00:00 2001 From: Adam <56338480+adastx@users.noreply.github.com> Date: Tue, 5 Oct 2021 21:12:16 +0200 Subject: Neovim setup ported to lua + new plugins, picom edit so focused terminal is opaque --- .config/nvim/init.vim | 52 +++---------------------------- .config/nvim/lua/binds.lua | 27 ++++++++++++++++ .config/nvim/lua/init.lua | 5 +++ .config/nvim/lua/opts.lua | 74 ++++++++++++++++++++++++++++++++++++++++++++ .config/nvim/lua/plugins.lua | 46 +++++++++++++++++++++++++++ .config/nvim/lua/setup.lua | 24 ++++++++++++++ .config/nvim/lua/stl.lua | 27 ++++++++++++++++ 7 files changed, 208 insertions(+), 47 deletions(-) create mode 100644 .config/nvim/lua/binds.lua create mode 100644 .config/nvim/lua/init.lua create mode 100644 .config/nvim/lua/opts.lua create mode 100644 .config/nvim/lua/plugins.lua create mode 100644 .config/nvim/lua/setup.lua create mode 100644 .config/nvim/lua/stl.lua (limited to '.config/nvim') diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index ed02ddf..6907a74 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -10,51 +10,9 @@ if has('mouse') set mouse=a endif -set hidden -set wildmenu -set showcmd -set hlsearch -set ignorecase -set smartcase -set backspace=indent,eol,start -set autoindent -set nostartofline -set ruler -set laststatus=0 -set confirm -set visualbell -set cmdheight=2 -set number -set relativenumber -set notimeout ttimeout ttimeoutlen=200 -set pastetoggle= -set shiftwidth=4 -set softtabstop=4 -set expandtab -set incsearch - -map Y y$ -nnoremap :nohl -nnoremap n nzzzv -nnoremap N Nzzzv - -" inoremap kj -inoremap , ,u -inoremap . .u -inoremap [ [u -inoremap ! !u -inoremap ? ?u - -nnoremap k (v:count > 5 ? "m'" . v:count : "") . 'k' -nnoremap j (v:count > 5 ? "m'" . v:count : "") . 'j' -nnoremap - -call plug#begin() -Plug 'gruvbox-community/gruvbox' -call plug#end() - -colorscheme gruvbox -highlight CursorLineNr cterm=bold ctermfg=Yellow ctermbg=none -highlight Normal ctermbg=none +if has('persistent_undo') + set undodir=$HOME/.vim/undo + set undofile +endif -let mapleader=" " +lua require 'init' diff --git a/.config/nvim/lua/binds.lua b/.config/nvim/lua/binds.lua new file mode 100644 index 0000000..5782f68 --- /dev/null +++ b/.config/nvim/lua/binds.lua @@ -0,0 +1,27 @@ +vim.g.mapleader = ' ' +vim.b.mapleader = ' ' + +local map = vim.api.nvim_set_keymap +local opts = { noremap = true, silent = true } + +map('', 'Y', 'y$', opts) +map('n', '', ':nohl', opts) +map('n', 'n', 'nzzzv', opts) +map('n', 'N', 'Nzzzv', opts) + +map('i', 'kj', '', opts) +map('i', ',', ',u', opts) +map('i', '.', '.u', opts) +map('i', '[', '[u', opts) +map('i', '!', '!u', opts) +map('i', '?', '?u', opts) + +map('n', 'fu', 'Telescope lsp_references', opts) +map('n', 'gd', 'Telescope lsp_definitions', opts) +map('n', 'rn', 'lua vim.lsp.buf.rename()', opts) +map('n', 'xd', 'Telescope lsp_document_diagnostics', opts) +map('n', 'xD', 'Telescope lsp_workspace_diagnostics', opts) +map('n', 'xn', 'lua vim.lsp.diagnostic.goto_next()', opts) +map('n', 'xN', 'lua vim.lsp.diagnostic.goto_prev()', opts) +map('n', 'xx', 'Telescope lsp_code_actions', opts) +map('n', 'xX', 'Telescope lsp_range_code_actions', opts) diff --git a/.config/nvim/lua/init.lua b/.config/nvim/lua/init.lua new file mode 100644 index 0000000..3bc3238 --- /dev/null +++ b/.config/nvim/lua/init.lua @@ -0,0 +1,5 @@ +require('plugins') +require('opts') +require('setup') +require('binds') +require('stl') diff --git a/.config/nvim/lua/opts.lua b/.config/nvim/lua/opts.lua new file mode 100644 index 0000000..4500929 --- /dev/null +++ b/.config/nvim/lua/opts.lua @@ -0,0 +1,74 @@ +-- autocomplete config +local cmp = require 'cmp' + +cmp.setup { + mapping = { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }) + }, + sources = { + { name = 'nvim_lsp' }, + } +} + +-- C# +local pid = vim.fn.getpid() + +require 'lspconfig'.omnisharp.setup { + capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), + on_attach = function(_, bufnr) + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + end, + cmd = { "/usr/bin/omnisharp", "--languageserver" , "--hostPID", tostring(pid) }, +} + +-- LUA +local sumneko_root_path = "/home/adam/Documents/github/lua-language-server" +local sumneko_binary = sumneko_root_path.."/bin/Linux/lua-language-server" + +local runtime_path = vim.split(package.path, ';') +table.insert(runtime_path, "lua/?.lua") +table.insert(runtime_path, "lua/?/init.lua") + +require'lspconfig'.sumneko_lua.setup { + cmd = {sumneko_binary, "-E", sumneko_root_path.."/main.lua"}; + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT', + -- Setup your lua path + path = runtime_path, + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = {'vim'}, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, +} + +-- Treesitter +require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + }, +} + +require'lspconfig'.html.setup{} +require'lspconfig'.cssls.setup{} +require'lspconfig'.tsserver.setup{} +require'lspconfig'.bashls.setup{} diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..49354f2 --- /dev/null +++ b/.config/nvim/lua/plugins.lua @@ -0,0 +1,46 @@ +return require('packer').startup(function() + use 'wbthomason/packer.nvim' + use 'gruvbox-community/gruvbox' + + use 'neovim/nvim-lspconfig' + use 'hrsh7th/nvim-cmp' + use 'hrsh7th/cmp-nvim-lsp' + use 'hrsh7th/cmp-buffer' + use 'hrsh7th/cmp-path' + + use 'kyazdani42/nvim-web-devicons' + + use { + 'norcalli/nvim-colorizer.lua', + ft = { 'css', 'javascript', 'vim', 'html' }, + config = [[require('colorizer').setup {'css', 'javascript', 'vim', 'html'}]], + } + + use { + 'nvim-telescope/telescope.nvim', + requires = { {'nvim-lua/plenary.nvim'} } + } + + use 'tpope/vim-fugitive' + use { + 'lewis6991/gitsigns.nvim', + requires = { + 'nvim-lua/plenary.nvim' + }, + config = function() + require('gitsigns').setup() + end + } + + use { + 'hoob3rt/lualine.nvim', + requires = {'kyazdani42/nvim-web-devicons', opt = true} + } + + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate' + } + + use 'ThePrimeagen/vim-be-good' +end) diff --git a/.config/nvim/lua/setup.lua b/.config/nvim/lua/setup.lua new file mode 100644 index 0000000..9dc3698 --- /dev/null +++ b/.config/nvim/lua/setup.lua @@ -0,0 +1,24 @@ +local set = vim.opt + +set.termguicolors = true +set.hidden = true +set.wildmenu = true +set.showcmd = true +set.hlsearch = true +set.ignorecase = true +set.smartcase = true +set.incsearch = true +set.backspace= 'indent,eol,start' +set.pastetoggle = '' +set.confirm = true +set.relativenumber = true +set.shiftwidth = 4 +set.softtabstop = 4 +set.autoindent = true +set.expandtab = true +set.showmode = false +set.ruler = false + +vim.cmd('colorscheme gruvbox') +vim.cmd('highlight CursorLineNr cterm=bold ctermfg=Yellow ctermbg=none') +vim.cmd('highlight Normal ctermbg=none') diff --git a/.config/nvim/lua/stl.lua b/.config/nvim/lua/stl.lua new file mode 100644 index 0000000..1f5f47f --- /dev/null +++ b/.config/nvim/lua/stl.lua @@ -0,0 +1,27 @@ +require'lualine'.setup { + options = { + icons_enabled = true, + theme = 'gruvbox', + component_separators = {'', ''}, + section_separators = {'', ''}, + disabled_filetypes = {} + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + extensions = {} +} -- cgit v1.2.3-70-g09d2