diff --git a/init.vim b/init.vim index b90c69a..5eb2d47 100644 --- a/init.vim +++ b/init.vim @@ -12,10 +12,12 @@ source plug.vim source airline.vim source syntastic.vim source fzf.vim -source rust.vim +source lsp.vim source mapping.vim source jsonnet.vim source nerdtree.vim +source wiki.vim +source prettier.vim exec "cd " . oldwd " set up a line number on the current line but relative above and below to help @@ -118,16 +120,3 @@ noremap :call AdjustFontSize(1) noremap :call AdjustFontSize(-1) inoremap :call AdjustFontSize(1)a inoremap :call AdjustFontSize(-1)a - -" override the default location of vimwiki and change to markdown -let g:vimwiki_list = [{'path': '~/Documents/Wiki', 'syntax': 'markdown', 'ext': '.md'}] -let g:vimwiki_dir_link = 'index' -let g:vimwiki_global_ext = 0 - -let g:LanguageClient_serverCommands = { -\ 'rust': ['rust-analyzer'], -\ } - -lua< f :lua vim.lsp.buf.formatting()") + -- format on save + vim.cmd("autocmd BufWritePost lua vim.lsp.buf.formatting()") + end + + if client.resolved_capabilities.document_range_formatting then + vim.cmd("xnoremap f :lua vim.lsp.buf.range_formatting({})") + end + end, +}) + +prettier.setup({ + bin = 'prettier', -- or `prettierd` + filetypes = { + "css", + "graphql", + "html", + "javascript", + "javascriptreact", + "json", + "less", + "markdown", + "scss", + "typescript", + "typescriptreact", + "yaml", + }, + + -- prettier format options (you can use config files too. ex: `.prettierrc`) + arrow_parens = "always", + bracket_spacing = true, + embedded_language_formatting = "auto", + end_of_line = "lf", + html_whitespace_sensitivity = "css", + jsx_bracket_same_line = false, + jsx_single_quote = false, + print_width = 80, + prose_wrap = "preserve", + quote_props = "as-needed", + semi = true, + single_quote = false, + tab_width = 2, + trailing_comma = "es5", + use_tabs = false, + vue_indent_script_and_style = false, +}) +EOF diff --git a/wiki.vim b/wiki.vim new file mode 100644 index 0000000..cbad8a3 --- /dev/null +++ b/wiki.vim @@ -0,0 +1,4 @@ +" override the default location of vimwiki and change to markdown +let g:vimwiki_list = [{'path': '~/Documents/Wiki', 'syntax': 'markdown', 'ext': '.md'}] +let g:vimwiki_dir_link = 'index' +let g:vimwiki_global_ext = 0