commit f2ff7bda11d8842a275ed4cc9a1f2533674a4b20 Author: agryphus Date: Sat Apr 29 05:40:23 2023 -0400 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ef02d0c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/plugin/ + diff --git a/after/ftplugin/html.lua b/after/ftplugin/html.lua new file mode 100755 index 0000000..806b55a --- /dev/null +++ b/after/ftplugin/html.lua @@ -0,0 +1,4 @@ +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 + diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua new file mode 100755 index 0000000..e4685b7 --- /dev/null +++ b/after/plugin/colors.lua @@ -0,0 +1,7 @@ +vim.o.background = "dark" + +local c = require("vscode.colors").get_colors() +require("vscode").setup({ + transparent = true +}) + diff --git a/after/plugin/comment.lua b/after/plugin/comment.lua new file mode 100755 index 0000000..121e765 --- /dev/null +++ b/after/plugin/comment.lua @@ -0,0 +1,9 @@ +require("Comment").setup() + +vim.keymap.set( + "n", + "", + function() require("Comment.api").toggle.linewise.current() end, + { noremap = true, silent = true } +) + diff --git a/after/plugin/firenvim.lua b/after/plugin/firenvim.lua new file mode 100755 index 0000000..19b99fb --- /dev/null +++ b/after/plugin/firenvim.lua @@ -0,0 +1,18 @@ +vim.g.firenvim_config = { + globalSettings = { alt = "all" }, + localSettings = { + [".*"] = { + cmdline = "neovim", + content = "text", + priority = 0, + selector = "textarea", + takeover = "never" + } + } +} + +-- Prevents scrolling when cursor is near the bottom of the text area +if vim.g.started_by_firenvim == true then + vim.opt.scrolloff = 0 +end + diff --git a/after/plugin/lightline.lua b/after/plugin/lightline.lua new file mode 100755 index 0000000..a18c054 --- /dev/null +++ b/after/plugin/lightline.lua @@ -0,0 +1,4 @@ +vim.g.lightline = { + colorscheme = "one" +} + diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100755 index 0000000..171f8a7 --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,52 @@ +local lsp = require('lsp-zero') +lsp.preset('recommended') + +lsp.ensure_installed({ + "lua_ls", -- Lua + "rust_analyzer", -- Rust + "pyright", -- Python + "texlab", -- Latex + "clangd", -- C + "jdtls", -- Java + "html", -- Html +}) + +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 }), +}) + +lsp.set_preferences({ + sign_icons = { } +}) + +lsp.setup_nvim_cmp({ + mapping = cmp_mappings +}) + +lsp.configure('lua_ls', { + settings = { + Lua = { + diagnostics = { + -- Making sure that lua recognizes the global variable 'vim' + globals = { 'vim' }, + }, + }, + }, +}) + +lsp.configure('pyright', { + settings = { + python = { + analysis = { + typeCheckingMode = "off", + }, + }, + }, +}) + +lsp.setup() + diff --git a/after/plugin/nvimtree.lua b/after/plugin/nvimtree.lua new file mode 100755 index 0000000..c015d85 --- /dev/null +++ b/after/plugin/nvimtree.lua @@ -0,0 +1,10 @@ +-- set termguicolors to enable highlight groups +vim.opt.termguicolors = true + +require("nvim-tree").setup() + +vim.keymap.set("n", "pt", ":NvimTreeToggle") + +-- sets transparent background +vim.cmd[[hi NvimTreeNormal guibg=NONE ctermbg=NONE]] + diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua new file mode 100755 index 0000000..dc6298f --- /dev/null +++ b/after/plugin/telescope.lua @@ -0,0 +1,12 @@ +local builtin = require("telescope.builtin") +vim.keymap.set("n", "pf", builtin.find_files, {}) +vim.keymap.set("n", "ps", function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) +end) + +require("telescope").setup{ + defaults = { + file_ignore_patterns = { ".git\\", ".pyc", ".mypy_cache\\", "node_modules\\", ".svg" } + } +} + diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua new file mode 100755 index 0000000..a9f210e --- /dev/null +++ b/after/plugin/treesitter.lua @@ -0,0 +1,16 @@ +require'nvim-treesitter.configs'.setup { + ensure_installed = { "vim", "javascript", "html", "css", "python", "java", "lua", "perl", "php", "c" }, + + ignore_install = { "latex", "markdown", "htmldjango" }, + + sync_install = false, + + auto_install = false, + + highlight = { + enable = true, + + addition_vim_regex_highlighting = false, + }, +} + diff --git a/after/plugin/vimtex.lua b/after/plugin/vimtex.lua new file mode 100755 index 0000000..a4545ab --- /dev/null +++ b/after/plugin/vimtex.lua @@ -0,0 +1,24 @@ +vim.cmd([[ + +let maplocalleader = " " + +let g:vimtex_compiler_method = 'latexmk' + +let g:tex_flavor='latex' +let g:vimtex_quickfix_mode=0 + +" settings for sumatraPDF +let g:vimtex_view_general_viewer = 'C:\Users\andre\AppData\Local\SumatraPDF\SumatraPDF.exe' +let g:vimtex_view_general_options + \ = '-reuse-instance -forward-search @tex @line @pdf' + +set conceallevel=1 +let g:tex_conceal='abdmg' + +augroup vimtex_config + au! + au User VimtexEventQuit call vimtex#compiler#clean(0) +augroup END + +]]) + diff --git a/after/syntax/asm.vim b/after/syntax/asm.vim new file mode 100755 index 0000000..c923012 --- /dev/null +++ b/after/syntax/asm.vim @@ -0,0 +1,40 @@ +syntax case ignore + +" Match regexes. +syntax match lc3Label /[A-Za-z_][A-Za-z0-9_]*/ +syntax match lc3Register /[rR][0-7]/ +syntax match lc3Decimal /#\=-\=\<[0-9]\+\>/ +syntax match lc3Hex /x-\=[A-Fa-f0-9]\+/ +syntax match lc3Binary /b-\=[01]\+/ +syntax region lc3String start=+"+ skip=+\\"+ end=+"+ +syntax region lc3Comment start=+;+ end=+$+ + +" Assembler directives/pseudo-ops +syntax match lc3Directive /\.orig/ +syntax match lc3Directive /\.end/ +syntax match lc3Directive /\.fill/ +syntax match lc3Directive /\.blkw/ +syntax match lc3Directive /\.stringz/ + +" LC-3 opcodes/aliases, minus branches +syntax keyword lc3Opcode add ld st jsrr jsr and ldr str rti not ldi sti jmp ret lea trap nop +" Branches +syntax keyword lc3Opcode br brn brz brp brnz brnp brzp brnzp +" Trap subroutines +syntax keyword lc3Opcode getc out puts in putsp halt +" LC-3b opcodes +syntax keyword lc3Opcode ldb ldw lshf rshfl rshfa stb stw xor + +" Link colors. +hi def link lc3Opcode Statement +hi def link lc3Label Identifier +hi def link lc3Register Type +hi def link lc3Directive Define +hi def link lc3Decimal Number +hi def link lc3Hex Number +hi def link lc3Binary Number +hi def link lc3String String +hi def link lc3Comment Comment + +let b:current_syntax = "asm" + diff --git a/after/syntax/lua.vim b/after/syntax/lua.vim new file mode 100755 index 0000000..aa05f50 --- /dev/null +++ b/after/syntax/lua.vim @@ -0,0 +1,15 @@ + +syn include @Vim $VIMRUNTIME/syntax/vim.vim +syn region embedvim matchgroup=luaEmbedError start="vim\.api\.nvim_command(\[\[" end="\]\])" keepend contains=@Vim +syn region embedvim matchgroup=luaEmbedError start="vim\.api\.nvim_command \[\[" end="\]\]" keepend contains=@Vim +syn region embedvim matchgroup=luaEmbedError start="vim\.api\.nvim_exec(\[\[" end="\]\])" keepend contains=@Vim +syn region embedvim matchgroup=luaEmbedError start="vim\.api\.nvim_exec \[\[" end="\]\]" keepend contains=@Vim +syn region embedvim matchgroup=luaEmbedError start="vim\.cmd \[\[" end="\]\]" keepend contains=@Vim +syn region embedvim matchgroup=luaEmbedError start="vim\.cmd(\[\[" end="\]\])" keepend contains=@Vim +syn region embedvim matchgroup=luaEmbedError start="vim\.cmd \"" end="\"" keepend contains=@Vim +syn region embedvim matchgroup=luaEmbedError start="vim\.cmd(\"" end="\")" keepend contains=@Vim +syn region embedvim matchgroup=luaEmbedError start="vim\.cmd '" end="'" keepend contains=@Vim +syn region embedvim matchgroup=luaEmbedError start="vim\.cmd('" end="')" keepend contains=@Vim + +let b:current_syntax = 'lua' + diff --git a/init.lua b/init.lua new file mode 100755 index 0000000..3a19e05 --- /dev/null +++ b/init.lua @@ -0,0 +1,2 @@ +require("andrew") + diff --git a/lua/andrew/init.lua b/lua/andrew/init.lua new file mode 100755 index 0000000..180a9a4 --- /dev/null +++ b/lua/andrew/init.lua @@ -0,0 +1,4 @@ +require("andrew.remap") +require("andrew.packer") +require("andrew.set") + diff --git a/lua/andrew/packer.lua b/lua/andrew/packer.lua new file mode 100755 index 0000000..85639b1 --- /dev/null +++ b/lua/andrew/packer.lua @@ -0,0 +1,72 @@ +vim.cmd.packadd("packer.nvim") + +return require("packer").startup(function(use) + use "wbthomason/packer.nvim" + + -- Find files and strings + use { + "nvim-telescope/telescope.nvim", tag = "0.1.0", + requires = { {"nvim-lua/plenary.nvim"} } + } + + -- Treesitter (I use mainly for syntax highlighting) + use({"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}) + + -- VSCode-like theme + use { + "Mofiqul/vscode.nvim", + commit = "db9ee33" + } + + -- Left-side file tryy dispaly + use { + "nvim-tree/nvim-tree.lua", + requires = { + "nvim-tree/nvim-web-devicons", -- for file icons + }, + tag = "nightly" -- optional, updated every week + } + + -- Shows current code on bottom of screen + use "itchyny/lightline.vim" + + -- LSP + use { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v1.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 + {'hrsh7th/cmp-buffer'}, -- Optional + {'hrsh7th/cmp-path'}, -- Optional + {'saadparwaiz1/cmp_luasnip'}, -- Optional + {'hrsh7th/cmp-nvim-lua'}, -- Optional + + -- Snippets + {'L3MON4D3/LuaSnip'}, -- Required + {'rafamadriz/friendly-snippets'}, -- Optional + } + } + + -- Latex editing in vim + use "lervag/vimtex" + + -- Vim Games :D + use "ThePrimeagen/vim-be-good" + + -- Auto comment + use "numToStr/Comment.nvim" + + -- Jupyter notebook integration + use { + "glacambre/firenvim", + run = function() vim.fn["firenvim#install"](0) end + } +end) + diff --git a/lua/andrew/remap.lua b/lua/andrew/remap.lua new file mode 100755 index 0000000..a2961c7 --- /dev/null +++ b/lua/andrew/remap.lua @@ -0,0 +1,34 @@ +vim.g.mapleader = " " + +-- opens file explorer +vim.keymap.set("n", "pv", vim.cmd.Ex) + +-- centers cursor when jumping up and down page +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") + +-- easier escape back to normal mode +vim.keymap.set("i", "", "") + +-- lol +vim.keymap.set("n", "Q", "") + +-- universal find and replace +vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) + +-- moving highlighted text +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +-- allow for pasting over without losing buffer +vim.keymap.set("x", "p", "\"_dP") + +-- allow copying to system clipboard +vim.keymap.set("n", "y", "\"+y") +vim.keymap.set("v", "y", "\"+y") +vim.keymap.set("n", "y", "\"+y") + +-- allow deleting to void register +vim.keymap.set("n", "d", "\"_d") +vim.keymap.set("v", "d", "\"_d") + diff --git a/lua/andrew/set.lua b/lua/andrew/set.lua new file mode 100755 index 0000000..5ac4050 --- /dev/null +++ b/lua/andrew/set.lua @@ -0,0 +1,17 @@ +vim.opt.guicursor = "" + +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "auto" +