📝 Added entire config directory for backup purposes

This commit is contained in:
z3rOR0ne 2022-11-03 00:09:22 -07:00
parent 4b38e59bb6
commit 9b946e2d14
11091 changed files with 1440953 additions and 0 deletions

394
.config/nvim/lua/config.lua Normal file
View file

@ -0,0 +1,394 @@
keymap = vim.api.nvim_set_keymap
-- Enable ColorScheme
vim.cmd[[colorscheme nord]]
-- Enable autopairs
require('nvim-autopairs').setup{}
-- Enable gitsigns
require('gitsigns').setup()
-- nvim-treesiter configuration: -- setup with all defaults
require'nvim-treesitter.configs'.setup{
ensure_installed = {"bash", "c", "c_sharp", "cmake", "cpp", "css", "dockerfile", "go", "html", "http", "java", "javascript", "json", "json5", "jsonc", "lua", "make", "perl", "php", "pug", "python", "regex", "ruby", "toml", "tsx", "typescript", "rust", "vim", "vue", "wgsl", "yaml",}, highlight = { enable = 'true' } }
-- To enable basic vim folding methods/expressions:
--
-- vim.opt.foldmethod = "expr"
-- vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
-- Disable folds
vim.g.nofoldenable = true
local lsp_installer = require("nvim-lsp-installer")
lsp_installer.on_server_ready(function(server)
local opts = {}
-- This setup() function will take the provided server configuration and decorate it with the necessary properties
-- before passing it onwards to lspconfig.
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
server:setup(opts)
end)
-- Setup nvim-cmp.
local cmp = require'cmp'
cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
end,
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'buffer' },
{ name = 'ultisnips' },
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
}, {
{ name = 'buffer' },
})
})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
-- Setup lspconfig.
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
local lspconfig =require'lspconfig'
local on_attach = function(client)
require'completion'.on_attach(client)
end
-- Enable quick-lint-js lsp
require('lspconfig/quick_lint_js').setup {}
-- Enable use of ripgrep
require('nvim-ripgrep').setup{
runner = require('nvim-ripgrep.run').ripgrep, -- grep command
prompt = " ", -- prompt
window = {
width = 0.8,
border = "rounded",
};
open_qf_fn = function()
return vim.api.nvim_command('copen')
end,
}
-- quick-lint-js detects errors in insert mode
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = true,
}
)
-- Enable rust-analyzer lsp
lspconfig.rust_analyzer.setup({
on_attach=on_attach,
settings = {
["rust_analyzer"] = {
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true
}
}
}
})
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'dockerls', 'grammarly', 'html', 'sqls', 'quick_lint_js', 'sumneko_lua', 'pyright', 'bashls', 'clangd', 'rust_analyzer', 'volar', }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
capabilities = capabilities,
}
end
-- Nvim_Tree configuration: -- setup with all defaults
-- each of these are documented in `:help nvim-tree.OPTION_NAME`
require'nvim-tree'.setup { -- BEGIN_DEFAULT_OPTS
auto_reload_on_write = true,
disable_netrw = false,
-- hide_root_folder = false,
hijack_cursor = false,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
ignore_buffer_on_setup = false,
open_on_setup = false,
open_on_setup_file = false,
open_on_tab = false,
sort_by = "name",
update_cwd = false,
view = {
width = 25,
-- height = 30,
side = "right",
preserve_window_proportions = true,
number = false,
relativenumber = false,
signcolumn = "yes",
mappings = {
custom_only = false,
list = {
-- user mappings go here
},
},
},
renderer = {
indent_markers = {
enable = false,
icons = {
corner = "",
edge = "",
none = " ",
},
},
icons = {
webdev_colors = true,
},
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = false,
update_cwd = false,
ignore_list = {},
},
ignore_ft_on_setup = {},
system_open = {
cmd = nil,
args = {},
},
diagnostics = {
enable = false,
show_on_dirs = false,
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
filters = {
dotfiles = false,
custom = {},
exclude = {},
},
git = {
enable = true,
ignore = true,
timeout = 400,
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
restrict_above_cwd = false,
},
open_file = {
quit_on_open = false,
resize_window = false,
window_picker = {
enable = true,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
},
trash = {
cmd = "trash",
require_confirm = true,
},
log = {
enable = false,
truncate = false,
types = {
all = false,
config = false,
copy_paste = false,
diagnostics = false,
git = false,
profile = false,
},
},
} -- END_DEFAULT_OPTS for Nvim_Tree
-- Lua Line color configuration
require('lualine').setup({
options = { theme = 'nord' }
})
-- Automatically closes Nvim tree if last window open
vim.cmd[[autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif]]
-- vim-smoothie configuration
-- Use experimental features of vim-smoothie (gg and G)
vim.g.smoothie_experimental_mappings = 1
-- set colored brackets via rainbow
vim.g.rainbow_active = 1
-- Marks end of line, space, and trailing space characters
vim.opt.listchars:append({ eol = '', trail = '·', space = '·' })
vim.opt.list = true
-- enable AutoSave on start
vim.g.auto_save = 1
-- silence AutoSave messages
vim.g.auto_save_silent = 1
-- Create Default Mappings for NerdCommenter
vim.g.NERDCreateDefaultMappings = 1
-- Add spaces after NerdCommenter delimiters by default
vim.g.NERDSpaceDelims = 1
-- this variable must be enabled for colors to be applied properly
vim.opt.termguicolors = true
vim.g.nosplitright = true
-- Enable colorizer (css)
require'colorizer'.setup()
-- specify markdown-preview browser / set to dark mode
vim.g.mkdp_browser = 'librewolf'
vim.g.mkdp_theme = 'dark'
-- set relative number
-- vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.cursorcolumn = true
-- vim.opt.cursor = true
--
vim.opt.mouse = 'a'
vim.opt.autoindent = true
vim.opt.smarttab = true
vim.opt.ignorecase = true
vim.opt.cindent = true
vim.opt.tabstop = 8
vim.opt.softtabstop = 0
vim.opt.shiftwidth = 4
-- always uses spaces instead of tab characters
vim.opt.expandtab = true
-- if hidden is not set, TextEdit might fail.
vim.opt.hidden = true
-- Set the height of the status line down at the bottom
vim.opt.cmdheight = 1
-- Set the amount of characters you get back from status/error messages
vim.opt.updatetime = 300
-- always show signcolumns
vim.opt.signcolumn = 'yes'
-- Fix Splitting
vim.opt.splitbelow = true
vim.opt.splitright = true
-- Disable git-blame by default
-- vim.cmd[[g:gitblame_enabled = 0]]
vim.g.gitblame_enabled = 0
-- Vertically center document when entering Insert mode
vim.cmd[[autocmd InsertEnter * norm zz]]
-- Removes trailing spaces
vim.cmd[[function TrimWhiteSpace()
%s/\s*$//
''
endfunction]]
-- Search pattern across repository files
vim.cmd[[
function! FzfExplore(...)
let inpath = substitute(a:1, "'", '', 'g')
if inpath == "" || matchend(inpath, '/') == strlen(inpath)
execute "cd" getcwd() . '/' . inpath
let cwpath = getcwd() . '/'
call fzf#run(fzf#wrap(fzf#vim#with_preview({'source': 'ls -1ap', 'dir': cwpath, 'sink': 'FZFExplore', 'options': ['--prompt', cwpath]})))
else
let file = getcwd() . '/' . inpath
execute "e" file
endif
endfunction]]
vim.cmd[[command! -nargs=* FZFExplore call FzfExplore(shellescape(<q-args>))]]
-- fzf is on bottom of screen
vim.cmd[[let g:fzf_layout = { 'down': '~30%' }]]
--Removes trailing spaces on save
vim.cmd[[autocmd FileWritePre * call TrimWhiteSpace()]]
vim.cmd[[autocmd FileAppendPre * call TrimWhiteSpace()]]
vim.cmd[[autocmd FilterWritePre * call TrimWhiteSpace()]]
vim.cmd[[autocmd BufWritePre * call TrimWhiteSpace()]]
-- Enable Comments with Italics (below selected colorscheme)
vim.cmd[[highlight Comment cterm=italic gui=italic]]
-- Re-enable transparency while termguicolors are set
vim.cmd[[hi! Normal ctermbg=NONE guibg=NONE]]
vim.cmd[[hi! NonText ctermbg=NONE guibg=NONE]]
-- never create swap files
vim.cmd[[set noswapfile]]
-- set up lab.nvim
sources = cmp.config.sources({ {name = 'lab.quick_data', keyword_length = 4 }})
require('lab').setup {
code_runner = {
enabled = true,
},
quick_data = {
enabled = true,
}
}
-- do not close the markdown preview tab when switching to other buffers
-- vim.g.mkdp_auto_close = 0

View file

@ -0,0 +1,85 @@
-- remap leader key
vim.g.mapleader = ","
-- remap Nvim_Tree toggle to CTRL+B
keymap('n', '<c-b>', '<c-w>:NvimTreeToggle<CR>', {})
-- Tab Shortcuts
keymap('n', '<c-t>', '<c-w>:tabnew<CR>', {}) keymap('n', '<s-tab>', '<c-w>:tabprevious<CR>', {}) keymap('n', '<a-tab>', '<c-w>:tabnext<CR>', {})
keymap('n', '<a-left>', '<c-w>:tabprevious<CR>', {})
keymap('n', '<a-right>', '<c-w>:tabnext<CR>', {})
-- Use ctrl- [hl] to select the active split!
keymap('n', '<c-h>', '<c-w>:wincmd h<CR>', {}) keymap('n', '<c-l>', '<c-w>:wincmd l<CR>', {})
-- open fzf
vim.cmd[[nnoremap fzf :silent :FZFExplore]]
keymap('n', '<c-p>', '<c-w>:FZFExplore<CR>', {})
-- toggle gitblame
-- vim.cmd[[nnoremap gb :silent :GitBlameToggle]]
keymap('n', '<c-g>', '<c-w>:GitBlameToggle<CR>', {})
-- open ripgrep
vim.cmd[[nnoremap rg :silent :Rg]]
--open a new vertical split
vim.cmd[[nnoremap nv :silent :vnew]]
-- open lsp-installer
vim.cmd[[nnoremap lsp :silent :LspInstallInfo]]
-- invoke Neoformat
vim.cmd[[nnoremap nf :silent :Neoformat]]
-- invoke PackerSync
keymap('n', '<s-p>', '<c-w>:PackerSync<CR>', {})
-- invoke numbered line counter
-- simple enter two numbers in between the range (0,10) will yield 1 to 10 all on new lines
vim.cmd[[nnoremap rp :silent :put =range(,)]]
--invoke Diffview
-- keymap('n', '<s-d>', '<c-w>:DiffviewOpen<CR>', {})
-- Toggle NERDCommenter with Ctrl + c
vim.cmd[[:map <C-c> <Plug>NERDCommenterToggle]]
-- <Ctrl-x> redraws the screen and removes any search highlighting
keymap('n', '<c-x>', '<c-w>:nohl<CR>', {silent = true} )
-- <Shift -m> brings up a preview of Markdown files
keymap('n', '<s-m>', '<c-w>:MarkdownPreview<CR>', {})
-- Toggle Multi-Cursor with j or k
vim.cmd[[nmap <C-j> <C-Down>]]
vim.cmd[[nmap <C-k> <C-Up>]]
-- Toggle relativenumber
vim.cmd[[nmap <s-x> :set relativenumber! number<cr>]]
-- Escape Insert Mode with ii
-- keymap('i', 'ii', '<Esc>', {})
-- Alias replace all to shift + S
vim.cmd[[nnoremap S :%s///gI<Left><Left><Left><Left>]]
-- Alias replace all on current line (shift + Y)
vim.cmd[[nnoremap Y :.,.s///g<Left><Left><Left>]]
-- Format C and C++ Code using cp alias ( thus far preferable to Neoformat)
vim.cmd[[nnoremap cp :silent :ClangFormat]]
-- j/k will move virtual lines (lines that wrap)
vim.cmd[[noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j')]]
vim.cmd[[noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')]]
-- Toggle English spellcheck with F11
vim.cmd[[nnoremap <silent> <F11> :set spell!<cr>]]
vim.cmd[[inoremap <silent> <F11> <C-O>:set spell!<cr>]]
-- lab.nvim keybindings
vim.cmd[[nnoremap <F4> :Lab code stop<CR>]]
vim.cmd[[nnoremap <F5> :Lab code run<CR>]]
vim.cmd[[nnoremap <F6> :Lab code panel<CR>]]

View file

@ -0,0 +1,57 @@
-- packer.nvim requires nvim-packer-git package
-- paru -S nvim-packer-git
-- Packages installed using 'packer', install using :PackerSync
-- Remove packages by deleting (or commenting out) use line below and running :PackerClean
require('packer').startup(function()
use 'wbthomason/packer.nvim'
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} -- :TSInstall <language_to_install>
-- :TSUpdate all
use 'neovim/nvim-lspconfig'
use 'williamboman/nvim-lsp-installer'
-- :LspInstallInfo (use i to install, u to upgrade, r to uninstall)
-- :LspUninstall [--sync] <server> ...
-- NVim Completion packages
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-cmdline'
use 'SirVer/ultisnips'
use 'honza/vim-snippets'
use 'quangnguyen30192/cmp-nvim-ultisnips'
use({"hrsh7th/nvim-cmp",
requires = {"quangnguyen30192/cmp-nvim-ultisnips",
config = function()
-- optional call to setup (see customization section)
require("cmp_nvim_ultisnips").setup{}
end,
-- If you want to enable filetype detection based on treesitter:
requires = { "nvim-treesitter/nvim-treesitter" },
}
})
use 'kyazdani42/nvim-web-devicons' -- for file icons
use 'kyazdani42/nvim-tree.lua'
use {'nvim-lualine/lualine.nvim', requires = { 'kyazdani42/nvim-web-devicons', opt = true }}
use 'shaunsingh/nord.nvim'
use { "ellisonleao/gruvbox.nvim" }
use 'psliwka/vim-smoothie'
use 'mattn/emmet-vim'
use 'norcalli/nvim-colorizer.lua'
use 'airblade/vim-gitgutter'
use 'f-person/git-blame.nvim'
use 'junegunn/fzf.vim' -- better fuzzy find files
use 'preservim/nerdcommenter'
use {'lewis6991/gitsigns.nvim'}
use 'Yggdroot/indentLine'
use 'mg979/vim-visual-multi'-- {'branch': 'master'}
use {'iamcco/markdown-preview.nvim'} -- call mkdp#util#install()
use 'luochen1990/rainbow'
use 'windwp/nvim-autopairs'
use 'simeji/winresizer'
use '907th/vim-auto-save'
use 'rinx/nvim-ripgrep'
use 'sbdchd/neoformat' -- general formatter for various languages
use 'rhysd/vim-clang-format' -- formatter for c and c++
-- use { 'sindrets/diffview.nvim', requires = 'nvim-lua/plenary.nvim' }
use { '0x100101/lab.nvim', run = 'cd js && npm ci', requires = { 'nvim-lua/plenary.nvim' } }
end)