Last active
September 28, 2021 05:10
-
-
Save mustardfrog/b868f68bc944ad1ff85a93af4a5f33f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set exrc | |
set nohlsearch | |
set ruler | |
set number | |
set relativenumber | |
set tabstop=4 softtabstop=4 | |
"set smartindent | |
set shiftwidth=4 | |
set expandtab | |
set hidden | |
set nobackup | |
set noerrorbells | |
set wrap | |
set incsearch | |
set scrolloff=8 | |
set cmdheight=2 | |
set updatetime=300 | |
set shortmess+=c | |
"set bg=light | |
set t_Co=256 | |
let g:fugitive_dynamic_colors = 256 | |
set mouse=vi | |
"set guicursor=i:blinkon175,n:blinkoff0 | |
set guicursor= | |
"set termguicolors | |
"vno y "*y | |
set signcolumn=yes | |
"noremap pp :r !pbpaste<CR> | |
set completeopt=menuone,noinsert,noselect | |
set updatetime=300 | |
set switchbuf=useopen,usetab | |
nnoremap <C-p> :bp<CR> | |
nnoremap <C-n> :bn<CR> | |
nnoremap <C-x> :bd<CR> | |
syntax on | |
filetype plugin indent on | |
vnoremap J :m '>+1<CR>gv=gv vnoremap K :m '<-2<CR>gv=gv | |
"vmap <C-c> y:call system("xclip -i -selection clipboard", getreg("\""))<CR>:call system("xclip -i", getreg("\""))<CR> | |
call plug#begin('~/.vim/plugged') | |
"Plug 'scrooloose/nerdtree' | |
Plug 'ThePrimeagen/vim-be-good' | |
Plug 'mattn/emmet-vim' | |
"Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
"Plug 'morhetz/gruvbox' | |
"Plug 'dracula/vim', {'as': 'dracula'} | |
"Plug 'ayu-theme/ayu-vim' | |
"Plug 'arcticicestudio/nord-vim' | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'sainnhe/gruvbox-material' | |
"Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
"Plug 'junegunn/fzf.vim' | |
Plug 'stsewd/fzf-checkout.vim' | |
Plug 'airblade/vim-rooter' | |
Plug 'nvim-lua/popup.nvim' | |
Plug 'nvim-lua/plenary.nvim' | |
Plug 'nvim-telescope/telescope.nvim' | |
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} | |
Plug 'nvim-treesitter/playground' | |
Plug 'kyazdani42/nvim-tree.lua' | |
"Plug 'christoomey/vim-tmux-navigator' | |
Plug 'preservim/nerdcommenter' | |
Plug 'tpope/vim-fugitive' | |
Plug 'vim-airline/vim-airline' | |
Plug 'pangloss/vim-javascript' | |
Plug 'mxw/vim-jsx' | |
Plug 'vim-ruby/vim-ruby' | |
Plug 'neovim/nvim-lspconfig' | |
" Extensions to built-in LSP, for example, providing type inlay hints | |
Plug 'nvim-lua/lsp_extensions.nvim' | |
" Adds extra functionality over rust analyzer | |
Plug 'simrat39/rust-tools.nvim' | |
" Autocompletion framework for built-in LSP | |
"Plug 'nvim-lua/completion-nvim' | |
Plug 'hrsh7th/nvim-compe' | |
Plug 'windwp/nvim-autopairs' | |
Plug 'mfussenegger/nvim-dap' | |
call plug#end() | |
colorscheme gruvbox-material | |
" Important!! | |
if has('termguicolors') | |
set termguicolors | |
endif | |
" For dark version. | |
set background=dark | |
let g:gruvbox_material_background = 'soft' | |
" Example config in Vim-Script | |
" Use completion-nvim in every buffer | |
"autocmd BufEnter * lua require'completion'.on_attach() | |
"airline | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tabline#left_sep = ' ' | |
let g:airline#extensions#tabline#left_alt_sep = '|' | |
let g:airline#extensions#tabline#formatter = 'unique_tail' | |
let g:completion_enable_auto_hover = 0 | |
let g:completion_enable_auto_signature = 0 | |
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy'] | |
"let g:completion_trigger_character = ['.', '::'] | |
" use <Tab> as trigger keys | |
imap <Tab> <Plug>(completion_smart_tab) | |
imap <S-Tab> <Plug>(completion_smart_s_tab) | |
"let g:netrw_browse_split = 2 | |
let g:netrw_banner = 0 | |
let g:netrw_liststyle = 3 | |
""""treesitter | |
lua <<EOF | |
require'nvim-treesitter.configs'.setup { | |
highlight = { | |
enable = true | |
}, | |
playground = { | |
enable = true, | |
disable = {}, | |
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code | |
persist_queries = false -- Whether the query persists across vim sessions | |
} | |
} | |
EOF | |
"Configure lsp | |
"https://github.com/neovim/nvim-lspconfig#rust_analyzer | |
lua <<EOF | |
-- nvim_lsp object | |
local nvim_lsp = require'lspconfig' | |
local opts = { | |
tools = { | |
autoSetHints = true, | |
hover_with_actions = true, | |
runnables = { | |
use_telescope = true | |
}, | |
inlay_hints = { | |
show_parameter_hints = false, | |
parameter_hints_prefix = "", | |
other_hints_prefix = "", | |
}, | |
}, | |
-- all the opts to send to nvim-lspconfig | |
-- these override the defaults set by rust-tools.nvim | |
-- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer | |
server = {}, -- rust-analyer options | |
} | |
require('rust-tools').setup(opts) | |
require('nvim-autopairs').setup({ | |
enable_check_bracket_line = false | |
}) | |
EOF | |
nnoremap <silent> <c-]> <cmd>lua vim.lsp.buf.definition()<CR> | |
nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR> | |
nnoremap <silent> gD <cmd>lua vim.lsp.buf.implementation()<CR> | |
nnoremap <silent> <c-k> <cmd>lua vim.lsp.buf.signature_help()<CR> | |
nnoremap <silent> 1gD <cmd>lua vim.lsp.buf.type_definition()<CR> | |
nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR> | |
nnoremap <silent> g0 <cmd>lua vim.lsp.buf.document_symbol()<CR> | |
nnoremap <silent> gW <cmd>lua vim.lsp.buf.workspace_symbol()<CR> | |
nnoremap <silent> gd <cmd>lua vim.lsp.buf.declaration()<CR> | |
nnoremap <silent> ga <cmd>lua vim.lsp.buf.code_action()<CR> | |
autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics() | |
" Goto previous/next diagnostic warning/error | |
nnoremap <silent> g[ <cmd>lua vim.lsp.diagnostic.goto_prev()<CR> | |
nnoremap <silent> g] <cmd>lua vim.lsp.diagnostic.goto_next()<CR> | |
" Completion | |
lua <<EOF | |
require'compe'.setup { | |
enabled = true; | |
autocomplete = true; | |
debug = false; | |
min_length = 1; | |
preselect = 'enable'; | |
throttle_time = 80; | |
source_timeout = 800; | |
incomplete_delay = 800; | |
max_abbr_width = 100; | |
max_kind_width = 100; | |
max_menu_width = 100; | |
source = { | |
path = true; | |
buffer = true; | |
calc = true; | |
vsnip = true; | |
nvim_lsp = true; | |
nvim_lua = true; | |
spell = true; | |
tags = true; | |
snippets_nvim = true; | |
}; | |
} | |
EOF | |
" Use <Tab> and <S-Tab> to navigate through popup menu | |
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" | |
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" | |
inoremap <silent><expr> <C-Space> compe#complete() | |
inoremap <silent><expr> <CR> compe#confirm('<CR>') | |
inoremap <silent><expr> <C-e> compe#close('<C-e>') | |
" Enable type inlay hints | |
autocmd CursorMoved,InsertLeave,BufEnter,BufWinEnter,TabEnter,BufWritePost * | |
\ lua require'lsp_extensions'.inlay_hints{ prefix = '', highlight = "Comment", enabled = {"TypeHint", "ChainingHint", "ParameterHint"} } | |
""""telescope | |
"" Find files using Telescope command-line sugar. | |
nnoremap <leader>ff <cmd>Telescope find_files<cr> | |
nnoremap <leader>fg <cmd>Telescope live_grep<cr> | |
nnoremap <leader>fb <cmd>Telescope buffers<cr> | |
nnoremap <leader>fh <cmd>Telescope help_tags<cr> | |
nnoremap <leader>fl <cmd>Telescope git_files<cr> | |
""""""nvim tree"""""" | |
nnoremap <leader>tt :NvimTreeToggle<CR> | |
nnoremap <leader>tr :NvimTreeRefresh<CR> | |
nnoremap <leader>tn :NvimTreeFindFile<CR> | |
"" NvimTreeOpen and NvimTreeClose are also available if you need them | |
""Emmet | |
"let g:user_emmet_settings = { | |
"\ 'javascript' : { | |
"\ 'extends' : 'jsx', | |
"\ }, | |
"\} | |
"let g:user_emmet_install_global = 1 | |
"autocmd FileType html,css,javascript.jsx EmmetInstall | |
"let g:user_emmet_leader_key='<TAB>' | |
vmap <leader>cc <plug>NERDCommenterToggle | |
nmap <leader>cc <plug>NERDCommenterToggle | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment