diff --git a/lua/config_lsp.lua b/lua/config_lsp.lua index efed5aea..6c59eb6b 100644 --- a/lua/config_lsp.lua +++ b/lua/config_lsp.lua @@ -1,6 +1,6 @@ -- Mappings. -- See `:help vim.diagnostic.*` for documentation on any of the below functions -local opts = { noremap=true, silent=true } +local opts = { noremap = true, silent = true } vim.keymap.set('n', '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) @@ -14,7 +14,7 @@ local on_attach = function(client, bufnr) -- Mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions - local bufopts = { noremap=true, silent=true, buffer=bufnr } + 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) @@ -31,12 +31,12 @@ local on_attach = function(client, bufnr) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) -- Keep support for deprecated syntax in vim <= 7 if vim.version().minor <= 7 then - vim.keymap.set('n', 'i', function () - vim.lsp.buf.formatting_sync({timeout_ms=10000}) + vim.keymap.set('n', 'i', function() + vim.lsp.buf.formatting_sync({ timeout_ms = 10000 }) end, bufopts) else - vim.keymap.set('n', 'i', function () - vim.lsp.buf.format({timeout_ms=10000,async=false}) + vim.keymap.set('n', 'i', function() + vim.lsp.buf.format({ timeout_ms = 10000, async = false }) end, bufopts) end -- Enable aerial support @@ -49,7 +49,7 @@ local lsp_flags = { } -- Setup nvim-cmp. -local cmp = require'cmp' +local cmp = require 'cmp' cmp.setup({ snippet = { @@ -114,30 +114,30 @@ cmp.setup.cmdline(':', { local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) local function file_exists(name) - local f=io.open(name,"r") - if f~=nil then io.close(f) return true else return false end + local f = io.open(name, "r") + if f ~= nil then io.close(f) return true else return false end end -local pyright_file = os.getenv( "HOME" ).."/.pyenv/versions/neovim3/bin/pyright-langserver" -local pylsp_file = os.getenv( "HOME" ).."/.pyenv/versions/neovim3/bin/pylsp" +local pyright_file = os.getenv("HOME") .. "/.pyenv/versions/neovim3/bin/pyright-langserver" +local pylsp_file = os.getenv("HOME") .. "/.pyenv/versions/neovim3/bin/pylsp" if file_exists(pyright_file) then - require('lspconfig')['pyright'].setup{ - cmd = {pyright_file, "--stdio"}, + require('lspconfig')['pyright'].setup { + cmd = { pyright_file, "--stdio" }, on_attach = on_attach, flags = lsp_flags, capabilities = capabilities, } elseif file_exists(pylsp_file) then - require('lspconfig')['pylsp'].setup{ - cmd = {pylsp_file}, + require('lspconfig')['pylsp'].setup { + cmd = { pylsp_file }, on_attach = on_attach, flags = lsp_flags, settings = { pylsp = { plugins = { - pycodestyle = {maxLineLength = 88}, - flake8 = {maxLineLength = 88} + pycodestyle = { maxLineLength = 88 }, + flake8 = { maxLineLength = 88 } } } }, @@ -145,21 +145,21 @@ elseif file_exists(pylsp_file) then } end -require('lspconfig')['efm'].setup{ - init_options = {documentFormatting = true}, +require('lspconfig')['efm'].setup { + init_options = { documentFormatting = true }, settings = { languages = { python = { - {formatCommand = 'black --quiet -', formatStdin = true}, - {formatCommand = 'isort --quiet -', formatStdin = true}, + { formatCommand = 'black --quiet -', formatStdin = true }, + { formatCommand = 'isort --quiet -', formatStdin = true }, }, }, }, - filetypes = {'python'}, + filetypes = { 'python' }, } -require('lspconfig')['fortls'].setup{ - cmd = {os.getenv( "HOME" ).."/.pyenv/versions/neovim3/bin/fortls"}, +require('lspconfig')['fortls'].setup { + cmd = { os.getenv("HOME") .. "/.pyenv/versions/neovim3/bin/fortls" }, on_attach = on_attach, flags = lsp_flags, capabilities = capabilities @@ -174,7 +174,7 @@ require('lspconfig')['sumneko_lua'].setup { }, diagnostics = { -- Get the language server to recognize the `vim` global - globals = {'vim'}, + globals = { 'vim' }, }, workspace = { -- Make the server aware of Neovim runtime files diff --git a/lua/config_plugins/config_aerial.lua b/lua/config_plugins/config_aerial.lua index a3253b54..d70a919d 100644 --- a/lua/config_plugins/config_aerial.lua +++ b/lua/config_plugins/config_aerial.lua @@ -1,4 +1,4 @@ -require('aerial').setup{ +require('aerial').setup { on_attach = function(bufnr) -- Toggle the aerial window with a vim.api.nvim_buf_set_keymap(bufnr, 'n', 'k', 'AerialToggle!', {}) @@ -10,4 +10,3 @@ require('aerial').setup{ vim.api.nvim_buf_set_keymap(bufnr, 'n', ']]', 'AerialNextUp', {}) end, } - diff --git a/lua/config_plugins/config_gitsigns.lua b/lua/config_plugins/config_gitsigns.lua index 321c4082..52354324 100644 --- a/lua/config_plugins/config_gitsigns.lua +++ b/lua/config_plugins/config_gitsigns.lua @@ -1,4 +1,4 @@ -require('gitsigns').setup{ +require('gitsigns').setup { signcolumn = true, numhl = true, linehl = true, diff --git a/lua/config_plugins/config_lualine.lua b/lua/config_plugins/config_lualine.lua index b29ce587..264d5784 100644 --- a/lua/config_plugins/config_lualine.lua +++ b/lua/config_plugins/config_lualine.lua @@ -1,11 +1,11 @@ -require('lualine').setup{ +require('lualine').setup { options = { icons_enabled = true, theme = 'auto', }, sections = { -- lualine_x = {'encoding', 'fileformat', 'filetype'}, - lualine_x = {'aerial', 'filetype'} + lualine_x = { 'aerial', 'filetype' } }, - extensions = {'aerial', 'fugitive', 'fzf', 'nvim-tree', 'toggleterm'} + extensions = { 'aerial', 'fugitive', 'fzf', 'nvim-tree', 'toggleterm' } } diff --git a/lua/config_plugins/config_nightfox.lua b/lua/config_plugins/config_nightfox.lua index 5f66a3e3..206cee23 100644 --- a/lua/config_plugins/config_nightfox.lua +++ b/lua/config_plugins/config_nightfox.lua @@ -1,5 +1,5 @@ -vim.opt.termguicolors=true -require('nightfox').setup{ +vim.opt.termguicolors = true +require('nightfox').setup { modules = { aerial = true, cmp = true, diff --git a/lua/config_plugins/config_nvim-tree.lua b/lua/config_plugins/config_nvim-tree.lua index 6818a655..39d8ae61 100644 --- a/lua/config_plugins/config_nvim-tree.lua +++ b/lua/config_plugins/config_nvim-tree.lua @@ -1,6 +1,6 @@ vim.g.loaded = 1 vim.g.loaded_netrwPlugin = 1 -require('nvim-tree').setup{ +require('nvim-tree').setup { filters = { custom = { "^.git$" } }, renderer = { group_empty = true, diff --git a/lua/config_plugins/config_sniprun.lua b/lua/config_plugins/config_sniprun.lua index ea38bec0..8be904ed 100644 --- a/lua/config_plugins/config_sniprun.lua +++ b/lua/config_plugins/config_sniprun.lua @@ -1,6 +1,6 @@ -require('sniprun').setup{ +require('sniprun').setup { selected_interpreters = { 'Python3_fifo' }, - repl_enable = {'Python3_fifo'}, + repl_enable = { 'Python3_fifo' }, display = { "NvimNotify" }, diff --git a/lua/config_plugins/config_telescope.lua b/lua/config_plugins/config_telescope.lua index 6777a774..af41f962 100644 --- a/lua/config_plugins/config_telescope.lua +++ b/lua/config_plugins/config_telescope.lua @@ -1,10 +1,10 @@ require('telescope').load_extension('aerial') require('telescope').load_extension('notify') -local actions = require('telescope.actions') +require('telescope.actions') local trouble = require('trouble.providers.telescope') -require('telescope').setup{ +require('telescope').setup { defaults = { mappings = { i = { [""] = trouble.open_with_trouble }, diff --git a/lua/config_plugins/config_toggleterm.lua b/lua/config_plugins/config_toggleterm.lua index 7980017a..e2ac83b7 100644 --- a/lua/config_plugins/config_toggleterm.lua +++ b/lua/config_plugins/config_toggleterm.lua @@ -1,4 +1,4 @@ -require('toggleterm').setup{ +require('toggleterm').setup { direction = 'float', open_mapping = [[\t]], size = 20, @@ -7,7 +7,7 @@ require('toggleterm').setup{ } function _G.set_terminal_keymaps() - local opts = {buffer = 0} + local opts = { buffer = 0 } vim.keymap.set('t', '', [[wincmd h]], opts) vim.keymap.set('t', '', [[wincmd j]], opts) vim.keymap.set('t', '', [[wincmd k]], opts) diff --git a/lua/config_plugins/config_treesitter.lua b/lua/config_plugins/config_treesitter.lua index 90269193..d9a93934 100644 --- a/lua/config_plugins/config_treesitter.lua +++ b/lua/config_plugins/config_treesitter.lua @@ -1,9 +1,8 @@ -require'nvim-treesitter.configs'.setup { +require 'nvim-treesitter.configs'.setup { ensure_installed = { "python" }, highlight = { enable = true, additional_vim_regex_highlighting = false, - disable = {'help'}, + disable = { 'help' }, }, } - diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 4d94547f..32bffd3a 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -10,9 +10,9 @@ local function imap(shortcut, command) map('i', shortcut, command) end -vim.g.mapleader=' ' +vim.g.mapleader = ' ' -- Misc -imap('jk','') +imap('jk', '') nmap('sr', ':SnipRun') nmap('gf', ':Git fetch') nmap('gp', ':Git pull') diff --git a/lua/options.lua b/lua/options.lua index d2d18b94..4967119c 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -5,18 +5,17 @@ vim.g.python_indent = { continue = 'shiftwidth()', closed_paren_align_last_line = 'v:false', } -vim.opt.mouse="nv" -vim.opt.shiftwidth=4 -vim.opt.number=true -vim.opt.relativenumber=true -vim.opt.listchars = {trail = '.', tab = '>_'} -vim.opt.list=true -vim.opt.wrap=true -vim.opt.linebreak=true -vim.opt.autoread=true -vim.opt.expandtab=true -vim.opt.autoindent=true -vim.opt.smartindent=true -vim.opt.splitbelow=true -vim.opt.splitright=true - +vim.opt.mouse = "nv" +vim.opt.shiftwidth = 4 +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.listchars = { trail = '.', tab = '>_' } +vim.opt.list = true +vim.opt.wrap = true +vim.opt.linebreak = true +vim.opt.autoread = true +vim.opt.expandtab = true +vim.opt.autoindent = true +vim.opt.smartindent = true +vim.opt.splitbelow = true +vim.opt.splitright = true diff --git a/lua/plugins.lua b/lua/plugins.lua index b080ae92..98daf423 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -10,7 +10,7 @@ require('packer').startup { use 'wbthomason/packer.nvim' use { 'rcarriga/nvim-notify', - config = function () + config = function() vim.notify = require("notify") end } @@ -28,45 +28,45 @@ require('packer').startup { use 'hrsh7th/vim-vsnip' use { 'EdenEast/nightfox.nvim', - config = function () + config = function() require 'config_plugins.config_nightfox' end } use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', - config = function () + config = function() require 'config_plugins.config_treesitter' end } use { 'j-hui/fidget.nvim', - config = function () + config = function() require('fidget').setup() end } use { 'stevearc/aerial.nvim', branch = 'nvim-0.5', - config = function () + config = function() require 'config_plugins.config_aerial' end } use { 'tpope/vim-fugitive', opt = true, - cmd = {'G', 'Git'} + cmd = { 'G', 'Git' } } use { 'https://github.com/lewis6991/gitsigns.nvim.git', tag = 'release', - config = function () + config = function() require 'config_plugins.config_gitsigns' end } use { 'nvim-lualine/lualine.nvim', - config = function () + config = function() require 'config_plugins.config_lualine' end } @@ -79,7 +79,7 @@ require('packer').startup { use { 'akinsho/toggleterm.nvim', tag = 'v2.*', - config = function () + config = function() require 'config_plugins.config_toggleterm' end } @@ -87,9 +87,9 @@ require('packer').startup { 'nvim-telescope/telescope.nvim', branch = '0.1.x', requires = { - {'nvim-lua/plenary.nvim'} + { 'nvim-lua/plenary.nvim' } }, - config = function () + config = function() require 'config_plugins.config_telescope' end } @@ -101,33 +101,33 @@ require('packer').startup { 'michaelb/sniprun', run = 'bash install.sh', opt = true, - cmd = {'SnipRun', 'SnipInfo', 'SnipReset'}, - config = function () + cmd = { 'SnipRun', 'SnipInfo', 'SnipReset' }, + config = function() require 'config_plugins.config_sniprun' end } use { 'phaazon/hop.nvim', - config = function () + config = function() require('hop').setup() end } use { 'folke/trouble.nvim', - config = function () + config = function() require('trouble').setup() end } use { "lukas-reineke/indent-blankline.nvim", - config = function () + config = function() require('indent_blankline').setup() end } end, config = { display = { - open_fn = function () + open_fn = function() return require('packer.util').float({ border = 'single' }) end }, diff --git a/lua/vimcommands.lua b/lua/vimcommands.lua index 05437f1c..466f495b 100644 --- a/lua/vimcommands.lua +++ b/lua/vimcommands.lua @@ -1,6 +1,6 @@ -- TODO convert to lua -vim.cmd("let &t_ut=''") -- For kitty background colour support -vim.cmd[[ +vim.cmd("let &t_ut=''") -- For kitty background colour support +vim.cmd [[ au BufRead,BufNewFile *.ipynb setlocal filetype=json au BufRead,BufNewFile *.md setlocal spell au BufRead,BufNewFile *.code-workspace setlocal filetype=json @@ -9,4 +9,3 @@ au BufRead,BufNewFile *.service[a-zA-Z0-9]* setlocal filetype=systemd au TermOpen * setlocal nonumber norelativenumber syntax on ]] -