feat: Neovim config
This commit is contained in:
@@ -23,3 +23,4 @@ popd
|
|||||||
echo "Linking files"
|
echo "Linking files"
|
||||||
stow --dotfiles -t ~ zsh
|
stow --dotfiles -t ~ zsh
|
||||||
stow --dotfiles -t ~ ruby
|
stow --dotfiles -t ~ ruby
|
||||||
|
stow --dotfiles -t ~ nvim
|
||||||
|
|||||||
6
nvim/.config/nvim/after/plugin/colors.lua
Normal file
6
nvim/.config/nvim/after/plugin/colors.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
function ColorMyPencils(color)
|
||||||
|
color = color or 'flexoki-light'
|
||||||
|
vim.cmd.colorscheme(color)
|
||||||
|
end
|
||||||
|
|
||||||
|
ColorMyPencils()
|
||||||
48
nvim/.config/nvim/after/plugin/lsp.lua
Normal file
48
nvim/.config/nvim/after/plugin/lsp.lua
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
local lsp = require('lsp-zero')
|
||||||
|
local mason = require('mason')
|
||||||
|
local mason_lspconfig = require('mason-lspconfig')
|
||||||
|
|
||||||
|
mason.setup({})
|
||||||
|
mason_lspconfig.setup({
|
||||||
|
ensure_installed = {
|
||||||
|
'ruby_ls',
|
||||||
|
'tsserver',
|
||||||
|
'lua_ls',
|
||||||
|
},
|
||||||
|
handlers = {
|
||||||
|
lsp.default_setup,
|
||||||
|
lua_ls = function()
|
||||||
|
require('lspconfig').lua_ls.setup({
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = {
|
||||||
|
'vim',
|
||||||
|
'require',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
lsp.on_attach(function(_client, bufnr)
|
||||||
|
local opts = { buffer = bufnr, remap = false }
|
||||||
|
|
||||||
|
lsp.default_keymaps(opts)
|
||||||
|
|
||||||
|
vim.keymap.set('n', 'gd', function() vim.lsp.buf.definition() end, opts)
|
||||||
|
vim.keymap.set('n', 'K', function() vim.lsp.buf.hover() end, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vws', function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vd', function() vim.diagnostic.open_float() end, opts)
|
||||||
|
vim.keymap.set('n', '[d', function() vim.diagnostic.goto_next() end, opts)
|
||||||
|
vim.keymap.set('n', ']d', function() vim.diagnostic.goto_prev() end, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vca', function() vim.lsp.buf.code_action() end, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vrr', function() vim.lsp.buf.references() end, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vrn', function() vim.lsp.buf.rename() end, opts)
|
||||||
|
vim.keymap.set('n', '<C-h>', function() vim.lsp.buf.signature_help() end, opts)
|
||||||
|
end)
|
||||||
|
|
||||||
|
lsp.setup()
|
||||||
6
nvim/.config/nvim/after/plugin/telescope.lua
Normal file
6
nvim/.config/nvim/after/plugin/telescope.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
|
||||||
|
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
|
||||||
|
vim.keymap.set('n', '<leader>ps', function()
|
||||||
|
builtin.grep_string({ search = vim.fn.input("Grep > ") });
|
||||||
|
end)
|
||||||
21
nvim/.config/nvim/after/plugin/treesitter.lua
Normal file
21
nvim/.config/nvim/after/plugin/treesitter.lua
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
require'nvim-treesitter.configs'.setup {
|
||||||
|
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||||
|
ensure_installed = { "lua", "ruby", "javascript", "typescript" },
|
||||||
|
|
||||||
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
|
||||||
|
-- Automatically install missing parsers when entering buffer
|
||||||
|
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||||
|
auto_install = true,
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
|
||||||
|
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||||
|
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||||
|
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||||
|
-- Instead of true it can also be a list of languages
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
1
nvim/.config/nvim/after/plugin/undotree.lua
Normal file
1
nvim/.config/nvim/after/plugin/undotree.lua
Normal file
@@ -0,0 +1 @@
|
|||||||
|
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||||
1
nvim/.config/nvim/init.lua
Normal file
1
nvim/.config/nvim/init.lua
Normal file
@@ -0,0 +1 @@
|
|||||||
|
require('yock')
|
||||||
3
nvim/.config/nvim/lua/yock/init.lua
Normal file
3
nvim/.config/nvim/lua/yock/init.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
require('yock.pckr')
|
||||||
|
require('yock.remap')
|
||||||
|
require('yock.set')
|
||||||
41
nvim/.config/nvim/lua/yock/pckr.lua
Normal file
41
nvim/.config/nvim/lua/yock/pckr.lua
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
local function bootstrap_pckr()
|
||||||
|
local pckr_path = vim.fn.stdpath('data') .. 'pckr/pckr.nvim'
|
||||||
|
|
||||||
|
if not vim.loop.fs_stat(pckr_path) then
|
||||||
|
vim.fn.system({
|
||||||
|
'git',
|
||||||
|
'clone',
|
||||||
|
'--filter=blob:none',
|
||||||
|
'https://github.com/lewis6991/pckr.nvim',
|
||||||
|
pckr_path
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt.rtp:prepend(pckr_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
bootstrap_pckr()
|
||||||
|
|
||||||
|
require('pckr').add{
|
||||||
|
{ 'nvim-telescope/telescope.nvim', requires = { 'nvim-lua/plenary.nvim' } },
|
||||||
|
{ 'kepano/flexoki-neovim' },
|
||||||
|
{ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
|
||||||
|
{ 'mbbill/undotree' },
|
||||||
|
{
|
||||||
|
'VonHeikemen/lsp-zero.nvim',
|
||||||
|
requires = {
|
||||||
|
{ 'neovim/nvim-lspconfig' },
|
||||||
|
{ 'williamboman/mason.nvim' },
|
||||||
|
{ 'williamboman/mason-lspconfig.nvim' },
|
||||||
|
{ 'hrsh7th/nvim-cmp' },
|
||||||
|
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||||
|
{ 'L3MON4D3/LuaSnip' },
|
||||||
|
{ 'hrsh7th/cmp-path' },
|
||||||
|
{ 'hrsh7th/cmp-nvim-lua' },
|
||||||
|
{ 'hrsh7th/cmp-buffer' },
|
||||||
|
{ 'rafamadriz/friendly-snippets' },
|
||||||
|
{ 'saadparwaiz1/cmp_luasnip' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ 'zbirenbaum/copilot-cmp', requires = { 'github/copilot.lua' } },
|
||||||
|
}
|
||||||
14
nvim/.config/nvim/lua/yock/remap.lua
Normal file
14
nvim/.config/nvim/lua/yock/remap.lua
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||||
|
|
||||||
|
-- Move highlights
|
||||||
|
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
|
||||||
|
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
|
||||||
|
|
||||||
|
-- Paste over without copying what is under
|
||||||
|
vim.keymap.set('x', '<leader>p', "\"_dP")
|
||||||
|
|
||||||
|
-- Copy to system clipboard
|
||||||
|
vim.keymap.set('n', '<leader>y', "\"+y")
|
||||||
|
vim.keymap.set('v', '<leader>y', "\"+y")
|
||||||
|
vim.keymap.set('n', '<leader>Y', "\"+Y")
|
||||||
|
|
||||||
26
nvim/.config/nvim/lua/yock/set.lua
Normal file
26
nvim/.config/nvim/lua/yock/set.lua
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
vim.opt.nu = true
|
||||||
|
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.softtabstop = 2
|
||||||
|
vim.shiftwidth = 2
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.smartindent = true
|
||||||
|
|
||||||
|
vim.opt.wrap = false
|
||||||
|
|
||||||
|
vim.opt.swapfile = false
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.undodir = os.getenv('HOME') .. '/.nvim/undodir'
|
||||||
|
vim.opt.undofile = true
|
||||||
|
|
||||||
|
vim.opt.hlsearch = false
|
||||||
|
vim.opt.incsearch = true
|
||||||
|
|
||||||
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
|
vim.opt.scrolloff = 8
|
||||||
|
vim.opt.signcolumn = 'yes'
|
||||||
|
|
||||||
|
vim.opt.colorcolumn = '120'
|
||||||
|
|
||||||
|
vim.g.mapleader = '\\'
|
||||||
Reference in New Issue
Block a user