From 2aed415cbf68b9cab3b5325ba47043a954d20f15 Mon Sep 17 00:00:00 2001 From: key Date: Sat, 5 Aug 2023 17:40:05 +0200 Subject: [PATCH] Finished setting up NeoVim configuration now need to implement the instalation script --- dotfiles/vim/.vimrc | 65 +++++-- dotfiles/vim/nvim/after/plugin/colors.lua | 9 + dotfiles/vim/nvim/after/plugin/feline.lua | 0 dotfiles/vim/nvim/after/plugin/fugitive.lua | 1 + dotfiles/vim/nvim/after/plugin/harpoon.lua | 10 + dotfiles/vim/nvim/after/plugin/lsp.lua | 54 ++++++ dotfiles/vim/nvim/after/plugin/telescope.lua | 6 + dotfiles/vim/nvim/after/plugin/treesitter.lua | 38 ++++ dotfiles/vim/nvim/after/plugin/undotree.lua | 1 + dotfiles/vim/nvim/ftplugin/c_mappings.vim | 2 + dotfiles/vim/nvim/init.lua | 1 + dotfiles/vim/nvim/lua/key/init.lua | 3 + dotfiles/vim/nvim/lua/key/packer.lua | 46 +++++ dotfiles/vim/nvim/lua/key/remap.lua | 92 +++++++++ dotfiles/vim/nvim/lua/key/set.lua | 45 +++++ dotfiles/vim/nvim/plugin/packer_compiled.lua | 174 ++++++++++++++++++ dotfiles/vim/nvim/snippets/c_for.c | 4 + dotfiles/vim/nvim/snippets/c_switch.c | 19 ++ dotfiles/vim/nvim/snippets/c_while.c | 4 + dotfiles/vim/nvim/snippets/htlm_skeleton.html | 14 ++ .../snippets/html_horizontal_bracets.html | 3 + .../nvim/snippets/html_vertical_bracets.html | 1 + programs/neovim/neovim.sh | 9 - programs/neovim/nvim_install.sh | 10 + 24 files changed, 582 insertions(+), 29 deletions(-) create mode 100644 dotfiles/vim/nvim/after/plugin/colors.lua create mode 100644 dotfiles/vim/nvim/after/plugin/feline.lua create mode 100644 dotfiles/vim/nvim/after/plugin/fugitive.lua create mode 100644 dotfiles/vim/nvim/after/plugin/harpoon.lua create mode 100644 dotfiles/vim/nvim/after/plugin/lsp.lua create mode 100644 dotfiles/vim/nvim/after/plugin/telescope.lua create mode 100644 dotfiles/vim/nvim/after/plugin/treesitter.lua create mode 100644 dotfiles/vim/nvim/after/plugin/undotree.lua create mode 100644 dotfiles/vim/nvim/ftplugin/c_mappings.vim create mode 100644 dotfiles/vim/nvim/init.lua create mode 100644 dotfiles/vim/nvim/lua/key/init.lua create mode 100644 dotfiles/vim/nvim/lua/key/packer.lua create mode 100644 dotfiles/vim/nvim/lua/key/remap.lua create mode 100644 dotfiles/vim/nvim/lua/key/set.lua create mode 100644 dotfiles/vim/nvim/plugin/packer_compiled.lua create mode 100644 dotfiles/vim/nvim/snippets/c_for.c create mode 100644 dotfiles/vim/nvim/snippets/c_switch.c create mode 100644 dotfiles/vim/nvim/snippets/c_while.c create mode 100644 dotfiles/vim/nvim/snippets/htlm_skeleton.html create mode 100644 dotfiles/vim/nvim/snippets/html_horizontal_bracets.html create mode 100644 dotfiles/vim/nvim/snippets/html_vertical_bracets.html delete mode 100755 programs/neovim/neovim.sh create mode 100755 programs/neovim/nvim_install.sh diff --git a/dotfiles/vim/.vimrc b/dotfiles/vim/.vimrc index 1720ca9..03eccbd 100644 --- a/dotfiles/vim/.vimrc +++ b/dotfiles/vim/.vimrc @@ -12,11 +12,13 @@ set nowrap ""Will continue to go right when line is too long set incsearch ""incremental searching as i am typing the words will be highligted. set number ""Self explanatory set scrolloff=8 ""Will start to scroll down wehn there is still 8 Lines before end of page. + "Backup and Undo set noswapfile ""No swap file. they are anoying set nobackup ""Nobackup because we will do a undo dir set undodir=~/.vim/undodir set undofile + packadd termdebug let g:termdebug_wide=1 filetype plugin indent on @@ -28,6 +30,7 @@ syntax enable "plugins(included with vim) for file specific mappings Located at ~/.vim/ftplugin/ "Example for c Would be: ~/.vim/ftplugin/c_mappings.vim filetype plugin on +filetype plugin indent on "Plug pkluginmanager start and end call plug#begin('~/.vim/plugged') @@ -50,7 +53,7 @@ highlight Normal guibg=blue "-------------------------------------------------------------------- "REMAPS-------------------------------------------------------------- -"(VIM) Remaps Spca bar as the Leader command +"(VIM) Remaps Space bar as the Leader command let mapleader=" " "(NAVIGATION) @@ -64,23 +67,41 @@ map k :wincmd k map l :wincmd l "(FILES) -map fw :Sex! :vertical resize 30 -map u :UndotreeShow +map pv :Ex :vertical resize 30 +map pf :Sex! :vertical resize 30 + +"(PUGINS) +"maptree Toggle +map u :UndotreeToggle "(POSITION) "[P]ut one line [U]p everything from the cursor till the end of the line map pu d$Op "[P]ut one line [D]own everything from the cursor till the end of the line map pd d$op - "Put at then end of the [L]ine [U]pper from the cursor (everything from the cursor till the end of the line) map lu DkApjddkI "Put at then end of the [L]ine [D]own(er) from the cursor (everything from the cursor till the end of the line) map ld DjApkddjI +"Classic Vim's Windo [U]p and [D]onw controls but keeps the cursor in the middle +map zz +map zz +"Classic Vim's [n]ext and [N]previous controls but keeps the cursor in the middle +map n nzzzv +map N Nzzzv +"Mooves what's under the cursor +map J :m '>+1gv=gv +map K :m '<-2gv=gv + + +"(COPY PASTE) +"Copy to your clipboard of your system and not in the internal buffer of vim +map y [["+y]]) +map Y [["+Y]]) "(WORD) Manipulation "[W]ord [R]reformat for word under the cursor -map wr ebvey:%s/0//g +map wr [[:%s/\<\>//gI]] "[C]hange [W]ord in registered buffer To be more similar to whant vim implment map cw ebvey/0Ncw "[C]hange [N]ext word in registered buffer To be more similar to what vim implements @@ -97,17 +118,31 @@ map wff ebveyG/0 map wfl ebveyG/0N "-------------------------------------------------------------------- +"(ADDERS) +"[A]dds a [)] at the end of the line +map a) A)I +"[A]dds a [}] at the end of the line +map a} A}I +"[A]dds a ["]"] at the end of the line +map a] A]I + + "DEBUGER-------------------------------------------------------------- map db :Termdebug :vertical resize 30 noremap ts :Step noremap to :Over noremap tn :Next noremap tc :Cont +"QUICKFIX Navigation for going to the next errors and so on +map ne cnextzz +map me cprevzz +map nl lnextzz +map ml lprevzz +set makeprg=bundle\ exec\ rspec\ -f\ QuickfixFormatter "-------------------------------------------------------------------- "WILDMENU FOR FUZZY FILE SEARCH-------------------------------------- set path+=** - set wildmenu "Display all matching files when we tab complete " NOW WE CAN: " Type :find @@ -137,6 +172,10 @@ command! MakeTags !ctags -R . " - Use ^n and ^p to go back and forth in the suggestion list "-------------------------------------------------------------------- +""(TERMINAL COMMANDS) +"" Makes current file executable +map mx, !chmod +x % + "SNIPPETS------------------------------------------------------------ " Command Read template move cursor nnoremap shs :-1read $HOME/.vim/snippets/html_skeleton.html5jwf>a @@ -146,17 +185,3 @@ nnoremap scf :-1read $HOME/.vim/snippets/c_for.cyi)/0N:s/VA nnoremap scs :-1read $HOME/.vim/snippets/c_switch.cyi)/0Ncw nnoremap scw :-1read $HOME/.vim/snippets/c_while.cyi)/0Ncw "-------------------------------------------------------------------- - - -"BUILD INTEGRATION--------------------------------------------------- -" Steal Mr. Bradley's formatter & add it to our spec_helper -" http://philipbradley.net/rspec-into-vim-with-quickfix -" Configure the `make` command to run RSpec -set makeprg=bundle\ exec\ rspec\ -f\ QuickfixFormatter - - " NOW WE CAN: - " - Run :make to run RSpec - " - :cl to list errors - " - :cc# to jump to error by number - " - :cn and :cp to navigate forward and back -"-------------------------------------------------------------------- diff --git a/dotfiles/vim/nvim/after/plugin/colors.lua b/dotfiles/vim/nvim/after/plugin/colors.lua new file mode 100644 index 0000000..24035bc --- /dev/null +++ b/dotfiles/vim/nvim/after/plugin/colors.lua @@ -0,0 +1,9 @@ +function ColorMyPencils(color) + color = color or "rose-pine" + vim.cmd.colorscheme(color) + vim.api.nvim_set_hl(0,"Normal",{bg = "none"}) + vim.api.nvim_set_hl(0,"NormalFloat",{bg = "none"}) +end + +ColorMyPencils() + diff --git a/dotfiles/vim/nvim/after/plugin/feline.lua b/dotfiles/vim/nvim/after/plugin/feline.lua new file mode 100644 index 0000000..e69de29 diff --git a/dotfiles/vim/nvim/after/plugin/fugitive.lua b/dotfiles/vim/nvim/after/plugin/fugitive.lua new file mode 100644 index 0000000..82c8196 --- /dev/null +++ b/dotfiles/vim/nvim/after/plugin/fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "gs", vim.cmd.Git); diff --git a/dotfiles/vim/nvim/after/plugin/harpoon.lua b/dotfiles/vim/nvim/after/plugin/harpoon.lua new file mode 100644 index 0000000..00f0595 --- /dev/null +++ b/dotfiles/vim/nvim/after/plugin/harpoon.lua @@ -0,0 +1,10 @@ +local mark = require("harpoon.mark") +local ui = require("harpoon.ui") + +vim.keymap.set("n", "", mark.add_file) +vim.keymap.set("n", "", ui.toggle_quick_menu) + +vim.keymap.set("n", "", function() ui.nav_file(1) end) +vim.keymap.set("n", "", function() ui.nav_file(2) end) +vim.keymap.set("n", "", function() ui.nav_file(3) end) +vim.keymap.set("n", "", function() ui.nav_file(4) end) diff --git a/dotfiles/vim/nvim/after/plugin/lsp.lua b/dotfiles/vim/nvim/after/plugin/lsp.lua new file mode 100644 index 0000000..88d9d0f --- /dev/null +++ b/dotfiles/vim/nvim/after/plugin/lsp.lua @@ -0,0 +1,54 @@ +local lsp = require('lsp-zero').preset({}) + +lsp.ensure_installed({ +}) + +-- Fix Undefined global 'vim' +lsp.nvim_workspace() + +local cmp = require('cmp') +local cmp_select = {behavior = cmp.SelectBehavior.Select} +local cmp_mappings = lsp.defaults.cmp_mappings({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.complete(), +}) + + +cmp_mappings[''] = nil +cmp_mappings[''] = nil + +lsp.setup_nvim_cmp({ + mapping = cmp_mappings +}) + +lsp.set_preferences({ + suggest_lsp_servers = false, + sign_icons = { + error = 'E', + warn = 'W', + hint = 'H', + info = 'I' + } +}) + +lsp.on_attach(function(client, bufnr) + local opts = {buffer = bufnr, remap = false} + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) +end) + +lsp.setup() + +vim.diagnostic.config({ + virtual_text = true +}) diff --git a/dotfiles/vim/nvim/after/plugin/telescope.lua b/dotfiles/vim/nvim/after/plugin/telescope.lua new file mode 100644 index 0000000..558c491 --- /dev/null +++ b/dotfiles/vim/nvim/after/plugin/telescope.lua @@ -0,0 +1,6 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'pf', builtin.find_files, {}) +vim.keymap.set('n', 'pg', builtin.git_files, {}) +vim.keymap.set('n', 'ps', function() + builtin.grep_string({search = vim.fn.input("Grep > ")}); +end) diff --git a/dotfiles/vim/nvim/after/plugin/treesitter.lua b/dotfiles/vim/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..28e8614 --- /dev/null +++ b/dotfiles/vim/nvim/after/plugin/treesitter.lua @@ -0,0 +1,38 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "python", "javascript" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) + -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! + + highlight = { + enable = true, + + -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to + -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is + -- the name of the parser) + -- list of language that will be disabled + disable = { }, + -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} diff --git a/dotfiles/vim/nvim/after/plugin/undotree.lua b/dotfiles/vim/nvim/after/plugin/undotree.lua new file mode 100644 index 0000000..b6b9276 --- /dev/null +++ b/dotfiles/vim/nvim/after/plugin/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) diff --git a/dotfiles/vim/nvim/ftplugin/c_mappings.vim b/dotfiles/vim/nvim/ftplugin/c_mappings.vim new file mode 100644 index 0000000..79386a0 --- /dev/null +++ b/dotfiles/vim/nvim/ftplugin/c_mappings.vim @@ -0,0 +1,2 @@ +map :s/^/\/\// +map :s/\/\/// diff --git a/dotfiles/vim/nvim/init.lua b/dotfiles/vim/nvim/init.lua new file mode 100644 index 0000000..48dec57 --- /dev/null +++ b/dotfiles/vim/nvim/init.lua @@ -0,0 +1 @@ +require("key") diff --git a/dotfiles/vim/nvim/lua/key/init.lua b/dotfiles/vim/nvim/lua/key/init.lua new file mode 100644 index 0000000..7095528 --- /dev/null +++ b/dotfiles/vim/nvim/lua/key/init.lua @@ -0,0 +1,3 @@ +require("key.set") +require("key.remap") +require("key.packer") diff --git a/dotfiles/vim/nvim/lua/key/packer.lua b/dotfiles/vim/nvim/lua/key/packer.lua new file mode 100644 index 0000000..4f37dbe --- /dev/null +++ b/dotfiles/vim/nvim/lua/key/packer.lua @@ -0,0 +1,46 @@ +-- This file can be loaded by calling `lua require('plugins')` from your init.vim +-- Only required if you have packer configured as `opt` +vim.cmd [[packadd packer.nvim]] + +return require('packer').startup(function(use) + -- Packer can manage itself + use 'wbthomason/packer.nvim' + + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.2', + -- or , branch = '0.1.x', + requires = { {'nvim-lua/plenary.nvim'} } + } + + use { + 'nvim-treesitter/nvim-treesitter', + 'nvim-treesitter/playground', + run = function() + local ts_update = require('nvim-treesitter.install').update({ with_sync = true }) + ts_update() + end, + } + use { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v2.x', + requires = { + -- LSP Support + {'neovim/nvim-lspconfig'}, -- Required + {'williamboman/mason.nvim'}, -- Optional + {'williamboman/mason-lspconfig.nvim'}, -- Optional + + -- Autocompletion + {'hrsh7th/nvim-cmp'}, -- Required + {'hrsh7th/cmp-nvim-lsp'}, -- Required + {'L3MON4D3/LuaSnip'}, -- Required + } + } + + use{'rose-pine/neovim', as = 'rose-pine'} + + use('theprimeagen/harpoon') + + use('mbbill/undotree') + + use('tpope/vim-fugitive') +end) diff --git a/dotfiles/vim/nvim/lua/key/remap.lua b/dotfiles/vim/nvim/lua/key/remap.lua new file mode 100644 index 0000000..de32623 --- /dev/null +++ b/dotfiles/vim/nvim/lua/key/remap.lua @@ -0,0 +1,92 @@ +-- (VIM) Remaps Space bar as the Leader command +vim.keymap.set("n", "pv", vim.cmd.Ex) + +--(NAVIGATION) +--Switches to the Left window +vim.keymap.set("n","h", ":wincmd h",{ silent = true }) +--Switches to the Bottom window +vim.keymap.set("n","j", ":wincmd j",{ silent = true } ) +--Switches to the Top window +vim.keymap.set("n","k", ":wincmd k",{ silent = true }) +--Switches to the Right window +vim.keymap.set("n","l", ":wincmd l",{ silent = true }) + +--(FILES) +vim.keymap.set("n", "pf", ":Sex! :vertical resize 30") + +--(POSITION) +--[P]ut one line [U]p everything from the cursor till the end of the line +vim.keymap.set("n","pu", "d$Op") +--[P]ut one line [D]own everything from the cursor till the end of the line +vim.keymap.set("n","pd", "d$op") +--Put at then end of the [L]ine [U]pper from the cursor (everything from the cursor till the end of the line) +vim.keymap.set("n","lu", "DkApjddkI") +--Put at then end of the [L]ine [D]own(er) from the cursor (everything from the cursor till the end of the line) +vim.keymap.set("n","ld", "DjApkddjI") +-- Classic Vim's Windo [U]p and [D]onw controls but keeps the cursor in the middle +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +-- Classic Vim's [n]ext and [N]previous controls but keeps the cursor in the middle +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") +-- Mooves what's under the cursor +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +--(COPY PASTE) +-- Copy to your clipboard of your system and not in the internal buffer of vim +vim.keymap.set({"n", "v"}, "y", [["+y]]) +vim.keymap.set("n", "Y", [["+Y]]) + +--(WORD) Manipulation +--[W]ord [R]reformat for word under the cursor +-- Replace Madness from the primeagen +vim.keymap.set("n", "wr", [[:%s/\<\>//gI]]) +--[C]hange [W]ord in registered buffer To be more similar to whant vim implment +vim.keymap.set("n","cw", "ebvey/0Ncw") +--[C]hange [N]ext word in registered buffer To be more similar to what vim implements +vim.keymap.set("n","cn", "ncw") +--[W]ord [N]ext occurence for word under the cursor +vim.keymap.set("n","wn", "ebvey/0") +--[W]ord [P]revious occurence for word under the cursor +vim.keymap.set("n","wp", "ebvey/0NN") +--[W]ord [S]earch for word under the cursor +vim.keymap.set("n","ws", "ebvey/0") +--[W]ord [F]ind [F]irst for word under the cursor +vim.keymap.set("n","wff", "ebveyG/0", { silent = true }) +--[W]ord [F]ind [L]ast for word under the cursor +vim.keymap.set("n","wfl", "ebveyG/0N",{ silent = true }) + +--(ADDERS) +--[A]dds a [)] at the end of the line +vim.keymap.set("n","a)", "A)I") +--[A]dds a [}] at the end of the line +vim.keymap.set("n","a}", "A}I") +--[A]dds a ["]"] at the end of the line +vim.keymap.set("n","a]", "A]I") + +--(DEBUGER) +vim.keymap.set("n","db", ":Termdebug :vertical resize 30") +vim.keymap.set("n","ts", ":Step", { silent = true }) +vim.keymap.set("n","to", ":Over", { silent = true }) +vim.keymap.set("n","tn", ":Next", { silent = true }) +vim.keymap.set("n","tc", ":Cont", { silent = true }) +--QUICKFIX Navigation for going to the next errors and so on +vim.keymap.set("n", "ne", "cnextzz") +vim.keymap.set("n", "me", "cprevzz") +vim.keymap.set("n", "nl", "lnextzz") +vim.keymap.set("n", "ml", "lprevzz") + +--(TERMINAL COMMANDS) +-- Makes current file executable +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) + +--SNIPPETS------------------------------------------------------------ +-- Command Read template move cursor +vim.keymap.set("n","shs", ":-1read $HOME/.config/nvim/snippets/html_skeleton.html5jwf>a") +vim.keymap.set("n","shb", ":-1read $HOME/.config/nvim/snippets/html_vertical_bracets.html:s/VARTOCHANGE//g") +vim.keymap.set("n","sht", ":-1read $HOME/.config/nvim/snippets/html_horizontal_bracets.html:.,+2s/VARTOCHANGE//g") +vim.keymap.set("n","scf", ":-1read $HOME/.config/nvim/snippets/c_for.cyi)/0N:s/VARTOCHANGE//g") +vim.keymap.set("n","scs", ":-1read $HOME/.config/nvim/snippets/c_switch.cyi)/0Ncw") +vim.keymap.set("n","scw", ":-1read $HOME/.config/nvim/snippets/c_while.cyi)/0Ncw") +---------------------------------------------------------------------- diff --git a/dotfiles/vim/nvim/lua/key/set.lua b/dotfiles/vim/nvim/lua/key/set.lua new file mode 100644 index 0000000..271ebbd --- /dev/null +++ b/dotfiles/vim/nvim/lua/key/set.lua @@ -0,0 +1,45 @@ +-- Map Leader as spacebar +vim.g.mapleader = " " + +-- Big cursor +vim.opt.guicursor = "" + +-- Print lines +vim.opt.nu = true +-- Print lines relative +vim.opt.relativenumber = true +vim.opt.scrolloff = 8 + +-- Indentation to be 4 spaces +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +-- Automatically indents depending on the line before +vim.opt.expandtab = true +vim.opt.smartindent = true + +-- Do not go to the a new line when screnn doesn't fit +vim.opt.wrap = false + +-- Diabslebing vim's swap and backup as we are using undotree +vim.opt.swapfile = false +vim.opt.backup = false +-- Directory for undotree +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +-- Guidance to hihlight your seraches incremetally +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +-- To show whne there is an issue found by LPS simmilar to GBD +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +-- Column as delimitor +vim.opt.colorcolumn = "80" + +-- Fast update times +vim.opt.updatetime = 50 diff --git a/dotfiles/vim/nvim/plugin/packer_compiled.lua b/dotfiles/vim/nvim/plugin/packer_compiled.lua new file mode 100644 index 0000000..457f0e9 --- /dev/null +++ b/dotfiles/vim/nvim/plugin/packer_compiled.lua @@ -0,0 +1,174 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + +_G._packer = _G._packer or {} +_G._packer.inside_compile = true + +local time +local profile_info +local should_profile = false +if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end +else + time = function(chunk, start) end +end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + if threshold then + table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') + end + + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/key/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/key/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/key/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/key/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/key/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + LuaSnip = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + harpoon = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/harpoon", + url = "https://github.com/theprimeagen/harpoon" + }, + ["lsp-zero.nvim"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim", + url = "https://github.com/VonHeikemen/lsp-zero.nvim" + }, + ["mason-lspconfig.nvim"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", + url = "https://github.com/williamboman/mason-lspconfig.nvim" + }, + ["mason.nvim"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/mason.nvim", + url = "https://github.com/williamboman/mason.nvim" + }, + ["nvim-cmp"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-lspconfig"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + playground = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/playground", + url = "https://github.com/nvim-treesitter/playground" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["rose-pine"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/rose-pine", + url = "https://github.com/rose-pine/neovim" + }, + ["telescope.nvim"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + undotree = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/undotree", + url = "https://github.com/mbbill/undotree" + }, + ["vim-fugitive"] = { + loaded = true, + path = "/home/key/.local/share/nvim/site/pack/packer/start/vim-fugitive", + url = "https://github.com/tpope/vim-fugitive" + } +} + +time([[Defining packer_plugins]], false) + +_G._packer.inside_compile = false +if _G._packer.needs_bufread == true then + vim.cmd("doautocmd BufRead") +end +_G._packer.needs_bufread = false + +if should_profile then save_profiles() end + +end) + +if not no_errors then + error_msg = error_msg:gsub('"', '\\"') + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end diff --git a/dotfiles/vim/nvim/snippets/c_for.c b/dotfiles/vim/nvim/snippets/c_for.c new file mode 100644 index 0000000..cb396ce --- /dev/null +++ b/dotfiles/vim/nvim/snippets/c_for.c @@ -0,0 +1,4 @@ +for(VARTOCHANGE = 0; VARTOCHANGE < n; VARTOCHANGE++) +{ + VARTOCHANGE +} diff --git a/dotfiles/vim/nvim/snippets/c_switch.c b/dotfiles/vim/nvim/snippets/c_switch.c new file mode 100644 index 0000000..7ce3c88 --- /dev/null +++ b/dotfiles/vim/nvim/snippets/c_switch.c @@ -0,0 +1,19 @@ +switch (VARTOCHANGE) +{ + case VARTOCHANGE: + break; + + case VARTOCHANGE: + break; + + case VARTOCHANGE: + break; + + case VARTOCHANGE: + break; + + case VARTOCHANGE: + break; + + default: +} diff --git a/dotfiles/vim/nvim/snippets/c_while.c b/dotfiles/vim/nvim/snippets/c_while.c new file mode 100644 index 0000000..60e660a --- /dev/null +++ b/dotfiles/vim/nvim/snippets/c_while.c @@ -0,0 +1,4 @@ +while(VARTOCHANGE) +{ + VARTOCHANGE +} diff --git a/dotfiles/vim/nvim/snippets/htlm_skeleton.html b/dotfiles/vim/nvim/snippets/htlm_skeleton.html new file mode 100644 index 0000000..0651214 --- /dev/null +++ b/dotfiles/vim/nvim/snippets/htlm_skeleton.html @@ -0,0 +1,14 @@ + + + + + + + + +
+
+
+
+ + diff --git a/dotfiles/vim/nvim/snippets/html_horizontal_bracets.html b/dotfiles/vim/nvim/snippets/html_horizontal_bracets.html new file mode 100644 index 0000000..dd17dd9 --- /dev/null +++ b/dotfiles/vim/nvim/snippets/html_horizontal_bracets.html @@ -0,0 +1,3 @@ + + + diff --git a/dotfiles/vim/nvim/snippets/html_vertical_bracets.html b/dotfiles/vim/nvim/snippets/html_vertical_bracets.html new file mode 100644 index 0000000..0300df7 --- /dev/null +++ b/dotfiles/vim/nvim/snippets/html_vertical_bracets.html @@ -0,0 +1 @@ + diff --git a/programs/neovim/neovim.sh b/programs/neovim/neovim.sh deleted file mode 100755 index cb0ba39..0000000 --- a/programs/neovim/neovim.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -NVIMDIR="/home/$USER/.config/" -CURDATE=$(date +%m%d%Y%H%M%S) - -cd $NVIMDIR -rm -rf nvim -rm -rf ~/.local/share/nvim -rm -rf ~/.local/state/nvim diff --git a/programs/neovim/nvim_install.sh b/programs/neovim/nvim_install.sh new file mode 100755 index 0000000..4aa8c16 --- /dev/null +++ b/programs/neovim/nvim_install.sh @@ -0,0 +1,10 @@ +sudo apt-get install ninja-build gettext cmake unzip curl ripgrep +git clone https://github.com/neovim/neovim +cd neovim +make CMAKE_BUILD_TYPE=Release +sudo make install +cd .. +sudo rm -r neovim + +git clone --depth 1 https://github.com/wbthomason/packer.nvim\ + ~/.local/share/nvim/site/pack/packer/start/packer.nvim