rice/nvim/init.vim

274 lines
9.4 KiB
VimL
Raw Normal View History

2022-02-10 01:58:12 -08:00
syntax enable
filetype plugin on
2022-02-07 21:27:27 -08:00
set noshowmode "disable default vim insert text at bottom
2022-04-15 23:21:17 -07:00
set laststatus=3
2022-02-07 21:27:27 -08:00
set number
set colorcolumn=80
2022-05-22 15:35:26 -07:00
set textwidth=80
2022-02-07 21:27:27 -08:00
set shiftwidth=4
set tabstop=4
set autoindent
set ignorecase
set smartcase
set incsearch
set smartindent
set hlsearch
set ignorecase
set noerrorbells
set title
set mouse=a
set relativenumber
set splitright
set cursorline
set scrolloff=8
set sidescrolloff=8
set wildmenu " show candidates for vim commands with tab
set wildignore=*.o,*.obj,*.bak,*.exe
set background=dark
set showmatch
set list
set listchars=tab:\ ,trail:
set encoding=UTF-8
set guifont=FiraCode\ Nerd\ Font\ 18
set expandtab
" coc settings
set hidden
set nobackup
set nowritebackup
2022-04-29 17:09:49 -07:00
set cmdheight=1
2022-02-07 21:27:27 -08:00
set updatetime=300
2022-02-09 01:25:05 -08:00
set timeoutlen=400
2022-02-07 21:27:27 -08:00
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
2022-04-29 17:09:49 -07:00
set pumwidth=35
2022-05-22 15:35:26 -07:00
" set nocompatible " no more vi
" set path from current directory and all directories under
" set path=$PWD/**
2022-02-07 21:27:27 -08:00
" Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
2022-02-09 01:25:05 -08:00
\| endif
2022-02-07 21:27:27 -08:00
call plug#begin('~/.vim/plugged')
2022-02-10 23:02:09 -08:00
Plug 'ap/vim-css-color'
Plug 'github/copilot.vim'
Plug 'jiangmiao/auto-pairs'
2022-02-07 21:27:27 -08:00
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
2022-02-10 23:02:09 -08:00
Plug 'pechorin/any-jump.vim'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'voldikss/vim-floaterm'
Plug 'wakatime/vim-wakatime'
2022-02-12 00:13:03 -08:00
" Plug 'christoomey/vim-tmux-navigator'
2022-02-07 21:27:27 -08:00
2022-02-10 00:43:30 -08:00
" Plug 'dense-analysis/ale'
" Plug 'neoclide/coc.nvim', {'branch': 'release'}
2022-02-10 23:02:09 -08:00
let g:mapleader = "\<Space>"
let g:maplocalleader = ','
2022-02-07 21:27:27 -08:00
if has('nvim')
2022-02-10 23:02:09 -08:00
Plug 'nvim-lua/plenary.nvim'
2022-02-11 10:14:42 -08:00
Plug 'nvim-lua/popup.nvim'
2022-03-08 22:49:34 -08:00
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
2022-02-10 23:02:09 -08:00
2022-02-07 21:27:27 -08:00
Plug 'akinsho/bufferline.nvim'
2022-02-13 15:15:35 -08:00
Plug 'andweeb/presence.nvim'
2022-02-08 01:21:19 -08:00
Plug 'folke/which-key.nvim'
Plug 'glepnir/dashboard-nvim'
Plug 'kyazdani42/nvim-tree.lua'
2022-02-10 23:02:09 -08:00
Plug 'kyazdani42/nvim-web-devicons'
Plug 'lewis6991/gitsigns.nvim'
Plug 'nvim-lualine/lualine.nvim'
2022-10-27 17:28:20 -07:00
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' }
2022-02-10 16:56:49 -08:00
Plug 'ojroques/nvim-lspfuzzy'
2022-02-07 21:27:27 -08:00
2022-02-10 23:02:09 -08:00
Plug 'L3MON4D3/LuaSnip'
2022-10-27 17:28:20 -07:00
Plug 'amrbashir/nvim-docs-view'
2022-02-10 00:43:30 -08:00
Plug 'hrsh7th/cmp-buffer'
2022-02-10 23:02:09 -08:00
Plug 'hrsh7th/cmp-nvim-lsp'
2022-02-10 00:43:30 -08:00
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/nvim-cmp'
2022-02-14 23:15:13 -08:00
Plug 'j-hui/fidget.nvim'
2022-02-10 23:02:09 -08:00
Plug 'jose-elias-alvarez/null-ls.nvim'
2022-02-14 23:15:13 -08:00
Plug 'ksyasuda/lsp_lines.nvim'
2022-02-10 23:02:09 -08:00
Plug 'neovim/nvim-lspconfig'
2022-02-10 00:43:30 -08:00
Plug 'onsails/lspkind-nvim'
2022-02-10 23:02:09 -08:00
Plug 'ray-x/lsp_signature.nvim'
2022-02-10 16:56:49 -08:00
Plug 'rmagatti/goto-preview',
2022-02-10 23:02:09 -08:00
Plug 'saadparwaiz1/cmp_luasnip'
Plug 'williamboman/nvim-lsp-installer'
2022-02-09 01:25:05 -08:00
2022-02-07 21:27:27 -08:00
Plug 'Mofiqul/dracula.nvim'
2022-02-10 23:02:09 -08:00
Plug 'NTBBloodbath/doom-one.nvim'
Plug 'olimorris/onedarkpro.nvim'
2022-02-07 21:27:27 -08:00
Plug 'projekt0n/github-nvim-theme'
else
Plug 'ap/vim-buftabline'
2022-02-10 16:56:49 -08:00
Plug 'itchyny/lightline.vim'
2022-02-10 23:02:09 -08:00
Plug 'liuchengxu/vim-which-key', { 'on': ['WhichKey', 'WhichKey!'] }
2022-02-10 16:56:49 -08:00
Plug 'maximbaz/lightline-ale'
2022-02-10 23:02:09 -08:00
Plug 'mhinz/vim-startify'
Plug 'preservim/nerdtree' | Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'ryanoasis/vim-devicons'
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-fugitive'
2022-02-09 01:25:05 -08:00
2022-02-07 21:27:27 -08:00
Plug 'joshdick/onedark.vim'
Plug 'kaicataldo/material.vim', { 'branch': 'main' }
Plug 'morhetz/gruvbox'
Plug 'vv9k/vim-github-dark'
endif
call plug#end()
if has('nvim')
2022-02-10 23:02:09 -08:00
set completeopt=menu,menuone,noselect
2022-02-11 10:14:42 -08:00
let g:fzf_command = 'fzf --height 90% --width=85% --layout=reverse --preview "bat --color=always {}"'
2022-02-10 23:02:09 -08:00
source ~/.config/nvim/keybindings.vim
2022-03-08 22:49:34 -08:00
" nvim plugins
2022-02-09 01:25:05 -08:00
source ~/.config/nvim/plugin-confs/bufferline.lua
source ~/.config/nvim/plugin-confs/dashboard-art.vim
2022-02-10 23:02:09 -08:00
source ~/.config/nvim/plugin-confs/dashboard-nvim.lua
source ~/.config/nvim/plugin-confs/gitsigns.lua
2022-02-10 16:56:49 -08:00
source ~/.config/nvim/plugin-confs/lspfuzzy.lua
source ~/.config/nvim/plugin-confs/lualine.lua
2022-02-10 23:02:09 -08:00
source ~/.config/nvim/plugin-confs/nvimtree.lua
2022-02-14 23:15:13 -08:00
source ~/.config/nvim/plugin-confs/presence.lua
2022-02-10 23:02:09 -08:00
source ~/.config/nvim/plugin-confs/treesitter.lua
source ~/.config/nvim/plugin-confs/whichkey.lua
2022-10-27 17:28:20 -07:00
source ~/.config/nvim/plugin-confs/telescope.lua
2022-02-09 01:25:05 -08:00
2022-02-10 16:56:49 -08:00
source ~/.config/nvim/plugin-confs/code_actions.lua
2022-04-15 23:21:17 -07:00
" source ~/.config/nvim/plugin-confs/copilot.lua
2022-02-10 23:02:09 -08:00
source ~/.config/nvim/plugin-confs/goto-preview.lua
source ~/.config/nvim/plugin-confs/lsp-kind.lua
2022-02-09 01:25:05 -08:00
source ~/.config/nvim/plugin-confs/lsp-signature.lua
2022-02-10 23:02:09 -08:00
source ~/.config/nvim/plugin-confs/lspconfig.lua
2022-02-14 23:15:13 -08:00
source ~/.config/nvim/plugin-confs/lsplines.lua
2022-02-10 00:43:30 -08:00
source ~/.config/nvim/plugin-confs/null-ls.lua
source ~/.config/nvim/plugin-confs/nvim-cmp.lua
2022-02-14 23:15:13 -08:00
source ~/.config/nvim/plugin-confs/fidget.lua
2022-02-10 23:02:09 -08:00
source ~/.config/nvim/plugin-confs/symbols-outline.lua
2022-10-27 17:28:20 -07:00
source ~/.config/nvim/plugin-confs/nvim-docs-view.lua
2022-02-09 01:25:05 -08:00
2022-03-08 22:49:34 -08:00
" nvim and vim plugins
2022-02-10 23:02:09 -08:00
source ~/.vim/plugin-confs/floaterm.vim
2022-02-09 01:25:05 -08:00
source ~/.vim/plugin-confs/fzf.vim
source ~/.vim/plugin-confs/vim-closetag.vim
source ~/.vim/plugin-confs/wakatime.vim
source ~/.config/nvim/plugin-confs/doomone.lua
source ~/.config/nvim/plugin-confs/dracula.lua
source ~/.config/nvim/plugin-confs/github-theme.lua
2022-02-10 16:56:49 -08:00
source ~/.config/nvim/plugin-confs/onedarkpro.lua
2022-02-07 21:27:27 -08:00
2022-05-19 01:26:07 -07:00
source ~/.config/nvim/lua/toggle_lsp_diagnostics.lua
2022-02-07 21:27:27 -08:00
" makes fzf match colorscheme (I think)
augroup fzf_preview
2022-05-19 01:26:07 -07:00
autocmd!
autocmd User fzf_preview#rpc#initialized call s:fzf_preview_settings()
2022-02-07 21:27:27 -08:00
augroup END
function! s:fzf_preview_settings() abort
2022-05-19 01:26:07 -07:00
let g:fzf_preview_command = 'COLORTERM=truecolor ' . g:fzf_preview_command
let g:fzf_preview_grep_preview_cmd = 'COLORTERM=truecolor ' . g:fzf_preview_grep_preview_cmd
2022-02-07 21:27:27 -08:00
endfunction
" make terminal not have line numbers
autocmd TermOpen * setlocal nonumber norelativenumber
2022-02-08 01:21:19 -08:00
else
2022-02-10 23:02:09 -08:00
source ~/.vim/keybindings.vim
2022-02-09 01:25:05 -08:00
source ~/.vim/plugin-confs/nerdtree.vim
source ~/.vim/plugin-confs/whichkey.vim
source ~/.vim/plugin-confs/ale.vim
source ~/.vim/plugin-confs/fzf.vim
source ~/.vim/plugin-confs/vim-closetag.vim
source ~/.vim/plugin-confs/wakatime.vim
source ~/.vim/plugin-confs/prettier.vim
source ~/.vim/plugin-confs/lightline.vim
source ~/.vim/plugin-confs/coc.vim
source ~/.vim/plugin-confs/floaterm.vim
if executable('bash-language-server')
au User lsp_setup call lsp#register_server({
\ 'name': 'bash-language-server',
\ 'cmd': {server_info->[&shell, &shellcmdflag, 'bash-language-server start']},
\ 'allowlist': ['sh'],
\ })
endif
2022-02-07 21:27:27 -08:00
endif
"------------------------------------------------------------------------------
" Enable :Man <man_page>
"------------------------------------------------------------------------------
runtime ftplugin/man.vim
"------------------------------------------------------------------------------
" Force help/man buffers into vertical split
"------------------------------------------------------------------------------
autocmd FileType help wincmd L
autocmd FileType man wincmd L
"------------------------------------------------------------------------------
"jump to remembered position in file if available
"------------------------------------------------------------------------------
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
"------------------------------------------------------------------------------
"COLORSCHEME
"------------------------------------------------------------------------------
set t_Co=256
if has('nvim')
set termguicolors
2022-02-14 17:41:21 -08:00
colorscheme doom-one
2022-02-07 21:27:27 -08:00
" colorscheme dracula
2022-02-14 17:41:21 -08:00
" colorscheme github_dark
" colorscheme onedark
" colorscheme onedarkpro
2022-02-07 21:27:27 -08:00
else
" let g:onedark_termcolors=256 "enable 256 colors
" colorscheme onedark "set colorsheme as onedark
"material theme
" let g:material_theme_style = 'default' | 'palenight' | 'ocean' | 'lighter' | 'darker' | 'default-community' | 'palenight-community' | 'ocean-community' | 'lighter-community' | 'darker-community'
" let g:material_terminal_italics = 1
" let g:material_theme_style = 'darker'
" colorscheme material
let g:gruvbox_contrast_dark = "medium" "default
" let g:gruvbox_contrast_dark = "soft"
let g:gruvbox_improved_strings = 0
let g:gruvbox_improved_warnings = 1
colorscheme gruvbox
endif
"------------------------------------------------------------------------------
" custom commands
"------------------------------------------------------------------------------
2022-02-09 01:25:05 -08:00
command! -bang -nargs=? -complete=dir Files
2022-02-10 23:02:09 -08:00
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline', '--preview', '~/.vim/plugged/fzf.vim/bin/preview.sh']}), <bang>0)
2022-02-09 01:25:05 -08:00
command! -bang -nargs=? -complete=dir AllFiles
2022-06-25 23:35:18 -07:00
\ call fzf#run(fzf#wrap('allfiles', fzf#vim#with_preview({'dir': <q-args>, 'sink': 'e', 'source': 'rg --files --hidden --no-ignore', 'options': ['--layout=reverse', '--preview', '~/.vim/plugged/fzf.vim/bin/preview.sh']}), <bang>0))
2022-02-10 23:02:09 -08:00
2022-06-25 23:35:18 -07:00
command! -bang -nargs=? -complete=dir Lines
\ call fzf#vim#lines(<q-args>, ({'options': ['--layout=reverse']}), <bang>0)
2022-02-10 23:02:09 -08:00
command! -bang -nargs=? -complete=dir Buffers
\ call fzf#vim#buffers(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline', '--preview', '~/.vim/plugged/fzf.vim/bin/preview.sh']}), <bang>0)
2022-02-07 21:27:27 -08:00
command! Reload execute "source ~/.vimrc"
command! Config execute ":e ~/.vimrc"
command! Env execute ":Dotenv .env"
command! MakeTags !ctags -R .
command! Ovewrite execute ":w !sudo tee %"
command! Aniwrapper execute ":FloatermNew aniwrapper -qtdoomone -D 144"