Skip to content

Instantly share code, notes, and snippets.

@Arzte
Last active April 29, 2023 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arzte/925f0ca79fbfaf9be8b3d7061ffd7151 to your computer and use it in GitHub Desktop.
Save Arzte/925f0ca79fbfaf9be8b3d7061ffd7151 to your computer and use it in GitHub Desktop.
Iris must init my vim for the souls I cannot collect
if (has("termguicolors"))
set termguicolors
endif
if exists("g:neovide")
let g:neovide_transparency=1
endif
"dein Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved (Disables Vi compat)
endif
let g:python3_host_prog = '/Users/iris/.pyenv/versions/neovim3/bin/python'
" Required:
set runtimepath+=/Users/iris/.cache/dein/repos/github.com/Shougo/dein.vim
" Required:
if dein#load_state('/Users/iris/.cache/dein')
call dein#begin('/Users/iris/.cache/dein')
" Let dein manage dein
" Required:
call dein#add('/Users/iris/.cache/dein/repos/github.com/Shougo/dein.vim')
" Dien specific dien plugins------------------------------------------------
"" (Brought to you by the department of redundency and redundency)
" Dien doesn't come with an UI, but someone *has* made one,
" It's basically plug's UI, so that's neat.
call dein#add('wsdjeg/dein-ui.vim')
" Completion for Completion sakes (I am very smart)-------------------------
call dein#add('Shougo/deoplete.nvim')
call dein#add('tbodt/deoplete-tabnine', { 'build': './install.sh' })
call dein#add('codota/tabnine-nvim')
"" Snippets (For DDC)
call dein#add('hrsh7th/vim-vsnip')
call dein#add('rafamadriz/friendly-snippets')
" General Vim plugins-------------------------------------------------------
"" Plugins that Improve Vim functionality, features, or style but aren't language plugins.
" Startify provides a starting screen for vim when vim is started and no file is passed.
" Convinient to get back where you were, open recent files/sessions, etc.
call dein#add('mhinz/vim-startify')
" Vim Airline preforms a simular function to normal airline, by providing a nice looking
" status lines with fancy font stuff. Does not come bundled with themes.
call dein#add('vim-airline/vim-airline')
call dein#add('vim-airline/vim-airline-themes')
" Speaking of themes, oceanic-next is objectively the best dark mode editor theme
call dein#add('mhartington/oceanic-next')
" LSPs (Language Server Protocol (Providers))
call dein#add('neovim/nvim-lsp')
" Language Plugins----------------------------------------------------------
" Rust
call dein#add('dense-analysis/ale')
call dein#add('tpope/vim-fugitive')
call dein#add('scrooloose/nerdtree')
call dein#add('Xuyuanp/nerdtree-git-plugin')
call dein#add('majutsushi/tagbar')
call dein#add('junegunn/fzf')
call dein#add('tpope/vim-sleuth')
call dein#add('RRethy/vim-illuminate')
call dein#add('airblade/vim-rooter')
call dein#add('ryanoasis/vim-devicons')
call dein#add('autozimu/LanguageClient-neovim', {'rev': 'next', 'build': 'bash install.sh'})
call dein#add('machakann/vim-highlightedyank')
call dein#add('tpope/vim-surround')
call dein#add('jeffkreeftmeijer/vim-numbertoggle')
call dein#add('~/.zinit/plugins/hschne---fzf-git/', {'rtp': '', 'merged': 0})
call dein#add('yuki-ycino/fzf-preview.vim', { 'rev': 'release' })
"Language Plugins------------------------
" Python
call dein#add('janko-m/vim-test')
call dein#add('puremourning/vimspector')
" Rust
call dein#add('rust-lang/rust.vim', {'on_ft': 'rust'})
call dein#add('sebastianmarkow/deoplete-rust', {'on_ft': 'rust'})
call dein#add('mattn/webapi-vim', {'on_ft': 'rust'})
" Latex and General Writing
call dein#add('vim-pandoc/vim-pandoc', {'name': 'vim_pandoc', 'on_source': 'pandoc-after'})
call dein#add('dhruvasagar/vim-table-mode', {'on_cmd': 'TableModeToggle'})
call dein#add('lervag/vimtex', {'on_ft': ['plaintex', 'tex']})
call dein#add('vim-pandoc/vim-pandoc-syntax', {'depends':'vim_pandoc'})
call dein#add('vim-pandoc/vim-pandoc-after', {'depends': 'vim_pandoc'})
call dein#add('junegunn/goyo.vim', {'on_cmd': 'Goyo'})
call dein#add('ron89/thesaurus_query.vim',{'on_ft': ['pandoc', 'text']})
call dein#add('rhysd/vim-grammarous',{'on_ft':['pandoc', 'text']})
call dein#add('junegunn/limelight.vim', {'on_cmd': 'Limelight'})
" JavaScript and TypeScript
call dein#add('yuezk/vim-js')
call dein#add('HerringtonDarkholme/yats.vim')
call dein#add('maxmellon/vim-jsx-pretty')
" Neosnippet thingys
call dein#add('roxma/nvim-yarp')
call dein#add('roxma/vim-hug-neovim-rpc')
call dein#add('Shougo/neosnippet.vim')
call dein#add('Shougo/neosnippet-snippets')
" Discord RPC
" Disabled as I am currently not using Discord
" call dein#add('ObserverOfTime/discord.nvim')
" Required:
call dein#end()
call dein#save_state()
endif
" Required:
filetype plugin on
filetype plugin indent on
syntax enable
" If you want to install not installed plugins on startup.
if dein#check_install()
call dein#install()
endif
"End dein Scripts--------------------------
"Begin Vim Settings------------------------------
set showmatch " Show matching
set ignorecase " case insensitive
set smartcase " Case sensitive when not lowercase (Overrides ignorecase when Uppercase is used in search)
set expandtab " Convert tabs to spaces
set smartindent " Syntax/style aware indentation works with autoindent (autoindent is still required)
set number relativenumber " Hybrid line numbers, relative numbers in default mode, absolute line numbers in insert mode
set colorcolumn=120 " Change the column color if a line is over 80 columns wide
set cursorline " Highlight the current cursor line
set spelllang=en_us " Spell checker language :) (set spell not enabled because it's not great with code usually)
set wrap " Line wrapping (visual only)
set linebreak " Wrap at the first word that doesn't fit, rather than the character
set textwidth=500 " Line break on 500 characters
" 1 tab == 4 spaces
set shiftwidth=4 " width for autoindents
set tabstop=4 " Number of columns occupied by a tab
set softtabstop=4 " See multiple spaces as tabstops so <BS> (backspace) does the right thing
set list
" Set the colorscheme to OceanicNext, the best theme evhar!1!!
colorscheme OceanicNext
" Mouse Mode
set mouse=a
" Encoding
set fileencoding=utf-8
set fileencodings=utf-8
" Set font
set guifont=CaskaydiaCove\ Nerd\ Font:h11
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
"" LanguageClient Neovim
nnoremap <leader>5 :call LanguageClient_contextMenu()<CR>
nnoremap <leader>fi :call LanguageClient_textDocument_codeAction()<CR>
" Fast saving
" Not forcing a write because if there's an error I'd want to manually fix it
nmap <leader>w :w<cr>
nmap <leader>x :x<cr>
nmap <leader>t :NERDTreeToggle<cr>
nmap <leader>q :q<cr>
" :W sudo saves the file
" (useful for handling the permission-denied error)
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
try
set undodir=/Users/iris/.cache/nvim
set undofile
catch
endtry
noremap YY "y<CR>
noremap <leader>p "+gP<CR>
noremap XX "+x<CR>
if has('macunix')
" pbcopy for OSX copy/paste
vmap <C-x> :!pbcopy<CR>
vmap <C-c> :w !pbcopy<CR><CR>
endif
" More natural splits
set splitbelow
set splitright
"End Vim Settings-----------------------
"Begin Plugin Settings---------------------
" Enable Deoplete
let g:deoplete#enable_at_startup = 1
" For conceal markers.
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
"Vim airline settings
let g:airline_theme='oceanicnext'
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let g:airline#extensions#ale#enabled = 1
" Rust settings
let g:rustfmt_autosave = 1
" Ale Settings
let g:ale_linters = {
\'rust': ['cargo'],
\'python': ['ruff']
\}
let g:ale_fixers = {
\'*': ['remove_trailing_lines', 'trim_whitespace'],
\'rust': ['rustfmt'],
\'javascript': ['eslint', 'prettier'],
\'python': ['ruff', 'black'],
\}
let b:ale_rust_analyzer_config = {'rust': {'clippy_preference': 'on'}}
let g:ale_python_ruff_executable = '/Users/iris/.pyenv/versions/neovim3/bin/ruff'
let g:ale_fix_on_save = 1
"Vim Rooter
let g:rooter_change_directory_for_non_project_files = 'current'
"LanguageClient Neovim settings
""Required for operations modifying multiple buffers like rename.
set hidden
let g:LanguageClient_serverCommands = {'rust': ['rust-analyzer']}
"fzf preview settings
""Keybindings
nnoremap <C-p> :FzfPreviewProjectFiles<Cr>
nmap <Leader>f [fzf-p]
xmap <Leader>f [fzf-p]
nnoremap <silent> [fzf-p]p :<C-u>FzfPreviewFromResources project_mru git<CR>
nnoremap <silent> [fzf-p]gs :<C-u>FzfPreviewGitStatus<CR>
nnoremap <silent> [fzf-p]ga :<C-u>FzfPreviewGitActions<CR>
nnoremap <silent> [fzf-p]b :<C-u>FzfPreviewBuffers<CR>
nnoremap <silent> [fzf-p]B :<C-u>FzfPreviewAllBuffers<CR>
nnoremap <silent> [fzf-p]o :<C-u>FzfPreviewFromResources buffer project_mru<CR>
nnoremap <silent> [fzf-p]<C-o> :<C-u>FzfPreviewJumps<CR>
nnoremap <silent> [fzf-p]g; :<C-u>FzfPreviewChanges<CR>
nnoremap <silent> [fzf-p]/ :<C-u>FzfPreviewLines --add-fzf-arg=--no-sort --add-fzf-arg=--query="'"<CR>
nnoremap <silent> [fzf-p]* :<C-u>FzfPreviewLines --add-fzf-arg=--no-sort --add-fzf-arg=--query="'<C-r>=expand('<cword>')<CR>"<CR>
nnoremap [fzf-p]gr :<C-u>FzfPreviewProjectGrep<Space>
xnoremap [fzf-p]gr "sy:FzfPreviewProjectGrep<Space>-F<Space>"<C-r>=substitute(substitute(@s, '\n', '', 'g'), '/', '\\/', 'g')<CR>"
nnoremap <silent> [fzf-p]t :<C-u>FzfPreviewBufferTags<CR>
nnoremap <silent> [fzf-p]q :<C-u>FzfPreviewQuickFix<CR>
nnoremap <silent> [fzf-p]l :<C-u>FzfPreviewLocationList<CR>
"vim-startify
"" returns all modified files of the current git repo
"" `2>/dev/null` makes the command fail quietly, so that when we are not
"" in a git repo, the list will be empty
function! s:gitModified()
let files = systemlist('git ls-files -m 2>/dev/null')
return map(files, "{'line': v:val, 'path': v:val}")
endfunction
"" same as above, but show untracked files, honoring .gitignore
function! s:gitUntracked()
let files = systemlist('git ls-files -o --exclude-standard 2>/dev/null')
return map(files, "{'line': v:val, 'path': v:val}")
endfunction
let g:startify_lists = [
\ { 'type': 'files', 'header': [' MRU'] },
\ { 'type': 'dir', 'header': [' MRU '. getcwd()] },
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ { 'type': function('s:gitModified'), 'header': [' git modified']},
\ { 'type': function('s:gitUntracked'), 'header': [' git untracked']},
\ { 'type': 'commands', 'header': [' Commands'] },
\ ]
"End Plugin Settings-----------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment