Created
October 10, 2021 07:03
-
-
Save binary4cat/c2f3473d0849baa61d65ca7945156b19 to your computer and use it in GitHub Desktop.
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
--[[ | |
lvim is the global options object | |
Linters should be | |
filled in as strings with either | |
a global executable or a path to | |
an executable | |
]] | |
-- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT | |
-- general | |
lvim.log.level = "warn" | |
lvim.format_on_save = true | |
lvim.colorscheme = "onedarker" | |
-- keymappings [view all the defaults by pressing <leader>Lk] | |
lvim.leader = "space" | |
-- add your own keymapping | |
lvim.keys.normal_mode["<C-s>"] = ":w<cr>" | |
-- unmap a default keymapping | |
-- lvim.keys.normal_mode["<C-Up>"] = "" | |
-- edit a default keymapping | |
-- lvim.keys.normal_mode["<C-q>"] = ":q<cr>" | |
-- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode. | |
-- lvim.builtin.telescope.on_config_done = function() | |
-- local actions = require "telescope.actions" | |
-- -- for input mode | |
-- lvim.builtin.telescope.defaults.mappings.i["<C-j>"] = actions.move_selection_next | |
-- lvim.builtin.telescope.defaults.mappings.i["<C-k>"] = actions.move_selection_previous | |
-- lvim.builtin.telescope.defaults.mappings.i["<C-n>"] = actions.cycle_history_next | |
-- lvim.builtin.telescope.defaults.mappings.i["<C-p>"] = actions.cycle_history_prev | |
-- -- for normal mode | |
-- lvim.builtin.telescope.defaults.mappings.n["<C-j>"] = actions.move_selection_next | |
-- lvim.builtin.telescope.defaults.mappings.n["<C-k>"] = actions.move_selection_previous | |
-- end | |
-- Use which-key to add extra bindings with the leader-key prefix | |
-- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" } | |
-- lvim.builtin.which_key.mappings["t"] = { | |
-- name = "+Trouble", | |
-- r = { "<cmd>Trouble lsp_references<cr>", "References" }, | |
-- f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" }, | |
-- d = { "<cmd>Trouble lsp_document_diagnostics<cr>", "Diagnostics" }, | |
-- q = { "<cmd>Trouble quickfix<cr>", "QuickFix" }, | |
-- l = { "<cmd>Trouble loclist<cr>", "LocationList" }, | |
-- w = { "<cmd>Trouble lsp_workspace_diagnostics<cr>", "Diagnostics" }, | |
-- } | |
lvim.builtin.which_key.mappings["t"] = { | |
name = "Diagnostics", | |
t = { "<cmd>TroubleToggle<cr>", "trouble" }, | |
w = { "<cmd>TroubleToggle lsp_workspace_diagnostics<cr>", "workspace" }, | |
d = { "<cmd>TroubleToggle lsp_document_diagnostics<cr>", "document" }, | |
q = { "<cmd>TroubleToggle quickfix<cr>", "quickfix" }, | |
l = { "<cmd>TroubleToggle loclist<cr>", "loclist" }, | |
r = { "<cmd>TroubleToggle lsp_references<cr>", "references" }, | |
} | |
lvim.builtin.which_key.mappings["o"] = { | |
name = "SymbolsOutline", | |
o = {":SymbolsOutlineOpen<CR>","symbols-outline open"}, | |
t = {":SymbolsOutline<CR>","symbols-outline toggle"}, | |
c = {":SymbolsOutlineClose<CR>","symbols-outline close"}, | |
} | |
-- TODO: User Config for predefined plugins | |
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile | |
lvim.builtin.dashboard.active = true | |
lvim.builtin.terminal.active = true | |
lvim.builtin.nvimtree.side = "left" | |
lvim.builtin.nvimtree.show_icons.git = 0 | |
-- if you don't want all the parsers change this to a table of the ones you want | |
lvim.builtin.treesitter.ensure_installed = "maintained" | |
lvim.builtin.treesitter.ignore_install = { "haskell" } | |
lvim.builtin.treesitter.highlight.enabled = true | |
-- generic LSP settings | |
-- you can set a custom on_attach function that will be used for all the language servers | |
-- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion> | |
-- lvim.lsp.on_attach_callback = function(client, bufnr) | |
-- local function buf_set_option(...) | |
-- vim.api.nvim_buf_set_option(bufnr, ...) | |
-- end | |
-- --Enable completion triggered by <c-x><c-o> | |
-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") | |
-- end | |
-- you can overwrite the null_ls setup table (useful for setting the root_dir function) | |
-- lvim.lsp.null_ls.setup = { | |
-- root_dir = require("lspconfig").util.root_pattern("Makefile", ".git", "node_modules"), | |
-- } | |
-- or if you need something more advanced | |
-- lvim.lsp.null_ls.setup.root_dir = function(fname) | |
-- if vim.bo.filetype == "javascript" then | |
-- return require("lspconfig/util").root_pattern("Makefile", ".git", "node_modules")(fname) | |
-- or require("lspconfig/util").path.dirname(fname) | |
-- elseif vim.bo.filetype == "php" then | |
-- return require("lspconfig/util").root_pattern("Makefile", ".git", "composer.json")(fname) or vim.fn.getcwd() | |
-- else | |
-- return require("lspconfig/util").root_pattern("Makefile", ".git")(fname) or require("lspconfig/util").path.dirname(fname) | |
-- end | |
-- end | |
-- set a formatter if you want to override the default lsp one (if it exists) | |
-- lvim.lang.python.formatters = { | |
-- { | |
-- exe = "black", | |
-- } | |
-- } | |
lvim.lang.go.formatters = {{ exe = "goimports" }} | |
-- set an additional linter | |
-- lvim.lang.python.linters = { | |
-- { | |
-- exe = "flake8", | |
-- } | |
-- } | |
-- Additional Plugins | |
lvim.plugins = { | |
-- themes use name is `deus` | |
{ | |
"theniceboy/nvim-deus" | |
}, | |
{ | |
"f-person/git-blame.nvim", | |
event = "BufRead", | |
config = function() | |
vim.cmd "highlight default link gitblame SpecialComment" | |
vim.g.gitblame_enabled = 0 | |
end, | |
}, | |
{ | |
"windwp/nvim-ts-autotag", | |
event = "InsertEnter", | |
config = function() | |
require("nvim-ts-autotag").setup() | |
end, | |
}, | |
{ | |
"p00f/nvim-ts-rainbow", | |
}, | |
{ | |
"simrat39/symbols-outline.nvim", | |
cmd = "SymbolsOutline", | |
}, | |
{ | |
"folke/trouble.nvim", | |
cmd = "TroubleToggle", | |
}, | |
{ | |
"karb94/neoscroll.nvim", | |
event = "WinScrolled", | |
config = function() | |
require('neoscroll').setup({ | |
-- All these keys will be mapped to their corresponding default scrolling animation | |
mappings = {'<C-u>', '<C-d>', '<C-b>', '<C-f>', | |
'<C-y>', '<C-e>', 'zt', 'zz', 'zb'}, | |
hide_cursor = true, -- Hide cursor while scrolling | |
stop_eof = true, -- Stop at <EOF> when scrolling downwards | |
use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope | |
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file | |
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further | |
easing_function = nil, -- Default easing function | |
pre_hook = nil, -- Function to run before the scrolling animation starts | |
post_hook = nil, -- Function to run after the scrolling animation ends | |
}) | |
end | |
}, | |
{ | |
"ethanholz/nvim-lastplace", | |
event = "BufRead", | |
config = function() | |
require("nvim-lastplace").setup({ | |
lastplace_ignore_buftype = { "quickfix", "nofile", "help" }, | |
lastplace_ignore_filetype = { | |
"gitcommit", "gitrebase", "svn", "hgcommit", | |
}, | |
lastplace_open_folds = true, | |
}) | |
end, | |
}, | |
{ | |
"folke/todo-comments.nvim", | |
event = "BufRead", | |
}, | |
{ | |
"tpope/vim-surround", | |
keys = {"c", "d", "y"} | |
}, | |
{ | |
"ray-x/lsp_signature.nvim", | |
event = "InsertEnter", | |
config = function() | |
require "lsp_signature".setup() | |
end | |
}, | |
{ | |
"nacro90/numb.nvim", | |
event = "BufRead", | |
config = function() | |
require("numb").setup { | |
show_numbers = true, -- Enable 'number' for the window while peeking | |
show_cursorline = true, -- Enable 'cursorline' for the window while peeking | |
} | |
end | |
}, | |
{ | |
"ray-x/go.nvim", | |
config = function () | |
require("go").setup() | |
-- Import on save | |
vim.api.nvim_exec([[ autocmd BufWritePre *.go :silent! lua require('go.format').goimport() ]], false) | |
end | |
} | |
} | |
-- Autocommands (https://neovim.io/doc/user/autocmd.html) | |
-- lvim.autocommands.custom_groups = { | |
-- { "BufWinEnter", "*.lua", "setlocal ts=8 sw=8" }, | |
-- } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment