diff --git a/manjaro.md b/manjaro.md index 3bb7e9a..cb8fe88 100644 --- a/manjaro.md +++ b/manjaro.md @@ -25,10 +25,14 @@ * indexing `yay -S fsearch-git the_silver_searcher ripgrep ctags` * java `yay -S npm nodejs` * build `yay -S ninja` +* language servers and linting + * `yay prettier efm-langserver` + * `npm install -g yaml-language-server` + * `npm install -g pyright` # python * pytorch `yay python-pytorch-opt-cuda` -* `pip install ipython pytest neovim numpy scipy sympy flake8 ptvsd addict dill ipdb pudb web-pdb` +* `pip install ipython pytest neovim numpy scipy sympy flake8 ptvsd addict dill ipdb pudb web-pdb isort` * matplotlib stuff `pip install matplotlib seaborn matplotlib-label-lines ipympl qbstyles` * other plotting `pip install plotly ggplot` * `pip install tensorboard torchtext pytorch-lightning torchvision` diff --git a/nvim/ftplugins/lua.vim b/nvim/ftplugins/lua.vim new file mode 100644 index 0000000..9603a7d --- /dev/null +++ b/nvim/ftplugins/lua.vim @@ -0,0 +1,4 @@ +setlocal tabstop=2 +setlocal softtabstop=2 +setlocal shiftwidth=2 +setlocal formatoptions=croql diff --git a/nvim/ftplugins/markdown.vim b/nvim/ftplugins/markdown.vim new file mode 100644 index 0000000..9603a7d --- /dev/null +++ b/nvim/ftplugins/markdown.vim @@ -0,0 +1,4 @@ +setlocal tabstop=2 +setlocal softtabstop=2 +setlocal shiftwidth=2 +setlocal formatoptions=croql diff --git a/nvim/ftplugins/python.vim b/nvim/ftplugins/python.vim new file mode 100644 index 0000000..a0f8bcd --- /dev/null +++ b/nvim/ftplugins/python.vim @@ -0,0 +1,4 @@ +setlocal tabstop=4 +setlocal softtabstop=4 +setlocal shiftwidth=4 +setlocal formatoptions=ql diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..cd8df62 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,636 @@ +local opt = vim.opt +-- ---------------------------------------- +-- SETTINGS +-- ---------------------------------------- + +-- system +opt.shell = "/usr/bin/bash" +opt.fileencodings = "utf-8,ucs-bom,gb18030,gbk,gb2312,cp936" +opt.fileformats = "unix" +opt.swapfile = false +opt.backup = false +opt.updatetime = 300 +opt.timeoutlen = 200 +vim.g.BASH_Ctrl_j = "off" +vim.g.BASH_Ctrl_l = "off" + +-- looks +opt.termguicolors = true +opt.cmdheight = 2 +opt.background = "light" +vim.cmd "colorscheme tokyonight" +opt.listchars = "tab:→ ,trail:·,extends:↷,precedes:↶,nbsp:+,eol:↵" +opt.list = true -- Show listchars +opt.showtabline = 2 + +-- undo +opt.undodir = "/home/hjalmarlucius/.cache/vim/undo" +opt.undofile = true +opt.undolevels = 1000 +opt.undoreload = 10000 + +-- window +opt.splitbelow = true -- Put new windows below current +opt.splitright = true -- Put new windows right of current + +-- buffer +opt.hidden = true -- Enable background buffers +opt.wrap = false -- Disable line wrap +opt.number = true -- Show line numbers +opt.relativenumber = false -- Relative line numbers +opt.cursorline = false -- Highlight current line +opt.switchbuf = "useopen" -- Use existing window if buffer is already open +opt.colorcolumn = "88" + +-- tabs +opt.expandtab = true -- Use spaces instead of tabs +opt.smartindent = true -- Insert indents automatically +opt.shiftround = true -- Round indent +opt.tabstop = 2 -- Number of spaces tabs count for +opt.shiftwidth = 2 -- Size of an indent + +-- search +opt.ignorecase = true -- Ignore case +opt.smartcase = true -- Do not ignore case with capitals +opt.wildmode = {"list", "longest"} -- Command-line completion mode +opt.wildignorecase = true +opt.wildignore = opt.wildignore + {"*swp", "*.class", "*.pyc", "*.png", "*.jpg", "*.gif", "*.zip", "*/tmp/*", "*.o", ".obj", "*.so"} + +-- cursor +opt.scrolloff = 1 -- Lines of context +opt.scrolljump = 1 -- Lines to scroll when cursor leaves screen +opt.sidescrolloff = 4 -- Columns of context +opt.showmatch = true -- Show matching brackets / parentheses + +-- editing +opt.joinspaces = false -- No double spaces with join +opt.timeoutlen = 500 -- How long to wait during key combo +opt.langmap = "å(,¨),Å{,^},Ø\\;,ø:,æ^,+$" +opt.clipboard = opt.clipboard + {"unnamedplus"} + +-- folding (also see treesitter) +-- zm/M zr/R increase/increase foldlevel (max) +-- zo/O zc/C open / close fold (max) +-- za zA switch fold (small/full) +-- zi toggle folds +-- zi zj move to next / prev fold +opt.foldenable = false +opt.foldmethod = "expr" + +-- ---------------------------------------- +-- AUTOCOMMANDS +-- ---------------------------------------- +-- highlight on yank +local cmd = vim.cmd + +local function create_augroup(autocmds, name) + cmd("augroup " .. name) + cmd("autocmd!") + for _, autocmd in ipairs(autocmds) do + cmd("autocmd " .. table.concat(autocmd, " ")) + end + cmd("augroup END") +end + +cmd "au TextYankPost * lua vim.highlight.on_yank {on_visual = false}" +create_augroup({ + -- { "FileType", "*", "setlocal formatoptions-=c formatoptions-=r formatoptions-=o" }, -- Disables automatic commenting on newline TODO await ftplugins + { "BufWritePre", "*", [[%s/\s\+$//e]] }, -- Delete trailing whitespace + { "BufReadPost", "quickfix", "nmap " }, + { "TextYankPost", "*", "lua vim.highlight.on_yank {on_visual = false}" }, +}, "myau") + +-- ---------------------------------------- +-- MAPS +-- ---------------------------------------- +-- leader/local leader +vim.g.mapleader = " " +vim.g.maplocalleader = "," + +local map = vim.api.nvim_set_keymap +map("n", "Q", "", {noremap = true}) +map("n", "q:", "", {noremap = true}) + +map("n", "r", [[:so ~/.config/nvim/init.lua:PackerCompile]], { noremap = true }) +map("n", "e", [[:vnew ~/dotfiles/nvim/init.lua]], { noremap = true }) +map("n", "t", [[:vnew ~/notes/todos.md]], { noremap = true }) +map("n", "n", [[:Explore ~/notes]], { noremap = true }) +map("n", "W", [[:cd %:p:h]], { noremap = true }) +map("n", "", ":noh", { silent = true, noremap = true } ) + +-- to navigate the completion menu +map("i", "", [[pumvisible() ? "\" : "\"]], { expr = true, noremap = true }) +map("i", "", [[pumvisible() ? "\" : "\"]], { expr = true, noremap = true }) + +-- CURSOR +-- stay visual when indenting +map("n", "-", "_", { noremap = true }) +map("v", "v", "", { noremap = true }) +map("v", "", ">gv", { noremap = true }) +map("v", "", "o", "m`o``", { noremap = true }) -- Insert a newline in normal mode + +-- WINDOWS / BUFFERS +-- make splits and tabs +map("n", "", ":vnew", { noremap = true }) +map("n", "", ":new", { noremap = true }) +map("n", "", ":tabe %", { noremap = true }) +map("n", "", ":tabnew", { noremap = true }) +-- buffers and tabs +map("n", "", ":bprev", { noremap = true }) +map("n", "", ":bnext", { noremap = true }) +map("n", "", ":tabprev", { noremap = true }) +map("n", "", ":tabnext", { noremap = true }) +-- resize windows with hjkl +map("n", "", "<", { noremap = true }) +map("n", "", "-", { noremap = true }) +map("n", "", "+", { noremap = true }) +map("n", "", ">", { noremap = true }) +-- quickfix window +-- map("n", "", ":cp", { noremap = true }) +-- map("n", "", ":cn", { noremap = true }) +-- remove buffer +map("n", "", ":bprev:bd#", { noremap = true }) +map("n", "", ":bprev:bd!#", { noremap = true }) +map("n", "", ":vimgrep TODO **/*:copen", { noremap = true }) +map("n", "", ":checkt", { noremap = true }) + +-- ---------------------------------------- +-- PACKER +-- ---------------------------------------- +local install_path = vim.fn.stdpath("data").."/site/pack/packer/start/packer.nvim" + +if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + vim.fn.system({"git", "clone", "https://github.com/wbthomason/packer.nvim", install_path}) + vim.api.nvim_command "packadd packer.nvim" +end + +require("packer").startup {function(use) + use {"wbthomason/packer.nvim"} + + -- tpope + use {"tpope/vim-sensible"} -- sensible default + use {"tpope/vim-commentary"} -- comment out stuff + use {"tpope/vim-repeat"} -- repeat vim-surround with . + use {"tpope/vim-eunuch"} -- Move, Rename etc + use {"farmergreg/vim-lastplace"} -- keep location upon reopening + + -- smooth scrolling + use {"psliwka/vim-smoothie"} + + -- git + use {"tpope/vim-fugitive", + config = function() + local map = vim.api.nvim_set_keymap + map("", "", ":vertical Git:vertical resize 60", {}) + end + } + + use { + "lewis6991/gitsigns.nvim", + requires = {"nvim-lua/plenary.nvim"}, + config = function() + require("gitsigns").setup{ + numhl = false, + linehl = false, + keymaps = { + -- Default keymap options + noremap = true, + buffer = true, + + ["n "] = { expr = true, [[&diff ? "]c" : "lua require("gitsigns.actions").next_hunk()"]]}, + ["n "] = { expr = true, [[&diff ? "[c" : "lua require("gitsigns.actions").prev_hunk()"]]}, + + ["n s"] = [[lua require("gitsigns").stage_hunk()]], + ["v s"] = [[lua require("gitsigns").stage_hunk({vim.fn.line("."), vim.fn.line("v")})]], + ["n u"] = [[lua require("gitsigns").undo_stage_hunk()]], + ["n x"] = [[lua require("gitsigns").reset_hunk()]], + ["v x"] = [[lua require("gitsigns").reset_hunk({vim.fn.line("."), vim.fn.line("v")})]], + ["n i"] = [[lua require("gitsigns").preview_hunk()]], + ["n b"] = [[lua require("gitsigns").blame_line(true)]], + + -- Text objects + ["o ih"] = [[:lua require("gitsigns.actions").select_hunk()]], + ["x ih"] = [[:lua require("gitsigns.actions").select_hunk()]] + }, + word_diff = false, + } + end + } + + -- folder tree + use {"kyazdani42/nvim-tree.lua", + requires = {"kyazdani42/nvim-web-devicons"}, + config = function() + local map = vim.api.nvim_set_keymap + map("n", "", ":NvimTreeToggle", {noremap = true}) + map("n", "", ":NvimTreeRefresh", {noremap = true}) + map("n", "", ":NvimTreeFindFile", {noremap = true}) + end + } + + -- theme + use {"folke/tokyonight.nvim", + config = function() + vim.g.tokyonight_style = "day" + end + } + + use {"skbolton/embark", + config = function() + vim.g.embark_terminal_italics = 1 + end + } + + use {"junegunn/seoul256.vim", + config = function() + vim.g.seoul256_background = 235 + end + } + + -- coloring of colornames + use {"rrethy/vim-hexokinase", + run = "cd /home/hjalmarlucius/.local/share/nvim/site/pack/packer/start/vim-hexokinase && make hexokinase", + config = function() + vim.g.Hexokinase_highlighters = {"backgroundfull"} + end + } + + -- flashing cursor on move + use {"danilamihailov/beacon.nvim", + setup = function() + vim.api.nvim_exec( [[highlight Beacon guibg=white ctermbg=15]], false) + end, + config = function() + vim.g.beacon_size = 40 + vim.g.beacon_minimal_jump = 10 + vim.g.beacon_shrink = 1 + end + } + + -- indentation guides + use {"lukas-reineke/indent-blankline.nvim", + config = function() + vim.g.indent_blankline_char = "|" + vim.g.indent_blankline_use_treesitter = true + end + } + + -- highlight for quick movement f/F + use {"unblevable/quick-scope", + config = function() + -- vim.g.qs_highlight_on_keys = {"f", "F", "t", "T"} + end + } + + use {"haya14busa/vim-asterisk", + config = function() + vim.g["asterisk#keeppos"] = 1 + local map = vim.api.nvim_set_keymap + map("", "*", "(asterisk-z*)", {}) + map("", "#", "(asterisk-z#)", {}) + map("", "g*", "(asterisk-gz*)", {}) + map("", "g#", "(asterisk-gz#)", {}) + end + } + + use {"christoomey/vim-tmux-navigator", + config = function() + vim.g.tmux_navigator_no_mappings = 1 + vim.g.tmux_navigator_disable_when_zoomed = 1 + local map = vim.api.nvim_set_keymap + opts = { silent = true, noremap = true } + map("n", "", ":TmuxNavigateLeft", opts) + map("n", "", ":TmuxNavigateDown", opts) + map("n", "", ":TmuxNavigateUp", opts) + map("n", "", ":TmuxNavigateRight", opts) + end + } + + use {"dkarter/bullets.vim", + config = function() + vim.g.bullets_outline_levels = {"ROM", "ABC", "num", "abc", "rom", "std-", "std*"} + vim.g.bullets_enabled_file_types = {"markdown", "text", "gitcommit"} + end + } + + use {"mbbill/undotree", + config = function() + local map = vim.api.nvim_set_keymap + map("", "", ":UndotreeToggle:UndotreeFocus", { noremap = true }) + end +} + + use {"iamcco/markdown-preview.nvim", -- requires yarn + run = "cd /home/hjalmarlucius/.local/share/nvim/site/pack/packer/start/markdown-preview && yarn install", + config = function() + vim.g.mkdp_auto_start = 0 -- auto start on moving into + vim.g.mkdp_auto_close = 0 -- auto close on moving away + vim.g.mkdp_open_to_the_world = 0 -- available to others + vim.g.mkdp_open_ip = "" -- use custom IP to open preview page + end + } + + use {"hoob3rt/lualine.nvim", + requires = {"kyazdani42/nvim-web-devicons"}, + config = function() + require("lualine").setup { + options = { theme = "tokyonight" }, + extensions = { + "fugitive", + }, + sections = { + lualine_a = {"mode"}, + lualine_b = {"branch"}, + lualine_c = {{"filename", file_status = true, path = 1}}, + lualine_x = {"encoding", "fileformat", "filetype"}, + lualine_y = {"progress"}, + lualine_z = {"location"} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {{"filename", file_status = true, path = 1}}, + lualine_x = {"location"}, + lualine_y = {"progress"}, + lualine_z = {} + }, + -- TODO tabline func https://blog.inkdrop.info/how-to-set-up-neovim-0-5-modern-plugins-lsp-treesitter-etc-542c3d9c9887 + tabline = { + lualine_a = {"filename"}, + lualine_b = {{ "diagnostics", sources = {"nvim_lsp"}}}, + lualine_c = {{"diff", colored=false}}, + lualine_x = {}, + lualine_y = {}, + lualine_z = {{"filename", file_status = true, path = 2}} + } + } + end + } + + use {"numtostr/FTerm.nvim", + config = function() + require("FTerm").setup{} + local map = vim.api.nvim_set_keymap + local opts = { noremap = true, silent = true } + map("n", "", [[lua require("FTerm").toggle()]], opts) + map("t", "", [[lua require("FTerm").toggle()]], opts) + end + } + + -- treesitter + use {"nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup { + ensure_installed = "all", + highlight = { + enable = true, + } + } + vim.opt.foldexpr = "nvim_treesitter#foldexpr()" + end + } + + use {"nvim-telescope/telescope.nvim", + requires = {"nvim-lua/popup.nvim", "nvim-lua/plenary.nvim"}, + config = function() + local map = vim.api.nvim_set_keymap + local opts = { noremap = true } + local actions = require("telescope.actions") + map("n", "", "Telescope find_files", opts ) + map("n", "", "Telescope git_files", opts ) + map("n", "", "Telescope live_grep", opts ) + map("n", "", "Telescope buffers", opts ) + map("n", "", "Telescope filetypes", opts ) + map("n", "", "Telescope colorscheme", opts ) + map("n", "a", "Telescope lsp_code_actions", opts ) + map("v", "a", "Telescope lsp_range_code_actions", opts ) + map("n", "d", "Telescope lsp_document_diagnostics", opts ) + map("n", "D", "Telescope lsp_workspace_diagnostics", opts ) + map("n", "g", "Telescope git_status", opts ) + map("n", "c", "Telescope git_commits", opts ) + map("n", "C", "Telescope git_bcommits", opts ) + map("n", "", "Telescope", opts ) + require("telescope").setup{ + defaults = { + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + -- "--with-filename", + "--line-number", + "--column", + "--smart-case" + }, + mappings = { + i = { + [""] = actions.close, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + [""] = actions.select_default + actions.center, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + [""] = actions.toggle_selection + actions.move_selection_worse, + [""] = actions.toggle_selection + actions.move_selection_better, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = actions.complete_tag + }, + }, + file_ignore_patterns = {}, + set_env = { ["COLORTERM"] = "truecolor" }, + }, + } + end } + + -- debugging + -- use {"mfussenegger/nvim-dap-python", + -- requires = {"mfussenegger/nvim-dap"}, + -- config = function() + -- require("dap-python").setup("/usr/bin/python") + -- local map = vim.api.nvim_set_keymap + -- local opts = { noremap = true, silent = true } + -- map("n", "", [[:lua require("dap").continue()]], opts) + -- map("n", "", [[:lua require("dap").step_over()]], opts) + -- map("n", "", [[:lua require("dap").step_into()]], opts) + -- map("n", "", [[:lua require("dap").step_out()]], opts) + -- map("n", "", [[:lua require("dap").toggle_breakpoint()]], opts) + -- map("n", "", [[:lua require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: '))]], opts) + -- map("n", "", [[:lua require("dap").set_breakpoint(nil, nil, vim.fn.input('Log point message: '))]], opts) + -- map("n", "", [[:lua require("dap").repl.open()]], opts) + -- map("n", "vl", [[:lua require("dap").repl.run_last()`]], opts) + -- map("n", "vt", [[:lua require('dap-python').test_method()]], opts) + -- map("v", "vs", [[:lua require('dap-python').debug_selection()]], opts) + -- end + -- } + + -- use {"nvim-telescope/telescope-dap.nvim", + -- requires = {"mfussenegger/nvim-dap", "nvim-telescope/telescope.nvim"}, + -- config = function() + -- require("telescope").load_extension("dap") + -- local map = vim.api.nvim_set_keymap + -- local opts = { noremap = true, silent = true } + -- map("n", "", [[:lua require("telescope").extensions.dap.commands{}]], opts) + -- map("n", "", [[:lua require("telescope").extensions.dap.configurations{}]], opts) + -- map("n", "", [[:lua require("telescope").extensions.dap.list_breakpoints{}]], opts) + -- map("n", "", [[:lua require("telescope").extensions.dap.variables{}]], opts) + -- end + -- } + + -- autocompletion + use {"hrsh7th/nvim-compe", + config = function() + vim.opt.completeopt = "menuone,noselect" + require("compe").setup { + source = { + nvim_lsp = true, + path = true, + buffer = true, + calc = true, + nvim_lua = true, + }, + } + local map = vim.api.nvim_set_keymap + local opts = { noremap = true, silent = true, expr = true } + map("i", "", [[compe#complete()]], opts) + map("i", "", [[compe#confirm("")]], opts) + map("i", "", [[compe#close("")]], opts) + -- TODO don't seem useful? + -- map("i", "", [[compe#scroll({ "delta": +4 })]], opts) + -- map("i", "", [[compe#scroll({ "delta": -4 })]], opts) + end + } + + use {"glepnir/lspsaga.nvim", + requires = {"neovim/nvim-lspconfig"}, + run = ":TSUpdate", + config = function() + -- see https://github.com/lukas-reineke/dotfiles/blob/master/vim/lua/lsp/init.lua + on_attach = function (client, bufnr) + local bmap = vim.api.nvim_buf_set_keymap + local opts = { noremap = true } + vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") + -- workspaces + bmap(bufnr, "n", "wa", "lua vim.lsp.buf.add_workspace_folder()", opts) + bmap(bufnr, "n", "wr", "lua vim.lsp.buf.remove_workspace_folder()", opts) + bmap(bufnr, "n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", opts) + -- jump + bmap(bufnr, "n", "gl", "lua vim.lsp.diagnostic.set_loclist()", opts) + bmap(bufnr, "n", "", ":Lspsaga show_line_diagnostics", opts) + bmap(bufnr, "n", "", ":Lspsaga diagnostic_jump_next", opts) + bmap(bufnr, "n", "", ":Lspsaga diagnostic_jump_prev", opts) + -- popups + bmap(bufnr, "n", "", ":Lspsaga signature_help", opts) + bmap(bufnr, "i", "", ":Lspsaga signature_help", opts) + bmap(bufnr, "n", "", "lua require('lspsaga.action').smart_scroll_with_saga(1)", opts) + bmap(bufnr, "n", "", "lua require('lspsaga.action').smart_scroll_with_saga(-1)", opts) + -- actions + bmap(bufnr, "n", "", ":Lspsaga range_code_action", opts) + bmap(bufnr, "v", "", ":Lspsaga range_code_action", opts) + -- other + if client.resolved_capabilities.goto_definition then + bmap(bufnr, "n", "gd", ":Lspsaga preview_definition", opts) + end + if client.resolved_capabilities.find_references then + bmap(bufnr, "n", "gh", ":Lspsaga lsp_finder", opts) + end + if client.resolved_capabilities.hover then + bmap(bufnr, "n", "K", ":Lspsaga hover_doc", opts) + end + if client.resolved_capabilities.rename then + bmap(bufnr, "n", "gr", ":Lspsaga rename", opts) + end + if client.resolved_capabilities.document_formatting or client.resolved_capabilities.document_range_formatting then + vim.api.nvim_command [[augroup Format]] + vim.api.nvim_command [[autocmd! * ]] + vim.api.nvim_command [[autocmd BufWritePost lua vim.lsp.buf.formatting_seq_sync()]] + vim.api.nvim_command [[augroup END]] + end + end + use_saga_diagnostic_sign = true + require("lspsaga").init_lsp_saga { + max_preview_lines = 20, + finder_action_keys = { + quit = {"", "C-c"}, + open = "", + vsplit = "v", + split = "s", + scroll_down = "", + scroll_up = "" + }, + code_action_keys = { + quit = {"", "C-c"}, + exec = "" + }, + rename_action_keys = { + quit = {"", "C-c"}, + exec = "" + }, + } + -- terminal TODO fix and replace with Fterm + -- map("n", "", ":Lspsaga open_floaterm", opts) + -- map("i", "", [[:lua require('lspsaga.floaterm').close_float_terminal()]], opts) + local nvim_lsp = require("lspconfig") + -- sudo npm install -g yaml-language-server + nvim_lsp.yamlls.setup{ + on_attach = on_attach + } + -- sudo npm install -g pyright + nvim_lsp.pyright.setup{ + on_attach = on_attach, + settings = { + python = { + analysis = { + diagnosticMode = "workspace", + logLevel = "Error", + typeCheckingMode = "strict", + } + } + } + } + local prettier = { + formatCommand = ([[prettier ${--config-precedence:configPrecedence} ${--tab-width:tabWidth} ${--single-quote:singleQuote} ${--trailing-comma:trailingComma}]]) + } + nvim_lsp.efm.setup{ + on_attach = on_attach, + init_options = {documentFormatting = true}, + filetypes = { "python", "markdown", "yaml", "lua" }, + root_dir = vim.loop.cwd, + settings = { + rootMarkers = {".git/"}, + languages = { + python = { + { + lintCommand = "flake8 --max-line-length 88 --format '%(path)s:%(row)d:%(col)d: %(code)s %(code)s %(text)s' --stdin-display-name ${INPUT} -", + lintStdin = true, + lintIgnoreExitCode = true, + lintFormats = {"%f:%l:%c: %t%n%n%n %m"}, + lintSource = "flake8" + }, + { + formatCommand = "isort --stdout --profile black --force-single-line-imports -", + formatStdin = true + }, + { + lintCommand = "mypy --show-column-numbers --ignore-missing-imports", + lintFormats = { "%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m", "%f:%l:%c: %tote: %m" }, + lintSource = "mypy" + }, + { + formatCommand = "black --fast -", + formatStdin = true + } + }, + yaml = {prettier}, + markdown = {prettier}, + }, + }, + } + end + } +end +}