From 4ebf7d185c3f4ee2940f88da2df4063952fc330b Mon Sep 17 00:00:00 2001 From: stitchy Date: Fri, 2 Feb 2024 03:34:22 +0000 Subject: [PATCH] Update neovim --- config/nvim/init.vim | 155 +++++++++++++++++++++++++++++++++++++++++++ configuration.nix | 2 +- 2 files changed, 156 insertions(+), 1 deletion(-) create mode 100755 config/nvim/init.vim diff --git a/config/nvim/init.vim b/config/nvim/init.vim new file mode 100755 index 0000000..a215cae --- /dev/null +++ b/config/nvim/init.vim @@ -0,0 +1,155 @@ +" (Neo)vim Configuration +" By Flying_Stitchman +" 4 Jan 2022 + + " Basic Configuration + +syntax on +set spell +set hlsearch +set ignorecase +set number relativenumber +set noswapfile +inoremap jk +xnoremap gy "+y +let mapleader = "`" + +" Good indents " +set tabstop=2 +set shiftwidth=2 +set expandtab + + " Make Lines Wrap Properly +set linebreak +set wrap + " True Color Support +if has('nvim') + set t_8f=[38;2;%lu;%lu;%lum + set t_8b=[48;2;%lu;%lu;%lum + set termguicolors +endif +"colorscheme cwcolors + + + " Highlight Trailing Spaces +let c_space_errors=1 + +set noincsearch + + " Plugs +"call plug#begin() +"Plug 'neovim/nvim-lspconfig' +"Plug 'jackguo380/vim-lsp-cxx-highlight' +"Plug 'folke/tokyonight.nvim', { 'branch': 'main' } +"Plug 'tribela/vim-transparent' +"Plug 'hrsh7th/nvim-cmp' +"Plug 'hrsh7th/cmp-nvim-lsp' +"Plug 'saadparwaiz1/cmp_luasnip' +"Plug 'L3MON4D3/LuaSnip' +"call plug#end() + +let g:airline#extensions#wordcount#filetypes = '\vasciidoc|help|mail|markdown|markdown.pandoc|org|rst|tex|text' +set laststatus=2 " enables vim-airline. + + + + " C Syntax highlighting +lua << EOF +require'lspconfig'.rust_analyzer.setup{} +require'lspconfig'.texlab.setup{} +require'lspconfig'.svls.setup{} +require'lspconfig'.pylsp.setup{ + settings = { + pylsp = { + plugins = { + pycodestyle = { + ignore = {'W391'}, + maxLineLength = 100 + }, + pylint = { + enabled = false + }, + pyflakes = { + enabled = true + } + } + } + } +} +require'lspconfig'.ccls.setup{ + init_options = { + highlight = { + lsRanges = true; + } + } + } + + +-- Add additional capabilities supported by nvim-cmp +local capabilities = require("cmp_nvim_lsp").default_capabilities() + +local lspconfig = require('lspconfig') + +-- Enable some language servers with the additional completion capabilities offered by nvim-cmp +local servers = { 'clangd', 'rust_analyzer', 'tsserver' } +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + -- on_attach = my_custom_on_attach, + capabilities = capabilities, + } +end + +-- luasnip setup +local luasnip = require 'luasnip' + +-- nvim-cmp setup +local cmp = require 'cmp' +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), -- Up + [''] = cmp.mapping.scroll_docs(4), -- Down + -- C-b (back) C-f (forward) for snippet placeholder navigation. + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, +} + +EOF + + + + + " Color Themes +colorscheme tokyonight +hi Comment guifg=#e69dc5 +hi Linenr guifg=#a672f3 diff --git a/configuration.nix b/configuration.nix index 6829cc0..fbe7cf9 100644 --- a/configuration.nix +++ b/configuration.nix @@ -55,7 +55,7 @@ vimAlias = true; defaultEditor = true; configure = { - customRC = builtins.readFile ./config/neovim/init.vim; + customRC = builtins.readFile ./config/nvim/init.vim; packages.myVimPackage = with pkgs.vimPlugins; { start = [ nvim-lspconfig