summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/getchoo
diff options
context:
space:
mode:
authorseth <[email protected]>2022-08-02 05:07:11 -0400
committerseth <[email protected]>2022-08-04 04:41:05 -0400
commit12527d71ea8b0921b910afa6bcd5fc6adf9649eb (patch)
tree4f03e53496da4ae0401cc1fd1c51eb8387a54be5 /.config/nvim/lua/getchoo
parentbd06652d62ccae12d2eb2e60a0120b767ba062a7 (diff)
start using lua :)
Diffstat (limited to '.config/nvim/lua/getchoo')
-rw-r--r--.config/nvim/lua/getchoo/lsp.lua80
-rw-r--r--.config/nvim/lua/getchoo/plugins.lua55
2 files changed, 135 insertions, 0 deletions
diff --git a/.config/nvim/lua/getchoo/lsp.lua b/.config/nvim/lua/getchoo/lsp.lua
new file mode 100644
index 0000000..7bd16ce
--- /dev/null
+++ b/.config/nvim/lua/getchoo/lsp.lua
@@ -0,0 +1,80 @@
+--
+-- lsp settings using nvim-lspconfig & coq-nvim
+--
+
+local fn = vim.fn
+local cmd = vim.cmd
+local opt = vim.opt
+
+
+vim.g.coq_settings = { auto_start = 'shut-up' }
+
+--- Mappings.
+--- See `:help vim.diagnostic.*` for documentation on any of the below functions
+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)
+
+--- Use an on_attach function to only map the following keys
+--- after the language server attaches to the current buffer
+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)
+end
+
+local servers = { 'rust_analyzer', 'pyright', 'bashls' }
+for _, lsp in ipairs(servers) do
+ require('lspconfig')[lsp].setup(require('coq').lsp_ensure_capabilities({
+ on_attach = on_attatch,
+ flags = lsp_flags
+ }))
+end
+
+require('lspconfig')['sumneko_lua'].setup(require('coq').lsp_ensure_capabilities({
+ on_attatch = on_attatch,
+ flags = lsp_flags,
+ settings = {
+ Lua = {
+ runtime = {
+ version = 'LuaJIT',
+ },
+ diagnostics = {
+ globals = {'vim'},
+ },
+ workspace = {
+ library = vim.api.nvim_get_runtime_file("", true),
+ }
+ },
+ },
+}))
+
+require('lint').linters_by_ft = {
+ python = {'flake8',}
+}
+
+vim.api.nvim_create_autocmd({ "BufWritePost" }, {
+ callback = function()
+ require('lint').try_lint()
+ end,
+})
diff --git a/.config/nvim/lua/getchoo/plugins.lua b/.config/nvim/lua/getchoo/plugins.lua
new file mode 100644
index 0000000..756a983
--- /dev/null
+++ b/.config/nvim/lua/getchoo/plugins.lua
@@ -0,0 +1,55 @@
+--
+-- plugins for neovim
+--
+
+local fn = vim.fn
+local cmd = vim.cmd
+local opt = vim.opt
+
+
+local packer_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
+
+if fn.empty(fn.glob(packer_path)) > 0 then
+ packer_bootstrap = fn.system({
+ 'git',
+ 'clone',
+ '--depth', '1',
+ 'https://github.com/wbthomason/packer.nvim',
+ packer_path
+ })
+ cmd [[packadd packer.nvim]]
+end
+
+require('packer').startup(function(use)
+ use 'wbthomason/packer.nvim'
+ use {
+ 'nvim-treesitter/nvim-treesitter',
+ run = function() require('nvim-treesitter.install').update({ with_sync = true }) end,
+ }
+ use 'neovim/nvim-lspconfig'
+ use { 'ms-jpq/coq_nvim', run = 'python3 -m coq deps' }
+ use 'ms-jpq/coq.artifacts'
+ use 'ms-jpq/coq.thirdparty'
+ use 'mfussenegger/nvim-lint'
+ use {
+ 'nvim-lualine/lualine.nvim',
+ requires = { 'kyazdani42/nvim-web-devicons', opt = true }
+ }
+ use 'arcticicestudio/nord-vim'
+ use {'rose-pine/neovim', as = 'rose-pine'}
+
+ if packer_bootstrap then
+ require('packer').sync()
+ end
+end)
+
+require('nvim-treesitter.configs').setup {
+ auto_install = true
+}
+
+require('lualine').setup {
+ options = {
+ theme = 'nord'
+ },
+ extensions = {'nvim-tree'}
+}