Formatting
This commit is contained in:
parent
038e5af3b5
commit
3903e1486f
|
@ -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', '<leader>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', '<leader>i', function ()
|
||||
vim.lsp.buf.formatting_sync({timeout_ms=10000})
|
||||
vim.keymap.set('n', '<leader>i', function()
|
||||
vim.lsp.buf.formatting_sync({ timeout_ms = 10000 })
|
||||
end, bufopts)
|
||||
else
|
||||
vim.keymap.set('n', '<leader>i', function ()
|
||||
vim.lsp.buf.format({timeout_ms=10000,async=false})
|
||||
vim.keymap.set('n', '<leader>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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require('aerial').setup{
|
||||
require('aerial').setup {
|
||||
on_attach = function(bufnr)
|
||||
-- Toggle the aerial window with <leader>a
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>k', '<cmd>AerialToggle!<CR>', {})
|
||||
|
@ -10,4 +10,3 @@ require('aerial').setup{
|
|||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']]', '<cmd>AerialNextUp<CR>', {})
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require('gitsigns').setup{
|
||||
require('gitsigns').setup {
|
||||
signcolumn = true,
|
||||
numhl = true,
|
||||
linehl = true,
|
||||
|
|
|
@ -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' }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vim.opt.termguicolors=true
|
||||
require('nightfox').setup{
|
||||
vim.opt.termguicolors = true
|
||||
require('nightfox').setup {
|
||||
modules = {
|
||||
aerial = true,
|
||||
cmp = true,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require('sniprun').setup{
|
||||
require('sniprun').setup {
|
||||
selected_interpreters = { 'Python3_fifo' },
|
||||
repl_enable = {'Python3_fifo'},
|
||||
repl_enable = { 'Python3_fifo' },
|
||||
display = {
|
||||
"NvimNotify"
|
||||
},
|
||||
|
|
|
@ -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 = { ["<c-t>"] = trouble.open_with_trouble },
|
||||
|
|
|
@ -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', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
|
||||
|
|
|
@ -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' },
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ local function imap(shortcut, command)
|
|||
map('i', shortcut, command)
|
||||
end
|
||||
|
||||
vim.g.mapleader=' '
|
||||
vim.g.mapleader = ' '
|
||||
-- Misc
|
||||
imap('jk','<Esc>')
|
||||
imap('jk', '<Esc>')
|
||||
nmap('<leader>sr', ':SnipRun<cr>')
|
||||
nmap('<leader>gf', ':Git fetch<cr>')
|
||||
nmap('<leader>gp', ':Git pull<cr>')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- TODO convert to lua
|
||||
vim.cmd("let &t_ut=''") -- For kitty background colour support
|
||||
vim.cmd[[
|
||||
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
|
||||
]]
|
||||
|
||||
|
|
Loading…
Reference in a new issue