Clean, add more TS support

main
Thomas Gideon 11 months ago
parent 6fd08618c9
commit 1aa5379036
  1. 17
      init.vim
  2. 8
      lsp.vim
  3. 90
      plug.vim
  4. 55
      prettier.vim
  5. 4
      wiki.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 <C-Up> :call AdjustFontSize(1)<CR>
noremap <C-Down> :call AdjustFontSize(-1)<CR>
inoremap <C-Up> <Esc>:call AdjustFontSize(1)<CR>a
inoremap <C-Down> <Esc>:call AdjustFontSize(-1)<CR>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<<EOF
require('lspconfig').tsserver.setup{}
EOF

@ -80,3 +80,11 @@ autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics()
" have a fixed column for the diagnostics to appear in
" this removes the jitter when warnings/errors flow in
set signcolumn=yes
let g:LanguageClient_serverCommands = {
\ 'rust': ['rust-analyzer'],
\ }
lua<<EOF
require('lspconfig').tsserver.setup{}
EOF

@ -1,25 +1,43 @@
call plug#begin("~/.config/nvim/plugged")
" I try to keep these to a minimum and to understand what each plugin does and
" adds to my existing set up. I try to capture the value, at least to me, each
" plugin adds. I've tried to logically group them, as well, to spot overlap
" and redundancy.
" look for .editorconfig and merge into vim settings
Plug 'editorconfig/editorconfig-vim'
" informational
" lightweight but sophisticated status line
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" visualize vim's undo tree
Plug 'mbbill/undotree'
" Preferred color scheme
Plug 'fneu/breezy'
" files, folders, projects, etc.
" file and dir browser
Plug 'preservim/nerdtree'
" git support for nerdtree
Plug 'Xuyuanp/nerdtree-git-plugin'
" syntax checking on steroids
Plug 'scrooloose/syntastic'
" integrate ripgrep, especially to be able to open matches, hugely useful for
" code aware search
Plug 'jremmen/vim-ripgrep'
" lightweight but sophisticated status line
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Support for the cd replacement, zoxide
Plug 'nanotee/zoxide.vim'
" taskwarrior
Plug 'xarthurx/taskwarrior.vim'
" Wiki support - my life is in vimwiki
Plug 'vimwiki/vimwiki', { 'branch': 'dev' }
" integrating taskwarrior and vimwiki - why did it take me so long to adopt
" this?
Plug 'tools-life/taskwiki'
" git integration
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'mhinz/vim-signify'
" visualize vim's undo tree
Plug 'mbbill/undotree'
" git support for nerdtree
Plug 'Xuyuanp/nerdtree-git-plugin'
" better support for JS
Plug 'pangloss/vim-javascript'
" find, complete, etc. on steroids
@ -30,56 +48,58 @@ Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-sleuth'
" support for the Rust programming language
Plug 'rust-lang/rust.vim'
" tools - all languages
" look for .editorconfig and merge into vim settings
Plug 'editorconfig/editorconfig-vim'
" syntax checking on steroids
Plug 'scrooloose/syntastic'
" auto format all the things
" https://github.com/Chiel92/vim-autoformat
Plug 'Chiel92/vim-autoformat'
" the rest of the rust config came from: https://sharksforarms.dev/posts/neovim-rust/
" Collection of common configurations for the Nvim LSP client
Plug 'neovim/nvim-lspconfig'
" Completion framework
" I found these when updating my lsp configuration and after using the
" additional sources for a while, find them super useful for general editing
" too
" See hrsh7th's other plugins for more completion sources!
Plug 'hrsh7th/nvim-cmp'
" LSP completion source for nvim-cmp
Plug 'hrsh7th/cmp-nvim-lsp'
" Snippet completion source for nvim-cmp
Plug 'hrsh7th/cmp-vsnip'
" Other useful completion sources
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-buffer'
" Snippet engine
Plug 'hrsh7th/vim-vsnip'
" See hrsh7th's other plugins for more completion sources!
" allows other programs and scripts to hook into NeoVim's language server
" protocol support; adopted as a pre-requisite for prettier integration
Plug 'jose-elias-alvarez/null-ls.nvim'
" specific languages, programming and otherwise
" support for the Rust programming language
Plug 'rust-lang/rust.vim'
" the rest of the rust config came from: https://sharksforarms.dev/posts/neovim-rust/
" To enable more of the features of rust-analyzer, such as inlay hints and more!
Plug 'simrat39/rust-tools.nvim'
" Snippet engine
Plug 'hrsh7th/vim-vsnip'
" support for jsonnet
Plug 'google/vim-jsonnet'
" groovy syntax and indent
Plug 'vim-scripts/groovy.vim'
Plug 'vim-scripts/groovyindent-unix'
" auto format all the things
" https://github.com/Chiel92/vim-autoformat
Plug 'Chiel92/vim-autoformat'
" taskwarrior
Plug 'xarthurx/taskwarrior.vim'
" Wiki support
Plug 'vimwiki/vimwiki', { 'branch': 'dev' }
" integrating taskwarrior and vimwiki
Plug 'tools-life/taskwiki'
" Preferred color scheme
Plug 'fneu/breezy'
" Support for the cd replacement, zoxide
Plug 'nanotee/zoxide.vim'
" nvm to make JS/TS/Node easier to work with
Plug 'marene/nvm.vim'
" automating format JS/TS sources
Plug 'MunifTanjim/prettier.nvim'
" All of your Plugins must be added before the following line
call plug#end() " required

@ -0,0 +1,55 @@
" https://github.com/MunifTanjim/prettier.nvim#setup
lua <<EOF
local null_ls = require("null-ls")
local prettier = require("prettier")
null_ls.setup({
on_attach = function(client, bufnr)
if client.resolved_capabilities.document_formatting then
vim.cmd("nnoremap <silent><buffer> <Leader>f :lua vim.lsp.buf.formatting()<CR>")
-- format on save
vim.cmd("autocmd BufWritePost <buffer> lua vim.lsp.buf.formatting()")
end
if client.resolved_capabilities.document_range_formatting then
vim.cmd("xnoremap <silent><buffer> <Leader>f :lua vim.lsp.buf.range_formatting({})<CR>")
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

@ -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
Loading…
Cancel
Save