Fixed null-ls format on save, added neovide options
This commit is contained in:
+18
-27
@@ -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
|
||||
|
||||
-- <leader> is leader key; default is \
|
||||
nmap("<leader>v", "<cmd>NvimTreeToggle<cr>")
|
||||
nmap("<leader>ec", "<cmd>e ~/.config/nvim/init.lua<cr>")
|
||||
@@ -87,8 +94,7 @@ local on_attach = function(client, bufnr)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>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', '<space>f', vim.lsp.buf.formatting, bufopts)
|
||||
vim.keymap.set('n', '<space>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('<leader>hd', '<cmd>Gitsigns diffthis<cr>')
|
||||
nmap('<leader>hp', '<cmd>Gitsigns preview_hunk<cr>')
|
||||
nmap('<leader>td', '<cmd>Gitsigns toggle_deleted<cr>')
|
||||
|
||||
Reference in New Issue
Block a user