initial commit

This commit is contained in:
pr0c3550r 2023-01-01 20:25:01 +01:00
commit 28b268d411
12 changed files with 407 additions and 0 deletions

View file

@ -0,0 +1,6 @@
vim.opt.list = true
vim.opt.listchars:append "space:⋅"
require("indent_blankline").setup {
space_char_blankline = " ",
}

View file

@ -0,0 +1,5 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fG', builtin.git_files, {})

View file

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

View file

@ -0,0 +1 @@
require("pr073c70r")

View file

@ -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", "<leader>c", ":exec '!xelatex %'<cr>", {})
vim.api.nvim_buf_set_keymap(0, "n", "<F5>", ":exec '!xelatex %'<cr>", {})
vim.api.nvim_buf_set_keymap(0, "i", "<F5>", ":exec '!xelatex %'<cr>", {})
vim.api.nvim_buf_set_keymap(0, "v", "<F5>", ":exec '!xelatex %'<cr>", {})
vim.api.nvim_buf_set_keymap(0, "n", "<F6>", ":silent !zathura --fork %:r.pdf& <cr>", {})
vim.api.nvim_buf_set_keymap(0, "i", "<F6>", "<esc> :silent !zathura --fork %:r.pdf& <cr>", {})
vim.api.nvim_buf_set_keymap(0, "v", "<F6>", "<esc> :silent !zathura --fork %:r.pdf& <cr>", {})
end
})
-- Compile C
vim.api.nvim_create_autocmd("Filetype", {
pattern = "c",
callback = function()
vim.api.nvim_buf_set_keymap(0, "n", "<leader>c", ":exec '!gcc % -o %<'<cr>", {})
vim.api.nvim_buf_set_keymap(0, "n", "<F5>", ":exec '!gcc % -o %<'<cr>", {})
vim.api.nvim_buf_set_keymap(0, "i", "<F5>", ":exec '!gcc % -o %<'<cr>", {})
vim.api.nvim_buf_set_keymap(0, "v", "<F5>", ":exec '!gcc % -o %<'<cr>", {})
end
})
-- run Python
vim.api.nvim_create_autocmd("Filetype", {
pattern = "python",
callback = function()
vim.api.nvim_buf_set_keymap(0, "n", "<leader>c", ":exec '!python3 %'<cr>", {})
vim.api.nvim_buf_set_keymap(0, "n", "<F5>", ":exec '!python3 %'<cr>", {})
vim.api.nvim_buf_set_keymap(0, "i", "<F5>", ":exec '!python3 %'<cr>", {})
vim.api.nvim_buf_set_keymap(0, "v", "<F5>", ":exec '!python3 %'<cr>", {})
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
})

View file

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

View file

@ -0,0 +1,7 @@
require("pr073c70r.settings")
require("pr073c70r.remap")
require("pr073c70r.autocmd")
require("pr073c70r.statusline")
require("pr073c70r.colors")
require("pr073c70r.packer")

View file

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

View file

@ -0,0 +1,38 @@
-- remaps
-- leaderkey
vim.keymap.set("n", "<Space>", "", {})
vim.g.mapleader = " "
-- centering / decentering
vim.api.nvim_set_keymap("n", "<leader>ctr", "set scrolloff=999 <cr>", {})
vim.api.nvim_set_keymap("n", "<leader>uctr", "set scrolloff=0 <cr>", {})
-- movements in commandmode
vim.api.nvim_set_keymap("c", "<C-h>", "<Left>", {})
vim.api.nvim_set_keymap("c", "<C-l>", "<Right>", {})
vim.api.nvim_set_keymap("c", "<C-j>", "<Down>", {})
vim.api.nvim_set_keymap("c", "<C-k>", "<Up>", {})
-- split switching
vim.api.nvim_set_keymap("n", "<C-h>", "<C-w>h", {})
vim.api.nvim_set_keymap("n", "<C-j>", "<C-w>j", {})
vim.api.nvim_set_keymap("n", "<C-k>", "<C-w>k", {})
vim.api.nvim_set_keymap("n", "<C-l>", "<C-w>l", {})
-- moving visual blocks
vim.api.nvim_set_keymap("v", "J", ":m '>+1<cr>gv=gv", {})
vim.api.nvim_set_keymap("v", "K", ":m '<-2<cr>gv=gv", {})
-- delete without overwriting the '+'-register
vim.api.nvim_set_keymap("n", "<leader>d", "\"_d", {})
vim.api.nvim_set_keymap("v", "<leader>d", "\"_d", {})
-- copy to system clipboard
vim.api.nvim_set_keymap("n", "<leader>y", "\"+y", {})
vim.api.nvim_set_keymap("v", "<leader>y", "\"+y", {})
vim.api.nvim_set_keymap("n", "<leader>Y", "\"+Y", {})
-- paste from system clipboard
vim.api.nvim_set_keymap("n", "<leader>p", "\"+p", {})

View file

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

View file

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

View file

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