Just replace CONFIG_DIR/nvim/init.lua
with the file below , where CONFIG_DIR
is generally ~/.config
in linux and mac
Last active
February 16, 2023 13:20
-
-
Save barelyhuman/af6c791ad950980314f2d9b29b521b91 to your computer and use it in GitHub Desktop.
Tiny Single File nvim config
This file contains hidden or 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
-- setup lazy if needed | |
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | |
if not vim.loop.fs_stat(lazypath) then | |
vim.fn.system({ | |
"git", | |
"clone", | |
"--filter=blob:none", | |
"https://github.com/folke/lazy.nvim.git", | |
"--branch=stable", -- latest stable release | |
lazypath, | |
}) | |
end | |
vim.opt.rtp:prepend(lazypath) | |
-- set number as true | |
vim.api.nvim_win_set_option(0, "number", true) | |
local plugins = { | |
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, | |
{ "nvim-telescope/telescope.nvim", tag = "0.1.1", dependencies = { "nvim-lua/plenary.nvim" } }, | |
"williamboman/mason.nvim", | |
"Shatur/neovim-ayu", | |
"jose-elias-alvarez/null-ls.nvim", | |
} | |
-- grab the needed plugins mentioned above | |
require("lazy").setup(plugins) | |
-- setup the colorsceme | |
require("ayu").setup({ | |
overrides = {}, | |
}) | |
vim.cmd.colorscheme("ayu") | |
-- setup basic lsp plugins and formatting | |
require("mason").setup() | |
local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) | |
function on_attach_format(client, bufnr) | |
if client.supports_method("textDocument/formatting") then | |
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 }) | |
end, | |
}) | |
end | |
end | |
local null_ls = require("null-ls") | |
null_ls.setup({ | |
debug = true, | |
on_attach = on_attach_format, | |
sources = { | |
null_ls.builtins.formatting.stylua, | |
null_ls.builtins.formatting.goimports, | |
null_ls.builtins.formatting.prettier, | |
}, | |
}) | |
-- define the leader and shortcuts to access fuzzy finder and file finder | |
vim.g.mapleader = "," | |
local telescope = require("telescope.builtin") | |
vim.keymap.set("n", "<leader>ff", telescope.find_files, {}) | |
vim.keymap.set("n", "<leader>fg", telescope.live_grep, {}) | |
vim.keymap.set("n", "<leader>fb", telescope.buffers, {}) | |
vim.keymap.set("n", "<leader>fh", telescope.help_tags, {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment