refinement of LSP options and vim packages for TS/JS development
This commit is contained in:
parent
0002f2e51e
commit
f9cdfb390f
3 changed files with 99 additions and 24 deletions
41
nix/home.nix
41
nix/home.nix
|
|
@ -38,6 +38,15 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
vim-catppuccino = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "vim-catppuccino";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Pocco81";
|
||||
repo = "Catppuccino.nvim";
|
||||
rev = "014d8575acdd19ecef4ecb12fc82a2e21794b548";
|
||||
sha256 = "0i0p21jkrx99n3dnm5xvnw8n963c67l4lgl4iwngz0psdzwxphkw";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
|
|
@ -127,7 +136,7 @@ in
|
|||
plugins = with pkgs.vimPlugins; [
|
||||
vim-sensible
|
||||
vim-startify
|
||||
papercolor-theme
|
||||
vim-catppuccino
|
||||
|
||||
vim-elixir
|
||||
alchemist-vim
|
||||
|
|
@ -150,7 +159,13 @@ in
|
|||
'';
|
||||
}
|
||||
vim-signify
|
||||
vim-indent-guides
|
||||
{
|
||||
plugin = vim-indent-guides;
|
||||
config = ''
|
||||
let g:indent_guides_enable_on_vim_startup = 1
|
||||
let g:indent_guides_start_level = 2
|
||||
'';
|
||||
}
|
||||
vim-surround
|
||||
fugitive
|
||||
{
|
||||
|
|
@ -165,19 +180,6 @@ in
|
|||
}
|
||||
vinegar
|
||||
undotree
|
||||
{
|
||||
plugin = vim-test;
|
||||
config = ''
|
||||
nmap <silent> <leader>t :TestNearest<CR>
|
||||
nmap <silent> <leader>T :TestFile<CR>
|
||||
nmap <silent> <leader>a :TestSuite<CR>
|
||||
nmap <silent> <leader>l :TestLast<CR>
|
||||
nmap <silent> <leader>g :TestVisit<CR>
|
||||
let test#strategy = "neovim"
|
||||
'';
|
||||
}
|
||||
fzf-vim
|
||||
fzfWrapper
|
||||
{
|
||||
plugin = nvim-compe;
|
||||
config = ''
|
||||
|
|
@ -226,6 +228,15 @@ in
|
|||
EOF
|
||||
'';
|
||||
}
|
||||
{
|
||||
plugin = telescope-nvim;
|
||||
config = ''
|
||||
nnoremap <leader>ff <cmd>lua require('telescope.builtin').find_files()<cr>
|
||||
nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr>
|
||||
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>
|
||||
nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr>
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = readFile ./vim/init.vim;
|
||||
|
|
|
|||
|
|
@ -1,22 +1,16 @@
|
|||
filetype plugin indent on
|
||||
|
||||
nnoremap <leader>t :call LanguageClient_textDocument_hover()<CR>
|
||||
nnoremap <leader>y :call LanguageClient_textDocument_definition()<CR>
|
||||
|
||||
" Indent guides
|
||||
let g:indent_guides_enable_on_vim_startup = 1
|
||||
let g:indent_guides_start_level = 2
|
||||
|
||||
" let netrw look like NERDTree
|
||||
let g:netrw_liststyle = 3
|
||||
let mapleader=","
|
||||
set nobackup
|
||||
set noswapfile
|
||||
set pastetoggle=<F2>
|
||||
set nowrap
|
||||
|
||||
set background=dark
|
||||
colorscheme PaperColor
|
||||
colorscheme catppuccino
|
||||
|
||||
set nocompatible
|
||||
set number relativenumber
|
||||
|
|
|
|||
|
|
@ -53,7 +53,77 @@ local on_attach = function(client, bufnr)
|
|||
end
|
||||
|
||||
nvim_lsp.diagnosticls.setup {
|
||||
on_attach = on_attach
|
||||
on_attach = on_attach;
|
||||
filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'css', 'scss', 'markdown', 'pandoc' },
|
||||
init_options = {
|
||||
linters = {
|
||||
eslint = {
|
||||
command = 'eslint',
|
||||
rootPatterns = { '.git' },
|
||||
debounce = 100,
|
||||
args = { '--stdin', '--stdin-filename', '%filepath', '--format', 'json' },
|
||||
sourceName = 'eslint',
|
||||
parseJson = {
|
||||
errorsRoot = '[0].messages',
|
||||
line = 'line',
|
||||
column = 'column',
|
||||
endLine = 'endLine',
|
||||
endColumn = 'endColumn',
|
||||
message = '[eslint] ${message} [${ruleId}]',
|
||||
security = 'severity'
|
||||
},
|
||||
securities = {
|
||||
[2] = 'error',
|
||||
[1] = 'warning'
|
||||
}
|
||||
},
|
||||
markdownlint = {
|
||||
command = 'markdownlint',
|
||||
rootPatterns = { '.git' },
|
||||
isStderr = true,
|
||||
debounce = 100,
|
||||
args = { '--stdin' },
|
||||
offsetLine = 0,
|
||||
offsetColumn = 0,
|
||||
sourceName = 'markdownlint',
|
||||
securities = {
|
||||
undefined = 'hint'
|
||||
},
|
||||
formatLines = 1,
|
||||
formatPattern = {
|
||||
'^.*:(\\d+)\\s+(.*)$',
|
||||
{
|
||||
line = 1,
|
||||
column = -1,
|
||||
message = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
filetypes = {
|
||||
javascript = 'eslint',
|
||||
javascriptreact = 'eslint',
|
||||
typescript = 'eslint',
|
||||
typescriptreact = 'eslint',
|
||||
markdown = 'markdownlint',
|
||||
pandoc = 'markdownlint'
|
||||
},
|
||||
formatters = {
|
||||
prettier = {
|
||||
command = 'prettier',
|
||||
args = { '--stdin-filepath', '%filename' }
|
||||
}
|
||||
},
|
||||
formatFiletypes = {
|
||||
css = 'prettier',
|
||||
javascript = 'prettier',
|
||||
javascriptreact = 'prettier',
|
||||
json = 'prettier',
|
||||
scss = 'prettier',
|
||||
typescript = 'prettier',
|
||||
typescriptreact = 'prettier'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nvim_lsp.elmls.setup{
|
||||
|
|
@ -61,7 +131,7 @@ nvim_lsp.elmls.setup{
|
|||
}
|
||||
nvim_lsp.tsserver.setup {
|
||||
on_attach = function(client)
|
||||
-- Avoid conflict with prettier
|
||||
-- Avoid conflict with prettier and eslint
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
on_attach(client)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue