From 340bd3893f90cefa9d6c2f60364008cf7ca1c53c Mon Sep 17 00:00:00 2001 From: justanothercatgirl Date: Sun, 17 Dec 2023 13:59:21 +0300 Subject: added useful things treesitter: nvim ghauth: 2fa .bashrc: some exports --- .bashrc | 5 ++ .config/nvim/init.lua | 9 +-- .config/nvim/lazy-lock.json | 4 +- .config/nvim/lua/user/lsp/common.lua | 36 +++++++++-- .config/nvim/lua/user/lsp/rust.lua | 47 ++++++++------ .config/nvim/lua/user/lspinit.lua | 1 - .config/nvim/lua/user/plugins.lua | 14 ++++- .config/nvim/lua/user/snippets.lua | 18 ++++++ .config/nvim/lua/user/treesitter.lua | 20 ++++++ .local/bin/ghauth | 8 +++ .zshrc | 115 +++++++++++++++++++++++++++++++---- 11 files changed, 231 insertions(+), 46 deletions(-) create mode 100644 .config/nvim/lua/user/snippets.lua create mode 100644 .config/nvim/lua/user/treesitter.lua create mode 100755 .local/bin/ghauth diff --git a/.bashrc b/.bashrc index 6d68740..25d7ed8 100644 --- a/.bashrc +++ b/.bashrc @@ -11,6 +11,11 @@ alias whatsapp=whatsie alias lan="bash zerotierconnect.sh" alias python=/home/main/coding/py/venv/bin/python3 alias copy="xclip -selection clipboard" +alias ""="g++" +alias fucking=sudo +alias AAAAA=su +alias md=mkdir +export DRO=/mnt/D/root export c="/mnt/C" export d="/mnt/D" diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index f4fe98e..67190b4 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -2,10 +2,7 @@ require "user.beautiful" require "user.options" require "user.plugins" require "user.remaps" +require "user.lspinit" +require "user.treesitter" +-- autocmd to load lsp seems to break it --- require "user.lspinit" --- TODO: OPTIMIZE SO THAT IT LOADS ONLY THE FIRST TIME - -vim.api.nvim_exec([[ - autocmd InsertEnter * lua require 'user.lspinit' -]], false) diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index a335715..2ab507c 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,9 +1,10 @@ { "LuaSnip": { "branch": "master", "commit": "954c81b53989097faaff0fabc11c29575288c3e1" }, "awesome-vim-colorschemes": { "branch": "master", "commit": "4b2787b8894c4a70c42d15c2808d7cf278cb6abb" }, + "bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, @@ -19,6 +20,7 @@ "nvim-treesitter": { "branch": "master", "commit": "1b5bbb54b385c4eae217113f72df5284bc3cc94b" }, "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, + "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" }, "vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, diff --git a/.config/nvim/lua/user/lsp/common.lua b/.config/nvim/lua/user/lsp/common.lua index 7873752..1b1920c 100644 --- a/.config/nvim/lua/user/lsp/common.lua +++ b/.config/nvim/lua/user/lsp/common.lua @@ -1,5 +1,32 @@ -- this file contains setup for snippets and common LSP options +-- nvim diagnostics setup + +local define_sign = function(options) + vim.fn.sign_define(options.name, { texthl = options.name, text = options.textm, numhl = '' }) +end + +define_sign({name = "DiagnosticSignError", text = ''}) +define_sign({name = "DiagnosticSignWarn", text = ''}) +define_sign({name = "DiagnosticSignHint", text = ''}) +define_sign({name = "DiagnosticSignInfo", text = ''}) + +vim.diagnostic.config{ + virtual_text = true, + signs = true, + update_in_insert = false, + underline = true, + severity_sort = true, + float = { + source = 'always', + }, +} + +vim.cmd[[ +set signcolumn=yes +autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) +]] + -- WHY THE FUCK DID THE PROTECTED CALL SOLVE THE ISSUE UGH local cmp_status, cmp = pcall(require, 'cmp') if not cmp_status then @@ -8,7 +35,8 @@ if not cmp_status then end autopairs_cmp = require 'nvim-autopairs.completion.cmp' luasnip = require 'luasnip' -luasnip.setup() +-- require 'user.snippets' +-- luasnip.setup() local expnoresilent = {expr = true, noremap = true, silent = true} local noresilent = {noremap = true, silent = true} @@ -44,8 +72,6 @@ local supertabforward = function(fallback) cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() - -- elseif stolen_function() then - -- cmp.complete() else fallback() end @@ -80,8 +106,8 @@ cmp.setup { }, [""] = map(supertabforward, inselect), [""] = map(supertabbackward, inselect), - [""] = map(supertabforward, inselect), - [""] = map(supertabbackward, inselect), + [""] = map.scroll_docs(2), + [""] = map.scroll_docs(-2), [""] = map(superenterconfirm, inselect), [""] = map(function(fallback) if cmp.visible() then diff --git a/.config/nvim/lua/user/lsp/rust.lua b/.config/nvim/lua/user/lsp/rust.lua index def29af..41cb03c 100644 --- a/.config/nvim/lua/user/lsp/rust.lua +++ b/.config/nvim/lua/user/lsp/rust.lua @@ -1,24 +1,35 @@ -lsp = require 'lspconfig' +local lsp = require 'lspconfig' +local rust = require 'rust-tools' -vim.cmd [[ - autocmd FileType rust highlight link rustLifetime SpecialComment -]] +-- vim.cmd [[ +-- autocmd FileType rust highlight link rustLifetime SpecialComment +-- ]] -vim.cmd [[ - autocmd FileType rust setlocal inccommand=nosplit -]] +-- vim.cmd [[ +-- autocmd FileType rust setlocal inccommand=nosplit +-- ]] -lsp.rust_analyzer.setup{ - cmd = {"rust-analyzer"}, - filetypes = {"rust", "rs"}, - root_dir = lsp.util.root_pattern("Cargo.toml"), - -- fucking magic - capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()), - settings = { - ["rust-analyzer"] = { - disgnostics = { enable = true }, - inlayHints = { typeHints = true }, - }, +-- lsp.rust_analyzer.setup{ +-- cmd = {"rust-analyzer"}, +-- filetypes = {"rust", "rs"}, +-- root_dir = lsp.util.root_pattern("Cargo.toml"), +-- -- fucking magic +-- capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()), +-- settings = { +-- ["rust-analyzer"] = { +-- disgnostics = { enable = true }, +-- inlayHints = { typeHints = true }, +-- }, +-- }, +-- } + +rust.setup{ + server = { + on_attach = function(_, bufnr) + vim.keymap.set("n", " ", rust.hover_actions.hover_actions, { buffer = bufnr }) + vim.keymap.set("n", "a", rust.code_action_group.code_action_group, { buffer = bufnr }) + end, }, } + diff --git a/.config/nvim/lua/user/lspinit.lua b/.config/nvim/lua/user/lspinit.lua index 61f203b..4a75ec2 100644 --- a/.config/nvim/lua/user/lspinit.lua +++ b/.config/nvim/lua/user/lspinit.lua @@ -1,4 +1,3 @@ - require'nvim-autopairs'.setup{} require 'user.lsp.common' require 'user.lsp.haskell' diff --git a/.config/nvim/lua/user/plugins.lua b/.config/nvim/lua/user/plugins.lua index 57fcef1..da0d366 100644 --- a/.config/nvim/lua/user/plugins.lua +++ b/.config/nvim/lua/user/plugins.lua @@ -34,6 +34,9 @@ plugins = { "neovim/nvim-lspconfig", -- LSP configuration event = { "InsertEnter" }, }, + { + "simrat39/rust-tools.nvim", + }, -- { "hrsh7th/vim-vsnip" }, -- snippet engine @@ -87,7 +90,12 @@ plugins = { require('crates').setup() end, }, - + { + 'akinsho/bufferline.nvim', -- tab & buffer line + version = "*", + -- dependencies = 'nvim-tree/nvim-web-devicons' + -- for more details on how to configure this plugin in details please see `:h bufferline-configuration` + }, --{ "lvimuser/lsp-inlayhints.nvim" } -- saved for the better times } @@ -115,6 +123,8 @@ vim.opt.rtp:prepend(lazypath) -- initialization lazy = require("lazy") lazy.setup(plugins, opts) --- lazy.load('nerdtree') + +-- miscellanous plugin setup +require('bufferline').setup{} diff --git a/.config/nvim/lua/user/snippets.lua b/.config/nvim/lua/user/snippets.lua new file mode 100644 index 0000000..d1b3090 --- /dev/null +++ b/.config/nvim/lua/user/snippets.lua @@ -0,0 +1,18 @@ +local luasnip = require 'luasnip' + +local text = luasnip.text_node +local snip = luasnip.snippet + +-- local snippets = { +-- rust = { +-- constant_string = snip({ +-- trig = "pubconst", +-- namr = "define a string constant", +-- dscr = "I am too lazy", +-- }, +-- text { "pub const ${1:name}: &str = \"${2:text}\";", } +-- ) +-- }, +-- } + +luasnip.add_snippets(snippets) diff --git a/.config/nvim/lua/user/treesitter.lua b/.config/nvim/lua/user/treesitter.lua new file mode 100644 index 0000000..b98311f --- /dev/null +++ b/.config/nvim/lua/user/treesitter.lua @@ -0,0 +1,20 @@ +--! tree-sitter configuration + + +local ts = require 'nvim-treesitter' +local tsc = require 'nvim-treesitter.configs' + +tsc.setup{ + ensure_installed = { "rust" }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = true, ---------------------- + }, + ident = { enable = true }, + rainbow = { + enable = true, + extended_mode = true, + max_file_lines = 1024, + }, +} diff --git a/.local/bin/ghauth b/.local/bin/ghauth new file mode 100755 index 0000000..15f39a1 --- /dev/null +++ b/.local/bin/ghauth @@ -0,0 +1,8 @@ +#/bin/bash + +[[ "x${TERMUX_VERSION}" == "x" ]] && PIPE_CMD='xclip -selection clipboard' || PIPE_CMD='cat -' + +gpg --pinentry-mode loopback --decrypt --quiet "${HOME}/.2fa/justanothercatgirl@github.com/.key" | oathtool --totp -b - | ${PIPE_CMD} + + + diff --git a/.zshrc b/.zshrc index b8aa4cc..90c61c2 100644 --- a/.zshrc +++ b/.zshrc @@ -1,13 +1,102 @@ -# Lines configured by zsh-newuser-install -HISTFILE=~/.histfile -HISTSIZE=1000 -SAVEHIST=1000 -setopt autocd -bindkey -e -# End of lines configured by zsh-newuser-install -# The following lines were added by compinstall -zstyle :compinstall filename '/home/main/.zshrc' - -autoload -Uz compinit -compinit -# End of lines added by compinstall +# If you come from bash you might have to change your $PATH. +export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="$HOME/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +ZSH_THEME="robbyrussell" +# ZSH_THEME="random" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment one of the following lines to change the auto-update behavior +# zstyle ':omz:update' mode disabled # disable automatic updates +# zstyle ':omz:update' mode auto # update automatically without asking +# zstyle ':omz:update' mode reminder # just remind me to update when it's time + +# Uncomment the following line to change how often to auto-update (in days). +# zstyle ':omz:update' frequency 13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# You can also set it to another string to have that shown instead of the default red dots. +# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" +# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git) + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" -- cgit v1.2.3-70-g09d2