initial commit
This commit is contained in:
commit
31ebe341c3
13 files changed
+278
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
plugin
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
for _, name in ipairs({
|
||||||
|
'mappings/colemak',
|
||||||
|
'reload',
|
||||||
|
'general',
|
||||||
|
'plugins',
|
||||||
|
'mappings/general',
|
||||||
|
'theme',
|
||||||
|
}) do require('config.' .. name) end
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
-- basic stuff
|
||||||
|
vim.o.number = true
|
||||||
|
vim.cmd('filetype plugin on')
|
||||||
|
vim.cmd('syntax on')
|
||||||
|
vim.o.cmdheight = 2
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
|
||||||
|
-- line break (wrapping) settings
|
||||||
|
vim.o.linebreak = true
|
||||||
|
vim.o.breakindent = true
|
||||||
|
vim.o.showbreak = '\\ '
|
||||||
|
|
||||||
|
-- lines after end of file empty instead of ~ (fillchars)
|
||||||
|
vim.o.fcs = 'eob: '
|
||||||
|
|
||||||
|
-- tab
|
||||||
|
vim.o.expandtab = true
|
||||||
|
vim.o.softtabstop = 4
|
||||||
|
vim.o.shiftwidth = 4
|
||||||
|
|
||||||
|
-- turn of gui colors if in tty
|
||||||
|
if os.getenv('TERM') ~= 'linux' then
|
||||||
|
vim.o.termguicolors = true
|
||||||
|
else
|
||||||
|
vim.o.termguicolors = false
|
||||||
|
end
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
return function(cmp)
|
||||||
|
return cmp.mapping.preset.insert({
|
||||||
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<c-space>'] = cmp.mapping.complete(),
|
||||||
|
['<c-e>'] = cmp.mapping.abort(),
|
||||||
|
['<cr>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
['<tab>'] = cmp.mapping.select_next_item(),
|
||||||
|
})
|
||||||
|
end
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
local map = function(from, to)
|
||||||
|
vim.keymap.set('n', from, to, { noremap = true, silent = true })
|
||||||
|
vim.keymap.set('x', from, to, { noremap = true, silent = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
local swap = function(a, b)
|
||||||
|
map(a, b)
|
||||||
|
map(b, a)
|
||||||
|
end
|
||||||
|
|
||||||
|
swap('n', 'h')
|
||||||
|
swap('e', 'j')
|
||||||
|
swap('i', 'k')
|
||||||
|
swap('o', 'l')
|
||||||
|
|
||||||
|
swap('<C-w>n', '<C-w>h')
|
||||||
|
swap('<C-w>e', '<C-w>j')
|
||||||
|
swap('<C-w>i', '<C-w>k')
|
||||||
|
swap('<C-w>o', '<C-w>l')
|
||||||
|
|
||||||
|
swap('N', 'H')
|
||||||
|
swap('O', 'L')
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
local map = vim.keymap.set
|
||||||
|
local nmap = function(from, to) map('n', from, to, opts) end
|
||||||
|
local cmd = function(content) return '<cmd>' .. content .. '<cr>' end
|
||||||
|
|
||||||
|
-- terminal
|
||||||
|
map('t', '<esc>', '<C-\\><C-n>', opts)
|
||||||
|
nmap('<space>tm', ':belowright 7sp<cr>:term<cr>A')
|
||||||
|
|
||||||
|
-- off search highlight when escape is pressed
|
||||||
|
nmap('<esc>', ':noh<cr><esc>')
|
||||||
|
|
||||||
|
-- telescope
|
||||||
|
nmap('<space>ff', cmd('Telescope find_files'))
|
||||||
|
nmap('<space>fg', cmd('Telescope live_grep'))
|
||||||
|
nmap('<space>fb', cmd('Telescope buffers'))
|
||||||
|
nmap('<space>fh', cmd('Telescope help_tags'))
|
||||||
|
|
||||||
|
-- explorer
|
||||||
|
nmap('<space>e', cmd('Neotree toggle'))
|
||||||
|
|
||||||
|
-- lsp (universal)
|
||||||
|
nmap('E', vim.diagnostic.open_float)
|
||||||
|
nmap('[d', vim.diagnostic.goto_prev)
|
||||||
|
nmap(']d', vim.diagnostic.goto_next)
|
||||||
|
nmap('<space>q', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
return function(bufnr)
|
||||||
|
local map = function(from, to)
|
||||||
|
vim.keymap.set('n', from, to, { noremap = true, silent = true, buffer = bufnr })
|
||||||
|
end
|
||||||
|
|
||||||
|
map('gd', vim.lsp.buf.definition)
|
||||||
|
map('gr', vim.lsp.buf.references)
|
||||||
|
map('gi', vim.lsp.buf.implementation)
|
||||||
|
map('gD', vim.lsp.buf.declaration)
|
||||||
|
|
||||||
|
map('K', vim.lsp.buf.hover)
|
||||||
|
map('<C-k>', vim.lsp.buf.signature_help)
|
||||||
|
|
||||||
|
map('<space>wa', vim.lsp.buf.add_workspace_folder)
|
||||||
|
map('<space>wr', vim.lsp.buf.remove_workspace_folder)
|
||||||
|
map('<space>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end)
|
||||||
|
map('<space>D', vim.lsp.buf.type_definition)
|
||||||
|
map('<space>rn', vim.lsp.buf.rename)
|
||||||
|
map('<space>ca', vim.lsp.buf.code_action)
|
||||||
|
map('<space>fm', vim.lsp.buf.formatting)
|
||||||
|
end
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
require 'telescope'.load_extension('ui-select')
|
||||||
|
|
||||||
|
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||||
|
require 'neo-tree'.setup {
|
||||||
|
filesystem = {
|
||||||
|
filtered_items = {
|
||||||
|
visible = true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
width = 30,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'nvim-treesitter.configs'.setup {
|
||||||
|
highlight = { enable = true }
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'lualine'.setup()
|
||||||
|
|
||||||
|
local cmp = require 'cmp'
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
mapping = require 'config.mappings.cmp' (cmp),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'path' },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
require 'nvim-autopairs'.setup {}
|
||||||
|
|
||||||
|
if vim.o.termguicolors then
|
||||||
|
require 'colorizer'.setup()
|
||||||
|
end
|
||||||
|
|
||||||
|
require('gitsigns').setup()
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
require 'config.plugins.plugins'
|
||||||
|
require 'config.plugins.config'
|
||||||
|
require 'config.plugins.lsps'
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
local on_attach = function(_, bufnr)
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
vim.o.signcolumn = 'yes'
|
||||||
|
require 'config.mappings.lsp' (bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
|
|
||||||
|
require 'lspconfig'.sumneko_lua.setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = { 'vim' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'rust-tools'.setup {
|
||||||
|
server = {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.g.markdown_fenced_languages = {
|
||||||
|
"ts=typescript"
|
||||||
|
}
|
||||||
|
require'lspconfig'.denols.setup{
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
local packer = require('packer')
|
||||||
|
packer.startup(function(use)
|
||||||
|
use 'wbthomason/packer.nvim'
|
||||||
|
-- files
|
||||||
|
use 'nvim-lua/plenary.nvim'
|
||||||
|
use { 'nvim-telescope/telescope.nvim', tag = '0.1.0' }
|
||||||
|
use {
|
||||||
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'
|
||||||
|
}
|
||||||
|
use 'nvim-telescope/telescope-ui-select.nvim'
|
||||||
|
use { 'nvim-neo-tree/neo-tree.nvim', branch = "v2.x", }
|
||||||
|
use 'MunifTanjim/nui.nvim'
|
||||||
|
-- syntax highlighting
|
||||||
|
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
|
||||||
|
-- autocomplete / snippits
|
||||||
|
use 'hrsh7th/cmp-nvim-lsp'
|
||||||
|
use 'hrsh7th/cmp-buffer'
|
||||||
|
use 'hrsh7th/cmp-path'
|
||||||
|
use 'hrsh7th/cmp-cmdline'
|
||||||
|
use 'hrsh7th/nvim-cmp'
|
||||||
|
use 'L3MON4D3/LuaSnip'
|
||||||
|
use 'saadparwaiz1/cmp_luasnip'
|
||||||
|
-- auto pairs
|
||||||
|
use 'windwp/nvim-autopairs'
|
||||||
|
-- lsp
|
||||||
|
use 'neovim/nvim-lspconfig'
|
||||||
|
use 'simrat39/rust-tools.nvim'
|
||||||
|
use 'mfussenegger/nvim-dap'
|
||||||
|
use 'nvim-lua/completion-nvim'
|
||||||
|
use 'tjdevries/nlua.nvim'
|
||||||
|
-- visual
|
||||||
|
use 'kyazdani42/nvim-web-devicons'
|
||||||
|
use 'navarasu/onedark.nvim'
|
||||||
|
use 'norcalli/nvim-colorizer.lua'
|
||||||
|
use 'nvim-lualine/lualine.nvim'
|
||||||
|
use 'lewis6991/gitsigns.nvim'
|
||||||
|
end)
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
local group = vim.api.nvim_create_augroup("reload", {})
|
||||||
|
|
||||||
|
local post_write = function(path, cmd)
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
|
group = group,
|
||||||
|
pattern = "**/lua/bryan/" .. path,
|
||||||
|
command = cmd,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, path in ipairs({
|
||||||
|
"general.lua",
|
||||||
|
"theme.lua",
|
||||||
|
"mappings/*.lua",
|
||||||
|
"neovide.lua",
|
||||||
|
}) do post_write(path, "source <afile>") end
|
||||||
|
|
||||||
|
-- allows you to install and clean plugins after writing to the file
|
||||||
|
post_write("plugins/plugins.lua", "source <afile> | PackerCompile")
|
||||||
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
-- color scheme
|
||||||
|
vim.g.onedark_config = { style = 'darker' }
|
||||||
|
vim.cmd('colorscheme onedark')
|
||||||
|
|
||||||
|
-- highlight extra white space with red
|
||||||
|
vim.api.nvim_set_hl(0, 'TrailingWhitespace', { ctermbg = 'red', bg = '#ff5555' })
|
||||||
|
vim.cmd([[match TrailingWhitespace /\s\+$/]])
|
||||||
|
|
||||||
|
-- diagnostics
|
||||||
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = { prefix = '●' };
|
||||||
|
})
|
||||||
|
|
||||||
Reference in new issue
Block a user