Skip to content

Instantly share code, notes, and snippets.

@bollu
Last active December 5, 2024 09:50
Show Gist options
  • Select an option

  • Save bollu/c680fe4d480e4a7285a2bcc6d1fe3c2b to your computer and use it in GitHub Desktop.

Select an option

Save bollu/c680fe4d480e4a7285a2bcc6d1fe3c2b to your computer and use it in GitHub Desktop.
neovim config
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- lsp_attach is where you enable features that only work
-- if there is a language server active in the file
local custom_on_attach = function(client, bufnr)
local opts = {buffer = bufnr}
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
vim.keymap.set('n', 's', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
vim.keymap.set('n', '<CR>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
vim.keymap.set({'n', 'x'}, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
end
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- {
-- 'axelf4/vim-strip-trailing-whitespace',
-- lazy = false,
-- },
{
'mrcjkb/rustaceanvim',
version = '^4', -- Recommended
lazy = false, -- This plugin is already lazy
},
{ 'nvim-telescope/telescope.nvim',
dependencies = {
'nvim-telescope/telescope-ui-select.nvim',
},
lazy = false,
},
{ 'airblade/vim-rooter'},
{
'Julian/lean.nvim',
event = { 'BufReadPre *.lean', 'BufNewFile *.lean' },
dependencies = {
'neovim/nvim-lspconfig',
'nvim-lua/plenary.nvim',
-- you also will likely want nvim-cmp or some completion engine
},
-- see details below for full configuration options
opts = {
lsp = {
on_attach = custom_on_attach,
},
mappings = true,
}
},
{
'sogaiu/janet-neovim-trial-kit',
}
-- add your plugins here
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "retrobox" } },
})
-- https://github.com/nvim-telescope/telescope-ui-select.nvim
require("telescope").load_extension("ui-select")
vim.opt.clipboard = 'unnamedplus'
vim.opt.nu = true
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<C-p>', builtin.find_files, {})
vim.keymap.set('n', '<C-f>', builtin.live_grep, {})
vim.keymap.set('n', '<C-b>', builtin.buffers, {})
vim.cmd('colorscheme retrobox')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment