From 169096e245c7ffed4c4c92ab7390c5cebe094292 Mon Sep 17 00:00:00 2001 From: Rawley Fowler <75388349+rawleyfowler@users.noreply.github.com> Date: Sun, 24 Jul 2022 20:21:09 -0600 Subject: [PATCH] Update init.lua --- neovim/init.lua | 155 +----------------------------------------------- 1 file changed, 1 insertion(+), 154 deletions(-) diff --git a/neovim/init.lua b/neovim/init.lua index 9894c1c..8b96f13 100644 --- a/neovim/init.lua +++ b/neovim/init.lua @@ -1,154 +1 @@ -local set = vim.opt -local cmd = vim.api.nvim_command -local au = vim.api.nvim_create_autocmd -local plug = vim.fn['plug#'] - --- Plugins -vim.call('plug#begin', '~/.config/nvim/plugged') -plug('jnurmine/zenburn') -plug('ap/vim-css-color') -plug('ap/vim-buftabline') -plug('kana/vim-textobj-user') -plug('whatyouhide/vim-textobj-erb') -plug('dag/vim-fish') -plug('kassio/neoterm') -plug('tpope/vim-dispatch') -plug('tpope/vim-haml') -plug('radenling/vim-dispatch-neovim') -plug('clojure-vim/clojure.vim', {['for'] = 'clojure'}) -plug('Olical/conjure', {['for'] = 'clojure'}) -plug('tpope/vim-fireplace', {['for'] = 'clojure'}) -plug('guns/vim-clojure-highlight', {['for'] = 'clojure'}) -plug('guns/vim-clojure-static', {['for'] = 'clojure'}) -plug('clojure-vim/vim-jack-in', {['for'] = 'clojure'}) -plug('luochen1990/rainbow') -plug('scrooloose/nerdtree', { on = 'NERDTreeToggle'}) -plug('fatih/vim-go', { ['for'] = 'go' }) -plug('tree-sitter/tree-sitter') -plug('tpope/vim-surround') -plug('neovim/nvim-lsp') -plug('neovim/nvim-lspconfig') -plug('williamboman/nvim-lsp-installer') -plug('junegunn/goyo.vim', {['for'] = 'markdown'}) -plug('junegunn/fzf', {['dir'] = '~/.fzf', ['do'] = './install --all'}) -plug('junegunn/fzf.vim') -plug('jiangmiao/auto-pairs') -plug('docunext/closetag.vim') -plug('norcalli/nvim_utils') -plug('hrsh7th/nvim-cmp') -plug('hrsh7th/cmp-buffer') -plug('hrsh7th/cmp-nvim-lsp') -plug('saadparwaiz1/cmp_luasnip') -plug('l3mon4d3/luasnip') -plug('leafgarland/typescript-vim', {['for'] = 'typescript'}) -vim.call('plug#end') -pcall(require, 'nvim_utils') -local cmp = require('cmp') - --- Basic editor configurations -set.tabstop = 4 -set.shiftwidth = 4 -set.expandtab = true -set.number = true -set.autoindent = true -set.smartindent = true -set.autowrite = true -set.hlsearch = false -set.incsearch = true -set.wrap = false -set.ai = true -set.wildignore = {'*/cache/*', '*/tmp*'} - --- Keybindings -function map(mode, lhs, rhs, opts) - options = {} - if opts then - options = vim.tbl_extend("force", options, opts) - end - vim.api.nvim_set_keymap(mode, lhs, rhs, options) -end - ----- Cycling through buffers -map('n', '', ':bprev', { noremap = true }) -map('n', '', ':bnext', { noremap = true }) - ----- NERDTree -map('n', '', ':NERDTreeToggle', { noremap = true }) -map('n', '', ':NERDTreeClose', { noremap = true }) - ----- Ripgrep -map('n', '', ':Rg') ----- Auto-complete -cmp.setup({ - snippet = { - expand = function(a) - -- Enable the lua snips engine - require('luasnip').lsp_expand(a.body) - end - }, - - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }), - [''] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping.complete() - }), - - sources = { - -- Get completions from these sources - { name = 'buffer' }, - { name = 'nvim_lsp' }, - { name = 'luasnip' } - } -}) - --- Colors -vim.cmd('syntax enable') -vim.cmd('colo zenburn') -vim.o.background = 'light' - --- Rainbow Parens for Clojure, and Lisp -vim.cmd([[ -filetype on -filetype plugin on -filetype plugin indent on -autocmd Filetype clojure,clj,lisp,lsp,cl,l,elisp :RainbowToggle -]]) - --- Auto complete -local opts = { noremap=true, silent=true } -map('n', 'e', 'lua vim.diagnostic.open_float()', opts) -map('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) -map('n', ']d', 'lua vim.diagnostic.goto_next()', opts) -map('n', 'q', 'lua vim.diagnostic.setloclist()', opts) -local on_attach = function(client, bufnr) - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'f', 'lua vim.lsp.buf.formatting()', opts) -end -local cmp_capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -local servers = { 'clojure_lsp', 'gopls', 'clangd', 'tsserver', 'solargraph' } -for _, lsp in pairs(servers) do - require('lspconfig')[lsp].setup { - on_attach = on_attach, - capabilities = cmp_capabilities, - flags = { - debounce_text_changes = 150, - } - } -end - --- 2 Tab space standard languages -vim.cmd([[ -autocmd Filetype ruby,rb,clojure,clj,lisp,lsp,cl,l,javascript,js,typescript,ts setlocal tabstop=2 shiftwidth=2 -]]) +require('rf')