refactored and switched to config with packer
This commit is contained in:
1 parent
efece83eb8
commit
f5b6ec34ad
19 files changed
+325
-259
No files matched your search
@@ -1,8 +1,5 @@
|
|||||||
for _, name in ipairs({
|
for _, name in ipairs({
|
||||||
'mappings.colemak',
|
|
||||||
'reload',
|
'reload',
|
||||||
'general',
|
'settings',
|
||||||
'plugins',
|
'plugins',
|
||||||
'mappings.general',
|
|
||||||
'theme',
|
|
||||||
}) do require('config.' .. name) end
|
}) do require('config.' .. name) end
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
-- 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
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
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')
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
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)
|
|
||||||
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
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,124 @@
|
|||||||
|
local fn = vim.fn
|
||||||
|
|
||||||
|
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||||
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
|
PACKER_BOOTSTRAP = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||||
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
end
|
||||||
|
|
||||||
|
local packer = require('packer')
|
||||||
|
packer.startup(function(use)
|
||||||
|
use 'wbthomason/packer.nvim'
|
||||||
|
|
||||||
|
-- files
|
||||||
|
use {
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
tag = '0.1.0',
|
||||||
|
requires = { 'nvim-lua/plenary.nvim' },
|
||||||
|
config = function() require 'config.plugins.telescope' end
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
run = 'make',
|
||||||
|
requires = { 'nvim-telescope/telescope.nvim' },
|
||||||
|
-- doesn't work?
|
||||||
|
-- config = function() require 'telescope'.load_extension('fzf') end
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'nvim-telescope/telescope-ui-select.nvim',
|
||||||
|
requires = { 'nvim-telescope/telescope.nvim' },
|
||||||
|
config = function() require 'telescope'.load_extension('ui-select') end
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'nvim-neo-tree/neo-tree.nvim',
|
||||||
|
branch = "v2.x",
|
||||||
|
requires = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'kyazdani42/nvim-web-devicons',
|
||||||
|
'MunifTanjim/nui.nvim'
|
||||||
|
},
|
||||||
|
config = function() require 'config.plugins.neotree' end
|
||||||
|
}
|
||||||
|
|
||||||
|
-- syntax highlighting
|
||||||
|
use {
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
run = function()
|
||||||
|
require('nvim-treesitter.install').update { with_sync = true }
|
||||||
|
end,
|
||||||
|
config = function()
|
||||||
|
require 'nvim-treesitter.configs'.setup {
|
||||||
|
highlight = { enable = true }
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- autocomplete
|
||||||
|
use 'hrsh7th/cmp-nvim-lsp'
|
||||||
|
use 'hrsh7th/cmp-buffer'
|
||||||
|
use 'hrsh7th/cmp-path'
|
||||||
|
use 'hrsh7th/cmp-cmdline'
|
||||||
|
use {
|
||||||
|
'hrsh7th/nvim-cmp',
|
||||||
|
config = function()
|
||||||
|
require 'config.plugins.cmp'
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
-- snippets
|
||||||
|
use 'L3MON4D3/LuaSnip'
|
||||||
|
use 'saadparwaiz1/cmp_luasnip'
|
||||||
|
|
||||||
|
-- autopairs
|
||||||
|
use {
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
config = function() require 'nvim-autopairs'.setup {} end
|
||||||
|
}
|
||||||
|
|
||||||
|
-- lsp
|
||||||
|
use {
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
config = function()
|
||||||
|
require 'config.plugins.lspconfig'
|
||||||
|
end
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'simrat39/rust-tools.nvim',
|
||||||
|
requires = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'mfussenegger/nvim-dap',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
use 'tjdevries/nlua.nvim'
|
||||||
|
|
||||||
|
-- visual
|
||||||
|
use {
|
||||||
|
'navarasu/onedark.nvim',
|
||||||
|
config = function()
|
||||||
|
require 'onedark'.setup { style = 'darker' }
|
||||||
|
require 'onedark'.load()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'norcalli/nvim-colorizer.lua',
|
||||||
|
config = function()
|
||||||
|
if vim.o.termguicolors then
|
||||||
|
require 'colorizer'.setup()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'nvim-lualine/lualine.nvim',
|
||||||
|
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
|
||||||
|
config = function() require 'lualine'.setup() end
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
config = function() require 'gitsigns'.setup() end
|
||||||
|
}
|
||||||
|
|
||||||
|
-- sync if bootstrapped
|
||||||
|
if PACKER_BOOTSTRAP then
|
||||||
|
require('packer').sync()
|
||||||
|
end
|
||||||
|
end)
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
local cmp = require 'cmp'
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
mapping = 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(),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'path' },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
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()
|
|
||||||
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
require 'config.plugins.plugins'
|
|
||||||
require 'config.plugins.config'
|
|
||||||
require 'config.plugins.lsps'
|
|
||||||
|
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
local u = require 'config.utils'
|
||||||
|
|
||||||
|
u.nmap('E', vim.diagnostic.open_float)
|
||||||
|
u.nmap('[d', vim.diagnostic.goto_prev)
|
||||||
|
u.nmap(']d', vim.diagnostic.goto_next)
|
||||||
|
u.nmap('<space>q', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
|
local on_attach = function(_, bufnr)
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
vim.o.signcolumn = 'yes'
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
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,14 @@
|
|||||||
|
local u = require 'config.utils'
|
||||||
|
|
||||||
|
vim.cmd [[ let g:neo_tree_remove_legacy_commands = 1 ]]
|
||||||
|
require 'neo-tree'.setup {
|
||||||
|
filesystem = {
|
||||||
|
filtered_items = {
|
||||||
|
visible = true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
width = 30,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
u.nmap('<space>e', u.cmd('Neotree toggle'))
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
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,9 @@
|
|||||||
|
local u = require 'config.utils'
|
||||||
|
|
||||||
|
require 'telescope'.setup {}
|
||||||
|
|
||||||
|
u.nmap('<space>ff', u.cmd('Telescope find_files'))
|
||||||
|
u.nmap('<space>fg', u.cmd('Telescope live_grep'))
|
||||||
|
u.nmap('<space>fb', u.cmd('Telescope buffers'))
|
||||||
|
u.nmap('<space>fh', u.cmd('Telescope help_tags'))
|
||||||
|
|
||||||
@@ -3,18 +3,17 @@ local group = vim.api.nvim_create_augroup("reload", {})
|
|||||||
local post_write = function(path, cmd)
|
local post_write = function(path, cmd)
|
||||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
group = group,
|
group = group,
|
||||||
pattern = "**/lua/bryan/" .. path,
|
pattern = "**/lua/config/" .. path,
|
||||||
command = cmd,
|
command = cmd,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, path in ipairs({
|
for _, path in ipairs({
|
||||||
"general.lua",
|
"reload.lua",
|
||||||
"theme.lua",
|
"settings.lua",
|
||||||
"mappings/*.lua",
|
"utils.lua"
|
||||||
"neovide.lua",
|
|
||||||
}) do post_write(path, "source <afile>") end
|
}) do post_write(path, "source <afile>") end
|
||||||
|
|
||||||
-- allows you to install and clean plugins after writing to the file
|
-- allows you to install and clean plugins after writing to the file
|
||||||
post_write("plugins/plugins.lua", "source <afile> | PackerCompile")
|
post_write("plugins.lua", "source <afile> | PackerCompile")
|
||||||
|
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
local u = require 'config.utils'
|
||||||
|
local o = vim.o
|
||||||
|
|
||||||
|
-- basic stuff
|
||||||
|
o.number = true
|
||||||
|
vim.cmd('filetype plugin on')
|
||||||
|
vim.cmd('syntax on')
|
||||||
|
o.cmdheight = 2
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
|
||||||
|
-- line break (wrapping) settings
|
||||||
|
o.linebreak = true
|
||||||
|
o.breakindent = true
|
||||||
|
o.showbreak = '\\ '
|
||||||
|
|
||||||
|
-- lines after end of file empty instead of ~ (fillchars)
|
||||||
|
o.fcs = 'eob: '
|
||||||
|
|
||||||
|
-- tab
|
||||||
|
o.expandtab = true
|
||||||
|
o.softtabstop = 4
|
||||||
|
o.shiftwidth = 4
|
||||||
|
|
||||||
|
-- turn of gui colors if in tty
|
||||||
|
if os.getenv('TERM') ~= 'linux' then
|
||||||
|
o.termguicolors = true
|
||||||
|
else
|
||||||
|
o.termguicolors = false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 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 = '●' };
|
||||||
|
})
|
||||||
|
|
||||||
|
-- terminal
|
||||||
|
u.map('t', '<esc>', '<C-\\><C-n>')
|
||||||
|
u.nmap('<space>tm', '<cmd>belowright 7sp<cr>:term<cr>A')
|
||||||
|
|
||||||
|
-- off search highlight when escape is pressed
|
||||||
|
u.nmap('<esc>', '<cmd>noh<cr><esc>')
|
||||||
|
|
||||||
|
-- colemak
|
||||||
|
local l = u.layout
|
||||||
|
l.swap('n', 'h')
|
||||||
|
l.swap('e', 'j')
|
||||||
|
l.swap('i', 'k')
|
||||||
|
l.swap('o', 'l')
|
||||||
|
|
||||||
|
l.swap('<C-w>n', '<C-w>h')
|
||||||
|
l.swap('<C-w>e', '<C-w>j')
|
||||||
|
l.swap('<C-w>i', '<C-w>k')
|
||||||
|
l.swap('<C-w>o', '<C-w>l')
|
||||||
|
|
||||||
|
l.swap('N', 'H')
|
||||||
|
l.swap('O', 'L')
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
-- 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 = '●' };
|
|
||||||
})
|
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
local utils = {}
|
||||||
|
utils.map = function(mode, from, to) vim.keymap.set(mode, from, to, opts) end
|
||||||
|
utils.nmap = function(from, to) vim.keymap.set('n', from, to, opts) end
|
||||||
|
utils.cmd = function(content) return '<cmd>' .. content .. '<cr>' end
|
||||||
|
|
||||||
|
local layout = {}
|
||||||
|
layout.map = function(from, to)
|
||||||
|
vim.keymap.set('n', from, to, opts)
|
||||||
|
vim.keymap.set('x', from, to, opts)
|
||||||
|
end
|
||||||
|
layout.swap = function(a, b)
|
||||||
|
utils.layout.map(a, b)
|
||||||
|
utils.layout.map(b, a)
|
||||||
|
end
|
||||||
|
utils.layout = layout
|
||||||
|
|
||||||
|
return utils
|
||||||
|
|
||||||
Reference in new issue
Block a user