initial commit
This commit is contained in:
26
lua/binds.lua
Normal file
26
lua/binds.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
--
|
||||
-- Configuration Tools
|
||||
--
|
||||
local ct = require('conftool')
|
||||
local defs = require('defs')
|
||||
|
||||
--
|
||||
-- Maps
|
||||
--
|
||||
-- select all
|
||||
ct.map('n', '<C-a>', '<esc>ggVG<LF>')
|
||||
--[[
|
||||
-- spawn terminal
|
||||
ct.map('n', '<C-M-t>', ':!' .. defs.external_term .. ' . &<LF><LF>')
|
||||
-- spwan file manager
|
||||
ct.map('n', '<C-M-f>', ':!' .. defs.external_filemgr .. ' . &<LF><LF>')
|
||||
]]
|
||||
-- spellchecking
|
||||
ct.map('n', '<C-s>', ':set spell!<LF>')
|
||||
|
||||
--
|
||||
-- Commands
|
||||
--
|
||||
ct.defcmd('Xrdb', '!xrdb %')
|
||||
ct.defcmd('ExTerm', '!' .. defs.external_term .. '&<LF><LF>')
|
||||
ct.defcmd('ExFileMgr', '!' .. defs.external_filemgr .. '&<LF><LF>')
|
||||
37
lua/conftool.lua
Normal file
37
lua/conftool.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
local conftool = {}
|
||||
|
||||
function conftool.set(...)
|
||||
for _,a in ipairs{...} do
|
||||
if type(a) == "string" then
|
||||
vim.opt[a] = true;
|
||||
elseif type(a) == "table" then
|
||||
local val = false
|
||||
if #a == 2 then val = a[2]
|
||||
elseif #a == 1 then val = true end
|
||||
vim.opt[ a[1] ] = val
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function conftool.augroup(name, ...)
|
||||
vim.cmd('augroup ' .. name)
|
||||
vim.cmd('autocmd!')
|
||||
for _, autocmd in ipairs{...} do
|
||||
vim.cmd('autocmd ' .. table.concat(autocmd, ' '))
|
||||
end
|
||||
vim.cmd('augroup END')
|
||||
end
|
||||
|
||||
function conftool.map(mode, keyseq, argcmd, argopts)
|
||||
local opts = {noremap = true}
|
||||
if argopts then opts = vim.tbl_extend('force', defopts, opts) end
|
||||
vim.api.nvim_set_keymap(mode, keyseq, argcmd, opts)
|
||||
end
|
||||
|
||||
function conftool.defcmd(cmd, repl, attr, redef)
|
||||
if not redef then redef = '' end
|
||||
if not attr then attr = '' end
|
||||
vim.cmd('command' .. redef .. ' ' .. cmd .. ' ' .. attr .. ' ' .. repl)
|
||||
end
|
||||
|
||||
return conftool
|
||||
8
lua/defs.lua
Normal file
8
lua/defs.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
-- Yes, I use the Mate desktop environment
|
||||
template_dir = '~/templates',
|
||||
external_term = 'mate-terminal',
|
||||
external_filemgr = 'caja',
|
||||
external_pdfviewer = 'atril',
|
||||
lsp_path = vim.env.HOME .. '/.local/share/lsp_servers'
|
||||
}
|
||||
26
lua/filetypes.lua
Normal file
26
lua/filetypes.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
--
|
||||
-- Configuration Tools
|
||||
--
|
||||
local ct = require('conftool')
|
||||
local defs = require('defaults')
|
||||
--
|
||||
-- Templates
|
||||
--
|
||||
ct.augroup('templates',
|
||||
{'BufNewFile', '*.c', '0r', defs.template_dir .. '/c_stdio.c'},
|
||||
{'BufNewFile', '*.cpp', '0r', defs.template_dir .. '/cpp_iostream.cpp'},
|
||||
{'BufNewFile', '*.html', '0r', defs.template_dir .. '/html.html'},
|
||||
{'BufNewFile', '*.html', '0r', defs.template_dir .. '/html.html'},
|
||||
{'BufNewFile', '*.py', '0r', defs.template_dir .. '/py.py'},
|
||||
{'BufNewFile', '*.sh', '0r', defs.template_dir .. '/sh.sh'}
|
||||
)
|
||||
|
||||
--
|
||||
-- FileType based Settings
|
||||
--
|
||||
ct.augroup('filetypeSettings',
|
||||
{'FileType', 'python', 'setlocal', 'tabstop=4 shiftwidth=4 expandtab'},
|
||||
{'FileType', 'html', 'setlocal', 'tabstop=2 shiftwidth=2 expandtab'},
|
||||
{'FileType', 'javascript', 'setlocal', 'tabstop=2 shiftwidth=2 expandtab'},
|
||||
{'FileType', 'vue', 'setlocal', 'tabstop=2 shiftwidth=2 expandtab'}
|
||||
)
|
||||
161
lua/ide.lua
Normal file
161
lua/ide.lua
Normal file
@@ -0,0 +1,161 @@
|
||||
--
|
||||
-- IDE-like features
|
||||
--
|
||||
|
||||
-- Load required tools
|
||||
local pk_use = require 'packer'.use
|
||||
local ct = require 'conftool'
|
||||
|
||||
|
||||
--
|
||||
-- Tree Sitter
|
||||
--
|
||||
pk_use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate',
|
||||
config = function()
|
||||
require('nvim-treesitter.configs').setup{
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"bibtex",
|
||||
"c",
|
||||
"cpp",
|
||||
"css",
|
||||
"go",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"latex",
|
||||
"python",
|
||||
"typescript",
|
||||
"vim",
|
||||
},
|
||||
sync_install = false,
|
||||
highlight = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
--
|
||||
-- Autocompletion
|
||||
--
|
||||
pk_use {
|
||||
'ms-jpq/coq_nvim',
|
||||
branch = 'coq',
|
||||
config = function()
|
||||
vim.cmd([[autocmd VimEnter * COQnow]])
|
||||
end
|
||||
}
|
||||
pk_use {
|
||||
'ms-jpq/coq.artifacts',
|
||||
branch = 'artifacts'
|
||||
}
|
||||
|
||||
--
|
||||
-- Language Configurations
|
||||
--
|
||||
pk_use 'ap/vim-css-color'
|
||||
-- close tags in html languages
|
||||
pk_use {
|
||||
'alvan/closetag.vim',
|
||||
ft = {"html", "vue"}
|
||||
}
|
||||
pk_use {
|
||||
'fatih/vim-go',
|
||||
ft = 'go'
|
||||
}
|
||||
pk_use {
|
||||
'lervag/vimtex',
|
||||
ft = 'tex',
|
||||
config = function()
|
||||
local defs = require 'defaults'
|
||||
vim.g.vimtex_view_general_viewer = defs.external_pdfviewer
|
||||
vim.g.vimtex_compiler_latexmk_engines = { _ = '-xelatex'}
|
||||
vim.g.vimtex_compiler_progname = 'nvim'
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
-- Language Server
|
||||
--
|
||||
|
||||
-- Basic commands
|
||||
pk_use 'nanotee/nvim-lsp-basics'
|
||||
|
||||
-- Language Server Installer
|
||||
pk_use {
|
||||
'williamboman/mason.nvim',
|
||||
config = function()
|
||||
require('mason').setup()
|
||||
end
|
||||
}
|
||||
pk_use {
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
requires = {
|
||||
'williamboman/mason.nvim',
|
||||
'ms-jpq/coq_nvim'
|
||||
},
|
||||
config = function()
|
||||
local masonlsp = require 'mason-lspconfig'
|
||||
masonlsp.setup {
|
||||
ensure_installed = {
|
||||
"sumneko_lua",
|
||||
"gopls",
|
||||
"vimls"
|
||||
}
|
||||
}
|
||||
masonlsp.setup_handlers {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup(require('coq').lsp_ensure_capabilities {
|
||||
on_attach = function(client, bufnr)
|
||||
local basics = require('lsp_basics')
|
||||
basics.make_lsp_commands(client, bufnr)
|
||||
basics.make_lsp_mappings(client, bufnr)
|
||||
end
|
||||
})
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
pk_use {'neovim/nvim-lspconfig'}
|
||||
|
||||
--
|
||||
-- Show code diagnostics in a separate buffer window
|
||||
--
|
||||
pk_use {
|
||||
'folke/trouble.nvim',
|
||||
config = function()
|
||||
require('trouble').setup {
|
||||
icons = false,
|
||||
fold_open = "v",
|
||||
fold_closed = ">",
|
||||
signs = {
|
||||
error = "E:",
|
||||
warning = "W:",
|
||||
hint = "H:",
|
||||
information = "I:"
|
||||
},
|
||||
use_diagnostic_signs = false
|
||||
}
|
||||
|
||||
require('conftool').map('n', '<C-S-`>', ':TroubleToggle<CR>')
|
||||
end
|
||||
}
|
||||
|
||||
--
|
||||
-- Debugger Adapter Protocol
|
||||
--
|
||||
--[[
|
||||
pk_use {
|
||||
'mfussenegger/nvim-dap',
|
||||
config = function()
|
||||
local dap = require('dap')
|
||||
|
||||
end
|
||||
}
|
||||
--]]
|
||||
|
||||
70
lua/misc.lua
Normal file
70
lua/misc.lua
Normal file
@@ -0,0 +1,70 @@
|
||||
local ct = require('conftool')
|
||||
local pk_use = require('packer').use
|
||||
|
||||
--
|
||||
-- Encoding
|
||||
--
|
||||
ct.set({'encoding', 'utf-8'}, {'fileencoding', 'utf-8'})
|
||||
|
||||
--
|
||||
-- Search
|
||||
--
|
||||
ct.set('wildmenu', 'incsearch', 'hlsearch')
|
||||
vim.opt.backspace = 'indent,eol,start'
|
||||
|
||||
--
|
||||
-- Folds
|
||||
--
|
||||
ct.augroup('AutoSaveFolds', {
|
||||
'BufWinLeave,BufLeave,BufWritePost',
|
||||
'?*', 'nested silent!',
|
||||
'mkview!'
|
||||
},{
|
||||
'BufWinEnter', '?*', 'silent!', 'loadview'
|
||||
}
|
||||
)
|
||||
|
||||
--
|
||||
-- Spell Checking
|
||||
--
|
||||
ct.set({'spelllang', {'en', 'cjk', 'id'}})
|
||||
ct.set({'spellsuggest', {'best', 5}})
|
||||
|
||||
--
|
||||
-- Focus Mode
|
||||
--
|
||||
pk_use {
|
||||
'junegunn/goyo.vim',
|
||||
cmd = 'Goyo'
|
||||
}
|
||||
|
||||
--
|
||||
-- Multi-cursor
|
||||
--
|
||||
pk_use {
|
||||
'mg979/vim-visual-multi',
|
||||
keys = {"<C-Up>", "<C-Down>"}
|
||||
}
|
||||
|
||||
--
|
||||
-- Netrw built-in file manager
|
||||
--
|
||||
vim.g.netrw_liststyle = 3 -- tree style display
|
||||
vim.g.netrw_banner = 0 -- no banner needed
|
||||
vim.g.netrw_browse_split = 4
|
||||
vim.g.netrw_winsize = 15 -- small window size
|
||||
vim.g.netrw_chgwin = 1
|
||||
|
||||
--
|
||||
-- EtC.
|
||||
--
|
||||
vim.opt.compatible = false
|
||||
vim.opt.autowrite = true
|
||||
-- auto cd to the current file's location
|
||||
vim.cmd('autocmd BufEnter * silent! lcd %:p:h')
|
||||
-- highlighting for other langs in markdown docs
|
||||
vim.g.markdown_fenced_languages = {'html', 'vim', 'python', 'c', 'bash=sh'}
|
||||
-- auto close delimiters (eg. parentheses, brackets)
|
||||
pk_use 'Raimondi/delimitMate'
|
||||
|
||||
|
||||
67
lua/ui.lua
Normal file
67
lua/ui.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
local pk_use = require 'packer'.use
|
||||
local ct = require 'conftool'
|
||||
|
||||
--
|
||||
-- Theme
|
||||
--
|
||||
vim.cmd('syntax on')
|
||||
--[[
|
||||
pk_use {
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
config = function()
|
||||
require('conftool').set({'background', "light"})
|
||||
require('gruvbox').setup({
|
||||
italic = true,
|
||||
bold = true,
|
||||
contrast = "hard"
|
||||
})
|
||||
vim.cmd [[colo gruvbox]]
|
||||
-- end
|
||||
--}
|
||||
--]]
|
||||
pk_use {
|
||||
'Th3Whit3Wolf/one-nvim',
|
||||
config = function()
|
||||
require('conftool').set({'background', "light"})
|
||||
vim.cmd [[colorscheme one-nvim]]
|
||||
end
|
||||
}
|
||||
|
||||
--
|
||||
-- Indentation
|
||||
--
|
||||
vim.cmd('filetype plugin indent on')
|
||||
ct.set('autoindent', 'smartindent', 'cindent')
|
||||
ct.set({'tabstop', 5}, {'shiftwidth', 5})
|
||||
|
||||
--
|
||||
-- Indent indicators
|
||||
--
|
||||
vim.opt.list = true
|
||||
vim.cmd([[set lcs=tab:\|\ ]])
|
||||
pk_use {
|
||||
'Yggdroot/indentLine',
|
||||
setup = function()
|
||||
vim.g.indentLine_char = '|'
|
||||
vim.g.indentLine_setConceal = 0
|
||||
end
|
||||
}
|
||||
|
||||
--
|
||||
-- EtC.
|
||||
--
|
||||
ct.set('ruler', 'showcmd', 'cursorline', 'number', 'termguicolors', 'title')
|
||||
ct.set(
|
||||
{'signcolumn', 'yes:1'},
|
||||
{'laststatus', 1},
|
||||
{'background', 'light'},
|
||||
{'conceallevel', 0},
|
||||
{'textwidth', 0},
|
||||
{'wrapmargin', 0},
|
||||
{'laststatus', 1}
|
||||
)
|
||||
|
||||
-- dont show line number in terminal window
|
||||
vim.cmd('autocmd TermOpen * setlocal nonu')
|
||||
-- turn on mouse
|
||||
vim.opt.mouse = 'a'
|
||||
Reference in New Issue
Block a user