You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
218 lines
6.5 KiB
218 lines
6.5 KiB
2 years ago
|
-- some basic options
|
||
|
local vim = vim
|
||
|
vim.opt.tabstop = 2
|
||
|
vim.opt.shiftwidth = 2
|
||
|
vim.opt.softtabstop = 2
|
||
|
vim.opt.expandtab = true
|
||
|
vim.opt.termguicolors = true
|
||
|
vim.opt.smartindent = true
|
||
|
vim.opt.number = true
|
||
|
vim.opt.autochdir = true
|
||
|
vim.opt.hidden = true
|
||
|
vim.o.hidden = true
|
||
|
vim.o.signcolumn = 'auto'
|
||
|
vim.o.smarttab = true
|
||
|
vim.o.clipboard = "unnamedplus"
|
||
|
vim.g.noswapfile = true
|
||
|
vim.cmd [[set mouse=a]] -- enable mouse
|
||
|
vim.wo.cursorline = true
|
||
|
|
||
|
vim.opt.guifont = "Iosevka Nerd Font:h12"
|
||
|
|
||
|
vim.g.neovide_refresh_rate = 140
|
||
|
--vim.g.coq_settings = { 'auto_start': 'shut-up' }
|
||
|
|
||
|
function map(mode, shortcut, command)
|
||
|
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
|
||
|
end
|
||
|
|
||
|
-- normal mode map
|
||
|
function nmap(shortcut, command)
|
||
|
map('n', shortcut, command)
|
||
|
end
|
||
|
|
||
|
-- insert mode map
|
||
|
function imap(shortcut, command)
|
||
|
map('i', shortcut, command)
|
||
|
end
|
||
|
|
||
|
-- <leader> is leader key; default is \
|
||
|
nmap("<leader>v", "<cmd>CHADopen<cr>")
|
||
|
nmap("<leader>ec", "<cmd>e ~/.config/nvim/init.lua<cr>")
|
||
|
nmap("<leader>sc", "<cmd>source ~/.config/nvim/init.lua<cr>")
|
||
|
|
||
|
-- buffer commands
|
||
|
nmap("<leader>b", "<cmd>BufferLineCyclePrev<cr>")
|
||
|
nmap("<leader>n", "<cmd>BufferLineCycleNext<cr>")
|
||
|
nmap("<leader>gb", "<cmd>BufferLinePick<cr>")
|
||
|
nmap("<leader>w", "<cmd>bdelete!<cr>")
|
||
|
|
||
|
-- lsp on_attach mappings
|
||
|
local on_attach = function(client, bufnr)
|
||
|
-- Enable completion triggered by <c-x><c-o>
|
||
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||
|
|
||
|
-- Mappings.
|
||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||
|
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||
|
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||
|
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||
|
vim.keymap.set('n', '<space>wl', function()
|
||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||
|
end, bufopts)
|
||
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||
|
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||
|
vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts)
|
||
|
require 'illuminate'.on_attach(client)
|
||
|
end
|
||
|
|
||
|
-- lsp config setup
|
||
|
require 'lspconfig'.hls.setup { on_attach = on_attach } -- haskell language server
|
||
|
require 'lspconfig'.pyright.setup {}
|
||
|
require 'lspconfig'.tsserver.setup { on_attach = on_attach }
|
||
|
require 'lspconfig'.sumneko_lua.setup { on_attach = on_attach,
|
||
|
settings = {
|
||
|
Lua = {
|
||
|
diagnostics = {
|
||
|
globals = { 'vim' }
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
-- lsp diagnostic mapping
|
||
|
local opts = { noremap = true, silent = true }
|
||
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||
|
|
||
|
vim.cmd("colorscheme nightfox")
|
||
|
|
||
|
-- packer boilerplate
|
||
|
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 })
|
||
|
end
|
||
|
|
||
|
return require('packer').startup(function(use)
|
||
|
use 'wbthomason/packer.nvim'
|
||
|
use 'neovim/nvim-lspconfig'
|
||
|
use {
|
||
|
'ms-jpq/coq_nvim',
|
||
|
branch = 'coq',
|
||
|
event = "VimEnter",
|
||
|
config = 'vim.cmd[[COQnow]]'
|
||
|
}
|
||
|
use { 'ms-jpq/coq.artifacts', branch = 'artifacts' }
|
||
|
use {
|
||
|
'nvim-treesitter/nvim-treesitter',
|
||
|
run = ':TSUpdate',
|
||
|
config = function() require('nvim-treesitter.configs').setup {
|
||
|
highlight = {
|
||
|
enable = true,
|
||
|
additional_vim_regex_highlighting = { 'org' }
|
||
|
},
|
||
|
indent = {
|
||
|
enable = true
|
||
|
},
|
||
|
ensure_installed = { 'org' }
|
||
|
}
|
||
|
end
|
||
|
}
|
||
|
use { 'ms-jpq/chadtree',
|
||
|
branch = 'chad',
|
||
|
run = ':CHADdeps',
|
||
|
}
|
||
|
use { 'ahmedkhalf/project.nvim', config = function() require("project_nvim").setup {
|
||
|
manual_mode = true
|
||
|
}
|
||
|
end
|
||
|
}
|
||
|
use {
|
||
|
'akinsho/bufferline.nvim',
|
||
|
tag = "v2.*",
|
||
|
requires = 'kyazdani42/nvim-web-devicons',
|
||
|
config = function() require("bufferline").setup {
|
||
|
options = {
|
||
|
seperator_style = { "slant", "slant" },
|
||
|
diagnostics = false
|
||
|
}
|
||
|
}
|
||
|
end
|
||
|
}
|
||
|
use { 'windwp/nvim-autopairs' } -- auto close brackets, etc.
|
||
|
use { "EdenEast/nightfox.nvim",
|
||
|
config = function() require("nightfox").setup{}
|
||
|
end
|
||
|
}
|
||
|
use {
|
||
|
"nvim-lualine/lualine.nvim",
|
||
|
event = "VimEnter",
|
||
|
config = function()
|
||
|
require("lualine").setup {
|
||
|
options = { theme = 'auto', globalstatus = true },
|
||
|
sections = { lualine_x = { 'filetype' } }
|
||
|
}
|
||
|
end,
|
||
|
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
|
||
|
}
|
||
|
use {
|
||
|
"startup-nvim/startup.nvim",
|
||
|
requires = {"nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim"},
|
||
|
config = function()
|
||
|
require"startup".setup()
|
||
|
end
|
||
|
}
|
||
|
use 'RRethy/vim-illuminate'
|
||
|
use { 'TimUntersberger/neogit',
|
||
|
requires = 'nvim-lua/plenary.nvim',
|
||
|
config = function() require("neogit").setup()
|
||
|
end
|
||
|
}
|
||
|
use {
|
||
|
'nvim-telescope/telescope.nvim',
|
||
|
requires = { { 'nvim-lua/plenary.nvim' } },
|
||
|
config = function()
|
||
|
require("telescope").setup {}
|
||
|
require("telescope").load_extension('projects')
|
||
|
end
|
||
|
}
|
||
|
use {
|
||
|
'nvim-orgmode/orgmode',
|
||
|
config = function()
|
||
|
require('orgmode').setup_ts_grammar()
|
||
|
require('orgmode').setup {
|
||
|
org_agenda_files = {
|
||
|
"~/Documents/org-mode/school.org",
|
||
|
"~/Documents/org-mode/personal.org",
|
||
|
"~/Documents/org-mode/tweaking.org",
|
||
|
"~/Documents/org-mode/projects.org"
|
||
|
},
|
||
|
win_split_mode = 'tabnew',
|
||
|
org_log_done = false,
|
||
|
-- notifications are supported?! emacs just got smoked fr
|
||
|
notifications = {
|
||
|
enabled = true,
|
||
|
cron_enabled = false, -- can set this up to send notifications even when vim is closed
|
||
|
deadline_reminder = true,
|
||
|
scheduled_reminder = true,
|
||
|
reminder_time = { 5, 10, 15 }
|
||
|
}
|
||
|
}
|
||
|
end
|
||
|
}
|
||
|
if packer_bootstrap then
|
||
|
require('packer').sync()
|
||
|
end
|
||
|
end)
|