Clean, add more TS support

This commit is contained in:
Thomas Gideon 2021-12-29 15:52:08 -05:00
parent 6fd08618c9
commit 1aa5379036
5 changed files with 128 additions and 52 deletions

View file

@ -12,10 +12,12 @@ source plug.vim
source airline.vim source airline.vim
source syntastic.vim source syntastic.vim
source fzf.vim source fzf.vim
source rust.vim source lsp.vim
source mapping.vim source mapping.vim
source jsonnet.vim source jsonnet.vim
source nerdtree.vim source nerdtree.vim
source wiki.vim
source prettier.vim
exec "cd " . oldwd exec "cd " . oldwd
" set up a line number on the current line but relative above and below to help " 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> noremap <C-Down> :call AdjustFontSize(-1)<CR>
inoremap <C-Up> <Esc>:call AdjustFontSize(1)<CR>a inoremap <C-Up> <Esc>:call AdjustFontSize(1)<CR>a
inoremap <C-Down> <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

View file

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

View file

@ -1,25 +1,43 @@
call plug#begin("~/.config/nvim/plugged") 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
" 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 " lightweight but sophisticated status line
Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes' 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'
" integrate ripgrep, especially to be able to open matches, hugely useful for
" code aware search
Plug 'jremmen/vim-ripgrep'
" 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 " git integration
Plug 'tpope/vim-fugitive' Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb' Plug 'tpope/vim-rhubarb'
Plug 'mhinz/vim-signify' Plug 'mhinz/vim-signify'
" visualize vim's undo tree " git support for nerdtree
Plug 'mbbill/undotree' Plug 'Xuyuanp/nerdtree-git-plugin'
" better support for JS " better support for JS
Plug 'pangloss/vim-javascript' Plug 'pangloss/vim-javascript'
" find, complete, etc. on steroids " find, complete, etc. on steroids
@ -30,56 +48,58 @@ Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-sleuth' Plug 'tpope/vim-sleuth'
" support for the Rust programming language " tools - all languages
Plug 'rust-lang/rust.vim' " 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 " Collection of common configurations for the Nvim LSP client
Plug 'neovim/nvim-lspconfig' Plug 'neovim/nvim-lspconfig'
" Completion framework " 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' Plug 'hrsh7th/nvim-cmp'
" LSP completion source for nvim-cmp " LSP completion source for nvim-cmp
Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-nvim-lsp'
" Snippet completion source for nvim-cmp " Snippet completion source for nvim-cmp
Plug 'hrsh7th/cmp-vsnip' Plug 'hrsh7th/cmp-vsnip'
" Other useful completion sources " Other useful completion sources
Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-buffer' Plug 'hrsh7th/cmp-buffer'
" See hrsh7th's other plugins for more completion sources!
" To enable more of the features of rust-analyzer, such as inlay hints and more!
Plug 'simrat39/rust-tools.nvim'
" Snippet engine " Snippet engine
Plug 'hrsh7th/vim-vsnip' Plug 'hrsh7th/vim-vsnip'
" 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'
" support for jsonnet " support for jsonnet
Plug 'google/vim-jsonnet' Plug 'google/vim-jsonnet'
" groovy syntax and indent " groovy syntax and indent
Plug 'vim-scripts/groovy.vim' Plug 'vim-scripts/groovy.vim'
Plug 'vim-scripts/groovyindent-unix' 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 " nvm to make JS/TS/Node easier to work with
Plug 'marene/nvm.vim' Plug 'marene/nvm.vim'
" automating format JS/TS sources
Plug 'MunifTanjim/prettier.nvim'
" All of your Plugins must be added before the following line " All of your Plugins must be added before the following line
call plug#end() " required call plug#end() " required

55
prettier.vim Normal file
View file

@ -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

4
wiki.vim Normal file
View file

@ -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