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