From f51cb50d6bce946a6b139b49ad952d85cfe823d1 Mon Sep 17 00:00:00 2001 From: DenebTM Date: Tue, 28 May 2024 20:42:24 +0200 Subject: [PATCH] initial commit --- .alias | 8 ++++ .bashrc | 44 +++++++++++++++++++ .clang-format | 5 +++ .gitignore | 2 + .gitmodules | 3 ++ .inputrc | 8 ++++ .profile | 33 ++++++++++++++ .tmux.conf | 6 +++ dotconfig/fish/config.fish | 12 ++++++ dotconfig/fish/fish_variables | 31 ++++++++++++++ dotconfig/fish/functions/mkcd.fish | 3 ++ dotconfig/fish/plugin-foreign-env | 1 + dotconfig/gdb/gdbinit | 3 ++ dotconfig/nvim/after/ftplugin/make.lua | 4 ++ dotconfig/nvim/after/ftplugin/tex.lua | 4 ++ dotconfig/nvim/init.lua | 1 + dotconfig/nvim/lua/modules/autocmd.lua | 20 +++++++++ dotconfig/nvim/lua/modules/init.lua | 9 ++++ dotconfig/nvim/lua/modules/keymap.lua | 3 ++ dotconfig/nvim/lua/modules/lsp.lua | 52 +++++++++++++++++++++++ dotconfig/nvim/lua/modules/plugged.lua | 12 ++++++ dotconfig/nvim/lua/modules/set.lua | 11 +++++ dotconfig/nvim/lua/modules/theme.lua | 12 ++++++ dotconfig/nvim/lua/modules/treesitter.lua | 24 +++++++++++ dotconfig/nvim/lua/modules/vimtex.lua | 14 ++++++ 25 files changed, 325 insertions(+) create mode 100644 .alias create mode 100644 .bashrc create mode 100644 .clang-format create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 .inputrc create mode 100644 .profile create mode 100644 .tmux.conf create mode 100644 dotconfig/fish/config.fish create mode 100644 dotconfig/fish/fish_variables create mode 100644 dotconfig/fish/functions/mkcd.fish create mode 160000 dotconfig/fish/plugin-foreign-env create mode 100644 dotconfig/gdb/gdbinit create mode 100644 dotconfig/nvim/after/ftplugin/make.lua create mode 100644 dotconfig/nvim/after/ftplugin/tex.lua create mode 100644 dotconfig/nvim/init.lua create mode 100644 dotconfig/nvim/lua/modules/autocmd.lua create mode 100644 dotconfig/nvim/lua/modules/init.lua create mode 100644 dotconfig/nvim/lua/modules/keymap.lua create mode 100644 dotconfig/nvim/lua/modules/lsp.lua create mode 100644 dotconfig/nvim/lua/modules/plugged.lua create mode 100644 dotconfig/nvim/lua/modules/set.lua create mode 100644 dotconfig/nvim/lua/modules/theme.lua create mode 100644 dotconfig/nvim/lua/modules/treesitter.lua create mode 100644 dotconfig/nvim/lua/modules/vimtex.lua diff --git a/.alias b/.alias new file mode 100644 index 0000000..9eae725 --- /dev/null +++ b/.alias @@ -0,0 +1,8 @@ +export EXA_COLORS="ur=0:uw=0:ux=0:ue=0:gr=0:gw=0:gx=0:tr=0:tw=0:tx=0:su=0:sf=0" +alias ls="eza --group-directories-first --group --binary" +alias diff=difft +alias du=dust +alias cat="bat --style=header" + +alias sd="sd -p" +alias feh="feh -." diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..fe18e79 --- /dev/null +++ b/.bashrc @@ -0,0 +1,44 @@ +# +# ~/.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# kdesrc-build ################################################################# + +## Add kdesrc-build to PATH +export PATH="/usr/bin:$PATH" + +## Autocomplete for kdesrc-run +function _comp_kdesrc_run +{ + local cur + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + + # Complete only the first argument + if [[ $COMP_CWORD != 1 ]]; then + return 0 + fi + + # Retrieve build modules through kdesrc-run + # If the exit status indicates failure, set the wordlist empty to avoid + # unrelated messages. + local modules + if ! modules=$(kdesrc-run --list-installed); + then + modules="" + fi + + # Return completions that match the current word + COMPREPLY=( $(compgen -W "${modules}" -- "$cur") ) + + return 0 +} + +## Register autocomplete function +complete -o nospace -F _comp_kdesrc_run kdesrc-run + +################################################################################ + diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..5c08c11 --- /dev/null +++ b/.clang-format @@ -0,0 +1,5 @@ +--- +TabWidth: '2' +UseTab: Never +IndentCaseLabels: true +ColumnLimit: 120 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ecfe174 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +nvim/plugged +**/.git diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5cd1e46 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "dotconfig/fish/plugin-foreign-env"] + path = dotconfig/fish/plugin-foreign-env + url = https://github.com/oh-my-fish/plugin-foreign-env diff --git a/.inputrc b/.inputrc new file mode 100644 index 0000000..0ff2af3 --- /dev/null +++ b/.inputrc @@ -0,0 +1,8 @@ +$include /etc/inputrc +set completion-ignore-case On +#"\C-h": backward-kill-word + +"\e[5~" history-search-backward +"\e[6~" history-search-forward +"\e[A" history-search-backward +"\e[B" history-search-forward diff --git a/.profile b/.profile new file mode 100644 index 0000000..09a53fd --- /dev/null +++ b/.profile @@ -0,0 +1,33 @@ +if [ -z "$DOTPROFILE_SOURCED" ]; then + + export DOTPROFILE_SOURCED=1 + + #export GTK_USE_PORTAL=1 this causes an issue with non-80/443 ports in Firefox + export MOZ_USE_XINPUT2=1 + export MOZ_X11_EGL=1 + #export MOZ_DISABLE_RDD_SANDBOX=1 + export SDL_VIDEO_ALLOW_SCREENSAVER=1 + + export GDK_BACKEND=$XDG_SESSION_TYPE + if [ "$XDG_SESSION_TYPE" == "wayland" ]; then + export MOZ_ENABLE_WAYLAND=1 + export QT_QPA_PLATFORM=wayland + fi + + # Disable PC speaker + #[[ $DISPLAY ]] && xset b off && + # Allow running graphical apps from Distrobox + #xhost +si:localuser:$USER + + export GHCUP_INSTALL_BASE_PREFIX=$HOME/.ghcup + [ -x $GHCUP_INSTALL_BASE_PREFIX/bin ] && PATH=$GHCUP_INSTALL_BASE_PREFIX/bin:$PATH || true + + [ -x $HOME/.yarn/bin ] && PATH=$HOME/.yarn/bin:$PATH || true + [ -x $HOME/.cargo/bin ] && PATH=$HOME/.cargo/bin:$PATH || true + #[ -x $HOME/.platformio/penv/bin ] && PATH=$HOME/.platformio/penv/bin:$PATH || true + + export PATH + + export GIT_EXTERNAL_DIFF=difft + +fi diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..86c4fe1 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,6 @@ +set -s escape-time 0 + +bind h select-pane -U +bind j select-pane -D +bind k select-pane -L +bind l select-pane -R diff --git a/dotconfig/fish/config.fish b/dotconfig/fish/config.fish new file mode 100644 index 0000000..c307d26 --- /dev/null +++ b/dotconfig/fish/config.fish @@ -0,0 +1,12 @@ +if status is-interactive + # Commands to run in interactive sessions can go here +end + +function fish_greeting +end + +source /etc/alias +source $HOME/.alias + +set fish_function_path $fish_function_path $HOME/.config/fish/plugin-foreign-env/functions +fenv source $HOME/.profile diff --git a/dotconfig/fish/fish_variables b/dotconfig/fish/fish_variables new file mode 100644 index 0000000..1a82b8a --- /dev/null +++ b/dotconfig/fish/fish_variables @@ -0,0 +1,31 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR __fish_initialized:3400 +SETUVAR fish_color_autosuggestion:555\x1ebrblack +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:blue +SETUVAR fish_color_comment:red +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:green +SETUVAR fish_color_error:brred +SETUVAR fish_color_escape:brcyan +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:brcyan +SETUVAR fish_color_param:cyan +SETUVAR fish_color_quote:yellow +SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold +SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_status:red +SETUVAR fish_color_user:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_key_bindings:fish_default_key_bindings +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di +SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR fish_pager_color_selected_background:\x2dr diff --git a/dotconfig/fish/functions/mkcd.fish b/dotconfig/fish/functions/mkcd.fish new file mode 100644 index 0000000..6f245a2 --- /dev/null +++ b/dotconfig/fish/functions/mkcd.fish @@ -0,0 +1,3 @@ +function mkcd +mkdir -p $argv[1] && cd $argv[1] +end diff --git a/dotconfig/fish/plugin-foreign-env b/dotconfig/fish/plugin-foreign-env new file mode 160000 index 0000000..7f0cf09 --- /dev/null +++ b/dotconfig/fish/plugin-foreign-env @@ -0,0 +1 @@ +Subproject commit 7f0cf099ae1e1e4ab38f46350ed6757d54471de7 diff --git a/dotconfig/gdb/gdbinit b/dotconfig/gdb/gdbinit new file mode 100644 index 0000000..593d988 --- /dev/null +++ b/dotconfig/gdb/gdbinit @@ -0,0 +1,3 @@ +set debuginfod enabled off +layout src +focus cmd diff --git a/dotconfig/nvim/after/ftplugin/make.lua b/dotconfig/nvim/after/ftplugin/make.lua new file mode 100644 index 0000000..1229572 --- /dev/null +++ b/dotconfig/nvim/after/ftplugin/make.lua @@ -0,0 +1,4 @@ +vim.opt_local.tabstop = 4 +vim.opt_local.softtabstop = 4 +vim.opt_local.shiftwidth = 4 +vim.opt_local.expandtab = false diff --git a/dotconfig/nvim/after/ftplugin/tex.lua b/dotconfig/nvim/after/ftplugin/tex.lua new file mode 100644 index 0000000..6c88187 --- /dev/null +++ b/dotconfig/nvim/after/ftplugin/tex.lua @@ -0,0 +1,4 @@ +vim.opt_local.textwidth = 80 +vim.opt_local.conceallevel = 2 +vim.g.tex_flavor = 'latex' +vim.g.tex_conceal = 'abdmg' diff --git a/dotconfig/nvim/init.lua b/dotconfig/nvim/init.lua new file mode 100644 index 0000000..f9a5fec --- /dev/null +++ b/dotconfig/nvim/init.lua @@ -0,0 +1 @@ +require('modules') diff --git a/dotconfig/nvim/lua/modules/autocmd.lua b/dotconfig/nvim/lua/modules/autocmd.lua new file mode 100644 index 0000000..cc5584c --- /dev/null +++ b/dotconfig/nvim/lua/modules/autocmd.lua @@ -0,0 +1,20 @@ +-- see :help restore-cursor and https://github.com/neovim/neovim/issues/16339#issuecomment-1457394370 +vim.api.nvim_create_autocmd('BufRead', { + callback = function(opts) + vim.api.nvim_create_autocmd('BufWinEnter', { + once = true, + buffer = opts.buf, + callback = function() + local ft = vim.bo[opts.buf].filetype + local last_known_line = vim.api.nvim_buf_get_mark(opts.buf, '"')[1] + if + not (ft:match('commit') and ft:match('rebase')) + and last_known_line > 1 + and last_known_line <= vim.api.nvim_buf_line_count(opts.buf) + then + vim.api.nvim_feedkeys([[g`"]], 'nx', false) + end + end, + }) + end, +}) diff --git a/dotconfig/nvim/lua/modules/init.lua b/dotconfig/nvim/lua/modules/init.lua new file mode 100644 index 0000000..dd441e0 --- /dev/null +++ b/dotconfig/nvim/lua/modules/init.lua @@ -0,0 +1,9 @@ +require('modules.plugged') + +require('modules.set') +require('modules.autocmd') +require('modules.theme') +require('modules.keymap') +require('modules.treesitter') +require('modules.lsp') +require('modules.vimtex') diff --git a/dotconfig/nvim/lua/modules/keymap.lua b/dotconfig/nvim/lua/modules/keymap.lua new file mode 100644 index 0000000..0882d14 --- /dev/null +++ b/dotconfig/nvim/lua/modules/keymap.lua @@ -0,0 +1,3 @@ +vim.keymap.set('v', '', '"+y') +vim.keymap.set('n', '', '"+p') +vim.keymap.set('i', '', '') diff --git a/dotconfig/nvim/lua/modules/lsp.lua b/dotconfig/nvim/lua/modules/lsp.lua new file mode 100644 index 0000000..a7b3efc --- /dev/null +++ b/dotconfig/nvim/lua/modules/lsp.lua @@ -0,0 +1,52 @@ +local lsp_zero = require('lsp-zero') +lsp_zero.on_attach(function(client, bufnr) + lsp_zero.default_keymaps({buffer = bufnr}) + + -- rename symbol + vim.keymap.set('', '', vim.lsp.buf.rename, {noremap = true}) + + -- tab completion + lsp_zero.extend_cmp() + local cmp = require('cmp') + cmp.setup({ + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.complete(), + + [''] = cmp.mapping( + function(fallback) + if cmp.visible() then + if #cmp.get_entries() == 1 then + cmp.confirm({ select = true }) + else + cmp.select_next_item() + end + else + fallback() + end + end, + { 'i', 's' } + ), + [''] = cmp.mapping.select_prev_item(), + + [''] = cmp.mapping.confirm({ select = true }), + -- [''] = cmp.mapping.abort(), + + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + }), + }) + + -- signature help + require('lsp_signature').setup({ floating_window_above_cur_line = true }) + + -- auto-format + -- vim.api.nvim_create_autocmd('BufWritePre', { + -- callback = vim.lsp.buf.format, + -- }) +end) + +local lsp_config = require('lspconfig') +lsp_config['clangd'].setup({}) +lsp_config['rust_analyzer'].setup({}) +lsp_config['texlab'].setup({}) +lsp_config['pylsp'].setup({}) diff --git a/dotconfig/nvim/lua/modules/plugged.lua b/dotconfig/nvim/lua/modules/plugged.lua new file mode 100644 index 0000000..cf180f5 --- /dev/null +++ b/dotconfig/nvim/lua/modules/plugged.lua @@ -0,0 +1,12 @@ +local Plug = vim.fn['plug#'] +vim.call('plug#begin') + Plug('christoomey/vim-tmux-navigator') + Plug('neovim/nvim-lspconfig') + Plug('hrsh7th/nvim-cmp') + Plug('hrsh7th/cmp-nvim-lsp') + Plug('L3MON4D3/LuaSnip') + Plug('VonHeikemen/lsp-zero.nvim', { ['branch'] = 'v3.x' }) + Plug('ray-x/lsp_signature.nvim') + Plug('lervag/vimtex') + Plug('nvim-treesitter/nvim-treesitter', { ['do'] = ':TSUpdate'}) +vim.call('plug#end') diff --git a/dotconfig/nvim/lua/modules/set.lua b/dotconfig/nvim/lua/modules/set.lua new file mode 100644 index 0000000..5bc73cd --- /dev/null +++ b/dotconfig/nvim/lua/modules/set.lua @@ -0,0 +1,11 @@ +vim.o.tabstop = 2 +vim.o.softtabstop = 2 +vim.o.shiftwidth = 2 +vim.o.expandtab = true +vim.o.autoindent = true +vim.o.smartindent = true +vim.o.number = true +vim.o.mouse = 'a' +-- this is default in neovim +-- vim.cmd('filetype plugin indent on') +-- vim.cmd('syntax on') diff --git a/dotconfig/nvim/lua/modules/theme.lua b/dotconfig/nvim/lua/modules/theme.lua new file mode 100644 index 0000000..3e08b00 --- /dev/null +++ b/dotconfig/nvim/lua/modules/theme.lua @@ -0,0 +1,12 @@ +-- why is this so dark by default anyway +vim.api.nvim_set_hl(0, 'Conceal', {}) +vim.api.nvim_set_hl(0, 'Normal', { + bg = 'NONE', + fg = 'NvimLightGrey2' +}) +vim.api.nvim_set_hl(0, 'LineNr', { + fg = 'NvimLightGrey4' +}) +vim.api.nvim_set_hl(0, 'NonText', { + fg = 'NvimLightGrey4' +}) diff --git a/dotconfig/nvim/lua/modules/treesitter.lua b/dotconfig/nvim/lua/modules/treesitter.lua new file mode 100644 index 0000000..c87c7d4 --- /dev/null +++ b/dotconfig/nvim/lua/modules/treesitter.lua @@ -0,0 +1,24 @@ +-- TODO: why does this cause errors +-- vim.api.nvim_create_autocmd('FileType', { +-- pattern = 'c,lua,python,rust,bash,js', +-- callback = vim.treesitter.start, +-- }) +-- -- TEMP: treesitter for cpp +-- vim.api.nvim_create_autocmd('FileType', { +-- pattern = 'cpp', +-- callback = function() +-- vim.treesitter.language.register('c', { 'cpp' }) +-- vim.treesitter.start() +-- end, +-- }) +-- TEMP: treesitter for vimscript +-- vim.api.nvim_create_autocmd('FileType', { +-- pattern = 'vim', +-- callback = function() +-- vim.treesitter.language.add('vim', +-- { path = '/home/deneb/git/tree-sitter-vim/libtree-sitter-vim.so' }) +-- vim.treesitter.start() +-- end, +-- }) + +require('nvim-treesitter.configs').setup({ highlight = { enable = true }}) diff --git a/dotconfig/nvim/lua/modules/vimtex.lua b/dotconfig/nvim/lua/modules/vimtex.lua new file mode 100644 index 0000000..93dacf2 --- /dev/null +++ b/dotconfig/nvim/lua/modules/vimtex.lua @@ -0,0 +1,14 @@ +vim.g.vimtex_view_method = 'general' +vim.g.vimtex_view_general_viewer = 'okular' +vim.g.vimtex_view_general_options = '--unique file:@pdf\\#src:@line@tex' +vim.g.vimtex_compiler_method = 'tectonic' +vim.g.vimtex_quickfix_mode = 0 +-- vim.g.vimtex_compiler_tectonic = { +-- [ 'options' ] = { +-- '--shell-escape', +-- '--verbose', +-- '--file-line-error', +-- '--synctex', +-- '--keep-logs' +-- }, +-- }