From efe132aa1a7806d11d466e87cae7433c3cf614f8 Mon Sep 17 00:00:00 2001 From: Rostyslav Hnatyshyn Date: Thu, 17 Nov 2022 19:44:17 -0700 Subject: [PATCH] Fixed null-ls format on save, added neovide options --- nvim/init.lua | 45 ++++++++++++++++++--------------------------- zshrc | 4 ++++ 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/nvim/init.lua b/nvim/init.lua index ca7054e..0fd6a72 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -30,9 +30,6 @@ vim.opt.foldexpr = "nvim_treesitter#foldexpr()" -- hit zc to enable folding vim.o.foldenable = false -vim.opt.guifont = "Iosevka Nerd Font:h12" - -vim.g.neovide_refresh_rate = 140 vim.g.neomake_open_list = 2 function map(mode, shortcut, command) @@ -49,6 +46,16 @@ function imap(shortcut, command) map('i', shortcut, command) end +if vim.fn.exists("g:neovide") then + vim.g.neovide_refresh_rate = 140 + vim.opt.guifont = "Iosevka Nerd Font:h12" + -- change to whatever font you prefer + -- can check font with fc-cache on linux + vim.g.neovide_hide_mouse_when_typing = true + vim.g.neovide_refresh_rate_idle = 140 + vim.g.neovide_scale_factor = 1.0 +end + -- is leader key; default is \ nmap("v", "NvimTreeToggle") nmap("ec", "e ~/.config/nvim/init.lua") @@ -87,8 +94,7 @@ local on_attach = function(client, bufnr) vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - -- won't need format on save if it always works - -- vim.keymap.set('n', 'f', vim.lsp.buf.formatting, bufopts) + vim.keymap.set('n', 'f', vim.lsp.buf.formatting, bufopts) require "coq".lsp_ensure_capabilities {} require 'illuminate'.on_attach(client) @@ -162,32 +168,17 @@ return require('packer').startup(function(use) } use { 'jose-elias-alvarez/null-ls.nvim', - config = function() require('null-ls').setup({ - on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - -- overwrites format on save if null-ls is loaded - vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) - vim.api.nvim_create_autocmd("BufWritePre", { - group = augroup, - buffer = bufnr, - callback = function() - vim.lsp.buf.format({ bufnr = bufnr, filter = function(client) - return client.name == "null-ls" - end - }) - end - }) - end - end, + config = function() require("null-ls").setup { sources = { - require('null-ls').builtins.formatting.eslint_d, - require('null-ls').builtins.diagnostics.eslint_d, + require("null-ls").builtins.formatting.eslint_d, + require("null-ls").builtins.diagnostics.eslint_d, require("null-ls").builtins.code_actions.eslint_d, require("null-ls").builtins.diagnostics.flake8, - require("null-ls").builtins.formatting.black, + require("null-ls").builtins.formatting.black.with { extra_args = { "--fast" } }, + require("null-ls").builtins.formatting.isort, require("null-ls").builtins.code_actions.gitsigns } - }) + } end, requires = { "nvim-lua/plenary.nvim" }, } @@ -260,7 +251,7 @@ return require('packer').startup(function(use) use { 'lewis6991/gitsigns.nvim', config = function() require('gitsigns').setup { - on_attach = function(bufnr) + on_attach = function() nmap('hd', 'Gitsigns diffthis') nmap('hp', 'Gitsigns preview_hunk') nmap('td', 'Gitsigns toggle_deleted') diff --git a/zshrc b/zshrc index 8d63a34..a28c5a2 100644 --- a/zshrc +++ b/zshrc @@ -71,5 +71,9 @@ bindkey -v # bind keys to vim mode eval "$(zoxide init zsh)" path+=('/home/frosty/.local/bin') + +export GEM_HOME="$(ruby -e 'puts Gem.user_dir')" +path+=("$GEM_HOME/bin") + export PATH [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh