Initial Commit

This commit is contained in:
agryphus 2023-04-29 05:40:23 -04:00
commit f2ff7bda11
18 changed files with 342 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/plugin/

4
after/ftplugin/html.lua Executable file
View file

@ -0,0 +1,4 @@
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2

7
after/plugin/colors.lua Executable file
View file

@ -0,0 +1,7 @@
vim.o.background = "dark"
local c = require("vscode.colors").get_colors()
require("vscode").setup({
transparent = true
})

9
after/plugin/comment.lua Executable file
View file

@ -0,0 +1,9 @@
require("Comment").setup()
vim.keymap.set(
"n",
"<C-_>",
function() require("Comment.api").toggle.linewise.current() end,
{ noremap = true, silent = true }
)

18
after/plugin/firenvim.lua Executable file
View file

@ -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

4
after/plugin/lightline.lua Executable file
View file

@ -0,0 +1,4 @@
vim.g.lightline = {
colorscheme = "one"
}

52
after/plugin/lsp.lua Executable file
View file

@ -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({
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
["<C-y>"] = 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()

10
after/plugin/nvimtree.lua Executable file
View file

@ -0,0 +1,10 @@
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
require("nvim-tree").setup()
vim.keymap.set("n", "<leader>pt", ":NvimTreeToggle<CR>")
-- sets transparent background
vim.cmd[[hi NvimTreeNormal guibg=NONE ctermbg=NONE]]

12
after/plugin/telescope.lua Executable file
View file

@ -0,0 +1,12 @@
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>pf", builtin.find_files, {})
vim.keymap.set("n", "<leader>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" }
}
}

16
after/plugin/treesitter.lua Executable file
View file

@ -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,
},
}

24
after/plugin/vimtex.lua Executable file
View file

@ -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
]])

40
after/syntax/asm.vim Executable file
View file

@ -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"

15
after/syntax/lua.vim Executable file
View file

@ -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'

2
init.lua Executable file
View file

@ -0,0 +1,2 @@
require("andrew")

4
lua/andrew/init.lua Executable file
View file

@ -0,0 +1,4 @@
require("andrew.remap")
require("andrew.packer")
require("andrew.set")

72
lua/andrew/packer.lua Executable file
View file

@ -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)

34
lua/andrew/remap.lua Executable file
View file

@ -0,0 +1,34 @@
vim.g.mapleader = " "
-- opens file explorer
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
-- centers cursor when jumping up and down page
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
-- easier escape back to normal mode
vim.keymap.set("i", "<C-c>", "<Esc>")
-- lol
vim.keymap.set("n", "Q", "<nop>")
-- universal find and replace
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
-- moving highlighted text
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
-- allow for pasting over without losing buffer
vim.keymap.set("x", "<leader>p", "\"_dP")
-- allow copying to system clipboard
vim.keymap.set("n", "<leader>y", "\"+y")
vim.keymap.set("v", "<leader>y", "\"+y")
vim.keymap.set("n", "<leader>y", "\"+y")
-- allow deleting to void register
vim.keymap.set("n", "<leader>d", "\"_d")
vim.keymap.set("v", "<leader>d", "\"_d")

17
lua/andrew/set.lua Executable file
View file

@ -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"