commit 28b268d411b56f1677188023f0457006a5e6e28f Author: pr0c3550r Date: Sun Jan 1 20:25:01 2023 +0100 initial commit diff --git a/nvim/.config/nvim/after/plugin/indent-blankline.lua b/nvim/.config/nvim/after/plugin/indent-blankline.lua new file mode 100644 index 0000000..efac1ed --- /dev/null +++ b/nvim/.config/nvim/after/plugin/indent-blankline.lua @@ -0,0 +1,6 @@ +vim.opt.list = true +vim.opt.listchars:append "space:⋅" + +require("indent_blankline").setup { + space_char_blankline = " ", +} diff --git a/nvim/.config/nvim/after/plugin/telescope.lua b/nvim/.config/nvim/after/plugin/telescope.lua new file mode 100644 index 0000000..5a32c3a --- /dev/null +++ b/nvim/.config/nvim/after/plugin/telescope.lua @@ -0,0 +1,5 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', builtin.find_files, {}) +vim.keymap.set('n', 'fg', builtin.live_grep, {}) +vim.keymap.set('n', 'fG', builtin.git_files, {}) + diff --git a/nvim/.config/nvim/after/plugin/treesitter.lua b/nvim/.config/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..97f8edb --- /dev/null +++ b/nvim/.config/nvim/after/plugin/treesitter.lua @@ -0,0 +1,24 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" + ensure_installed = { "c", "lua", "rust", "latex", "bibtex", "python", "vim" }, + + -- 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, + + highlight = { + -- `false` will disable the whole extension + 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 = { "markdown" }, + -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files + additional_vim_regex_highlighting = false, + }, +} diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua new file mode 100644 index 0000000..98d5a45 --- /dev/null +++ b/nvim/.config/nvim/init.lua @@ -0,0 +1 @@ +require("pr073c70r") diff --git a/nvim/.config/nvim/lua/pr073c70r/autocmd.lua b/nvim/.config/nvim/lua/pr073c70r/autocmd.lua new file mode 100644 index 0000000..1700bb4 --- /dev/null +++ b/nvim/.config/nvim/lua/pr073c70r/autocmd.lua @@ -0,0 +1,56 @@ +-- autocmd + +-- Disable autocommenting on new lines under commented ones + +vim.api.nvim_create_autocmd("Filetype", { + pattern = "*", + command = "setlocal formatoptions-=c formatoptions-=r formatoptions-=o" +}) + +-- Filetype specific mappings + +-- Compile and show LaTeX +vim.api.nvim_create_autocmd("Filetype", { + pattern = "tex", + callback = function() + vim.api.nvim_buf_set_keymap(0, "n", "c", ":exec '!xelatex %'", {}) + vim.api.nvim_buf_set_keymap(0, "n", "", ":exec '!xelatex %'", {}) + vim.api.nvim_buf_set_keymap(0, "i", "", ":exec '!xelatex %'", {}) + vim.api.nvim_buf_set_keymap(0, "v", "", ":exec '!xelatex %'", {}) + vim.api.nvim_buf_set_keymap(0, "n", "", ":silent !zathura --fork %:r.pdf& ", {}) + vim.api.nvim_buf_set_keymap(0, "i", "", " :silent !zathura --fork %:r.pdf& ", {}) + vim.api.nvim_buf_set_keymap(0, "v", "", " :silent !zathura --fork %:r.pdf& ", {}) + end +}) + +-- Compile C +vim.api.nvim_create_autocmd("Filetype", { + pattern = "c", + callback = function() + vim.api.nvim_buf_set_keymap(0, "n", "c", ":exec '!gcc % -o %<'", {}) + vim.api.nvim_buf_set_keymap(0, "n", "", ":exec '!gcc % -o %<'", {}) + vim.api.nvim_buf_set_keymap(0, "i", "", ":exec '!gcc % -o %<'", {}) + vim.api.nvim_buf_set_keymap(0, "v", "", ":exec '!gcc % -o %<'", {}) + end +}) + +-- run Python +vim.api.nvim_create_autocmd("Filetype", { + pattern = "python", + callback = function() + vim.api.nvim_buf_set_keymap(0, "n", "c", ":exec '!python3 %'", {}) + vim.api.nvim_buf_set_keymap(0, "n", "", ":exec '!python3 %'", {}) + vim.api.nvim_buf_set_keymap(0, "i", "", ":exec '!python3 %'", {}) + vim.api.nvim_buf_set_keymap(0, "v", "", ":exec '!python3 %'", {}) + end +}) + +-- Close nvim if only Nvim-Tree is open +vim.api.nvim_create_autocmd("BufEnter", { + nested = true, + callback = function() + if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil then + vim.cmd "quit" + end + end +}) diff --git a/nvim/.config/nvim/lua/pr073c70r/colors.lua b/nvim/.config/nvim/lua/pr073c70r/colors.lua new file mode 100644 index 0000000..38137d5 --- /dev/null +++ b/nvim/.config/nvim/lua/pr073c70r/colors.lua @@ -0,0 +1,47 @@ +-- setting colors + +-- everforest +vim.api.nvim_set_var("everforest_background", "hard") +vim.api.nvim_set_var("everforest_transparent_background", "1") +vim.api.nvim_set_var("everforest_ui_contrast", "low") +vim.api.nvim_set_var("everforest_show_eob", "0") +vim.api.nvim_set_var("everforest_enable_bold", "1") +vim.api.nvim_set_var("everforest_enable_italic", "1") +vim.api.nvim_set_var("everforest_better_performance", "1") + +-- gruvbox +vim.api.nvim_set_var("gruvbox_material_background", "hard") +vim.api.nvim_set_var("gruvbox_material_transparent_background", "1") +vim.api.nvim_set_var("gruvbox_material_ui_contrast", "low") +vim.api.nvim_set_var("gruvbox_material_show_eob", "0") +vim.api.nvim_set_var("gruvbox_material_enable_bold", "1") +vim.api.nvim_set_var("gruvbox_material_enable_italic", "1") +vim.api.nvim_set_var("gruvbox_material_better_performance", "1") + +-- setting colorscheme +vim.cmd [[colo gruvbox-material]] + +-- color of ModeMessage and bold Font +vim.api.nvim_set_hl(0, "ModeMsg", { bold = true, fg = "#8bba7f"}) + +-- colors of tabline +vim.api.nvim_set_hl(0, "TabLine", {bg = "#3c3836", fg = "#89b482"}) +vim.api.nvim_set_hl(0, "TabLineFill", {bg = "#1d2021"}) +vim.api.nvim_set_hl(0, "TabLineSel", {bold = true, bg = "none", fg = "#d8a657"}) + +-- color of statusline +vim.api.nvim_set_hl(0, "StatusLine", {bold = true, bg = "#1d2021", fg = "#ea6962"}) +vim.api.nvim_set_hl(0, "StatusLineNC", {bg = "#1d2021", fg = "#89b482"}) + +-- color of vertical split line +vim.api.nvim_set_hl(0, "VertSplit", {bg = "none", fg = "#1d2021"}) + +-- color of the cursorline and cursorlinenumber +vim.api.nvim_set_hl(0, "Cursorline", {bg = "#141617"}) +vim.api.nvim_set_hl(0, "CursorLineNr", {bold = true, bg = "#141617", fg = "#d8a657"}) + +-- transparent background in active, non active and at the end of buffer for colorschemes which does not support such options +-- vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) +-- vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" }) +-- vim.api.nvim_set_hl(0, "EndOfBuffer", { bg = "none" }) + diff --git a/nvim/.config/nvim/lua/pr073c70r/init.lua b/nvim/.config/nvim/lua/pr073c70r/init.lua new file mode 100644 index 0000000..79a5c2d --- /dev/null +++ b/nvim/.config/nvim/lua/pr073c70r/init.lua @@ -0,0 +1,7 @@ +require("pr073c70r.settings") +require("pr073c70r.remap") +require("pr073c70r.autocmd") +require("pr073c70r.statusline") +require("pr073c70r.colors") +require("pr073c70r.packer") + diff --git a/nvim/.config/nvim/lua/pr073c70r/packer.lua b/nvim/.config/nvim/lua/pr073c70r/packer.lua new file mode 100644 index 0000000..08a9ca2 --- /dev/null +++ b/nvim/.config/nvim/lua/pr073c70r/packer.lua @@ -0,0 +1,32 @@ +return require('packer').startup(function(use) + -- Packer can manage itself + use 'wbthomason/packer.nvim' + + -- Colorschemes + use 'sainnhe/everforest' + use 'sainnhe/gruvbox-material' + + -- Fuzzy finder + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.0', + requires = { {'nvim-lua/plenary.nvim'} } + } + + -- Treesitter for better highlighting + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate' + } + + -- Git + use 'tpope/vim-fugitive' + + -- lazy commenting + use 'tpope/vim-commentary' + + -- Indendation guides + use 'lukas-reineke/indent-blankline.nvim' + + -- LSP + +end) diff --git a/nvim/.config/nvim/lua/pr073c70r/remap.lua b/nvim/.config/nvim/lua/pr073c70r/remap.lua new file mode 100644 index 0000000..2548ba4 --- /dev/null +++ b/nvim/.config/nvim/lua/pr073c70r/remap.lua @@ -0,0 +1,38 @@ +-- remaps + +-- leaderkey +vim.keymap.set("n", "", "", {}) +vim.g.mapleader = " " + +-- centering / decentering +vim.api.nvim_set_keymap("n", "ctr", "set scrolloff=999 ", {}) +vim.api.nvim_set_keymap("n", "uctr", "set scrolloff=0 ", {}) + +-- movements in commandmode +vim.api.nvim_set_keymap("c", "", "", {}) +vim.api.nvim_set_keymap("c", "", "", {}) +vim.api.nvim_set_keymap("c", "", "", {}) +vim.api.nvim_set_keymap("c", "", "", {}) + +-- split switching +vim.api.nvim_set_keymap("n", "", "h", {}) +vim.api.nvim_set_keymap("n", "", "j", {}) +vim.api.nvim_set_keymap("n", "", "k", {}) +vim.api.nvim_set_keymap("n", "", "l", {}) + +-- moving visual blocks +vim.api.nvim_set_keymap("v", "J", ":m '>+1gv=gv", {}) +vim.api.nvim_set_keymap("v", "K", ":m '<-2gv=gv", {}) + +-- delete without overwriting the '+'-register +vim.api.nvim_set_keymap("n", "d", "\"_d", {}) +vim.api.nvim_set_keymap("v", "d", "\"_d", {}) + +-- copy to system clipboard +vim.api.nvim_set_keymap("n", "y", "\"+y", {}) +vim.api.nvim_set_keymap("v", "y", "\"+y", {}) +vim.api.nvim_set_keymap("n", "Y", "\"+Y", {}) + +-- paste from system clipboard +vim.api.nvim_set_keymap("n", "p", "\"+p", {}) + diff --git a/nvim/.config/nvim/lua/pr073c70r/settings.lua b/nvim/.config/nvim/lua/pr073c70r/settings.lua new file mode 100644 index 0000000..d7fc854 --- /dev/null +++ b/nvim/.config/nvim/lua/pr073c70r/settings.lua @@ -0,0 +1,45 @@ +-- settings + +-- cursor +vim.api.nvim_set_option("guicursor","n-v-c-sm:hor20-Cursor,i-ci-ve:ver80-iCursor,r-cr-o:hor40,a:blinkwait700-blinkoff400-blinkon250") + +-- disable mouse +vim.api.nvim_set_option("mouse","") + +-- relative numbers +vim.opt.rnu = true + +-- correct tabbing +vim.api.nvim_set_option("tabstop",4) +vim.api.nvim_set_option("softtabstop",4) +vim.api.nvim_set_option("shiftwidth",4) +vim.api.nvim_set_option("expandtab",true) + +-- smart indenting by vim +vim.api.nvim_set_option("smartindent",true) + +-- highlightsearch off but incsearch on with smartcase and ignorecase +vim.api.nvim_set_option("hlsearch", false) +vim.api.nvim_set_option("incsearch", true) +vim.api.nvim_set_option("smartcase", true) +vim.api.nvim_set_option("ignorecase", true) + +-- colors with gui-terminal and dark background +vim.api.nvim_set_option("termguicolors", true) +vim.api.nvim_set_option("background", "dark") + +-- always center +-- vim.opt.scrolloff = 999 +vim.api.nvim_set_option("scrolloff",999) + +-- spellchecking +vim.wo.spell = true +vim.bo.spelllang = "de,en_us" + +-- highlight the current linenumber +vim.wo.cursorline = true +vim.wo.cursorlineopt = "both" + +-- splitting below and right +vim.api.nvim_set_option("splitbelow",true) +vim.api.nvim_set_option("splitright",true) diff --git a/nvim/.config/nvim/lua/pr073c70r/statusline.lua b/nvim/.config/nvim/lua/pr073c70r/statusline.lua new file mode 100644 index 0000000..2e659b6 --- /dev/null +++ b/nvim/.config/nvim/lua/pr073c70r/statusline.lua @@ -0,0 +1,7 @@ +-- statusline +vim.api.nvim_set_option("laststatus", 2) +vim.api.nvim_set_option("statusline", " %F %h%m%r %= %= %l,%c ") + +-- tabline +-- always show tabline (0 = never, 1 = only with at least 2 tabs, 2 = always) and colors +vim.api.nvim_set_option("showtabline", 2) diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua new file mode 100644 index 0000000..1b5eaa1 --- /dev/null +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -0,0 +1,139 @@ +-- 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/pr073c70r/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/pr073c70r/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/pr073c70r/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/pr073c70r/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/pr073c70r/.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 = { + everforest = { + loaded = true, + path = "/home/pr073c70r/.local/share/nvim/site/pack/packer/start/everforest", + url = "https://github.com/sainnhe/everforest" + }, + ["gruvbox-material"] = { + loaded = true, + path = "/home/pr073c70r/.local/share/nvim/site/pack/packer/start/gruvbox-material", + url = "https://github.com/sainnhe/gruvbox-material" + }, + ["indent-blankline.nvim"] = { + loaded = true, + path = "/home/pr073c70r/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", + url = "https://github.com/lukas-reineke/indent-blankline.nvim" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/home/pr073c70r/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/pr073c70r/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/pr073c70r/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["telescope.nvim"] = { + loaded = true, + path = "/home/pr073c70r/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + ["vim-commentary"] = { + loaded = true, + path = "/home/pr073c70r/.local/share/nvim/site/pack/packer/start/vim-commentary", + url = "https://github.com/tpope/vim-commentary" + }, + ["vim-fugitive"] = { + loaded = true, + path = "/home/pr073c70r/.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