-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
466 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
--[[ | ||
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" | ||
|
||
-- general custom | ||
vim.opt.relativenumber = true | ||
vim.opt.hlsearch = false | ||
|
||
-- keymappings [view all the defaults by pressing <leader>Lk] | ||
lvim.leader = "space" | ||
-- add your own keymapping | ||
lvim.keys.normal_mode["<C-s>"] = ":w<cr>" | ||
|
||
-- override default mappings | ||
lvim.builtin.which_key.mappings.c = { | ||
-- remove the bang so that it doesn't close without saving | ||
"<cmd>write<cr><cmd>BufferClose<cr>", "Save & Close" | ||
} | ||
lvim.builtin.which_key.mappings.x = { | ||
"<cmd>BufferClose<cr>", "Close Buffer" | ||
} | ||
|
||
-- 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" }, | ||
-- } | ||
|
||
-- 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.setup.view.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 = { | ||
"bash", | ||
"c", | ||
"javascript", | ||
"json", | ||
"lua", | ||
"python", | ||
"typescript", | ||
"css", | ||
"rust", | ||
"java", | ||
"yaml", | ||
} | ||
|
||
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", | ||
-- } | ||
-- } | ||
-- set an additional linter | ||
-- lvim.lang.python.linters = { | ||
-- { | ||
-- exe = "flake8", | ||
-- } | ||
-- } | ||
|
||
-- Additional Plugins | ||
-- lvim.plugins = { | ||
-- {"folke/tokyonight.nvim"}, | ||
-- { | ||
-- "folke/trouble.nvim", | ||
-- cmd = "TroubleToggle", | ||
-- }, | ||
-- } | ||
|
||
-- Autocommands (https://neovim.io/doc/user/autocmd.html) | ||
-- lvim.autocommands.custom_groups = { | ||
-- { "BufWinEnter", "*.lua", "setlocal ts=8 sw=8" }, | ||
-- } |
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require("options") | ||
require("plugins") | ||
require("mappings") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
local lualine = require("lualine") | ||
|
||
lualine.setup { | ||
options = { | ||
theme = "onedark" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
local onedark = require("onedark") | ||
|
||
onedark.setup {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
local telescope = require("telescope") | ||
local builtins = require("telescope.builtin") | ||
local previewers = require("telescope.previewers") | ||
local sorters = require("telescope.sorters") | ||
|
||
telescope.setup { | ||
defaults = { | ||
file_sorter = sorters.get_fzy_sorter, | ||
file_previewer = previewers.vim_buffer_cat.new, | ||
grep_previewer = previewers.vim_buffer_vimgrep.new, | ||
|
||
file_ignore_patterns = { | ||
".git/", | ||
"node_modules/", | ||
"yarn.lock", | ||
"package-lock.json" | ||
} | ||
}, | ||
|
||
extensions = { | ||
fzy_native = { | ||
override_generic_sorter = false, | ||
override_file_sorter = true, | ||
} | ||
} | ||
} | ||
|
||
telescope.load_extension("fzy_native") | ||
|
||
-- Custom functions | ||
|
||
local M = {} | ||
|
||
M.search_files = function() | ||
builtins.find_files { | ||
find_command = { "rg", "--files", "--hidden" }, | ||
} | ||
end | ||
|
||
M.live_grep = function() | ||
builtins.live_grep {} | ||
end | ||
|
||
M.file_browser = function() | ||
builtins.file_browser {} | ||
end | ||
|
||
M.buffers= function() | ||
builtins.buffers {} | ||
end | ||
|
||
M.search_current_buffer = function() | ||
builtins.current_buffer_fuzzy_find {} | ||
end | ||
|
||
M.search_nvim = function() | ||
local directory = vim.env.HOME .. "/.config/nvim" | ||
builtins.find_files { | ||
find_command = { "rg", "--files", "--hidden", directory }, | ||
} | ||
end | ||
|
||
M.search_dotfiles = function() | ||
local directory = vim.env.HOME .. "/.dotfiles" | ||
builtins.find_files { | ||
find_command = { "rg", "--files", "--hidden", directory }, | ||
} | ||
end | ||
|
||
|
||
return M |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
local tree = require("nvim-tree") | ||
|
||
tree.setup {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
local treesitter = require("nvim-treesitter.configs") | ||
|
||
treesitter.setup { | ||
highlight = { enable = true }, | ||
refactor = { | ||
highlight_definitions = { enable = true } | ||
}, | ||
ensure_installed = "maintained" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
local keymap = require "utils".keymap | ||
|
||
-- Leader key | ||
vim.g.mapleader = " " | ||
|
||
-- Unbind default bindings for arrow keys | ||
keymap("v", "<up>", "<nop>") | ||
keymap("v", "<down>", "<nop>") | ||
keymap("v", "<left>", "<nop>") | ||
keymap("v", "<right>", "<nop>") | ||
keymap("i", "<up>", "<nop>") | ||
keymap("i", "<down>", "<nop>") | ||
keymap("i", "<left>", "<nop>") | ||
keymap("i", "<right>", "<nop>") | ||
|
||
-- Quick switching from Insert mode to Normal mode | ||
keymap("i", "jk", "<ESC>") | ||
|
||
-- Terminal | ||
keymap("n", "<leader>tt", "<cmd>terminal<CR>") | ||
keymap("t", "<ESC>", [[<C-\><C-n>]]) | ||
|
||
-- File explorer | ||
keymap("n", "<F3>", "<cmd>Np<CR>") | ||
|
||
-- Buffers | ||
keymap("n", "<leader>bl", [[<cmd>lua require('config.telescope').buffers()<CR>]]) | ||
keymap("n", "<C-l>", "<cmd>bnext<CR>") -- next buffer | ||
keymap("n", "<C-h>", "<cmd>bprevious<CR>") -- previous buffer | ||
|
||
-- Resize | ||
keymap("n", "<up>", "<cmd>resize +2<CR>") | ||
keymap("n", "<down>", "<cmd>resize -2<CR>") | ||
keymap("n", "<left>", "<cmd>vertical resize -2<CR>") | ||
keymap("n", "<right>", "<cmd>vertical resize +2<CR>") | ||
|
||
-- TEXT -- | ||
|
||
-- Move a line of text Alt+[j/k] | ||
keymap("n", "<M-j>", [[mz:m+<CR>`z]]) | ||
keymap("n", "<M-k>", [[mz:m-2<CR>`z]]) | ||
keymap("v", "<M-j>", [[:m'>+<CR>`<my`>mzgv`yo`z]]) | ||
keymap("v", "<M-k>", [[:m'<-2<CR>`>my`<mzgv`yo`z]]) | ||
|
||
-- Reload file | ||
keymap("n", "<leader>r", "<cmd>edit!<CR>") | ||
|
||
-- PLUGINS -- | ||
|
||
-- Telescope | ||
keymap("n", "<leader>ff", "<cmd>lua require('config.telescope').search_files()<CR>") | ||
keymap("n", "<leader>fg", "<cmd>lua require('config.telescope').live_grep()<CR>") | ||
keymap("n", "<leader>fl", "<cmd>lua require('config.telescope').file_browser()<CR>") | ||
keymap("n", "<C-f>", "<cmd>lua require('config.telescope').search_current_buffer()<CR>") | ||
keymap("n", "<leader>fd", "<cmd>lua require('config.telescope').search_dotfiles()<CR>") | ||
keymap("n", "<leader>fn", "<cmd>lua require('config.telescope').search_nvim()<CR>") | ||
|
||
-- Nvim Tree | ||
keymap("n", "<C-n>", "<cmd>NvimTreeToggle<CR>") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
local opt = vim.opt | ||
|
||
-- SPACING AND INDENTATION | ||
opt.tabstop = 2 | ||
opt.softtabstop = 2 | ||
opt.shiftwidth = 2 | ||
opt.expandtab = true | ||
opt.smartindent = true | ||
opt.autoindent = true | ||
opt.wrap = false | ||
opt.linebreak = true | ||
|
||
-- UI CONFIG | ||
opt.termguicolors = true | ||
opt.encoding = "utf8" | ||
opt.number = true | ||
opt.relativenumber = true | ||
opt.cursorline = true | ||
opt.signcolumn = "yes" | ||
opt.colorcolumn = "80" | ||
opt.scrolloff = 8 | ||
opt.hlsearch = false | ||
opt.incsearch = true | ||
|
||
-- BACKUP/SWAP | ||
opt.hidden = true | ||
opt.backup = false | ||
opt.writebackup = false | ||
opt.swapfile = false | ||
opt.undofile = true | ||
opt.undodir = os.getenv("HOME") .. "/.config/nvim/undo" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- https://vonheikemen.github.io/devlog/tools/configuring-neovim-using-lua | ||
|
||
local Plug = vim.fn["plug#"] | ||
|
||
vim.call("plug#begin", "~/.config/nvim/plugged") | ||
-- Telescope | ||
Plug("nvim-lua/plenary.nvim") | ||
Plug("nvim-telescope/telescope.nvim") | ||
Plug("nvim-telescope/telescope-fzy-native.nvim") | ||
Plug("nvim-treesitter/nvim-treesitter", {["do"] = ":TSUpdate"}) | ||
|
||
-- File tree | ||
Plug("kyazdani42/nvim-tree.lua") | ||
|
||
-- Theme | ||
Plug("navarasu/onedark.nvim") | ||
Plug("kyazdani42/nvim-web-devicons") | ||
Plug("hoob3rt/lualine.nvim") | ||
vim.call("plug#end") | ||
|
||
-- Plugin setup | ||
|
||
require("config/onedark") | ||
require("config/lualine") | ||
require("config/telescope") | ||
require("config/treesitter") | ||
require("config/tree") |
Oops, something went wrong.