Skip to content

Instantly share code, notes, and snippets.

@mattrasband
Created March 21, 2024 14:09
Show Gist options
  • Save mattrasband/b451a6883cd9cc9314f014ed3d0e168b to your computer and use it in GitHub Desktop.
Save mattrasband/b451a6883cd9cc9314f014ed3d0e168b to your computer and use it in GitHub Desktop.
neovim
local Plug = vim.fn['plug#']
vim.call('plug#begin')
Plug 'ctrlpvim/ctrlp.vim'
if vim.fn.executable('ag') then
Plug 'rking/ag.vim'
vim.g.ackprg = 'ag --nogroup --nocolor --column'
vim.opt.grepprg = 'ag --nogroup --nocolor'
vim.g.ctrlp_user_command = 'ag %s -l --nocolor -g ""'
vim.g.ctrlp_use_caching = 0
end
if vim.fn.executable('git') then
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
end
if vim.fn.executable('go') then
Plug('fatih/vim-go', {['do'] = 'GoInstallBinaries'})
vim.g.go_def_mode = 'gopls'
vim.g.go_info_mode = 'gopls'
vim.g.go_fmt_command = 'goimports'
vim.g.go_highlight_types = 1
vim.g.go_highlight_fields = 1
vim.g.go_highlight_functions = 1
vim.g.go_highlight_function_calls = 1
vim.g.go_highlight_operators = 1
vim.g.go_metalinter_enabled = {'vet', 'goling', 'errcheck'}
vim.g.go_metalinter_autosave_enabled = 1
vim.g.go_rename_command = 'gopls'
end
if vim.fn.executable('rustc') then
Plug 'rust-lang/rust.vim'
vim.g.rust_clip_command = 'clip.exe'
-- rustup component add rust-analyzer
Plug 'fannheyward/coc-rust-analyzer'
vim.g.rustfmt_autosave = 1
end
if vim.fn.executable('tmux') then
Plug 'edkolev/tmuxline.vim'
Plug 'christoomey/vim-tmux-navigator'
end
Plug 'AndrewRadev/splitjoin.vim'
Plug 'SirVer/ultisnips'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'fatih/molokai'
vim.g.rehash256 = 1
vim.g.molokai_original = 1
Plug 'junegunn/vim-easy-align'
Plug 'luochen1990/rainbow'
vim.g.rainbow_active = 1
Plug('neoclide/coc.nvim', { branch = 'release' })
Plug('preservim/nerdtree', { on = 'NERDTreeToggle' })
Plug 'ryanoasis/vim-devicons'
Plug 'scrooloose/nerdcommenter'
vim.g.NERDSpaceDelims = 1
vim.g.NERDDefaultAlign = 1
Plug 'terryma/vim-multiple-cursors'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-sensible'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
vim.g.airline_theme = 'molokai'
vim.call('plug#end')
vim.cmd([[
augroup all
autocmd!
autocmd BufWritePre * %s/\s\+$//e
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
augroup END
augroup golang
autocmd!
autocmd FileType go setlocal noexpandtab tabstop=4 shiftwidth=4
augroup END
augroup makefile
autocmd!
autocmd FileType make setlocal noexpandtab tabstop=4 shiftwidth=4
augroup END
augroup yaml
autocmd!
autocmd FileType yaml setlocal expandtab tabstop=2 shiftwidth=2
augroup END
]])
vim.cmd 'colorscheme molokai'
vim.cmd 'syntax enable'
vim.cmd 'filetype plugin indent on'
vim.g.mapleader = '\\'
vim.opt.autoread = true
vim.opt.autowrite = true
vim.opt.completeopt = 'longest,noinsert,menuone,noselect'
vim.opt.cursorline = true
vim.opt.encoding = 'utf-8'
vim.opt.expandtab = true
vim.opt.fileencodings = 'utf-8'
vim.opt.ignorecase = true
vim.opt.mouse = 'a'
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.shiftwidth = 4
vim.opt.showmatch = true
vim.opt.smartcase = true
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.swapfile = false
vim.opt.tabstop = 4
vim.opt.wrap = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment