Compare commits

...

6 Commits

@ -9,7 +9,7 @@ shopt -s autocd
shopt -s cdspell
shopt -s dirspell
alias vim='nvim'
alias nv='nvim'
alias diff='diff --color=auto'
alias ip='ip -color=auto'
@ -43,7 +43,7 @@ vicd () {
if command -v rpg-cli &> /dev/null
then
PS1='[\u@\h ](\W)\n$(CLICOLOR_FORCE=1 rpg-cli stat -q | sed "s/@.*//" | sed -r "s/(\\x1B\\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK])/\[\1\]/g" )\$ '
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"
@ -54,6 +54,18 @@ then
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
@ -93,3 +105,4 @@ export PATH="$HOME/.cargo/bin:$PATH"
# Set up Node Version Manager
source /usr/share/nvm/init-nvm.sh
bind 'set completion-ignore-case on'

@ -1,27 +1,40 @@
snippet fig "figure"
\begin{figure}
global !p
def math():
return vim.eval('vimtex#syntax#in_mathzone()') == '1'
def comment():
return vim.eval('vimtex#syntax#in_comment()') == '1'
def env(name):
[x,y] = vim.eval("vimtex#env#is_inside('" + name + "')")
return x != '0' and x != '0'
endglobal
snippet fig "Figure environment" b
\begin{figure}[${1:htpb}]
\centering
\includegraphics[width=.8\textwidth]{$1}
\caption{$3}
\label{fig:$2}
${2:\includegraphics[width=0.8\textwidth]{$3}}
\caption{${4:$3}}
\label{fig:${5:${3/\W+/-/g}}}
\end{figure}
endsnippet
snippet tab "table"
\begin{table}
snippet table "Table environment" b
\begin{table}[${1:htpb}]
\centering
\begin{tabular}{$1}
$0
\caption{${2:caption}}
\label{tab:${3:label}}
\begin{tabular}{${5:c}}
$0${5/((?<=.)c|l|r)|./(?1: & )/g}
\end{tabular}
\caption{$3}
\label{table:$2}
\end{table}
endsnippet
snippet \beg "\begin{}...\end{}"
\begin{$1}
snippet beg "\begin{}...\end{}" bA
\\begin{$1}
$0
\end{$1}
\\end{$1}
endsnippet
snippet enum "list"
@ -29,3 +42,227 @@ snippet enum "list"
\item $0
\end{enumerate}
endsnippet
snippet mk "Math" wA
$${1}$`!p
if t[2] and t[2][0] not in [',', '.', '?', '-', ' ']:
snip.rv = ' '
else:
snip.rv = ''
`$2
endsnippet
snippet dm "Math" wA
\[
$2
${1:.}\] $0
endsnippet
snippet ali "Align" bA
\begin{align*}
${2:${VISUAL}}
${1:.}\end{align*}
endsnippet
context "math()"
snippet '([A-Za-z])(\d)' "auto subscript" wrA
`!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)`
endsnippet
context "math()"
snippet '([A-Za-z])_(\d\d)' "auto subscript2" wrA
`!p snip.rv = match.group(1)`_{`!p snip.rv = match.group(2)`}
endsnippet
snippet __ "subscript" iA
_{$1}$0
endsnippet
context "math()"
snippet sr "^2" iA
^2
endsnippet
context "math()"
snippet cb "^3" iA
^3
endsnippet
context "math()"
snippet td "superscript" iA
^{$1}$0
endsnippet
context "math()"
snippet // "Fraction" iA
\\frac{$1}{$2}$0
endsnippet
context "math()"
snippet / "Fraction" i
\\frac{${VISUAL}}{$1}$0
endsnippet
context "math()"
snippet '((\d+)|(\d*)(\\)?([A-Za-z]+)((\^|_)(\{\d+\}|\d))*)/' "Fraction" wrA
\\frac{`!p snip.rv = match.group(1)`}{$1}$0
endsnippet
priority 1000
context "math()"
snippet '^.*\)/' "() Fraction" wrA
`!p
stripped = match.string[:-1]
depth = 0
i = len(stripped) - 1
while True:
if stripped[i] == ')': depth += 1
if stripped[i] == '(': depth -= 1
if depth == 0: break;
i -= 1
snip.rv = stripped[0:i] + "\\frac{" + stripped[i+1:-1] + "}"
`{$1}$0
endsnippet
context "math()"
snippet () "left( right)" iA
\left( ${1:${VISUAL}} \right) $0
endsnippet
snippet lr "left( right)" i
\left( ${1:${VISUAL}} \right) $0
endsnippet
snippet lr( "left( right)" i
\left( ${1:${VISUAL}} \right) $0
endsnippet
snippet lr| "left| right|" i
\left| ${1:${VISUAL}} \right| $0
endsnippet
snippet lr{ "left\{ right\}" i
\left\\{ ${1:${VISUAL}} \right\\} $0
endsnippet
snippet lrb "left\{ right\}" i
\left\\{ ${1:${VISUAL}} \right\\} $0
endsnippet
snippet lr[ "left[ right]" i
\left[ ${1:${VISUAL}} \right] $0
endsnippet
snippet lra "leftangle rightangle" iA
\left<${1:${VISUAL}} \right>$0
endsnippet
snippet sum "sum" w
\sum_{n=${1:1}}^{${2:\infty}} ${3:a_n z^n}
endsnippet
snippet taylor "taylor" w
\sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_$1} (x-a)^$1 $0
endsnippet
snippet lim "limit" w
\lim_{${1:n} \to ${2:\infty}}
endsnippet
snippet limsup "limsup" w
\limsup_{${1:n} \to ${2:\infty}}
endsnippet
snippet prod "product" w
\prod_{${1:n=${2:1}}}^{${3:\infty}} ${4:${VISUAL}} $0
endsnippet
snippet part "d/dx" w
\frac{\partial ${1:V}}{\partial ${2:x}} $0
endsnippet
context "math()"
snippet sq "\sqrt{}" iA
\sqrt{${1:${VISUAL}}} $0
endsnippet
context "math()"
snippet sr "^2" iA
^2
endsnippet
snippet plot "Plot" w
\begin{figure}[$1]
\centering
\begin{tikzpicture}
\begin{axis}[
xmin= ${2:-10}, xmax= ${3:10},
ymin= ${4:-10}, ymax = ${5:10},
axis lines = middle,
]
\addplot[domain=$2:$3, samples=${6:100}]{$7};
\end{axis}
\end{tikzpicture}
\caption{$8}
\label{${9:$8}}
\end{figure}
endsnippet
priority 100
context "math()"
snippet '(?<!\\)(sin|cos|arccot|cot|csc|ln|log|exp|star|perp)' "ln" rwA
\\`!p snip.rv = match.group(1)`
endsnippet
priority 300
context "math()"
snippet dint "integral" wA
\int_{${1:-\infty}}^{${2:\infty}} ${3:${VISUAL}} $0
endsnippet
priority 200
context "math()"
snippet '(?<!\\)(arcsin|arccos|arctan|arccot|arccsc|arcsec|pi|zeta|int)' "ln" rwA
\\`!p snip.rv = match.group(1)`
endsnippet
context "math()"
snippet case "cases" wA
\begin{cases}
$1
\end{cases}
endsnippet
snippet ooo "\infty" iA
\infty
endsnippet
context "math()"
snippet hnn "hn" iA
h[n]
endsnippet
context "math()"
snippet htt "ht" iA
h(t)
endsnippet
context "math()"
snippet xnn "xn" iA
x[n]
endsnippet
context "math()"
snippet xtt "xt" iA
x(t)
endsnippet
context "math()"
snippet ynn "yn" iA
y[n]
endsnippet
context "math()"
snippet ytt "yt" iA
y(t)
endsnippet

@ -1,11 +1,9 @@
let g:vimtex_compiler_latexmk = {
\ 'backend': 'nvim',
\ 'background' : 0,
\ 'background' : 1,
\ 'build_dir' : 'latex_build',
\ 'continuous' : 1,
\ 'options' : [
\ '-pdfdvi',
\ '-pdflatex="xelatex -shell-escape %O %S"',
\ '-verbose',
\ '-file-line-error',
\ '-synctex=1',

@ -6,6 +6,9 @@ if empty(glob(data_dir . '/autoload/plug.vim'))
endif
call plug#begin()
" auto pairs
Plug 'LunarWatcher/auto-pairs'
" Lightline
Plug 'itchyny/lightline.vim'
@ -58,10 +61,14 @@ Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-nvim-lua'
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' }
@ -135,7 +142,7 @@ let maplocalleader=" "
nnoremap <silent> <Enter> :nohl<CR><Enter>
if has('nvim')
nnoremap <leader>b <cmd>Telescope buffers<CR>
nnoremap  <cmd>lua require("telescope.builtin").current_buffer_fuzzy_find(require('telescope.themes').get_ivy())<CR>
nnoremap <C-/> <cmd>lua require("telescope.builtin").current_buffer_fuzzy_find(require('telescope.themes').get_ivy())<CR>
nnoremap <leader>f <cmd>Telescope find_files<CR>
else
nnoremap <leader>b <cmd>ls<CR>:b<Space>
@ -149,6 +156,9 @@ noremap k j
noremap j h
noremap h ;
nnoremap [q <cmd>:cprev<CR>
nnoremap ]q <cmd>:cnext<CR>
noremap <C-W>j <C-\><C-N><C-W>h
noremap <C-W>k <C-\><C-N><C-W>j
noremap <C-W>l <C-\><C-N><C-W>k
@ -220,15 +230,16 @@ let g:lightline = {
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)' ? 'RO' : ''
return &readonly && &filetype !~# '\v(help|fugitive|Trouble)' ? 'RO' : ''
endfunction
function! LightlineBranch()
return &filetype !~# '\v(help|fugitive|qf)' ? FugitiveHead() : ''
return &filetype !~# '\v(help|fugitive|qf|Trouble)' ? FugitiveHead() : ''
endfunction
" }}}
@ -269,9 +280,16 @@ 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 ; }
@ -289,7 +307,7 @@ if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
" LSP Setup {{{
" Lua Setup {{{
if has("nvim")
lua << EOF
@ -387,6 +405,14 @@ if has("nvim")
{ name = 'nvim_lsp' },
{ 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 = 'path' },
}, {
{ name = 'buffer', keyword_length = 5},
@ -400,6 +426,7 @@ if has("nvim")
nvim_lua = "[api]",
path = "[path]",
ultisnips = "[snip]",
spell = "[spell]",
--copilot = "[cop]",
},
},
@ -407,15 +434,16 @@ if has("nvim")
})
-- Setup lspconfig.
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local function on_attach(client, 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', '<Cmd>lua vim.lsp.buf.definition()<CR>', {noremap = true})
buf_set_keymap('n', 'gt', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', {noremap = true})
-- buf_set_keymap('n', 'gt', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', {noremap = true})
buf_set_keymap('n', 'gi', '<Cmd>lua vim.lsp.buf.implementation()<CR>', {noremap = true})
buf_set_keymap('n', '<leader>r', '<Cmd>lua vim.lsp.buf.rename()<CR>', {noremap = true})
buf_set_keymap('n', '<leader>d', '<Cmd>Trouble workspace_diagnostics<CR>', {noremap = true})
buf_set_keymap('n', ']d', '<Cmd>lua vim.diagnostic.goto_next()<CR>', {noremap = true})
buf_set_keymap('n', '[d', '<Cmd>lua vim.diagnostic.goto_prev()<CR>', {noremap = true})
buf_set_keymap('n', '<C-Space>', '<Cmd>lua vim.lsp.buf.code_action()<CR>', {noremap = true})
@ -424,6 +452,8 @@ if has("nvim")
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 })
@ -493,6 +523,12 @@ if has("nvim")
},
} -- }}}
--]]
require("trouble").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
EOF
endif

Loading…