diff --git a/.bashrc b/.bashrc index a83d00c..fb2dd1c 100644 --- a/.bashrc +++ b/.bashrc @@ -24,7 +24,7 @@ alias gc='git commit' alias gp='git pull' alias gP='git push' -alias nvcfg='nvim ~/.config/nvim/init.vim' +alias nvcfg='nvim ~/.config/nvim/init.lua' @@ -42,53 +42,86 @@ vicd () { cd "$dst" } -if command -v rpg-cli &> /dev/null -then - PS1='\[\e[1;97m\][\[\e[0;93m\]\u\[\e[0;36m\]@\[\e[0;33m\]\h\[\e[1;97m\]](\[\e[0;34m\]\W\[\e[1;97m\])\n$(CLICOLOR_FORCE=1 rpg-cli stat -q | sed -r "s/@.*//" | sed "s/\\x1b\\[0m/\x1b[0;97m/g" | sed -r "s/(\\x1B\\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK])/\[\1\]/g" )\[\e[0;33m\]\$\[\e[m\] ' - alias rpg-battle="rpg-cli cd -f . && rpg-cli battle" - - alias rm="rpg-battle && rm" - alias rmdir="rpg-battle && rmdir" - alias mkdir="rpg-battle && mkdir" - alias touch="rpg-battle && touch" - alias mv="rpg-battle && mv" - alias cp="rpg-battle && cp" - alias chown="rpg-battle && chown" - alias chmod="rpg-battle && chmod" - - bcd () { - builtin cd "$@" - command ls --color=auto - if [[ $PWD == ~ ]] ; then - rpg-cli cd -f ~ - else - rpg-cli cd -f . - rpg-cli battle --bribe - fi - } - - cd () { - builtin cd "$@" - command ls --color=auto - if [[ $PWD == ~ ]] ; then - rpg-cli cd -f ~ - else - rpg-cli cd -f . - rpg-cli battle - fi - } - - ls () { - command ls --color=auto "$@" - if [ $# -eq 0 ] ; then - rpg-cli cd -f . - rpg-cli ls - fi - } -else - PS1='[\u@\h \W]\$ ' +# ---- Color definitions ---- +RESET='\[\e[m\]' + +WHITE='\[\e[1;97m\]' +YELLOW='\[\e[0;93m\]' +CYAN='\[\e[0;36m\]' +ORANGE='\[\e[0;33m\]' +BLUE='\[\e[0;34m\]' +RED='\[\e[0;31m\]' + +# ---- OSC133 support ---- +# Command start marker (before each command) +PS0+='\e]133;C\e\\' + +# Capture last exit status and send OSC 133 ;D +__pc_osc133() { + LAST_STATUS=$? # store exit status natively + printf '\e]133;D;%s\e\\' "$__LAST_STATUS" +} + +# Prepend our function to PROMPT_COMMAND +if [[ ":$PROMPT_COMMAND:" != *":__pc_osc133:"* ]]; then + PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }__pc_osc133 fi +# Dynamic PS1 using native variable +PS1="\[\e]133;A\a\]${WHITE}[${YELLOW}\u${CYAN}@${ORANGE}\h${WHITE}](${BLUE}\W${WHITE})]"\ +'$(if (( LAST_STATUS == 0 )); then echo "'${ORANGE}\$${RESET}'"; else echo "'${RED}\$${RESET}'"; fi)'\ +"\[\e]133;B\a\] " + +# if command -v rpg-cli &> /dev/null +# then +# +# PS1="\[\e]133;A\a\]${WHITE}[${YELLOW}\u${CYAN}@${ORANGE}\h${WHITE}](${BLUE}\W${WHITE})]\n"\ +# '$(CLICOLOR_FORCE=1 rpg-cli stat -q 2>/dev/null | sed -r "s/@.*//" | sed "s/\\x1B\\[0m/\\x1B[0;97m/g" | sed -r "s/(\\x1B\\[[0-9;]{1,6}[mGK])/\\\\[\\1\\\\]/g")'\ +# '$(if (( LAST_STATUS == 0 )); then echo "'${ORANGE}\$${RESET}'"; else echo "'${RED}\$${RESET}'"; fi)'\ +# "\[\e]133;B\a\] " +# +# alias rpg-battle="rpg-cli cd -f . && rpg-cli battle" +# +# alias rm="rpg-battle && rm" +# alias rmdir="rpg-battle && rmdir" +# alias mkdir="rpg-battle && mkdir" +# alias touch="rpg-battle && touch" +# alias mv="rpg-battle && mv" +# alias cp="rpg-battle && cp" +# alias chown="rpg-battle && chown" +# alias chmod="rpg-battle && chmod" +# +# bcd () { +# builtin cd "$@" +# command ls --color=auto +# if [[ $PWD == ~ ]] ; then +# rpg-cli cd -f ~ +# else +# rpg-cli cd -f . +# rpg-cli battle --bribe +# fi +# } +# +# cd () { +# builtin cd "$@" +# command ls --color=auto +# if [[ $PWD == ~ ]] ; then +# rpg-cli cd -f ~ +# else +# rpg-cli cd -f . +# rpg-cli battle +# fi +# } +# +# ls () { +# command ls --color=auto "$@" +# if [ $# -eq 0 ] ; then +# rpg-cli cd -f . +# rpg-cli ls +# fi +# } +# fi + bind '"\e[A": history-search-backward' bind '"\e[B": history-search-forward' @@ -97,6 +130,7 @@ complete -cf sudo export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.elan/bin:$PATH" export PATH="$HOME/.cargo/bin:$PATH" +systemctl --user import-environment PATH #case $TERM in # rxvt|*term|st*) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..9ab3587 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,360 @@ +vim.pack.add({ + { src = "https://github.com/zoomiti/firewatch" }, + { src = "https://github.com/echasnovski/mini.pick" }, + { src = "https://github.com/neovim/nvim-lspconfig" }, + { src = "https://github.com/mrcjkb/rustaceanvim" }, + { src = 'https://github.com/folke/which-key.nvim' }, + { src = 'https://github.com/LunarWatcher/auto-pairs' }, + { src = 'https://github.com/tpope/vim-fugitive' }, + { src = 'https://github.com/airblade/vim-gitgutter' }, + { src = 'https://github.com/nvim-treesitter/nvim-treesitter' }, + { src = 'https://github.com/rayliwell/tree-sitter-rstml' }, + { src = 'https://github.com/Saghen/blink.cmp' } +}) + +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = false +vim.opt.signcolumn = 'yes' +vim.opt.smartindent = true +vim.opt.title = true +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.laststatus = 3 +vim.g.completeopt = { 'menu', 'menuone', 'noselect', 'noinsert' } +vim.g.encoding = 'utf-8' +-- vim.opt.hidden = true + +vim.opt.conceallevel = 2 +vim.opt.concealcursor = 'n' + +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +vim.keymap.set("x", "/", "/\\%V", { desc = 'Search forward within visual selection' }) +vim.keymap.set("x", "?", "?\\%V", { desc = 'Search forward within visual selection' }) + +require "mini.pick".setup() +vim.keymap.set('n', 'b', 'Pick buffers', { desc = "Buffers" }) +vim.keymap.set('n', 'f', 'Pick files') + +vim.keymap.set('n', 's', + 'update ~/.config/nvim/init.luasource ~/.config/nvim/init.lua', { desc = "Update Config" }) +vim.keymap.set('n', 'w', 'write', { desc = "Write File" }) + +-- Terminal Mode +vim.keymap.set('t', '', '') +vim.keymap.set('t', 'h', 'h') +vim.keymap.set('t', 'j', 'j') +vim.keymap.set('t', 'k', 'k') +vim.keymap.set('t', 'l', 'l') +vim.keymap.set('t', '', '') +vim.keymap.set('t', '', '') +vim.keymap.set('t', '', '') +vim.keymap.set('t', '', '') +vim.api.nvim_create_autocmd('BufEnter', { pattern = 'term://*', command = 'startinsert' }) +vim.api.nvim_create_autocmd('BufEnter', { + pattern = 'term://*', + callback = function(args) + vim.keymap.set('n', '', 'i', { buffer = args.buf }) + end +}) + +-- Colorscheme +vim.opt.termguicolors = true +vim.g.dark_transp_bg = 1 +vim.cmd("colorscheme fire") + +-- LSP +vim.keymap.set('n', 'grd', vim.lsp.buf.definition, { desc = "vim.lsp.buf.definition" }) +vim.keymap.set({ 'n', 'v', 'x' }, 'grf', vim.lsp.buf.format, { desc = "LSP Format" }) +vim.lsp.inlay_hint.enable(true) +vim.g.c_syntax_for_h = 1 +require('blink.cmp').setup({ + signature = { enabled = true } +}) +vim.lsp.enable({ 'lua_ls', 'ccls' }) +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if not client then return end + + if client:supports_method('textDocument/formatting', args.buf) then + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = args.buf, + callback = function() + vim.lsp.buf.format({ bufnr = args.buf, id = client.id }) + end + }) + end + end +}) +vim.diagnostic.config({ + jump = { + virtual_lines = true + }, + virtual_text = { + prefix = '■', + source = true, + }, + severity_sort = true, + float = { + source = "if_many" + }, + virtual_lines = { + source = "if_many", + current_line = true, + } +}) + + + +-- Fugitive +vim.keymap.set('n', 'gs', 'G', { desc = "Git Status" }) +vim.keymap.set('n', 'gp', 'G pull', { desc = "Git Pull" }) +vim.keymap.set('n', 'gP', 'G push', { desc = "Git Push" }) +vim.keymap.set('n', 'gP', 'G push', { desc = "Git Push" }) + +local wk = require "which-key" +wk.add({ + { "g", group = "git" }, +}) + +local statusline = { + '%{%v:lua.StatuslineHighlight("Left")%}', + '%{v:lua.StatuslineMode()}', + '%{%v:lua.StatuslineHighlight("Secondary")%}', + '%{v:lua.StatuslineBranch()}', + ' %{v:lua.StatuslineFilename()} ', + '%{%v:lua.StatuslineReadOnly()%}', + '%m', + '%{%v:lua.StatuslineHighlight("Middle")%}', + '%=', + ' ', + '%{&ff}', -- File Format + ' | ', + '%{&fenc!=#""?&fenc:&enc}', -- File Encoding + ' | ', + '%{&ft!=#""?&ft:"no ft"}', -- File Type + ' ', + '%{%v:lua.StatuslineHighlight("Secondary")%}', + ' ', + '%3p%%', -- Percent + ' ', + '%{%v:lua.StatuslineHighlight("Right")%}', + ' ', + '%3l:%-2c', -- Line Info + ' ', +} + +local mode_map = { + ['n'] = 'NORMAL', + ['no'] = 'O-PENDING', + ['nov'] = 'O-PENDING', + ['noV'] = 'O-PENDING', + ['no\22'] = 'O-PENDING', + ['niI'] = 'NORMAL', + ['niR'] = 'NORMAL', + ['niV'] = 'NORMAL', + ['nt'] = 'NORMAL', + ['v'] = 'VISUAL', + ['vs'] = 'VISUAL', + ['V'] = 'V-LINE', + ['Vs'] = 'V-LINE', + ['\22'] = 'V-BLOCK', + ['\22s'] = 'V-BLOCK', + ['s'] = 'SELECT', + ['S'] = 'S-LINE', + ['\19'] = 'S-BLOCK', + ['i'] = 'INSERT', + ['ic'] = 'INSERT', + ['ix'] = 'INSERT', + ['R'] = 'REPLACE', + ['Rc'] = 'REPLACE', + ['Rx'] = 'REPLACE', + ['Rv'] = 'V-REPLACE', + ['Rvc'] = 'V-REPLACE', + ['Rvx'] = 'V-REPLACE', + ['c'] = 'COMMAND', + ['cv'] = 'EX', + ['ce'] = 'EX', + ['r'] = 'REPLACE', + ['rm'] = 'MORE', + ['r?'] = 'CONFIRM', + ['!'] = 'SHELL', + ['t'] = 'TERMINAL', +} + +local mode_map_hi = { + ['n'] = 'NORMAL', + ['no'] = 'NORMAL', + ['nov'] = 'NORMAL', + ['noV'] = 'NORMAL', + ['no\22'] = 'NORMAL', + ['niI'] = 'NORMAL', + ['niR'] = 'NORMAL', + ['niV'] = 'NORMAL', + ['nt'] = 'NORMAL', + ['v'] = 'VISUAL', + ['vs'] = 'VISUAL', + ['V'] = 'VISUAL', + ['Vs'] = 'VISUAL', + ['\22'] = 'VISUAL', + ['\22s'] = 'VISUAL', + ['s'] = 'VISUAL', + ['S'] = 'VISUAL', + ['\19'] = 'VISUAL', + ['i'] = 'INSERT', + ['ic'] = 'INSERT', + ['ix'] = 'INSERT', + ['R'] = 'REPLACE', + ['Rc'] = 'REPLACE', + ['Rx'] = 'REPLACE', + ['Rv'] = 'REPLACE', + ['Rvc'] = 'REPLACE', + ['Rvx'] = 'REPLACE', + ['c'] = 'NORMAL', + ['cv'] = 'NORMAL', + ['ce'] = 'NORMAL', + ['r'] = 'REPLACE', + ['rm'] = 'REPLACE', + ['r?'] = 'REPLACE', + ['!'] = 'TERMINAL', + ['t'] = 'TERMINAL', +} + +local fmt = string.format + +vim.cmd [[ + hi StatusLine_NORMAL_Left guifg=#c8c6c5 guibg=#2e2828 gui=BOLD cterm=NONE + hi StatusLine_NORMAL_Right guifg=#c8c6c5 guibg=#2e2828 gui=NONE cterm=NONE + hi StatusLine_NORMAL_Secondary guifg=#807970 guibg=#423838 gui=NONE cterm=NONE + hi StatusLine_NORMAL_Middle guifg=#423838 guibg=#807970 gui=NONE cterm=NONE + + hi StatusLine_VISUAL_Left guifg=#8c9440 guibg=#2e2828 gui=BOLD cterm=NONE + hi StatusLine_VISUAL_Right guifg=#8c9440 guibg=#2e2828 gui=NONE cterm=NONE + hi StatusLine_VISUAL_Secondary guifg=#807970 guibg=#423838 gui=NONE cterm=NONE + hi StatusLine_VISUAL_Middle guifg=#423838 guibg=#c8c6c5 gui=NONE cterm=NONE + + hi StatusLine_INSERT_Left guifg=#f0b94e guibg=#2e2828 gui=BOLD cterm=NONE + hi StatusLine_INSERT_Right guifg=#f0b94e guibg=#2e2828 gui=NONE cterm=NONE + hi StatusLine_INSERT_Middle guifg=#423838 guibg=#c8c6c5 gui=NONE cterm=NONE + hi StatusLine_INSERT_Secondary guifg=#423838 guibg=#807970 gui=NONE cterm=NONE + + hi StatusLine_REPLACE_Left guifg=#de803f guibg=#2e2828 gui=BOLD cterm=NONE + hi StatusLine_REPLACE_Right guifg=#de803f guibg=#2e2828 gui=NONE cterm=NONE + hi StatusLine_REPLACE_Middle guifg=#423838 guibg=#c8c6c5 gui=NONE cterm=NONE + hi StatusLine_REPLACE_Secondary guifg=#423838 guibg=#807970 gui=NONE cterm=NONE + + hi StatusLine_TERMINAL_Left guifg=#8abeb7 guibg=#2e2828 gui=BOLD cterm=NONE + hi StatusLine_TERMINAL_Right guifg=#8abeb7 guibg=#2e2828 gui=NONE cterm=NONE + hi StatusLine_TERMINAL_Secondary guifg=#807970 guibg=#423838 gui=NONE cterm=NONE + hi StatusLine_TERMINAL_Middle guifg=#423838 guibg=#807970 gui=NONE cterm=NONE +]] + + +function StatuslineHighlight(part) + local mode = vim.api.nvim_get_mode().mode + local mode_name = mode_map_hi[mode] or mode + return fmt('%%#StatusLine_%s_%s#', mode_name, part) +end + +function StatuslineMode() + local mode = vim.api.nvim_get_mode().mode + local mode_name = mode_map[mode] or mode + return fmt(' %s ', mode_name) +end + +function SpecialBuffer() + local pattern = '\v(help|fugitive|qf|Trouble)' + return string.match(pattern, vim.bo.filetype) ~= nil and true or false +end + +function StatuslineReadOnly() + return SpecialBuffer() and '' or '%r' +end + +function StatuslineBranch() + local head = vim.fn.FugitiveHead() + return SpecialBuffer() ~= true and head ~= '' and fmt(' %s |', head) or '' +end + +function StatuslineFilename() + local special_files = { + ['help'] = "Help", + ['qf'] = 'QuickFix', + ['fugitive'] = vim.fn.FugitiveStatusline() + } + + local filename = vim.fn.expand('%:t') + + return special_files[vim.bo.filetype] or filename == "" and '[No Name]' or filename +end + +vim.opt.statusline = table.concat(statusline, '') + +require 'nvim-treesitter.configs'.setup { + ensure_installed = { "c", "lua" }, + --ensure_installed = {}, + sync_install = false, + auto_install = false, + ignore_install = { "javascript" }, + highlight = { enable = true }, + indent = { enable = true }, +} + +require("tree-sitter-rstml").setup() + +local function create_floating_window(opts) + opts = opts or {} + local width = opts.width or math.floor(vim.o.columns * 0.8) + local height = opts.height or math.floor(vim.o.lines * 0.8) + + local col = math.floor((vim.o.columns - width) / 2) + local row = math.floor((vim.o.lines - height) / 2) + + local buf = nil + if vim.api.nvim_buf_is_valid(opts.buf) then + buf = opts.buf + else + buf = vim.api.nvim_create_buf(false, true) + end + + local win_config = { + relative = "editor", + width = width, + height = height, + col = col, + row = row, + style = "minimal", + border = "single" + } + + local win = vim.api.nvim_open_win(buf, true, win_config) + + return { buf = buf, win = win } +end + +local floaterm_state = { + floating = { + buf = -1, + win = -1, + } +} + +local toggle_terminal = function() + if not vim.api.nvim_win_is_valid(floaterm_state.floating.win) then + floaterm_state.floating = create_floating_window({ buf = floaterm_state.floating.buf }) + if vim.bo[floaterm_state.floating.buf].buftype ~= "terminal" then + vim.cmd.terminal() + vim.cmd.startinsert() + end + else + vim.api.nvim_win_hide(floaterm_state.floating.win) + end +end + +vim.api.nvim_create_user_command("Floaterminal", toggle_terminal, { desc = "Toggles a floating terminal" }) +vim.keymap.set({ "n", "t" }, "t", toggle_terminal, { desc = "Toggles a floating terminal" }) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim deleted file mode 100644 index 4193a1b..0000000 --- a/.config/nvim/init.vim +++ /dev/null @@ -1,665 +0,0 @@ -" Plugged setup {{{ -let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' -if empty(glob(data_dir . '/autoload/plug.vim')) - silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC -endif - -call plug#begin() -" auto pairs -Plug 'LunarWatcher/auto-pairs' - -" Lightline -Plug 'itchyny/lightline.vim' - -" CSS-Color -Plug 'ap/vim-css-color' - -"Surround -Plug 'tpope/vim-surround' -Plug 'tpope/vim-repeat' - -" For snippets -Plug 'SirVer/ultisnips' - -" Vifm replacing netrw -Plug 'vifm/vifm.vim' - -" Git nuff said -Plug 'tpope/vim-fugitive' -Plug 'airblade/vim-gitgutter' - -" Latex -Plug 'lervag/vimtex' - -" Rust -if has("nvim") - Plug 'mrcjkb/rustaceanvim' - Plug 'rayliwell/nvim-ts-autotag' -else - Plug 'rust-lang/rust.vim' - let g:rustfmt_autosave = 1 -endif - -" Markdown -Plug 'preservim/vim-markdown' - -" Table mode -Plug 'dhruvasagar/vim-table-mode' - -" Color schemes -Plug 'zoomiti/firewatch' -Plug 'sonph/onehalf', { 'rtp': 'vim' } -Plug 'sjl/badwolf' -if !has("nvim") - Plug 'lifepillar/vim-colortemplate' -endif - -if has("nvim") -" Neoconf -Plug 'folke/neoconf.nvim' - -" LSP -Plug 'neovim/nvim-lspconfig' - -Plug 'andythigpen/nvim-coverage' - -" Cmp -Plug 'hrsh7th/nvim-cmp' -Plug 'hrsh7th/cmp-nvim-lsp' -Plug 'hrsh7th/cmp-nvim-lsp-signature-help' -Plug 'hrsh7th/cmp-path' -Plug 'hrsh7th/cmp-buffer' -Plug 'hrsh7th/cmp-nvim-lua' -Plug 'petertriho/cmp-git' -Plug 'f3fora/cmp-spell' -" Plug 'hrsh7th/cmp-copilot' -Plug 'onsails/lspkind.nvim' -Plug 'quangnguyen30192/cmp-nvim-ultisnips' - -" Diagnostics -Plug 'folke/trouble.nvim' - -" Telescope -Plug 'nvim-telescope/telescope.nvim' -Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } -Plug 'nvim-telescope/telescope-ui-select.nvim' -Plug 'nvim-neorg/neorg-telescope' -Plug 'kyazdani42/nvim-web-devicons' - -" Debugging -Plug 'mfussenegger/nvim-dap' - -" Lean requires nvim -" Plug 'Julian/lean.nvim' -Plug 'nvim-lua/plenary.nvim' -Plug 'andrewradev/switch.vim' " For Lean switch support -Plug 'norcalli/nvim-colorizer.lua' " For colorizing - -" Tree sitter -Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} -Plug 'lewis6991/spellsitter.nvim' -Plug 'rayliwell/tree-sitter-rstml' - -" Neorg -Plug 'nvim-neorg/neorg' - -" Copilot -" Plug 'github/copilot.vim' - -Plug 'folke/which-key.nvim' -endif - -call plug#end() -" }}} - -" Vim Config {{{ - -set encoding=utf-8 - -set completeopt=menu,menuone,noselect,noinsert - -syntax on - -" Uncomment the following to have Vim jump to the last position when -" reopening a file -au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif - - -" Uncomment the following to have Vim load indentation rules and plugins -" according to the detected filetype. -filetype plugin indent on -" show existing tab with 4 spaces width" -set tabstop=4 -" when indenting with '>', use 4 spaces width" -set shiftwidth=4 -" On pressing tab, insert 4 spaces" -"set expandtab - -" The following are commented out as they cause vim to behave a lot -" differently from regular Vi. They are highly recommended though. -"set showcmd " Show (partial) command in status line. -set showmatch " Show matching brackets. -"set ignorecase " Do case insensitive matching -set smartcase " Do smart case matching -set incsearch " Incremental search -set autowrite " Automatically save before commands like :next and :make -set hidden " Hide buffers when they are abandoned -set mouse=a " Enable mouse usage (all modes) -set mousemodel=popup -set number " Enable line numbers -set relativenumber " Enable relative line numbers -set title " Changes terminal title when started -set scrolloff=15 - -" Vim remaps {{{ -nnoremap -let mapleader=" " -let maplocalleader=" " -nnoremap :nohl -if has('nvim') - nnoremap b Telescope buffers - nnoremap lua require("telescope.builtin").current_buffer_fuzzy_find(require('telescope.themes').get_ivy()) - nnoremap f Telescope find_files - nnoremap p Telescope git_files - nnoremap t bel 15sp \| termstartinsert -else - nnoremap b ls:b - nnoremap s ls:sb - nnoremap t bel term -endif - - -noremap ; l -noremap l k -noremap k j -noremap j h -noremap h ; - -nnoremap [q :cprev -nnoremap ]q :cnext - -noremap j h -noremap k j -noremap l k -noremap ; l - -" Terminal Settings -if has("nvim") - " Enter terminal-mode automatically - " autocmd TermOpen * startinsert - autocmd BufEnter term://* startinsert - " Disable line numbers on terminals - autocmd TermOpen * :setlocal nonumber norelativenumber - " allows you to use Ctrl-c on terminal window - autocmd TermOpen * nnoremap i - " Allows for esc to leave insert mode - tnoremap - " Allows for window navigation - tnoremap - tnoremap - tnoremap j h - tnoremap k j - tnoremap l k - tnoremap ; l - tnoremap - tnoremap - tnoremap - tnoremap -endif - -" }}} - -" }}} - -" Colors {{{ -if has('termguicolors') - if &term =~ 'alacritty' - set t_8f=[38;2;%lu;%lu;%lum - set t_8b=[48;2;%lu;%lu;%lum - endif - set termguicolors -endif -let g:dark_transp_bg = 1 -" Deprecated becase of last line -" if has('nvim') -" au ColorScheme * hi Normal ctermbg=none guibg=none|hi LineNr guibg=none ctermbg=none|hi Folded guibg=none ctermbg=none|hi NonText guibg=none ctermbg=none|hi SpecialKey guibg=none ctermbg=none|hi VertSplit guibg=none ctermbg=none|hi SignColumn guibg=none ctermbg=none|hi EndOfBuffer guibg=none ctermbg=none -" endif -colorscheme fire -" }}} - -" LightLine config {{{ -set noshowmode -let g:lightline = { - \ 'enable': { - \ 'statusline': 1, - \ 'tabline': 1, - \ }, - \ 'colorscheme': 'fire', - \ 'active' : { - \ 'left' : [ [ 'mode', 'paste' ], - \ [ 'readonly', 'branch', 'filename', 'modified' ]] - \ }, - \ 'component_function': { - \ 'branch': 'LightlineBranch', - \ 'filename': 'LightlineFilename', - \ 'readonly': 'LightlineReadonly', - \ }, - \ } - -function! LightlineFilename() - return &filetype ==# 'fugitive' ? fugitive#statusline() : - \ &filetype ==# 'qf' ? 'QuickFix' : - \ &filetype ==# 'Trouble' ? 'Trouble' : - \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]' -endfunction - -function! LightlineReadonly() - return &readonly && &filetype !~# '\v(help|fugitive|Trouble)' ? 'RO' : '' -endfunction - -function! LightlineBranch() - return &filetype !~# '\v(help|fugitive|qf|Trouble)' ? FugitiveHead() : '' -endfunction - -" }}} - -" Conceal options {{{ -hi clear Conceal -set conceallevel=2 -set concealcursor=n -augroup filetype_vim - autocmd! - autocmd FileType vim setlocal foldmethod=marker -augroup END -" }}} - -" UltiSnips Config {{{ -let g:UltiSnipsExpandTrigger="" -let g:UltiSnipsJumpForwardTrigger="" -let g:UltiSnipsJumpBackwardTrigger="" -" }}} - -" Fugitive Config {{{ -nnoremap gs :G -nnoremap gp :G pull -nnoremap gP :G push -set updatetime=100 -" }}} - -" VIFM {{{ -let g:loaded_netrw = 1 -let g:loaded_netrwPlugin = 1 -let g:vifm_replace_netrw = 1 -let g:vifm_embed_split = 1 -let g:vifm_exec = "vifmrun" -nnoremap gx :!xdg-open =shellescape(expand('')) -command! Vex vertical VsplitVifm -command! Sex SplitVifm -command! Ex Vifm -" }}} - -" Markdown config {{{ -let g:vim_markdown_frontmatter = 1 -let g:vim_markdown_folding_disabled = 1 - -" }}} - -" Auto-Pairs config {{{ -let g:AutoPairsMapBS = 1 - -" }}} - - -" Autocompile dwmblocks {{{ -if has("nvim") - autocmd BufWritePost ~/desktop/dwmblocks/blocks.h :term cd ~/desktop/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks > /dev/null 2> /dev/null ; } -else - autocmd BufWritePost ~/desktop/dwmblocks/blocks.h !cd ~/desktop/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid dwmblocks > /dev/null 2> /dev/null & } -endif -" }}} - -" Make -" set makeprg=make\ --silent\ 2>&1\ \\\|\ grep\ -E\ \"^([^:\\S]+):\\S+:.+\" - - -" Source a global configuration file if available -if filereadable("/etc/vim/vimrc.local") - source /etc/vim/vimrc.local -endif - -" Lua Setup {{{ - -if has("nvim") - lua << EOF - vim.loader.enable() - require('neoconf').setup{} - - require('telescope').setup{} - - require('telescope').load_extension('fzf') - require('telescope').load_extension('ui-select') - - - -- Setup treesitter - require'nvim-treesitter.configs'.setup { --{{{ - -- A list of parser names, or "all" - ensure_installed = { "c", "lua", "vim" }, --"rust" - - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, - - -- Automatically install missing parsers when entering buffer - auto_install = true, - - -- List of parsers to ignore installing (for "all") - ignore_install = { "javascript" }, - - 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 = { 'latex', 'markdown' }, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, - - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "grn", - scope_incremental = "grc", - node_decremental = "grm", - } - }, - - indent = { - enable = true, - }, - - playground = { - enable = true, - }, - } --}}} - require('spellsitter').setup() - require('tree-sitter-rstml').setup() - require('nvim-ts-autotag').setup() - - require'colorizer'.setup() - - -- Setup nvim-cmp. - -- {{{ - local cmp = require'cmp' - local lspkind = require'lspkind' - local cmp_ultisnips_mappings = require'cmp_nvim_ultisnips.mappings' - - cmp.setup({ - snippet = { - expand = function(args) - vim.fn["UltiSnips#Anon"](args.body) - end, - }, - mapping = { - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - cmp_ultisnips_mappings.expand_or_jump_forwards(fallback) - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - cmp_ultisnips_mappings.jump_backwards(fallback) - end - end, { 'i', 's' }), - }, - sources = cmp.config.sources({ - { name = 'path' }, - { name = 'nvim_lsp' }, - { name = 'nvim_lsp_signature_help' }, - { name = 'neorg' }, - { name = 'nvim_lua' }, - { name = 'ultisnips' }, - { name = 'spell', - option = { - enable_in_context = function() - return true --require('cmp.config.context').in_treesitter_capture('spell') - end, - }, - keyword_length = 3, - }, - { name = "git" }, - }, { - { name = 'buffer', keyword_length = 5}, - }), - --{{{ - --window = { - -- completion = cmp.config.window.bordered(), - -- documentation = cmp.config.window.bordered(), - --}, - --}}} - formatting = { - format = lspkind.cmp_format { - with_text = true, - menu = { - buffer = "[buf]", - nvim_lsp = "[LSP]", - nvim_lua = "[api]", - path = "[path]", - ultisnips = "[snip]", - spell = "[spell]", - git = "[git]" - --copilot = "[cop]", - }, - }, - }, - }) - require("cmp_git").setup() - -- }}} - - -- Setup lspconfig. - local capabilities = require('cmp_nvim_lsp').default_capabilities() - - local function on_attach(client, bufnr) - vim.lsp.inlay_hint.enable(bufnr, true) - local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end - buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', {noremap = true}) - buf_set_keymap('n', 'gt', 'lua vim.lsp.buf.type_definition()', {noremap = true}) - buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', {noremap = true}) - buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', {noremap = true}) - buf_set_keymap('n', 'r', 'lua vim.lsp.buf.rename()', {noremap = true}) - buf_set_keymap('n', 'd', 'Trouble workspace_diagnostics', {noremap = true}) - buf_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', {noremap = true}) - buf_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', {noremap = true}) - buf_set_keymap('n', '', 'lua vim.lsp.buf.code_action()', {noremap = true}) - buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', {noremap = true}) - buf_set_keymap('n', '', 'lua vim.lsp.buf.hover()', {noremap = true}) - buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') - end - - require('lspconfig')['ccls'].setup({ capabilities = capabilities, on_attach = on_attach }) - - require('lspconfig')['pyright'].setup({ capabilities = capabilities, on_attach = on_attach }) - - require('lspconfig')['texlab'].setup({ capabilities = capabilities, on_attach = on_attach }) - - vim.opt.exrc = true - vim.g.rustaceanvim = { - -- LSP configuration - server = { - capabilities = capabilities, - on_attach = function(client, bufnr) - -- you can also put keymaps in here - on_attach(client, bufnr); - -- client.server_capabilities.semanticTokensProvider = nil - vim.api.nvim_create_autocmd({"BufWritePre"}, {pattern = {"*"}, command = "lua vim.lsp.buf.format()" }) - local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - buf_set_keymap('n', 'J', "RustLsp joinLines", {noremap = true}) - buf_set_keymap('n', '', "RustLsp codeAction", {noremap = true}) - buf_set_keymap('n', 'c', "RustLsp openCargo", {noremap = true}) - buf_set_keymap('n', 'gD', 'RustLsp openDocs', {noremap = true}) - end, - cmd = {"ra-multiplex", "client"}, - load_vscode_settings = true, - - default_settings = { - -- rust-analyzer language server configuration - ['rust-analyzer'] = { - cargo = { - features = "all", - targetDir = true, - }, - checkOnSave = true, - check = { - command = "clippy", - allfeatures = true, - extrArgs = {"--no-deps"}, - }, - rustfmt = { - overrideCommand = {"/home/zoomiti/.cargo/bin/leptosfmt", "--stdin", "--rustfmt"}, - }, - procMacro = { - enable = true - }, - - }, - }, - }, - } - - --[[ - require('lean').setup{ --{{{ - -- Enable the Lean language server(s)? - -- - -- false to disable, otherwise should be a table of options to pass to - -- `leanls` and/or `lean3ls`. - -- - -- See https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#leanls for details. - - -- Lean 4 - lsp = { on_attach = on_attach }, - - -- Lean 3 - lsp3 = { on_attach = on_attach }, - - -- What filetype should be associated with standalone Lean files? - -- Can be set to "lean3" if you prefer that default. - -- Having a leanpkg.toml or lean-toolchain file should always mean - -- autodetection works correctly. - ft = { default = "lean3" }, - - -- Abbreviation support - abbreviations = { - -- Set one of the following to true to enable abbreviations - builtin = true, -- built-in expander - compe = false, -- nvim-compe source - snippets = false, -- snippets.nvim source - -- additional abbreviations: - extra = { - -- Add a \wknight abbreviation to insert ♘ - -- - -- Note that the backslash is implied, and that you of - -- course may also use a snippet engine directly to do - -- this if so desired. - wknight = '♘', - }, - -- Change if you don't like the backslash - -- (comma is a popular choice on French keyboards) - leader = '\\', - }, - - -- Enable suggested mappings? - -- - -- false by default, true to enable - mappings = true, - - -- Infoview support - infoview = { - -- Automatically open an infoview on entering a Lean buffer? - autoopen = true, - -- Set the infoview windows' widths - width = 30, - }, - - -- Progress bar support - progress_bars = { - -- Enable the progress bars? - enable = true, - -- Use a different priority for the signs - priority = 10, - }, - } -- }}} - --]] - - require("trouble").setup { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - } - - --[[ - require('neorg').setup { - load = { - ["core.defaults"] = {}, - ["core.norg.completion"] = { - config = { -- Note that this table is optional and doesn't need to be provided - engine = 'nvim-cmp', - } - }, - ["core.integrations.nvim-cmp"] = { - config = { -- Note that this table is optional and doesn't need to be provided - -- Configuration here - } - }, - ["core.norg.concealer"] = { - config = { -- Note that this table is optional and doesn't need to be provided - -- Configuration here - } - }, - ["core.norg.dirman"] = { - config = { - workspaces = { - example_gtd = "~/GitHub/example_workspaces/gtd", - neorg = "~/neorg", - }, - default_workspace = "neorg", - }, - }, - ["core.gtd.base"] = { - config = { - workspace = "neorg", - }, - }, - ["core.integrations.telescope"] = {}, -- Enable the telescope module - } - } - --]] - - require("coverage").setup() - - require("which-key").setup { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - } -EOF -endif - -" }}} diff --git a/.vimrc b/.vimrc deleted file mode 120000 index 7e39a79..0000000 --- a/.vimrc +++ /dev/null @@ -1 +0,0 @@ -/home/zoomiti/.config/nvim/init.vim \ No newline at end of file diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..bfdd9e6 --- /dev/null +++ b/.vimrc @@ -0,0 +1,665 @@ +" Plugged setup {{{ +let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' +if empty(glob(data_dir . '/autoload/plug.vim')) + silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC +endif + +call plug#begin() +" auto pairs +Plug 'LunarWatcher/auto-pairs' + +" Lightline +Plug 'itchyny/lightline.vim' + +" CSS-Color +Plug 'ap/vim-css-color' + +"Surround +Plug 'tpope/vim-surround' +Plug 'tpope/vim-repeat' + +" For snippets +Plug 'SirVer/ultisnips' + +" Vifm replacing netrw +Plug 'vifm/vifm.vim' + +" Git nuff said +Plug 'tpope/vim-fugitive' +Plug 'airblade/vim-gitgutter' + +" Latex +Plug 'lervag/vimtex' + +" Rust +if has("nvim") + Plug 'mrcjkb/rustaceanvim' + Plug 'rayliwell/nvim-ts-autotag' +else + Plug 'rust-lang/rust.vim' + let g:rustfmt_autosave = 1 +endif + +" Markdown +Plug 'preservim/vim-markdown' + +" Table mode +Plug 'dhruvasagar/vim-table-mode' + +" Color schemes +Plug 'zoomiti/firewatch' +Plug 'sonph/onehalf', { 'rtp': 'vim' } +Plug 'sjl/badwolf' +if !has("nvim") + Plug 'lifepillar/vim-colortemplate', { 'branch': 'v2' } +endif + +if has("nvim") +" Neoconf +Plug 'folke/neoconf.nvim' + +" LSP +Plug 'neovim/nvim-lspconfig' + +Plug 'andythigpen/nvim-coverage' + +" Cmp +Plug 'hrsh7th/nvim-cmp' +Plug 'hrsh7th/cmp-nvim-lsp' +Plug 'hrsh7th/cmp-nvim-lsp-signature-help' +Plug 'hrsh7th/cmp-path' +Plug 'hrsh7th/cmp-buffer' +Plug 'hrsh7th/cmp-nvim-lua' +Plug 'petertriho/cmp-git' +Plug 'f3fora/cmp-spell' +" Plug 'hrsh7th/cmp-copilot' +Plug 'onsails/lspkind.nvim' +Plug 'quangnguyen30192/cmp-nvim-ultisnips' + +" Diagnostics +Plug 'folke/trouble.nvim' + +" Telescope +Plug 'nvim-telescope/telescope.nvim' +Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } +Plug 'nvim-telescope/telescope-ui-select.nvim' +Plug 'nvim-neorg/neorg-telescope' +Plug 'kyazdani42/nvim-web-devicons' + +" Debugging +Plug 'mfussenegger/nvim-dap' + +" Lean requires nvim +" Plug 'Julian/lean.nvim' +Plug 'nvim-lua/plenary.nvim' +Plug 'andrewradev/switch.vim' " For Lean switch support +Plug 'norcalli/nvim-colorizer.lua' " For colorizing + +" Tree sitter +Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} +Plug 'lewis6991/spellsitter.nvim' +Plug 'rayliwell/tree-sitter-rstml' + +" Neorg +Plug 'nvim-neorg/neorg' + +" Copilot +" Plug 'github/copilot.vim' + +Plug 'folke/which-key.nvim' +endif + +call plug#end() +" }}} + +" Vim Config {{{ + +set encoding=utf-8 + +set completeopt=menu,menuone,noselect,noinsert + +syntax on + +" Uncomment the following to have Vim jump to the last position when +" reopening a file +au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + + +" Uncomment the following to have Vim load indentation rules and plugins +" according to the detected filetype. +filetype plugin indent on +" show existing tab with 4 spaces width" +set tabstop=4 +" when indenting with '>', use 4 spaces width" +set shiftwidth=4 +" On pressing tab, insert 4 spaces" +"set expandtab + +" The following are commented out as they cause vim to behave a lot +" differently from regular Vi. They are highly recommended though. +"set showcmd " Show (partial) command in status line. +set showmatch " Show matching brackets. +"set ignorecase " Do case insensitive matching +set smartcase " Do smart case matching +set incsearch " Incremental search +set autowrite " Automatically save before commands like :next and :make +set hidden " Hide buffers when they are abandoned +set mouse=a " Enable mouse usage (all modes) +set mousemodel=popup +set number " Enable line numbers +set relativenumber " Enable relative line numbers +set title " Changes terminal title when started +set scrolloff=15 + +" Vim remaps {{{ +nnoremap +let mapleader=" " +let maplocalleader=" " +nnoremap :nohl +if has('nvim') + nnoremap b Telescope buffers + nnoremap lua require("telescope.builtin").current_buffer_fuzzy_find(require('telescope.themes').get_ivy()) + nnoremap f Telescope find_files + nnoremap p Telescope git_files + nnoremap t bel 15sp \| termstartinsert +else + nnoremap b ls:b + nnoremap s ls:sb + nnoremap t bel term +endif + + +noremap ; l +noremap l k +noremap k j +noremap j h +noremap h ; + +nnoremap [q :cprev +nnoremap ]q :cnext + +noremap j h +noremap k j +noremap l k +noremap ; l + +" Terminal Settings +if has("nvim") + " Enter terminal-mode automatically + " autocmd TermOpen * startinsert + autocmd BufEnter term://* startinsert + " Disable line numbers on terminals + autocmd TermOpen * :setlocal nonumber norelativenumber + " allows you to use Ctrl-c on terminal window + autocmd TermOpen * nnoremap i + " Allows for esc to leave insert mode + tnoremap + " Allows for window navigation + tnoremap + tnoremap + tnoremap j h + tnoremap k j + tnoremap l k + tnoremap ; l + tnoremap + tnoremap + tnoremap + tnoremap +endif + +" }}} + +" }}} + +" Colors {{{ +if has('termguicolors') + if &term =~ 'alacritty' + set t_8f=[38;2;%lu;%lu;%lum + set t_8b=[48;2;%lu;%lu;%lum + endif + set termguicolors +endif +let g:dark_transp_bg = 1 +" Deprecated becase of last line +" if has('nvim') +" au ColorScheme * hi Normal ctermbg=none guibg=none|hi LineNr guibg=none ctermbg=none|hi Folded guibg=none ctermbg=none|hi NonText guibg=none ctermbg=none|hi SpecialKey guibg=none ctermbg=none|hi VertSplit guibg=none ctermbg=none|hi SignColumn guibg=none ctermbg=none|hi EndOfBuffer guibg=none ctermbg=none +" endif +colorscheme fire +" }}} + +" LightLine config {{{ +set noshowmode +let g:lightline = { + \ 'enable': { + \ 'statusline': 1, + \ 'tabline': 1, + \ }, + \ 'colorscheme': 'fire', + \ 'active' : { + \ 'left' : [ [ 'mode', 'paste' ], + \ [ 'readonly', 'branch', 'filename', 'modified' ]] + \ }, + \ 'component_function': { + \ 'branch': 'LightlineBranch', + \ 'filename': 'LightlineFilename', + \ 'readonly': 'LightlineReadonly', + \ }, + \ } + +function! LightlineFilename() + return &filetype ==# 'fugitive' ? fugitive#statusline() : + \ &filetype ==# 'qf' ? 'QuickFix' : + \ &filetype ==# 'Trouble' ? 'Trouble' : + \ expand('%:t') !=# '' ? expand('%:t') : '[No Name]' +endfunction + +function! LightlineReadonly() + return &readonly && &filetype !~# '\v(help|fugitive|Trouble)' ? 'RO' : '' +endfunction + +function! LightlineBranch() + return &filetype !~# '\v(help|fugitive|qf|Trouble)' ? FugitiveHead() : '' +endfunction + +" }}} + +" Conceal options {{{ +hi clear Conceal +set conceallevel=2 +set concealcursor=n +augroup filetype_vim + autocmd! + autocmd FileType vim setlocal foldmethod=marker +augroup END +" }}} + +" UltiSnips Config {{{ +let g:UltiSnipsExpandTrigger="" +let g:UltiSnipsJumpForwardTrigger="" +let g:UltiSnipsJumpBackwardTrigger="" +" }}} + +" Fugitive Config {{{ +nnoremap gs :G +nnoremap gp :G pull +nnoremap gP :G push +set updatetime=100 +" }}} + +" VIFM {{{ +let g:loaded_netrw = 1 +let g:loaded_netrwPlugin = 1 +let g:vifm_replace_netrw = 1 +let g:vifm_embed_split = 1 +let g:vifm_exec = "vifmrun" +nnoremap gx :!xdg-open =shellescape(expand('')) +command! Vex vertical VsplitVifm +command! Sex SplitVifm +command! Ex Vifm +" }}} + +" Markdown config {{{ +let g:vim_markdown_frontmatter = 1 +let g:vim_markdown_folding_disabled = 1 + +" }}} + +" Auto-Pairs config {{{ +let g:AutoPairsMapBS = 1 + +" }}} + + +" Autocompile dwmblocks {{{ +if has("nvim") + autocmd BufWritePost ~/desktop/dwmblocks/blocks.h :term cd ~/desktop/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks > /dev/null 2> /dev/null ; } +else + autocmd BufWritePost ~/desktop/dwmblocks/blocks.h !cd ~/desktop/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid dwmblocks > /dev/null 2> /dev/null & } +endif +" }}} + +" Make +" set makeprg=make\ --silent\ 2>&1\ \\\|\ grep\ -E\ \"^([^:\\S]+):\\S+:.+\" + + +" Source a global configuration file if available +if filereadable("/etc/vim/vimrc.local") + source /etc/vim/vimrc.local +endif + +" Lua Setup {{{ + +if has("nvim") + lua << EOF + vim.loader.enable() + require('neoconf').setup{} + + require('telescope').setup{} + + require('telescope').load_extension('fzf') + require('telescope').load_extension('ui-select') + + + -- Setup treesitter + require'nvim-treesitter.configs'.setup { --{{{ + -- A list of parser names, or "all" + ensure_installed = { "c", "lua", "vim" }, --"rust" + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + auto_install = true, + + -- List of parsers to ignore installing (for "all") + ignore_install = { "javascript" }, + + 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 = { 'latex', 'markdown' }, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + } + }, + + indent = { + enable = true, + }, + + playground = { + enable = true, + }, + } --}}} + require('spellsitter').setup() + require('tree-sitter-rstml').setup() + require('nvim-ts-autotag').setup() + + require'colorizer'.setup() + + -- Setup nvim-cmp. + -- {{{ + local cmp = require'cmp' + local lspkind = require'lspkind' + local cmp_ultisnips_mappings = require'cmp_nvim_ultisnips.mappings' + + cmp.setup({ + snippet = { + expand = function(args) + vim.fn["UltiSnips#Anon"](args.body) + end, + }, + mapping = { + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + cmp_ultisnips_mappings.expand_or_jump_forwards(fallback) + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + cmp_ultisnips_mappings.jump_backwards(fallback) + end + end, { 'i', 's' }), + }, + sources = cmp.config.sources({ + { name = 'path' }, + { name = 'nvim_lsp' }, + { name = 'nvim_lsp_signature_help' }, + { name = 'neorg' }, + { name = 'nvim_lua' }, + { name = 'ultisnips' }, + { name = 'spell', + option = { + enable_in_context = function() + return true --require('cmp.config.context').in_treesitter_capture('spell') + end, + }, + keyword_length = 3, + }, + { name = "git" }, + }, { + { name = 'buffer', keyword_length = 5}, + }), + --{{{ + --window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + --}, + --}}} + formatting = { + format = lspkind.cmp_format { + with_text = true, + menu = { + buffer = "[buf]", + nvim_lsp = "[LSP]", + nvim_lua = "[api]", + path = "[path]", + ultisnips = "[snip]", + spell = "[spell]", + git = "[git]" + --copilot = "[cop]", + }, + }, + }, + }) + require("cmp_git").setup() + -- }}} + + -- Setup lspconfig. + local capabilities = require('cmp_nvim_lsp').default_capabilities() + + local function on_attach(client, bufnr) + vim.lsp.inlay_hint.enable(true, {bufnr}) + local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end + local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end + buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', {noremap = true}) + buf_set_keymap('n', 'gt', 'lua vim.lsp.buf.type_definition()', {noremap = true}) + buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', {noremap = true}) + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', {noremap = true}) + buf_set_keymap('n', 'r', 'lua vim.lsp.buf.rename()', {noremap = true}) + buf_set_keymap('n', 'd', 'Trouble workspace_diagnostics', {noremap = true}) + buf_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', {noremap = true}) + buf_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', {noremap = true}) + buf_set_keymap('n', '', 'lua vim.lsp.buf.code_action()', {noremap = true}) + buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', {noremap = true}) + buf_set_keymap('n', '', 'lua vim.lsp.buf.hover()', {noremap = true}) + buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') + end + + require('lspconfig')['ccls'].setup({ capabilities = capabilities, on_attach = on_attach }) + + require('lspconfig')['pyright'].setup({ capabilities = capabilities, on_attach = on_attach }) + + require('lspconfig')['texlab'].setup({ capabilities = capabilities, on_attach = on_attach }) + + vim.opt.exrc = true + vim.g.rustaceanvim = { + -- LSP configuration + server = { + capabilities = capabilities, + on_attach = function(client, bufnr) + -- you can also put keymaps in here + on_attach(client, bufnr); + -- client.server_capabilities.semanticTokensProvider = nil + vim.api.nvim_create_autocmd({"BufWritePre"}, {pattern = {"*"}, command = "lua vim.lsp.buf.format()" }) + local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end + buf_set_keymap('n', 'J', "RustLsp joinLines", {noremap = true}) + buf_set_keymap('n', '', "RustLsp codeAction", {noremap = true}) + buf_set_keymap('n', 'c', "RustLsp openCargo", {noremap = true}) + buf_set_keymap('n', 'gD', 'RustLsp openDocs', {noremap = true}) + end, + cmd = {"ra-multiplex", "client"}, + load_vscode_settings = true, + + default_settings = { + -- rust-analyzer language server configuration + ['rust-analyzer'] = { + cargo = { + features = "all", + targetDir = true, + }, + checkOnSave = true, + check = { + command = "clippy", + allfeatures = true, + extrArgs = {"--no-deps"}, + }, + rustfmt = { + overrideCommand = {"/home/zoomiti/.cargo/bin/leptosfmt", "--stdin", "--rustfmt"}, + }, + procMacro = { + enable = true + }, + + }, + }, + }, + } + + --[[ + require('lean').setup{ --{{{ + -- Enable the Lean language server(s)? + -- + -- false to disable, otherwise should be a table of options to pass to + -- `leanls` and/or `lean3ls`. + -- + -- See https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#leanls for details. + + -- Lean 4 + lsp = { on_attach = on_attach }, + + -- Lean 3 + lsp3 = { on_attach = on_attach }, + + -- What filetype should be associated with standalone Lean files? + -- Can be set to "lean3" if you prefer that default. + -- Having a leanpkg.toml or lean-toolchain file should always mean + -- autodetection works correctly. + ft = { default = "lean3" }, + + -- Abbreviation support + abbreviations = { + -- Set one of the following to true to enable abbreviations + builtin = true, -- built-in expander + compe = false, -- nvim-compe source + snippets = false, -- snippets.nvim source + -- additional abbreviations: + extra = { + -- Add a \wknight abbreviation to insert ♘ + -- + -- Note that the backslash is implied, and that you of + -- course may also use a snippet engine directly to do + -- this if so desired. + wknight = '♘', + }, + -- Change if you don't like the backslash + -- (comma is a popular choice on French keyboards) + leader = '\\', + }, + + -- Enable suggested mappings? + -- + -- false by default, true to enable + mappings = true, + + -- Infoview support + infoview = { + -- Automatically open an infoview on entering a Lean buffer? + autoopen = true, + -- Set the infoview windows' widths + width = 30, + }, + + -- Progress bar support + progress_bars = { + -- Enable the progress bars? + enable = true, + -- Use a different priority for the signs + priority = 10, + }, + } -- }}} + --]] + + require("trouble").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } + + --[[ + require('neorg').setup { + load = { + ["core.defaults"] = {}, + ["core.norg.completion"] = { + config = { -- Note that this table is optional and doesn't need to be provided + engine = 'nvim-cmp', + } + }, + ["core.integrations.nvim-cmp"] = { + config = { -- Note that this table is optional and doesn't need to be provided + -- Configuration here + } + }, + ["core.norg.concealer"] = { + config = { -- Note that this table is optional and doesn't need to be provided + -- Configuration here + } + }, + ["core.norg.dirman"] = { + config = { + workspaces = { + example_gtd = "~/GitHub/example_workspaces/gtd", + neorg = "~/neorg", + }, + default_workspace = "neorg", + }, + }, + ["core.gtd.base"] = { + config = { + workspace = "neorg", + }, + }, + ["core.integrations.telescope"] = {}, -- Enable the telescope module + } + } + --]] + + require("coverage").setup() + + require("which-key").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } +EOF +endif + +" }}}