WIP: Start moving neovim config to lua
This commit is contained in:
parent
80bc730cd3
commit
ed6b02924f
11 changed files with 305 additions and 0 deletions
.config/nvim/lua
36
.config/nvim/lua/configs.lua
Normal file
36
.config/nvim/lua/configs.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
-- Imports
|
||||
local U = require("utils")
|
||||
|
||||
-- Neovim Alias
|
||||
local exec = vim.api.nvim_exec -- execute Vimscript
|
||||
local api = vim.api -- neovim commands
|
||||
local autocmd = vim.api.nvim_create_autocmd -- execute autocommands
|
||||
local set = vim.opt -- global options
|
||||
local cmd = vim.cmd -- execute Vim commands
|
||||
|
||||
-- Configs
|
||||
vim.g.mapleader = " "
|
||||
|
||||
set.compatible = false
|
||||
set.showmatch = true
|
||||
set.ignorecase = true
|
||||
set.mouse = "v"
|
||||
set.hlsearch = true
|
||||
set.incsearch = true
|
||||
set.tabstop = 4
|
||||
set.softtabstop = 4
|
||||
set.expandtab = true
|
||||
set.shiftwidth = 4
|
||||
set.autoindent = true
|
||||
set.number = true
|
||||
set.relativenumber = true
|
||||
set.wildmode = "longest,list"
|
||||
set.cc = "80"
|
||||
set.mouse = "a"
|
||||
set.clipboard = "unnamedplus"
|
||||
set.cursorline = true
|
||||
set.ttyfast = true
|
||||
set.fixeol = false
|
||||
set.splitright = true
|
||||
set.splitbelow = true
|
||||
set.termguicolors = true
|
0
.config/nvim/lua/functions.lua
Normal file
0
.config/nvim/lua/functions.lua
Normal file
0
.config/nvim/lua/functions/.gitkeep
Normal file
0
.config/nvim/lua/functions/.gitkeep
Normal file
50
.config/nvim/lua/keybindings.lua
Normal file
50
.config/nvim/lua/keybindings.lua
Normal file
|
@ -0,0 +1,50 @@
|
|||
-- Helper function
|
||||
function map(mode, lhs, rhs, opts)
|
||||
local options = { noremap = true }
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
local opts = { silent = true, noremap = true, expr = true }
|
||||
|
||||
-- Move Lines Up/Down
|
||||
map("i", "<A-j>", "<Esc>:m .+1<CR>==gi", opts)
|
||||
map("i", "<A-k>", "<Esc>:m .-2<CR>==gi", opts)
|
||||
map("v", "<A-j>", ":m '>+1<CR>gv=gv", opts)
|
||||
map("v", "<A-k>", ":m '<-2<CR>gv=gv", opts)
|
||||
|
||||
map("n", "<A-h>", "<C-W>H", opts)
|
||||
map("n", "<A-j>", "<C-W>J", opts)
|
||||
map("n", "<A-k>", "<C-W>K", opts)
|
||||
map("n", "<A-l>", "<C-W>L", opts)
|
||||
|
||||
map("n", "<C-h>", "<C-w>h", opts)
|
||||
map("n", "<C-j>", "<C-w>j", opts)
|
||||
map("n", "<C-k>", "<C-w>k", opts)
|
||||
map("n", "<C-l>", "<C-w>l", opts)
|
||||
|
||||
map("n", "gf", ":vert winc f<cr>", opts)
|
||||
|
||||
map("i", "<cr>", [[coc#pum#visible() ? coc#_select_confirm() : "\<C-g>u\<CR>"]], opts)
|
||||
map("i", "<Tab>", [[coc#pum#visible() ? coc#pum#next(1) : "\<Tab>"]], opts)
|
||||
map("i", "<S-Tab>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<S-Tab>"]], opts)
|
||||
|
||||
map("n", "<leader>n", ":NERDTreeFocus<CR>", opts)
|
||||
map("n", "<C-n>", ":NERDTree<CR>", opts)
|
||||
map("n", "<C-t>", ":NERDTreeToggle<CR>", opts)
|
||||
map("n", "<C-f>", ":NERDTreeFind<CR>", opts)
|
||||
|
||||
map("n", "<leader>ha", function() require("harpoon.mark").add_file() end, opts)
|
||||
map("n", "<leader>hh", function() require("harpoon.ui").toggle_quick_menu() end, opts)
|
||||
map("n", "<leader>1", [[<cmd>lua require("harpoon.ui").nav_file(1)<CR>]], opts)
|
||||
map("n", "<leader>2", [[<cmd>lua require("harpoon.ui").nav_file(2)<CR>]], opts)
|
||||
map("n", "<leader>3", [[<cmd>lua require("harpoon.ui").nav_file(3)<CR>]], opts)
|
||||
map("n", "<leader>4", [[<cmd>lua require("harpoon.ui").nav_file(4)<CR>]], opts)
|
||||
map("n", "<A-[>", [[<cmd>lua require("harpoon.ui").nav_prev()<CR>]], opts)
|
||||
map("n", "<A-]>", [[<cmd>lua require("harpoon.ui").nav_next()<CR>]], opts)
|
||||
|
||||
map("n", "<leader>ff", ":FZF<CR>", opts)
|
||||
|
||||
map("n", "mm", ":nohl<CR>", opts)
|
41
.config/nvim/lua/plugins.lua
Normal file
41
.config/nvim/lua/plugins.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
packer_bootstrap =
|
||||
vim.fn.system({"git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path})
|
||||
end
|
||||
-- Register Packer with vim
|
||||
vim.api.nvim_cmd({
|
||||
cmd = "packadd",
|
||||
args = {"packer.nvim"},
|
||||
}, {})
|
||||
|
||||
return require("packer").startup {
|
||||
function(use)
|
||||
-- Packer can manage itself
|
||||
use "wbthomason/packer.nvim"
|
||||
|
||||
-- Plugins go here
|
||||
use 'dracula/vim'
|
||||
use 'ryanoasis/vim-devicons'
|
||||
-- use 'SirVer/ultisnips'
|
||||
use 'honza/vim-snippets'
|
||||
use 'scrooloose/nerdtree'
|
||||
use 'preservim/nerdcommenter'
|
||||
use 'mhinz/vim-startify'
|
||||
use {'neoclide/coc.nvim', branch = 'release'}
|
||||
use 'nvim-lua/plenary.nvim'
|
||||
use 'ThePrimeagen/harpoon'
|
||||
use 'junegunn/fzf'
|
||||
use 'junegunn/fzf.vim'
|
||||
use 'neovim/nvim-lspconfig'
|
||||
use 'jose-elias-alvarez/null-ls.nvim'
|
||||
use 'MunifTanjim/prettier.nvim'
|
||||
use 'OmniSharp/omnisharp-vim'
|
||||
|
||||
-- Install and compile Plugins
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end
|
||||
}
|
||||
|
0
.config/nvim/lua/plugins/.gitkeep
Normal file
0
.config/nvim/lua/plugins/.gitkeep
Normal file
0
.config/nvim/lua/utils.lua
Normal file
0
.config/nvim/lua/utils.lua
Normal file
Loading…
Add table
Add a link
Reference in a new issue