"  █▀ ▄▀█ █ ▄▀█ █▄░█ █▀█ █▄░█ █▄█ █▀▄▀█ █▀█ █░█ █▀
"  ▄█ █▀█ █ █▀█ █░▀█ █▄█ █░▀█ ░█░ █░▀░█ █▄█ █▄█ ▄█


:set autoindent
":set relativenumber
:set tabstop=4
:set shiftwidth=4
:set mouse=a
":let g:loaded_python3_provider = 0
let g:python3_host_prog = '/usr/bin/python3' " -- Set python 3 provider
:set smarttab
:nnoremap <silent> <C-N> :NERDTreeToggle<CR>
:set softtabstop=4
:set number relativenumber
set clipboard=unnamedplus
set encoding=UTF-8
set expandtab
set ignorecase
set smartcase
set nohlsearch

runtime! ./plugged/telescope.nvim/plugin/telescope.lua

packloadall
command! -nargs=0 Sw w !sudo tee % > /dev/null

nnoremap <leader>ts <cmd>Telescope<cr>
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>ss :Screenshot<CR>
nnoremap <leader>zm :ZenMode<CR>
nnoremap <leader>ts :Telescope<CR>
tnoremap <Esc> <C-\><C-n>
inoremap ( ()<Left>
inoremap (( (
inoremap [ []<Left>
inoremap [[ [
inoremap { {}<Left>
inoremap {{ {
inoremap " ""<Left>
inoremap "" "
inoremap ' ''<Left>
inoremap '' '
inoremap /* /**/<Left><Left>

let g:UltiSnipsExpandTrigger='<c-f>'
let g:UltiSnipsJumpForwardTrigger='<c-b>'
let g:UltiSnipsJumpBackwardTrigger='<c-z>'
let g:UltiSnipsListSnippets='<c-l>'

" let g:UltiSnipsExpandTrigger='<c-f>'
let g:easycomplete_diagnostics_next = "<C-j>"
let g:easycomplete_diagnostics_previous = "<C-k>"
" let g:easycomplete_tab_trigger="<c-space>"
":set nu rnu
":inoremap <S-space> _<CR>
"let g:clipboard = 'unnamed'
"let g:clipboard = {
"          \   'name': 'wl-clipboard',
"          \   'copy': {
"          \      '+': ['tmux', 'load-buffer', '-'],
"          \      '*': ['tmux', 'load-buffer', '-'],
"          \    },
"          \   'paste': {
"          \      '+': ['tmux', 'save-buffer', '-'],
"          \      '*': ['tmux', 'save-buffer', '-'],
"          \   },
"          \   'cache_enabled': 1,
"          \ }
"set clipboard=wl-clipboard

" Clipboard Begin
" " Copy to clipboard
" vnoremap  <leader>y  "+y
" nnoremap  <leader>Y  "+yg_
" nnoremap  <leader>y  "+y
" nnoremap  <leader>yy  "+yy

" " Paste from clipboard
" nnoremap <leader>p "+p
" nnoremap <leader>P "+P
" vnoremap <leader>p "+p
" vnoremap <leader>P "+P
" " Clipboard End

" " ASM-specific Vim configuration
" augroup asm_files
"   autocmd!
"   " Detect .asm files as assembly
"   autocmd BufRead,BufNewFile *.asm set filetype=asm
"   " Apply settings only to ASM files
"   autocmd FileType asm setlocal syntax=asm
"   autocmd FileType asm setlocal comments=:;     " Comments start with ;
"   autocmd FileType asm setlocal commentstring=;%s
"   autocmd FileType asm setlocal tabstop=4       " 8-space tabs
"   autocmd FileType asm setlocal softtabstop=4
"   autocmd FileType asm setlocal shiftwidth=4
"   autocmd FileType asm setlocal noexpandtab     " Use actual tabs
"   autocmd FileType asm setlocal number          " Show line numbers
"   autocmd FileType asm setlocal listchars=tab:→\ ,trail:· " Visualize tabs/trailing spaces
"   autocmd FileType asm setlocal list
" augroup END

" in your .vimrc (_vimrc for Windows)
autocmd! BufNewFile,BufRead *.vs,*.fs set ft=glsl



" function! s:on_lsp_buffer_enabled() abort
"     setlocal omnifunc=lsp#complete
"     setlocal signcolumn=yes
"     if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
"     nmap <buffer> gd <plug>(lsp-definition)
"     nmap <buffer> gs <plug>(lsp-document-symbol-search)
"     nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
"     nmap <buffer> gr <plug>(lsp-references)
"     nmap <buffer> gi <plug>(lsp-implementation)
"     nmap <buffer> gt <plug>(lsp-type-definition)
"     nmap <buffer> <leader>rn <plug>(lsp-rename)
"     nmap <buffer> [g <plug>(lsp-previous-diagnostic)
"     nmap <buffer> ]g <plug>(lsp-next-diagnostic)
"     nmap <buffer> K <plug>(lsp-hover)
"     nnoremap <buffer> <expr><c-f> lsp#scroll(+4)
"     nnoremap <buffer> <expr><c-d> lsp#scroll(-4)
"     let g:lsp_format_sync_timeout = 1000
"     autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
"     
"     " refer to doc to add more commands
" endfunction
" augroup lsp_install
"     au!
"     " call s:on_lsp_buffer_enabled only for languages that has the server registered.
"     autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
" augroup END





call plug#begin('~/.config/nvim/plugged')
" The default plugin directory will be as follows:
"   - Vim (Linux/macOS): '~/.vim/plugged'
"   - Vim (Windows): '~/vimfiles/plugged'
"   - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
"   - e.g. `call plug#begin('~/.vim/plugged')`
"   - Avoid using standard Vim directory names like 'plugin'

" Make sure you use single quotes

" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'

" Plug 'MeanderingProgrammer/render-markdown.nvim'

" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'

" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" Plug 'Valloric/YouCompleteMe'
" Plug 'ycm-core/YouCompleteMe'
" vim-easycomplete
"Plug 'Valloric/YouCompleteMe' Plug 'jayli/vim-easycomplete'
Plug 'jayli/vim-easycomplete'

" GLSL
Plug 'tikhomirov/vim-glsl'


" Plug 'BurntSushi/ripgrep'

Plug 'folke/zen-mode.nvim'

" Icons nerdtree
Plug 'ryanoasis/vim-devicons'

"
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'

" vim-plug
Plug 'lervag/vimtex'

" On-demand loading
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }

" Using a non-default branch
"Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }"
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.8' }
" or                                , { 'branch': '0.1.x' }
Plug 'BurntSushi/ripgrep'
Plug 'nvim-treesitter/nvim-treesitter', {'tag': 'v0.9.2', 'do': ':TSUpdate'}

"Theme"
Plug 'folke/tokyonight.nvim', { 'branch': 'main' }

" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }

" Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }

" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }

" Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin'

" Latexrun
Plug 'aclements/latexrun'

" Plug 'ycm-core/YouCompleteMe'

" Screenshot plugin
Plug 'mistweaverco/Screenshot.nvim'

" Telescope.nvim
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim' " , { 'tag': '0.1.8' }
" or                                , { 'branch': '0.1.x' }
" Initialize plugin system
" - Automatically executes `filetype plugin indent on` and `syntax enable`.
call plug#end()
" You can revert the settings after the call like so:
"   filetype indent off   " Disable file-type-specific indentation
"   syntax off            " Disable syntax highlighting

filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.config/nvim/bundle/Vundle.vim
call vundle#begin('~/.config/nvim/bundle')

"
"
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'sudoerwx/vim-ray-so-beautiful'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
"Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
"Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
colorscheme tokyonight-night
vnoremap <F5> :Ray<CR>


" This is necessary for VimTeX to load properly. The "indent" is optional.
" Note that most plugin managers will do this automatically.
filetype plugin indent on

" This enables Vim's and neovim's syntax-related features. Without this, some
" VimTeX features will not work (see ":help vimtex-requirements" for more
" info).
" syntax enable

" Viewer options: One may configure the viewer either by specifying a built-in
" viewer method:
let g:vimtex_view_method = 'zathura'

" Or with a generic interface:
let g:vimtex_view_general_viewer = 'okular'
let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'

" VimTeX uses latexmk as the default compiler backend. If you use it, which is
" strongly recommended, you probably don't need to configure anything. If you
" want another compiler backend, you can change it as follows. The list of
" supported backends and further explanation is provided in the documentation,
" see ":help vimtex-compiler".
let g:vimtex_compiler_method = 'pdflatex'

"let g:vimtex_compiler_latexmk = {
"    \ 'options' : [
"    \   '--pdf',
"    \   '--shell-escape',
"    \   '--verbose',
"    \   '--file-line-error',
"    \   '--synctex=1',
"    \   '--interaction=nonstopmode',
"    \ ],
"    \}

" Most VimTeX mappings rely on localleader and this can be changed with the
" following line. The default is usually fine and is the symbol "\".
let maplocalleader = ","


" Trigger configuration. Do not use <tab> if you use
" https://github.com/Valloric/YouCompleteMe.

" shortcut to go to next position
"let g:UltiSnipsJumpForwardTrigger='<c-j>'

" shortcut to go to previous position
"let g:UltiSnipsJumpBackwardTrigger='<c-k>'


let nnoremaplocalleader = ","

" nnoremap <localleader>ex :!chmod +x build.sh<CR>
" nnoremap <localleader>cr :!./build.sh<CR>
" let g:ray_base_url = 'http://localhost:3000'
let g:ray_browser = 'firefox'
" let g:deoplete#enable_at_startup = 1