├── init.lua
├── lua
└── wind
│ ├── plug
│ ├── lsp
│ │ ├── lang
│ │ │ ├── dart.lua
│ │ │ ├── emmetls.lua
│ │ │ ├── tsserver.lua
│ │ │ ├── tailwind.lua
│ │ │ ├── angular.lua
│ │ │ ├── booster.lua
│ │ │ ├── eslint.lua
│ │ │ ├── mlua.lua
│ │ │ ├── efm.lua
│ │ │ └── svelte.lua
│ │ ├── setup.lua
│ │ ├── functions.lua
│ │ └── lsp.lua
│ ├── lsp-trouble.lua
│ ├── me
│ │ ├── init.lua
│ │ └── alternate.lua
│ ├── oscyank.lua
│ ├── project-config.lua
│ ├── spectre.lua
│ ├── matchup.lua
│ ├── lspsaga.lua
│ ├── _end.lua
│ ├── eft.lua
│ ├── indent-blankline.lua
│ ├── web-devicons.lua
│ ├── formatter.lua
│ ├── autopairs.lua
│ ├── treesitter.lua
│ ├── windline
│ │ ├── animation.lua
│ │ ├── init.lua
│ │ └── comps.lua
│ ├── gitsigns.lua
│ ├── compe.lua
│ ├── _start.lua
│ ├── copyq.lua
│ ├── which-key.lua
│ └── telescope.lua
│ ├── general
│ ├── themes
│ │ ├── wind.lua
│ │ ├── miramare.lua
│ │ └── gruvbox.lua
│ ├── init.lua
│ ├── abbre.lua
│ ├── autocmd.lua
│ ├── keys.lua
│ └── setting.lua
│ ├── init.lua
│ ├── core
│ ├── env.lua
│ ├── init.lua
│ ├── wind.lua
│ ├── utils.lua
│ ├── plug.lua
│ ├── keymap.lua
│ └── nav.lua
│ └── plugins.lua
├── spell
├── en.utf-8.add
└── en.utf-8.add.spl
├── ftplugin
├── gitcommit.vim
├── typescript.vim
├── html.vim
├── lua.lua
├── svelte.vim
├── javascript.vim
└── markdown.vim
├── queries
└── xml
│ ├── injections.scm
│ └── highlights.scm
├── .gitignore
├── after
└── ftplugin
│ ├── image.vim
│ └── video.vim
├── scripts
├── agfile.sh
└── setup.sh
├── snippets
├── lua.json
├── vim.json
├── global.json
├── html.json
├── markdown.json
├── svelte.json
├── sh.json
├── typescript.json
├── go.json
└── dart.json
├── .editorconfig
├── ftdetect
└── media.vim
├── local.lua
├── local.sample.lua
├── plug
├── vim-floaterm.vim
├── vim-visual-multi.vim
├── gitopen.vim
└── fern.vim
├── note.lua
├── README.md
├── plugin
├── foldtext.vim
├── wind.vim
└── key.vim
└── autoload
└── win.vim
/init.lua:
--------------------------------------------------------------------------------
1 | require('wind')
2 |
3 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/lang/dart.lua:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/spell/en.utf-8.add:
--------------------------------------------------------------------------------
1 | popup
2 | diff
3 | vim
4 | config
5 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp-trouble.lua:
--------------------------------------------------------------------------------
1 | require("trouble").setup {}
2 |
--------------------------------------------------------------------------------
/lua/wind/plug/me/init.lua:
--------------------------------------------------------------------------------
1 | -- some small draft plugin for me
2 |
--------------------------------------------------------------------------------
/ftplugin/gitcommit.vim:
--------------------------------------------------------------------------------
1 | setlocal colorcolumn=80
2 | set spell
3 |
--------------------------------------------------------------------------------
/queries/xml/injections.scm:
--------------------------------------------------------------------------------
1 | ; injections.scm
2 | ; --------------
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.swp
2 | *.local
3 | *.ttf binary
4 | *.png binary
5 | .netrwhist
6 |
--------------------------------------------------------------------------------
/ftplugin/typescript.vim:
--------------------------------------------------------------------------------
1 | source $HOME/.config/nvim/ftplugin/javascript.vim
2 |
3 |
--------------------------------------------------------------------------------
/spell/en.utf-8.add.spl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/windwp/nvim/HEAD/spell/en.utf-8.add.spl
--------------------------------------------------------------------------------
/after/ftplugin/image.vim:
--------------------------------------------------------------------------------
1 | call system(wind#open() . ' ' . expand('%:p')) | buffer# | bdelete#
2 |
--------------------------------------------------------------------------------
/lua/wind/general/themes/wind.lua:
--------------------------------------------------------------------------------
1 | vim.cmd[[packadd wind-colors]]
2 | vim.cmd[[colorscheme wind]]
3 |
--------------------------------------------------------------------------------
/lua/wind/init.lua:
--------------------------------------------------------------------------------
1 | require('wind.core.wind')
2 | import('core')
3 | import('general')
4 | import('plugins')
5 |
6 |
--------------------------------------------------------------------------------
/scripts/agfile.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | if [[ ! -z "${@}" ]]; then
3 | ag -g "" | proximity-sort $@
4 | else
5 | ag -g ""
6 | fi
7 |
--------------------------------------------------------------------------------
/after/ftplugin/video.vim:
--------------------------------------------------------------------------------
1 | call system('mpv --geometry=50%+50%+50% ' . shellescape(expand('%:p')) . ' &>/dev/null &') | buffer# | bdelete#
2 |
--------------------------------------------------------------------------------
/snippets/lua.json:
--------------------------------------------------------------------------------
1 | {
2 | "foldcomment": {
3 | "prefix": "foldcomment",
4 | "body": "-- $1 {{{\n\t $2 \n-- }}}",
5 | "description": "fold for lua"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/snippets/vim.json:
--------------------------------------------------------------------------------
1 | {
2 | "fold_comment": {
3 | "prefix": "foldcomment",
4 | "body": "\" $1 {{{\n\t $2 \n\" }}}",
5 | "description": "fold for vim"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/lua/wind/plug/oscyank.lua:
--------------------------------------------------------------------------------
1 | vim.g.oscyank_term = 'tmux'
2 | vim.cmd[[
3 | autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '' | OSCYankReg " | endif
4 | ]]
5 |
--------------------------------------------------------------------------------
/snippets/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "foldcomment": {
3 | "prefix": "foldcomment",
4 | "body": "-- $1 {{{\n\t $2 \n-- }}}",
5 | "description": "fold for lua"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/lua/wind/general/init.lua:
--------------------------------------------------------------------------------
1 | import('general.setting')
2 | -- import('general.statusline')
3 | import('general.keys')
4 | import('general.autocmd').setup()
5 | import('general.abbre')
6 |
--------------------------------------------------------------------------------
/lua/wind/general/abbre.lua:
--------------------------------------------------------------------------------
1 | vim.cmd[[
2 | ab exprot export
3 | ab widht width
4 | ab heigth height
5 | ab resutl result
6 | ab locla local
7 | ab locla local
8 | ab conts const
9 | ]]
10 |
--------------------------------------------------------------------------------
/scripts/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | git clone https://github.com/savq/paq-nvim.git \
3 | "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/paqs/opt/paq-nvim
4 | cp ./local.sample.lua ./local.lua
5 |
6 | nvim -c ":PaqInstall"
7 |
--------------------------------------------------------------------------------
/lua/wind/plug/project-config.lua:
--------------------------------------------------------------------------------
1 | require('nvim-projectconfig').load_project_config({
2 | project_dir = "~/.config/projects-config/",
3 | silent = false
4 | })
5 |
6 |
7 | vim.cmd[[
8 | autocmd DirChanged * lua require('nvim-projectconfig').load_project_config()
9 | ]]
10 |
--------------------------------------------------------------------------------
/snippets/html.json:
--------------------------------------------------------------------------------
1 | {
2 | "ulemmet":{
3 | "prefix":"ulemmet" ,
4 | "body": [
5 | "
",
6 | " - ${1}
",
7 | " - ${2}
",
8 | " - ${3}
",
9 | " - ${4}
",
10 | "
"
11 | ]
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 |
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 |
8 | [*.lua]
9 | indent_style = space
10 | indent_size = 2
11 |
12 |
13 | [*.vim]
14 | indent_style = space
15 | indent_size = 4
16 |
17 | [*.snippets]
18 | indent_style = tab
19 | indent_size = 4
20 |
--------------------------------------------------------------------------------
/ftplugin/html.vim:
--------------------------------------------------------------------------------
1 | set foldmethod=manual
2 | nnoremap za zfat
3 | " delete tag in html
4 | nnoremap cx Td2f"
5 |
6 | " augroup remember_folds
7 | " autocmd!
8 | " au BufWinLeave *.html mkview 1
9 | " au BufWinEnter *.html silent! loadview 1
10 | " augroup END
11 |
12 |
--------------------------------------------------------------------------------
/ftdetect/media.vim:
--------------------------------------------------------------------------------
1 | au BufRead,BufNewFile *.jpg,*.png,*.gif,*.jpeg, set filetype=image
2 | au BufRead,BufNewFile *.mp3,*.flac,*.wav,*.ogg set filetype=audio
3 | au BufRead,BufNewFile *.avi,*.mp4,*.mkv,*.mov,*.mpg set filetype=video
4 | au FileType lua setlocal sw=2 ts=2 sts=2
5 | au FileType vim setlocal sw=2 ts=2 sts=2
6 |
--------------------------------------------------------------------------------
/ftplugin/lua.lua:
--------------------------------------------------------------------------------
1 | vim.opt.sw=4
2 | -- it help use gf to move to config on plugins
3 | vim.bo.includeexpr="printf('plug/%s.lua',v:fname)"
4 | vim.bo.suffixesadd=".lua"
5 |
6 | -- it help to press K to go help
7 | vim.bo.keywordprg=":help"
8 |
9 | -- mapping in vim is so ez :
10 | vim.cmd[[
11 | inoremap ! ~
12 | ]]
13 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/setup.lua:
--------------------------------------------------------------------------------
1 | local nvim_lsp = require('lspconfig')
2 |
3 | local mlsp = Wind.load_plug("lsp/lsp")
4 |
5 | Wind.load_plug('lsp/functions')
6 | mlsp.lsp_setup(nvim_lsp.yamlls)
7 | mlsp.lsp_setup(nvim_lsp.jsonls)
8 | mlsp.lsp_setup(nvim_lsp.cssls)
9 | mlsp.load_lsp('mlua')
10 | -- vim.lsp.set_log_level("debug")
11 |
12 |
--------------------------------------------------------------------------------
/lua/wind/plug/spectre.lua:
--------------------------------------------------------------------------------
1 | require('spectre').setup({
2 | line_sep_start = '┌--------------------------------------------------------',
3 | line_sep = '└--------------------------------------------------------',
4 | })
5 |
6 | if vim.g.wind_use_statusline == 1 then
7 | require('windline').add_status(
8 | require('spectre.state_utils').status_line()
9 | )
10 | end
11 |
--------------------------------------------------------------------------------
/local.lua:
--------------------------------------------------------------------------------
1 | local utils = import('core.utils')
2 | utils.set_vim_global({
3 | wind_use_bg = 1,
4 | wind_use_agsort = 0,
5 | wind_use_treesitter = 0,
6 |
7 | wind_use_icon = 1,
8 | wind_use_dap = 0,
9 | wind_lsp_mode = 'lsp',
10 | wind_tmux_line = 1,
11 | wind_auto_close = 1,
12 | wind_use_indent = 1,
13 | wind_theme = 'wind',
14 | wind_statusline_theme = 'wind',
15 | }, true)
16 |
--------------------------------------------------------------------------------
/lua/wind/plug/matchup.lua:
--------------------------------------------------------------------------------
1 | vim.api.nvim_exec([[
2 | " disable match parent on insert mode
3 | function! ToggleMatchParent(status)
4 | if &buftype != 'nofile'
5 | if a:status == 1
6 | DoMatchParen
7 | else
8 | NoMatchParen
9 | endif
10 | endif
11 | endfunction
12 |
13 | augroup matchparent_wind
14 | autocmd!
15 | au InsertLeave * call ToggleMatchParent(1)
16 | au InsertEnter * call ToggleMatchParent(0)
17 | augroup END
18 | ]],false)
19 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/lang/emmetls.lua:
--------------------------------------------------------------------------------
1 | local nvim_lsp = require'lspconfig'
2 | local configs = require'lspconfig/configs'
3 |
4 | configs.emmet_ls = {
5 | default_config = {
6 | cmd = {'node','/home/trieu/test/emmet-ls/out/server.js', '--stdio' };
7 | filetypes = {'html', 'css' ,'scss','svelte','typescriptreact'};
8 | root_dir = function()
9 | return vim.loop.cwd()
10 | end;
11 | settings = {};
12 | };
13 | }
14 | import('plug/lsp/lsp').lsp_setup(nvim_lsp.emmet_ls)
15 |
16 |
--------------------------------------------------------------------------------
/lua/wind/plug/lspsaga.lua:
--------------------------------------------------------------------------------
1 | local lspsaga= require('lspsaga')
2 | -- local lsp=import('plug/lsp/lsp')
3 | -- local nnoremap = import('core.keymap').nnoremap
4 |
5 | lspsaga.init_lsp_saga({
6 | code_action_prompt = {
7 | enable = false,
8 | sign = true,
9 | sign_priority = 20,
10 | virtual_text = true,
11 | },
12 | code_action_keys = { quit = '',exec = '' },
13 | rename_action_keys = {
14 | quit = '', exec = '' -- quit can be a table
15 | }
16 | })
17 |
18 |
--------------------------------------------------------------------------------
/lua/wind/plug/_end.lua:
--------------------------------------------------------------------------------
1 | require 'colorizer'.setup {
2 | 'css' ; 'scss' ; 'yml' ; 'yaml' ; 'vim' ; 'javascript' ; 'html' ; "rasi", "conf", "lua"
3 | }
4 |
5 |
6 | Wind.load_plug('me')
7 | import('general.autocmd').add_autocmd_color('whitespace',function ()
8 | vim.cmd[[highlight ExtraWhitespace ctermbg=red guibg=red]]
9 | vim.cmd[[match ExtraWhitespace /\s\+$/]]
10 | end)
11 |
12 |
13 |
14 | require('Navigator').setup({
15 | auto_save = 'current',
16 | disable_on_zoom = true
17 | })
18 |
19 |
20 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/lang/tsserver.lua:
--------------------------------------------------------------------------------
1 |
2 | local nvim_lsp = require('lspconfig')
3 | local function organize_imports()
4 | local params = {
5 | command = "_typescript.organizeImports",
6 | arguments = {vim.api.nvim_buf_get_name(0)},
7 | title = ""
8 | }
9 | vim.lsp.buf.execute_command(params)
10 | end
11 |
12 | nvim_lsp.tsserver.commands = {
13 | OrganizeImports = {
14 | organize_imports,
15 | description = "Organize Imports"
16 | }
17 | }
18 | import('plug/lsp/lsp').lsp_setup(nvim_lsp.tsserver)
19 |
--------------------------------------------------------------------------------
/local.sample.lua:
--------------------------------------------------------------------------------
1 | local utils = import('core.utils')
2 | utils.set_vim_global({
3 | wind_use_bg = 1,
4 | wind_use_agsort = 0,
5 | wind_use_treesitter = 1,
6 | wind_use_icon = 1,
7 | wind_use_buffline = 1,
8 | wind_use_statusline = 1,
9 | wind_use_dap = 0,
10 | wind_lsp_mode = 'lsp',
11 | wind_tmux_line = 1,
12 | wind_auto_close = 1,
13 | wind_use_indent = 1,
14 | wind_theme = 'wind',
15 | wind_statusline_theme = 'wind',
16 | }, true)
17 |
--------------------------------------------------------------------------------
/lua/wind/plug/eft.lua:
--------------------------------------------------------------------------------
1 | local keymap=import('core.keymap')
2 | keymap.nmap {'f' ,'(eft-f)'}
3 | keymap.xmap {'f' ,'(eft-f)'}
4 | keymap.omap {'f' ,'(eft-f)'}
5 | -- keymap." {'n'm,'ap F (e'}ft-F)
6 | -- keymap." {'x'm,'ap F (e'}ft-F)
7 | -- keymap." {'o'm,'ap F (e'}ft-F)
8 | keymap.nmap {'t' ,'(eft-t)'}
9 | keymap.xmap {'t' ,'(eft-t)'}
10 | keymap.omap {'t' ,'(eft-t)'}
11 | keymap.nmap {'T' ,'(eft-T)'}
12 | keymap.xmap {'T' ,'(eft-T)'}
13 | keymap.omap {'T' ,'(eft-T)'}
14 |
--------------------------------------------------------------------------------
/plug/vim-floaterm.vim:
--------------------------------------------------------------------------------
1 | " let g:floaterm_wintype='normal'
2 | " let g:floaterm_height=40
3 | let g:floaterm_position='bottom'
4 | let g:floaterm_keymap_toggle = ''
5 | " let g:floaterm_keymap_next = ''
6 | " let g:floaterm_keymap_prev = ''
7 | " let g:floaterm_keymap_new = ''
8 |
9 | " Floaterm
10 | let g:floaterm_gitcommit='floaterm'
11 | let g:floaterm_title=''
12 | let g:floaterm_autoinsert=1
13 | let g:floaterm_width=0.9
14 | let g:floaterm_height=0.7
15 | let g:floaterm_wintitle=0
16 | let g:floaterm_autoclose=1
17 |
--------------------------------------------------------------------------------
/lua/wind/general/themes/miramare.lua:
--------------------------------------------------------------------------------
1 |
2 | vim.g.miramare_palette = {
3 | light_grey= { '#928374', '245', 'LightGrey' },
4 | grey = { '#928374', '245', 'LightGrey' }
5 | }
6 | vim.g.miramare_enable_italic = 0
7 | vim.g.miramare_disable_italic_comment = 1
8 | vim.g.miramare_transparent_background = vim.g.wind_use_bg == 1
9 |
10 | vim.api.nvim_exec([[
11 | colorscheme miramare
12 | hi MatchParen ctermfg=172 ctermbg=none guibg=#d79921 guifg=#43A047
13 | hi IndentLine guifg=#37474F ctermfg=246 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
14 | ]],true)
15 |
16 |
17 |
--------------------------------------------------------------------------------
/lua/wind/plug/indent-blankline.lua:
--------------------------------------------------------------------------------
1 |
2 | -- Makes the vertical bars Green from term color 1
3 | -- vim.g.indentLine_color_term = 100
4 | vim.g.indentLine_char_list = { '┊','┊','┊','┊' }
5 | vim.g.indent_blankline_char = "┊"
6 | vim.g.indentLine_setConceal = 1
7 | vim.g.indentLine_conceallevel = 1
8 | vim.g.indentLine_concealcursor = ""
9 | vim.g.indent_blankline_char_highlight="IndentLine"
10 | -- vim.g.indent_blankline_char_highlight_list = { 'Error', 'Function' }
11 | vim.g.indentLine_fileTypeExclude = { "vifm","help","dashboard","fern",'lsp','which_key','sagahover' }
12 |
--------------------------------------------------------------------------------
/snippets/markdown.json:
--------------------------------------------------------------------------------
1 | {
2 | "link": {
3 | "prefix": "link",
4 | "body": ["[$0](http://example.com)"],
5 | "description": "link"
6 | },
7 | "image": {
8 | "prefix": "image",
9 | "body": [""],
10 | "description": "image"
11 | },
12 | "codeblock":{
13 | "prefix" :"code",
14 | "body":["``` $0\n","```"]
15 | },
16 | "table": {
17 | "prefix": "table",
18 | "body": [
19 | "| Usage | KEY |",
20 | "| ------------- | ---------------------|",
21 | "| $0 | |"
22 | ],
23 | "description":"table"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/lang/tailwind.lua:
--------------------------------------------------------------------------------
1 |
2 | local configs = require 'lspconfig/configs'
3 | local util = require 'lspconfig/util'
4 | local nvim_lsp = require('lspconfig')
5 |
6 | local server_name = 'tailwindls'
7 |
8 | configs[server_name] = {
9 | default_config = {
10 | cmd = {server_name};
11 | filetypes = {'html','svelte','typescriptreact'};
12 | root_dir = util.root_pattern("package.json", ".git");
13 | };
14 | docs = {
15 | description = [[ ]];
16 | default_config = {
17 | root_dir = [[root_pattern("package.json", ".git")]];
18 | };
19 | }
20 | }
21 |
22 |
23 | import('plug/lsp/lsp').lsp_setup(nvim_lsp.tailwindls)
24 |
25 |
--------------------------------------------------------------------------------
/lua/wind/core/env.lua:
--------------------------------------------------------------------------------
1 | local utils = import('core.utils')
2 | local local_env = string.format('%s/local.lua', Wind.vim_path)
3 |
4 | if vim.fn.filereadable(local_env) == 1 then
5 | vim.cmd("luafile " .. local_env)
6 | end
7 |
8 | utils.set_vim_global({
9 | wind_use_agsort = 1,
10 | wind_use_plugin = 1,
11 | wind_use_bg = 1,
12 | wind_use_treesitter = 1,
13 | wind_use_icon = 1,
14 | wind_use_buffline = 1,
15 | wind_use_statusline = 1,
16 | wind_use_dap = 0,
17 | wind_lsp_mode = 'lsp',
18 | wind_tmux_line = 1,
19 | wind_auto_close = 1,
20 | wind_use_indent = 1,
21 | wind_theme = 'wind',
22 | wind_statusline_theme = 'wind',
23 | }, true)
24 |
25 |
--------------------------------------------------------------------------------
/lua/wind/plug/web-devicons.lua:
--------------------------------------------------------------------------------
1 | require'nvim-web-devicons'.setup {
2 | -- your personnal icons can go here (to override)
3 | -- DevIcon will be appended to `name`
4 | override = {
5 | svelte = {
6 | icon = "",
7 | color = "#D50000",
8 | name = "svelte"
9 | },
10 |
11 | folderopen = {
12 | icon = "",
13 | color = "#019833",
14 | name = "folderopen"
15 | },
16 | folderclose = {
17 | icon = "",
18 | color = "#AA00FF",
19 | name = "folderopen"
20 | }
21 | };
22 | -- globally enable default icons (default to false)
23 | -- will get overriden by `get_icons` option
24 | default = true;
25 | }
26 | vim.cmd[[
27 | autocmd ColorScheme * lua require'nvim-web-devicons'.setup()
28 | ]]
29 |
--------------------------------------------------------------------------------
/plug/vim-visual-multi.vim:
--------------------------------------------------------------------------------
1 | let g:VM_leader = ','
2 | let g:VM_maps = {}
3 | let g:VM_maps['Find Under'] = '' " replace C-n
4 | let g:VM_maps['Find Subword Under'] = '' " replace visual C-n
5 | let g:VM_maps['Select Cursor Down'] = ',p' " start selecting down
6 | let g:VM_maps['Select Cursor Up'] = ',k' " start selecting up
7 | let g:VM_maps["Add Cursor Down"] = ',j'
8 | let g:VM_maps["Add Cursor Up"] = ',k'
9 | let g:VM_maps["Add Cursor At Pos"] = ',i'
10 | let g:VM_mouse_mappings = 1
11 |
12 |
13 | " c-d select word
14 | " q for skip current word
15 | " for gotto next"
16 | " tab to change mode
17 | "
18 | "
19 | ",, to start select by column ,j,k to add cursor up or down
20 | " better ,, then you mouse click :(
21 |
22 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/functions.lua:
--------------------------------------------------------------------------------
1 | local lsp = vim.lsp
2 | local M = {}
3 |
4 | M.organize_imports = function()
5 | local params = lsp.util.make_range_params()
6 | params.context = {
7 | diagnostics = {},
8 | only = { 'source.organizeImports' }
9 | }
10 |
11 | local responses = lsp.buf_request_sync(0, 'textDocument/codeAction', params)
12 |
13 | if not responses or vim.tbl_isempty(responses) then
14 | return
15 | end
16 |
17 | for _, response in pairs(responses) do
18 | for _, result in pairs(response.result or {}) do
19 | if result.edit then
20 | lsp.util.apply_workspace_edit(result.edit)
21 | else
22 | lsp.buf.execute_command(result.command)
23 | end
24 | end
25 | end
26 | end
27 |
28 | vim.cmd[[
29 | command! -nargs=* LspOrganizeImport call v:lua.import('plug/lsp/functions').organize_imports()
30 | ]]
31 |
32 | return M
33 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/lang/angular.lua:
--------------------------------------------------------------------------------
1 | local configs = require 'lspconfig/configs'
2 | local util = require 'lspconfig/util'
3 | local nvim_lsp = require('lspconfig')
4 |
5 | local server_name = 'angularls'
6 | local bin_name = 'angularls'
7 |
8 | -- local installer = util.npm_installer {
9 | -- server_name = server_name;
10 | -- packages = { "@angular/language-server" };
11 | -- binaries = { bin_name };
12 | -- }
13 |
14 | configs[server_name] = {
15 | default_config = {
16 | cmd = {bin_name};
17 | filetypes = {'html'};
18 | root_dir = util.root_pattern("angular.json", ".git");
19 | };
20 | docs = {
21 | description = [[ ]];
22 | default_config = {
23 | root_dir = [[root_pattern("angular.json", ".git")]];
24 | };
25 | }
26 | }
27 |
28 | -- configs[server_name].install = installer.install
29 | -- configs[server_name].install_info = installer.info
30 |
31 | import('plug/lsp/lsp').lsp_setup(nvim_lsp.angularls)
32 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/lang/booster.lua:
--------------------------------------------------------------------------------
1 | local configs = require 'lspconfig/configs'
2 | local util = require 'lspconfig/util'
3 | local nvim_lsp = require('lspconfig')
4 |
5 | local server_name = 'jsboosterls'
6 | local bin_name = 'jsboosterls'
7 |
8 | local installer = util.npm_installer {
9 | server_name = server_name;
10 | packages = { "@angular/language-server" };
11 | binaries = { bin_name };
12 | }
13 |
14 | configs[server_name] = {
15 | default_config = {
16 | cmd = {'jsboosterls.sh'};
17 | filetypes = {'javacript','typescript','typescriptreact'};
18 | root_dir = util.root_pattern("package.json", ".git");
19 | };
20 | docs = {
21 | description = [[ ]];
22 | default_config = {
23 | root_dir = [[root_pattern("package.json", ".git")]];
24 | };
25 | }
26 | }
27 |
28 | configs[server_name].install = installer.install
29 | configs[server_name].install_info = installer.info
30 |
31 | import('wind/lsp/lsp').lsp_setup(nvim_lsp.jsboosterls)
32 |
33 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/lang/eslint.lua:
--------------------------------------------------------------------------------
1 |
2 | local configs = require 'lspconfig/configs'
3 | local util = require 'lspconfig/util'
4 | local nvim_lsp = require('lspconfig')
5 |
6 | local server_cmd = 'lsp_eslint'
7 | -- local server_cmd = 'node /home/trieu/.vscode/extensions/dbaeumer.vscode-eslint-2.1.14/server/out/eslintServer.js -f unix --stdin --stdin-filename'
8 | local server_name = "eslint"
9 |
10 | configs[server_name] = {
11 | default_config = {
12 | cmd = vim.fn.split(server_cmd, ' ');
13 | setting = {
14 | nodePath = '/home/trieu/.fnm/node-versions/v14.3.0/installation/bin/';
15 | lala = '/home/trieu/.fnm/node-versions/v14.3.0/installation/bin/';
16 | };
17 | filetypes = {'html','typescript','typescriptreact'};
18 | root_dir = util.root_pattern("package.json", ".git");
19 | };
20 | docs = {
21 | description = [[ ]];
22 | default_config = {
23 | root_dir = [[root_pattern("package.json", ".git")]];
24 | };
25 | }
26 | }
27 |
28 |
29 | import('plug/lsp/lsp').lsp_setup(nvim_lsp[server_name])
30 |
31 |
--------------------------------------------------------------------------------
/ftplugin/svelte.vim:
--------------------------------------------------------------------------------
1 | if exists("b:did_ftplugin")
2 | finish
3 | endif
4 |
5 | " svelte {{{
6 |
7 | let g:tagalong_additional_filetypes = ['svelte']
8 | let g:closetag_filetypes = 'html,xhtml,phtml,svelte'
9 | let g:vim_svelte_plugin_use_typescript=1
10 |
11 | " }}}
12 | set foldmethod=manual
13 | nnoremap za zfat
14 | " delete tag in html
15 | nnoremap cx Td2f"
16 | nnoremap ul :call MyCodeFormat()
17 |
18 | " autocmd FileType svelte autocmd BufWritePre :Format
19 |
20 | " Example: set local options based on subtype
21 | function! OnChangeSvelteSubtype(subtype)
22 | " echom 'Subtype is '.a:subtype
23 | if empty(a:subtype) || a:subtype == 'html'
24 | setlocal commentstring=
25 | setlocal comments=s:
26 | elseif a:subtype =~ 'css'
27 | setlocal comments=s1:/*,mb:*,ex:*/ commentstring&
28 | else
29 | setlocal commentstring=//%s
30 | setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
31 | endif
32 | endfunction
33 | " vim: set ts=8 sts=4 sw=4 expandtab :
34 |
--------------------------------------------------------------------------------
/lua/wind/plug/formatter.lua:
--------------------------------------------------------------------------------
1 | local function prettier(args)
2 | if args == nil then args = {} end
3 | return function ()
4 | args = vim.tbl_flatten({"--stdin-filepath", vim.api.nvim_buf_get_name(0), args})
5 | return {
6 | exe = "prettier",
7 | args = args,
8 | stdin = true
9 | }
10 | end
11 | end
12 | local function rustywind()
13 | local args = vim.tbl_flatten({ vim.api.nvim_buf_get_name(0), '|', 'head', '-n', '-3', '|', 'tail', '-n', '+5'})
14 | return {
15 | exe = "rustywind",
16 | args = args,
17 | stdin = true
18 | }
19 | end
20 | local default_prettier = prettier()
21 | require('formatter').setup({
22 | filetype = {
23 | json = { default_prettier },
24 | xml = { default_prettier },
25 | scss = { default_prettier },
26 | html = { default_prettier },
27 | svelte = { rustywind},
28 | javascript = { prettier({'--single-quote'}) },
29 | javascriptreact = { prettier({'--single-quote'}) },
30 | typescript = { prettier({'--single-quote'}) },
31 | typescriptreact = { prettier({'--single-quote'}) },
32 | }
33 | })
34 |
--------------------------------------------------------------------------------
/snippets/svelte.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | "rinput":{
4 | "prefix":"rinput",
5 | "body":"import { RImageUpload, RTabs } from '$components/ui/form/index';",
6 | "description":""
7 | },
8 | "rmodel":{
9 | "prefix":"rmodel",
10 | "body":"import type { RModel } from '$common/model/rmodel';",
11 | "description":""
12 | },
13 | "ifelse":{
14 | "description": "hifelse",
15 | "prefix": ["hif"],
16 | "body": [
17 | "{#if $1}",
18 | "{:else}",
19 | "{/if}"
20 | ]
21 | },
22 | "foreach":{
23 | "prefix": "hfor",
24 | "body": [
25 | "{#each list as comp}",
26 | " $1",
27 | "{/each}"
28 | ],
29 | "description": "foreach"
30 | },
31 | "dispatch":{
32 | "prefix": "dispatch",
33 | "body": [
34 | "import { createEventDispatcher } from 'svelte';",
35 | "const dispatch = createEventDispatcher();"
36 | ],
37 | "description": "event"
38 | },
39 | "onMount":{
40 | "prefix": "onMount",
41 | "body": [
42 | "import { onMount } from 'svelte';",
43 | "onMount(() => {\n\n });"
44 | ]
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/lua/wind/plug/autopairs.lua:
--------------------------------------------------------------------------------
1 | local npairs = require('nvim-autopairs')
2 | -- local Cond= require('nvim-autopairs.conds')
3 | -- local ts_conds = require('nvim-autopairs.ts-conds')
4 |
5 | -- local endwise = require('nvim-autopairs.ts-rule').endwise
6 | npairs.setup({
7 | fast_wrap = {
8 | end_key = 'L',
9 | highlight = 'HopNextKey',
10 | },
11 | -- check_ts = true
12 | -- ignored_next_char = false
13 | -- enable_check_bracket_line = false
14 | })
15 |
16 |
17 |
18 | vim.keymap.imap({
19 | '',
20 | function()
21 | if vim.fn.pumvisible() ~= 0 then
22 | if vim.fn.complete_info()['selected'] ~= -1 then
23 | return vim.fn['compe#confirm'](vim.keymap.t(''))
24 | else
25 | vim.defer_fn(function()
26 | vim.fn['compe#confirm']('')
27 | end, 20)
28 | return vim.keymap.t('')
29 | end
30 | else
31 | return npairs.autopairs_cr()
32 | end
33 | end,
34 | expr = true,
35 | noremap = true,
36 | })
37 |
38 | require("nvim-autopairs.completion.compe").setup({map_cr = false, map_complete = true})
39 |
--------------------------------------------------------------------------------
/queries/xml/highlights.scm:
--------------------------------------------------------------------------------
1 | (tag_name) @tag
2 | (erroneous_end_tag_name) @error
3 | (doctype) @constant
4 | (attribute_name) @property
5 | (attribute_value) @string
6 | (quoted_attribute_value) @string
7 | (comment) @comment
8 |
9 | ((element (start_tag (tag_name) @_tag) (text) @text.title)
10 | (#match? @_tag "^(h[0-9]|title)$"))
11 |
12 | ((element (start_tag (tag_name) @_tag) (text) @text.strong)
13 | (#match? @_tag "^(strong|b)$"))
14 |
15 | ((element (start_tag (tag_name) @_tag) (text) @text.emphasis)
16 | (#match? @_tag "^(em|i)$"))
17 |
18 | ((element (start_tag (tag_name) @_tag) (text) @text.strike)
19 | (#match? @_tag "^(s|del)$"))
20 |
21 | ((element (start_tag (tag_name) @_tag) (text) @text.underline)
22 | (#eq? @_tag "u"))
23 |
24 | ((element (start_tag (tag_name) @_tag) (text) @text.literal)
25 | (#match? @_tag "^(code|kbd)$"))
26 |
27 | ((element (start_tag (tag_name) @_tag) (text) @text.uri)
28 | (#eq? @_tag "a"))
29 |
30 | ((attribute
31 | (attribute_name) @_attr
32 | (quoted_attribute_value (attribute_value) @text.uri))
33 | (#match? @_attr "^(href|src)$"))
34 |
35 | "=" @operator
36 |
37 | [
38 | "<"
39 | ""
41 | ""
42 | "/>"
43 | ] @tag.delimiter
44 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/lang/mlua.lua:
--------------------------------------------------------------------------------
1 | local nvim_lsp = require('lspconfig')
2 |
3 | nvim_lsp['sumneko_lua'].setup {
4 | cmd = {
5 | "/home/trieu/test/lua-language-server/bin/Linux/lua-language-server",
6 | "-E",
7 | "/home/trieu/test/lua-language-server/main.lua"
8 | },
9 | on_attach =import('plug/lsp/lsp').on_attach_vim,
10 | settings = {
11 | Lua = {
12 | runtime = {
13 | -- Get the language server to recognize LuaJIT globals like `jit` and `bit`
14 | version = 'LuaJIT',
15 | -- Setup your lua path
16 | path = vim.split(package.path, ';'),
17 | },
18 | diagnostics = {
19 | -- Get the language server to recognize the `vim` global
20 | globals = {'vim' , 'Wind', 'import' , 'describe' , 'it'},
21 | },
22 | workspace = {
23 | -- Make the server aware of Neovim runtime files
24 | library = {
25 | [vim.fn.expand('$VIMRUNTIME/lua')] = true,
26 | [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
27 | },
28 | },
29 | },
30 | },
31 | }
32 |
--------------------------------------------------------------------------------
/note.lua:
--------------------------------------------------------------------------------
1 | vim.g.wind_use_note = 1
2 | vim.g.wind_theme = 'gruvbox'
3 | vim.g.wind_use_indent = 0
4 | vim.g.gruvbox_contrast_light = 'medium'
5 |
6 | require('wind')
7 |
8 | vim.api.nvim_exec([[
9 | set cursorline
10 | set linebreak " line break will break a character to next line
11 | set cmdheight=1 "reduce cmd height
12 | set norelativenumber nonumber noshowmode noshowcmd! hidden! noruler noshowcmd
13 | set laststatus=0
14 | "turn off signcolumn
15 | set signcolumn=no
16 |
17 | " hide status bar on which_key
18 | autocmd! FileType which_key
19 |
20 | " use it to re open file when open note
21 | augroup MyAutoWriteNote
22 | autocmd!
23 | autocmd BufReadPre *.md :silent !echo '%:p' > /tmp/$USER/my_note_file.txt
24 | augroup END
25 | " hi Normal guibg=#faf9dc guifg=#7c6f64
26 | ]],false)
27 |
28 | import('general.autocmd').add_autocmd_color('telescope',function ()
29 | vim.api.nvim_exec([[
30 | hi CursorLine ctermbg=255 ctermfg=16
31 | " change color on selected text
32 | highlight Visual cterm=NONE ctermbg=252 guifg=#ebdbb2 guibg=#000000
33 | highlight TelescopeMatching guifg=#0091EA
34 | highlight TelescopeSelection guifg=#CC241D gui=bold guibg=#ebdbb2
35 | highlight TelescopeSelectionCaret guifg=#CC241D " selection caret
36 | ]],false)
37 | end)
38 |
--------------------------------------------------------------------------------
/lua/wind/general/themes/gruvbox.lua:
--------------------------------------------------------------------------------
1 | vim.g.gitgutter_override_sign_column_highlight = 1
2 | vim.g.gruvbox_sign_column = 1
3 |
4 | import('general.autocmd').add_autocmd_color('gruvbox',function ()
5 | vim.api.nvim_exec([[
6 | hi! link xmlTag GruvboxOrange
7 | hi! link htmlTag GruvboxOrange
8 | hi! link htmlTagN GruvboxOrange
9 | hi! link htmlTagName GruvboxOrange
10 | hi! link xmlEndTag GruvboxOrange
11 | hi! link xmlTagName GruvboxOrange
12 | hi! link xmlEqual GruvboxOrange
13 | hi LspDiagnosticsSignError guifg=#c43060 ctermfg=167 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
14 | hi LspDiagnosticsSignWarning guifg=#f08e48 ctermfg=209 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
15 | hi LspDiagnosticsSignInformation guifg=#c694ff ctermfg=177 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
16 | hi LspDiagnosticsSignHint guifg=#1c8db2 ctermfg=31 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
17 |
18 | hi link LspDiagnosticsVirtualTextError LspDiagnosticsSignError
19 | hi link LspDiagnosticsVirtualTextWarning LspDiagnosticsSignWarning
20 | hi link LspDiagnosticsVirtualTextInformation LspDiagnosticsSignInformation
21 | hi IndentLine guifg=#073d52 ctermfg=246 guibg=NONE ctermbg=NONE gui=NONE cterm=NONE
22 | hi MatchParen ctermfg=172 ctermbg=232 guifg=#d79921 guibg=#43A047
23 | ]],true)
24 | end)
25 | vim.cmd[[colorscheme gruvbox]]
26 |
--------------------------------------------------------------------------------
/lua/wind/core/init.lua:
--------------------------------------------------------------------------------
1 | local check_dir = function ()
2 | local data_dir = {
3 | Wind.cache_dir..'backup',
4 | Wind.cache_dir..'session',
5 | Wind.cache_dir..'undo'
6 | }
7 | if vim.fn.isdirectory(Wind.cache_dir) == 0 then
8 | os.execute("mkdir -p " .. Wind.cache_dir)
9 | for _,v in pairs(data_dir) do
10 | if vim.fn.isdirectory(v) == 0 then
11 | os.execute("mkdir -p " .. v)
12 | end
13 | end
14 | end
15 | end
16 |
17 | local function check_paq()
18 | local data_dir = string.format('%s/site/',vim.fn.stdpath('data'))
19 | local pag_dir = data_dir .. 'pack/paqs/opt/paq-nvim'
20 | local state = vim.loop.fs_stat(pag_dir)
21 | if not state then
22 | local cmd = "!git clone https://github.com/savq/paq-nvim.git " ..pag_dir
23 | vim.api.nvim_command(cmd)
24 | vim.loop.fs_mkdir(data_dir..'plugin',511,function()
25 | assert("make compile path dir failed")
26 | end)
27 | end
28 | end
29 |
30 | local function load_plug()
31 | vim.cmd 'packadd paq-nvim' -- Load package
32 | local paq = require'paq-nvim'.paq -- Import module and bind `paq` function
33 | paq{'savq/paq-nvim', opt = true} -- Let Paq manage itself
34 | end
35 |
36 | local function setup()
37 | vim.g.mapleader = " "
38 | check_dir()
39 | check_paq()
40 | load_plug()
41 | end
42 |
43 | setup()
44 | import('core.env')
45 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/lang/efm.lua:
--------------------------------------------------------------------------------
1 | local nvim_lsp = require('lspconfig')
2 | local nvim_setup=import('plug/lsp/lsp')
3 |
4 | local prettier = {
5 | formatCommand = "./node_modules/.bin/prettier --stdin --stdin-filepath ${INPUT}",
6 | formatStdin = true
7 | }
8 | local eslint = {
9 | lintCommand = "eslint -f unix --stdin --stdin-filename ${INPUT}",
10 | lintIgnoreExitCode = true,
11 | lintStdin = true,
12 | lintFormats = {"%f:%l:%c: %m"},
13 | }
14 | local languages = {
15 | --lua = {luafmt},
16 | typescript = { eslint},
17 | javascript = {prettier, eslint},
18 | typescriptreact = {prettier, eslint},
19 | ['typescript.tsx'] = {prettier, eslint},
20 | javascriptreact = {prettier, eslint},
21 | ['javascript.jsx'] = {prettier, eslint},
22 | yaml = {prettier},
23 | json = {prettier},
24 | html = {prettier},
25 | scss = {prettier},
26 | css = {prettier},
27 | markdown = {prettier},
28 | }
29 | nvim_lsp.efm.setup{
30 | on_attach = nvim_setup.on_attach_vim,
31 | root_dir = nvim_lsp.util.root_pattern("package.json", ".git", vim.fn.getcwd()),
32 | filetypes = vim.tbl_keys(languages),
33 | init_options = {
34 | documentFormatting = true,
35 | codeAction = true
36 | },
37 | settings = {
38 | rootMarkers = { "package.json", ".git" },
39 | lintDebounce = 500,
40 | languages = languages
41 | },
42 | }
43 | -- require('plug/lsp/lsp').lsp_setup(nvim_lsp.diagnosticls)
44 |
--------------------------------------------------------------------------------
/plug/gitopen.vim:
--------------------------------------------------------------------------------
1 | " https://github.com/tpope/vim-rhubarb/blob/master/autoload/rhubarb.vim#L28-L33
2 | " replace it because netrw
3 | function! s:gh_home_url(url) abort
4 | let domain_pattern = 'github\.com'
5 | let domains = get(g:, 'github_enterprise_urls', get(g:, 'fugitive_github_domains', []))
6 | for domain in domains
7 | let domain_pattern .= '\|' . escape(split(substitute(domain, '/$', '', ''), '://')[-2], '.')
8 | endfor
9 | let base = matchstr(a:url, '^\%(https\=://\%([^@/:]*@\)\=\|git://\|git@\|ssh://git@\|org-\d\+@\|ssh://org-\d\+@\)\=\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=/\=$')
10 | if index(domains, 'http://' . matchstr(base, '^[^:/]*')) >= -1
11 | return 'http://' . tr(base, ':', '/')
12 | elseif !empty(base)
13 | return 'https://' . tr(base, ':', '/')
14 | else
15 | return ''
16 | endif
17 | endfunction
18 |
19 | function! WindGitOpen(...)
20 | let l:remote = fugitive#repo().config('remote.origin.url')
21 | let l:branch = fugitive#head()
22 | let l:url = s:gh_home_url(l:remote)
23 | let l:url = printf("%s/blob/%s/%s", l:url, l:branch, a:1['path'])
24 | if a:1['line1'] >1 && a:1['line2']>1
25 | let l:url = printf("%s#L%s-L%s",l:url ,a:1['line1'],a:1['line2'])
26 | endif
27 | return shellescape(l:url)
28 | endfunction
29 |
30 | let g:fugitive_browse_handlers = [ function ('WindGitOpen') ]
31 | function! WindOpen(...)
32 | call system(wind#open() . ' ' . a:1)
33 | endfunction
34 | command! -nargs=* Browse call WindOpen()
35 |
36 |
--------------------------------------------------------------------------------
/lua/wind/plug/lsp/lang/svelte.lua:
--------------------------------------------------------------------------------
1 | local configs = require 'lspconfig/configs'
2 | local nvim_lsp = require('lspconfig')
3 | local util = require 'lspconfig/util'
4 |
5 | local server_name = 'svelte'
6 | local bin_name = 'svelteserver'
7 |
8 |
9 | configs[server_name] = {
10 | default_config = {
11 | cmd = {bin_name, '--stdio'};
12 | filetypes = {'svelte'};
13 | root_dir = util.root_pattern("package.json" );
14 | };
15 | docs = {
16 | description = [[
17 | ```sh
18 | npm install -g svelte-language-server
19 | ```
20 | ]];
21 | default_config = {
22 | root_dir = [[root_pattern("package.json" )]];
23 | };
24 | }
25 | }
26 |
27 | vim.cmd[[
28 | autocmd BufWritePost *.ts lua require('wind.plug.lsp.lang.svelte').svelte_update()
29 | ]]
30 |
31 |
32 | import('plug/lsp/lsp').lsp_setup(nvim_lsp.svelte)
33 |
34 | local M ={}
35 | function M.svelte_update()
36 | local buffList = vim.fn.getbufinfo({
37 | bufloaded = 1;
38 | buflisted = 1
39 | })
40 | for _, buf in pairs(buffList) do
41 | if string.match(buf.name,".*svelte$") then
42 | if buf.bufnr then
43 | local bufnr = vim.fn.bufnr('%')
44 | local uri = vim.uri_from_bufnr(bufnr)
45 | local text= require('wind.core.utils').buf_get_full_text(bufnr)
46 | local params = {
47 | uri = uri;
48 | changes = { { text = text } }
49 | }
50 | vim.lsp.buf_notify(buf.bufnr, '$/onDidChangeTsOrJsFile', params)
51 | end
52 | end
53 | end
54 | end
55 | return M
56 |
--------------------------------------------------------------------------------
/lua/wind/plug/treesitter.lua:
--------------------------------------------------------------------------------
1 |
2 | local hiLink= import('core.utils').hiLink
3 | local ts = require 'nvim-treesitter.configs'
4 | local keymap = import('core.keymap')
5 | -- local parser_config = require"nvim-treesitter.parsers".get_parser_configs()
6 |
7 | -- parser_config.svelte = {
8 | -- install_info = {
9 | -- url = "~/test/tree-sitter-svelte", -- local path or git repo
10 | -- files = {"src/parser.c", "src/scanner.cc"}
11 | -- },
12 | -- filetype = "svelte",
13 | -- used_by = {"svelte"}
14 | -- }
15 |
16 | -- parser_config.xml = {
17 | -- install_info = {
18 | -- url = "https://github.com/windwp/tree-sitter-html",
19 | -- files = { "src/parser.c", "src/scanner.cc" },
20 | -- },
21 | -- filetype = "xml",
22 | -- used_by = {"xml"}
23 | -- }
24 |
25 | ts.setup {
26 | ensure_installed = 'maintained',
27 | highlight = {enable = true},
28 | indent = {
29 | enable = false
30 | },
31 | autotag = {
32 | enable = true,
33 | }
34 | }
35 |
36 | -- https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/javascript/highlights.scm
37 | -- https://github.com/nvim-treesitter/nvim-treesitter/blob/7edf1d1c2bfb4bdc53319494697ca2947920b69e/lua/nvim-treesitter/highlight.lua
38 | if vim.g.wind_theme == 'miramare' then
39 | hiLink('TSVariableBuiltin','Purple')
40 | hiLink('TSConstructor','Cyan')
41 | hiLink('TSProperty','White')
42 | end
43 | vim.cmd[[set foldmethod=expr]]
44 | vim.cmd[[ set foldexpr=nvim_treesitter#foldexpr() ]]
45 | keymap.nnoremap({'.', ':TSHighlightCapturesUnderCursor'})
46 |
--------------------------------------------------------------------------------
/ftplugin/javascript.vim:
--------------------------------------------------------------------------------
1 | setlocal path=.,src
2 | setlocal suffixesadd=.js,.jsx,.ts,.tsx
3 | setlocal foldmethod=syntax
4 | " set formatoptions-=ro
5 | " Source:
6 | " https://damien.pobel.fr/post/configure-neovim-vim-gf-javascript-import/
7 | " TODO more robust solution (detect root directory, specific to javascript,
8 | " ...)
9 | function! s:find_node_modules_filename(fname) abort
10 | let nodeModules = "./node_modules/"
11 | let packageJsonPath = nodeModules . a:fname . "/package.json"
12 | if filereadable(packageJsonPath)
13 | return nodeModules . a:fname . "/" . json_decode(join(readfile(packageJsonPath))).main
14 | else
15 | let checkfname="@".a:fname
16 | let packageJsonPath = nodeModules . checkfname . "/package.json"
17 | if filereadable(packageJsonPath)
18 | return nodeModules . checkfname. "/" . json_decode(join(readfile(packageJsonPath))).main
19 | elseif filereadable( nodeModules . a:fname )
20 | return nodeModules . a:fname
21 | elseif filereadable(nodeModules ."@". a:fname)
22 | return nodeModules ."@" . a:fname
23 | endif
24 | endif
25 | endfunction
26 |
27 | " Used in 'includeexpr' to resolve file names
28 | function! Js_includeexpr(filename) abort
29 | let fname = s:find_node_modules_filename(a:filename)
30 | if filereadable(fname)
31 | return fname
32 | endif
33 | endfunction
34 |
35 | setlocal includeexpr=Js_includeexpr(v:fname)
36 |
37 | " disable match parent in insert mode for better cursor on pairs bracket
38 | " autocmd InsertEnter :NoMatchParen
39 | " autocmd InsertLeave :DoMatchParen
40 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## NEOVIM Config - Windvim
2 |
3 | 
4 |
5 | ## Install
6 | ``` bash
7 | ./scripts/setup.sh
8 |
9 | ```
10 | ## Plugins
11 |
12 | * [Paq](https://github.com/savq/paq-nvim)
13 | * [Telescope](https://github.com/nvim-telescope/telescope.nvim)
14 | * [windline](https://github.com/windwp/windline.nvim)
15 |
16 |
17 | ## Plug
18 |
19 | I use [Paq](https://github.com/savq/paq-nvim) and create a function Plug so I can use it like (vim-plug)
20 | with Plug you can customize it to load config from lua or vim
21 |
22 | ``` lua
23 |
24 | Plug {'neoclide/jsonc.vim' , ft = 'json'}
25 | Plug {'junegunn/gv.vim' , on = 'GV'}
26 |
27 |
28 |
29 | -- load vim file in /plug/fern.vim
30 | Plug {'lambdalisue/fern.vim' , config = 'fern.vim'}
31 |
32 | ```
33 | Plug can lazy load with filetype(ft),command(on), event and key.
34 |
35 | I don't need to rename Plug to `paq` or `use`
36 |
37 | All plugins config is store on folder /plug/.vim and /lua/wind/plug/.lua
38 |
39 | If you are develop or test config you can run command `:WindDev`.
40 | It will enable dev mode and all import module is auto reload.
41 |
42 |
43 | ## LSP
44 |
45 | by default it load some lsp server lua, jsonls, yamls.
46 |
47 | Another lsp can load when you open project and run script with my plugin
48 | [project-config](https://github.com/windwp/nvim-projectconfig)
49 |
50 | ``` lua
51 |
52 | Wind.load_lsp {'tsserver', 'efm'}
53 | Wind.load_lsp 'gopls'
54 |
55 | Wind.load_theme 'gruvbox'
56 |
57 | ```
58 | ## Thanks
59 |
60 | * [habamax](https://github.com/habamax/)
61 | * [tjdevries](https://github.com/tjdevries)
62 | * [glepnir](https://github.com/glepnir)
63 |
64 |
--------------------------------------------------------------------------------
/lua/wind/plug/windline/animation.lua:
--------------------------------------------------------------------------------
1 | local animation = require('wlanimation')
2 | local effects = require('wlanimation.effects')
3 |
4 | local blue_colors = {
5 | '#90CAF9',
6 | '#64B5F6',
7 | '#42A5F5',
8 | '#2196F3',
9 | '#1E88E5',
10 | '#1976D2',
11 | '#1565C0',
12 | '#0D47A1',
13 | }
14 |
15 | local function play()
16 | if Wind.state.animation==true then
17 | Wind.state.animation=false
18 | animation.stop_all()
19 | else
20 | animation.stop_all()
21 | Wind.state.animation=true
22 | animation.animation({
23 | data = {
24 | { 'waveleft1', effects.list_color(blue_colors, 6) },
25 | { 'waveleft2', effects.list_color(blue_colors, 5) },
26 | { 'waveleft3', effects.list_color(blue_colors, 4) },
27 | { 'waveleft4', effects.list_color(blue_colors, 3) },
28 | { 'waveleft5', effects.list_color(blue_colors, 2) },
29 | },
30 | -- timeout = 100,
31 | delay = 200,
32 | interval = 150,
33 | })
34 |
35 | animation.animation({
36 | data = {
37 | { 'waveright1', effects.list_color(blue_colors, 2) },
38 | { 'waveright2', effects.list_color(blue_colors, 3) },
39 | { 'waveright3', effects.list_color(blue_colors, 4) },
40 | { 'waveright4', effects.list_color(blue_colors, 5) },
41 | { 'waveright5', effects.list_color(blue_colors, 6) },
42 | },
43 | -- timeout = 100,
44 | delay = 200,
45 | interval = 150,
46 | })
47 | end
48 | end
49 |
50 | return {
51 | play = play,
52 | }
53 |
--------------------------------------------------------------------------------
/lua/wind/plug/gitsigns.lua:
--------------------------------------------------------------------------------
1 | require('gitsigns').setup {
2 | signs = {
3 | add = {hl = 'GitGutterAdd' , text = '┃', numhl='GitSignsAddNr' , linehl='DiffAdd'},
4 | change = {hl = 'GitGutterChange', text = '┃', numhl='GitSignsChangeNr', linehl='DiffChange'},
5 | -- delete = {hl = 'GitGutterDelete', text = 'ﬠ', numhl='GitSignsDeleteNr', linehl='DiffDelete'},
6 | -- topdelete = {hl = 'GitGutterDelete', text = 'ﬢ', numhl='GitSignsDeleteNr' ,linehl='DiffDelete'},
7 | delete = {hl = 'GitGutterDelete', text = '┃', numhl='GitSignsDeleteNr', linehl='DiffDelete', show_count = true},
8 | topdelete = {hl = 'GitGutterDelete', text = '▔', numhl='GitSignsDeleteNr' ,linehl='DiffDelete', show_count = true},
9 | changedelete = {hl = 'GitGutterDelete', text = '┃', numhl='GitSignsChangeNr', linehl='DiffDelete', show_count = true},
10 | },
11 | numhl = false,
12 | linehl = false,
13 | keymaps = {
14 | -- Default keymap options
15 | noremap = true,
16 | buffer = true,
17 |
18 | ['n gj'] = 'lua require"gitsigns".next_hunk()',
19 | ['n gk'] = 'lua require"gitsigns".prev_hunk()',
20 |
21 | -- ['n hs'] = 'lua require"gitsigns".stage_hunk()',
22 | -- ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()',
23 | ['n gu'] = 'lua require"gitsigns".reset_hunk()',
24 | ['n gR'] = ':Gread', -- reset buffer
25 | ['n gh'] = 'lua require"gitsigns".preview_hunk()',
26 | ['n gb'] = 'lua require"gitsigns".blame_line()',
27 |
28 | -- Text objects
29 | -- ['o ih'] = ':lua require"gitsigns".text_object()',
30 | -- ['x ih'] = ':lua require"gitsigns".text_object()'
31 | },
32 | watch_index = {
33 | interval = 1000
34 | },
35 | sign_priority = 6,
36 | update_debounce = 100,
37 | status_formatter = nil, -- Use default
38 | use_decoration_api = true,
39 | use_internal_diff = true, -- If luajit is present
40 | }
41 |
--------------------------------------------------------------------------------
/plugin/foldtext.vim:
--------------------------------------------------------------------------------
1 |
2 | "" Name: plugin/foldtext.vim
3 | "" Author: Maxim Kim
4 | "" https://github.com/habamax/.vim/blob/master/plugin/foldtext.vim
5 |
6 | set foldtext=MyFoldText()
7 | func! MyFoldText()
8 | let foldchar = get(b:, 'foldchar', '•')
9 | let strip_comments = get(b:, 'foldtext_strip_comments', v:false)
10 | let strip_add_regex = get(b:, 'foldtext_strip_add_regex', '')
11 |
12 | let line = getline(v:foldstart)
13 |
14 | " markdown frontmatter -- just take the next line hoping it would be
15 | " title: Your title
16 | if line =~ '^----*$'
17 | let line = getline(v:foldstart+1)
18 | endif
19 |
20 | let indent = indent(v:foldstart)
21 |
22 | let foldlevel = repeat(foldchar, v:foldlevel)
23 | let foldindent = repeat(' ', max([indent-strdisplaywidth(foldlevel), strdisplaywidth(foldchar)]))
24 | let foldlines = (v:foldend - v:foldstart + 1)
25 |
26 | " always strip away fold markers
27 | let strip_regex = '\%(\s*{{{\d*\s*\)'
28 | if strip_comments
29 | let strip_regex .= '\|\%(^\s*'
30 | \. substitute(&commentstring, '\s*%s\s*', '', '')
31 | \. '*\s*\)'
32 | endif
33 | let line = substitute(line, strip_regex, '', 'g')
34 |
35 | " additional per buffer strip
36 | if strip_add_regex != ""
37 | let line = substitute(line, strip_add_regex, '', 'g')
38 | endif
39 |
40 | let line = substitute(line, '^\s*\|\s*$', '', 'g')
41 | let line = substitute(line, '^"', '', 'g')
42 | let line = substitute(line, ':$', '', 'g')
43 |
44 |
45 | let nontextlen = strdisplaywidth(foldlevel.foldindent.foldlines.' ()')
46 | let foldtext = strcharpart(line, 0, winwidth(0) - nontextlen)
47 | let foldtext="[".foldtext." ]"
48 |
49 | let foldlines_padding = ' '
50 |
51 | return printf("%s%s%s%s(%d) ",
52 | \ foldlevel,
53 | \ foldindent,
54 | \ foldtext,
55 | \ foldlines_padding,
56 | \ foldlines)
57 | endfunc
58 |
--------------------------------------------------------------------------------
/lua/wind/plug/me/alternate.lua:
--------------------------------------------------------------------------------
1 | -- fast switch to another file match pattern
2 | -- vim.g.wind_switch_file = {
3 | -- {
4 | -- source = "main.svelte",
5 | -- target = "editor.svelte"
6 | -- },
7 | -- {
8 | -- source = "editor.svelte",
9 | -- target = "main.svelte"
10 | -- },
11 | -- }
12 | local M={}
13 | local nav=import('core.nav')
14 |
15 | local function getTargetPath(prefix)
16 |
17 | if vim.g.wind_switch_file == nil then
18 | print("Not have a config file")
19 | return
20 | end
21 | local filename = vim.fn.expand("%:t")
22 | local data = vim.g.wind_switch_file
23 | -- TEST
24 | -- filename="dio.lua"
25 | -- local data = {
26 | -- {
27 | -- source = ".*%.lua",
28 | -- target = "yank.xml"
29 | -- },
30 | -- {
31 | -- source = ".*%.html",
32 | -- target = "{}.ts"
33 | -- },
34 | -- {
35 | -- source = ".*%.ts",
36 | -- target = "{}.html"
37 | -- },
38 | -- }
39 | local path=''
40 | for _,item in pairs(data) do
41 | if filename:match(item.source) then
42 | path = vim.fn.expand("%:h")
43 | if item.target:match("{}") then
44 | filename=filename:gsub("%.%w*$","")
45 | local targetName=string.gsub(item.target,"{}",filename)
46 | path = path .. "/"..targetName
47 | else
48 | path = path .. "/"..item.target
49 | end
50 | if prefix ~= nil then
51 | if not path:match(prefix..'$') then
52 | path = "not valid"
53 | end
54 | end
55 | if vim.fn.filereadable(path) == 1 then
56 | return path
57 | end
58 | end
59 | end
60 | return ""
61 | end
62 | function M.switch(prefix)
63 | local target=getTargetPath(prefix)
64 | if vim.fn.filereadable(target) == 1 then
65 | nav.tabOpen(target)
66 | return
67 | end
68 | end
69 |
70 | function M.vsplit(prefix)
71 | local target=getTargetPath(prefix)
72 | if vim.fn.filereadable(target) == 1 then
73 | local windowId = nav.get_window_id(target)
74 | if windowId and windowId > 0 then
75 | vim.fn.win_gotoid(windowId)
76 | else
77 | vim.cmd (":vsplit " .. target)
78 | end
79 | return
80 | end
81 | end
82 |
83 | return M
84 |
--------------------------------------------------------------------------------
/lua/wind/plug/compe.lua:
--------------------------------------------------------------------------------
1 | local keymap = import('core.keymap')
2 |
3 | require'compe'.setup {
4 | enabled = true,
5 | debug = true,
6 | min_length = 2,
7 | preselect = "disable",
8 | source_timeout = 200,
9 | incomplete_delay = 400,
10 | allow_prefix_unmatch = false,
11 | source = {
12 | path = true;
13 | buffer = true;
14 | vsnip = true;
15 | nvim_lsp = true;
16 | nvim_lua = true;
17 | };
18 | }
19 | require('vim.lsp.protocol').CompletionItemKind = {
20 | ''; -- Text = 1;
21 | ''; -- Method = 2;
22 | 'ƒ'; -- Function = 3;
23 | ''; -- Constructor = 4;
24 | ''; -- Field = 5;
25 | ''; -- Variable = 6;
26 | ''; -- Class = 7;
27 | 'ﰮ'; -- Interface = 8;
28 | ''; -- Module = 9;
29 | ''; -- Property = 10;
30 | ''; -- Unit = 11;
31 | ''; -- Value = 12;
32 | '了'; -- Enum = 13;
33 | ''; -- Keyword = 14;
34 | ''; -- Snippet = 15;
35 | ''; -- Color = 16;
36 | ''; -- File = 17;
37 | ''; -- Reference = 18;
38 | ''; -- Folder = 19;
39 | ''; -- EnumMember = 20;
40 | ''; -- Constant = 21;
41 | ''; -- Struct = 22;
42 | "⌘"; -- Event = 23;
43 | ""; -- Operator = 24;
44 | "♛"; -- TypeParameter = 25;
45 | }
46 |
47 |
48 |
49 | keymap.imap({'',function ()
50 | if vim.fn.pumvisible() == 1 then
51 | if vim.fn.complete_info()["selected"] ~= -1 then
52 | return vim.fn["compe#confirm"]()
53 | else
54 | return keymap.t("a")
55 | end
56 | elseif vim.fn.call("vsnip#available", {1}) == 1 then
57 | return keymap.t "(vsnip-expand-or-jump)"
58 | else
59 | return keymap.t""
60 | end
61 | end, expr = true, noremap = false})
62 |
63 | keymap.imap({'', 'compe#complete()',silent = true, expr = true, noremap = true})
64 |
--------------------------------------------------------------------------------
/lua/wind/plug/_start.lua:
--------------------------------------------------------------------------------
1 | -- vim: foldmethod=marker sw=2 formatoptions-=o foldlevel=0
2 |
3 | vim.g.lens_disabled_filetypes = {'fugitiveblame', 'fern', 'selectprompt', 'selectresults','quickfix','qf','which_key'}
4 |
5 | -- Match up {{{
6 | vim.g.loaded_matchparen = 1
7 | vim.g.matchup_matchparen_offscreen = { method= 'popup'}
8 | vim.g.matchup_matchpref = {
9 | svelte = { tagnameonly = 1, },
10 | vue = { tagnameonly = 1, },
11 | typescriptreact = { tagnameonly = 1, },
12 | html = { tagnameonly = 1, },
13 | }
14 |
15 | -- }}}
16 |
17 | -- Compe {{{
18 | vim.g.loaded_compe_treesitter = 1
19 | vim.g.loaded_compe_calc = 1
20 | vim.g.loaded_compe_snippets_nvim = 1
21 | vim.g.loaded_compe_spell = 1
22 | vim.g.loaded_compe_vim_lsc = 1
23 | vim.g.loaded_compe_vim_lsp = 1
24 | -- }}}
25 |
26 | -- Markdown : {{{
27 | vim.g.vim_markdown_no_default_key_mappings = 1
28 | vim.g.vim_markdown_new_list_item_indent = 0
29 | vim.g.vim_markdown_auto_insert_bullets = 1
30 | vim.g.vim_markdown_follow_anchor = 1
31 | vim.g.vim_markdown_conceal_code_blocks = 0
32 | vim.g.vim_markdown_anchorexpr = [['^#\\\+ *'.v:anchor.'$']]
33 |
34 | vim.api.nvim_exec([[
35 | augroup markdown_tool
36 | autocmd!
37 | autocmd BufReadPost *.md call FixVimMarkdown()
38 | autocmd InsertLeave *.md call FixMdTable()
39 | augroup END
40 | ]],true)
41 |
42 | -- }}}
43 |
44 | -- GitGutter {{{
45 |
46 | vim.g.gitgutter_sign_added = '┃'
47 | vim.g.gitgutter_sign_modified = '┃'
48 | vim.g.gitgutter_sign_removed = '┃'
49 |
50 | --}}}
51 |
52 | -- Conflict Marker {{{
53 |
54 | vim.g.conflict_marker_highlight_group = ''
55 | vim.g.conflict_marker_begin = '^<<<<<<< .*$'
56 | vim.g.conflict_marker_end = '^>>>>>>> .*$'
57 |
58 | --}}}
59 |
60 | -- hight light extra white space
61 |
62 |
63 | vim.g.EasyMotion_smartcase = 1
64 | vim.g.switch_mapping = "gst"
65 | vim.g.switch_custom_definitions = {
66 | {'0', '1'},
67 | {'const', 'let', 'var'}
68 | }
69 |
70 | vim.g.undotree_SetFocusWhenToggle = 1
71 | vim.g.no_default_tabular_maps = 0
72 |
73 | -- "custom vifm to display image
74 | vim.g.vifm_exec ='$HOME/.config/vifm/scripts/vifmrun'
75 |
76 | vim.g.vsnip_snippet_dir = Wind.vim_path .. "/snippets"
77 |
78 | -- TmuxLine {{{
79 |
80 | if vim.g.wind_tmux_line == 1 then
81 | vim.g.tpipeline_tabline = 1
82 | import('general.autocmd').add_autocmd_enter('tpipe', function ()
83 | vim.cmd[[let g:tpipeline_statusline = &tabline]]
84 | vim.cmd[[set conceallevel=2]]
85 | end)
86 | end
87 | --}}}
88 |
--------------------------------------------------------------------------------
/lua/wind/general/autocmd.lua:
--------------------------------------------------------------------------------
1 | local vim = vim
2 | local autocmd = {}
3 |
4 | function autocmd.nvim_create_augroups(definitions)
5 | for group_name, definition in pairs(definitions) do
6 | vim.api.nvim_command('augroup '..group_name)
7 | vim.api.nvim_command('autocmd!')
8 | for _, def in ipairs(definition) do
9 | local command = table.concat(vim.tbl_flatten{'autocmd', def}, ' ')
10 | vim.api.nvim_command(command)
11 | end
12 | vim.api.nvim_command('augroup END')
13 | end
14 | end
15 | function autocmd.setup()
16 | if Wind.__autocmd_setup then return end
17 | Wind.__autocmd_setup = true
18 | local definitions = {
19 | lens ={
20 | {"BufWinEnter,WinEnter" ,"*", "silent! call win#lens()"}
21 | },
22 | bufs = {
23 | {"BufWritePre","*.tmp","setlocal noundofile"};
24 | {"BufWritePre","*.log","setlocal noundofile"};
25 | {"BufWritePre","*.bak","setlocal noundofile"};
26 | };
27 | wins = {
28 | -- write file when focus lost
29 | {'FocusLost','*','silent! wa'},
30 | -- if open 2 buffer in diffrent tab close it
31 | -- {"BufEnter" , '*' , "call v:lua.import('core.nav').on_buffer_open(expand(''))"};
32 | {"VimEnter" , "*" , "lua import('general.autocmd').on_enter()"};
33 | {"ColorScheme" , "*" , "lua import('general.autocmd').on_color()"}
34 | };
35 | ft = {
36 | {"FileType", "typescript,typescriptreact,javascript", "imap ; ;:lua require('nvim-autospace').format(999)A"},
37 | };
38 | lsp = {
39 | {"BufWritePre" ,"*.tsx", ":Format"}
40 | };
41 | yank = {
42 | {"TextYankPost", [[* silent! lua vim.highlight.on_yank({higroup="IncSearch", timeout=400})]]};
43 | };
44 | }
45 |
46 | autocmd.nvim_create_augroups(definitions)
47 | end
48 |
49 |
50 | Wind.enter_event = Wind.enter_event or {}
51 | Wind.color_event = Wind.color_event or {}
52 |
53 |
54 | autocmd.add_autocmd_enter = function(name, func)
55 | Wind.enter_event[name] = func
56 | end
57 |
58 | autocmd.on_enter = function()
59 | for _, handler in pairs(Wind.enter_event) do
60 | handler()
61 | end
62 | end
63 |
64 | autocmd.add_autocmd_color = function(name, func,add_to_enter)
65 | Wind.color_event[name] = func
66 | if add_to_enter then
67 | Wind.enter_event[name] = func
68 | end
69 | end
70 |
71 | autocmd.on_color = function()
72 | for _, handler in pairs(Wind.color_event) do
73 | handler()
74 | end
75 | end
76 |
77 | autocmd.setup()
78 | return autocmd
79 |
--------------------------------------------------------------------------------
/lua/wind/general/keys.lua:
--------------------------------------------------------------------------------
1 | local map = import('core.keymap')
2 | local n, i, v, x =
3 | map.nnoremap, map.inoremap, map.vnoremap, map.xnoremap
4 |
5 |
6 | n({'ev',':tabnew ~/.config/nvim/init.lua | tcd ~/.config/nvim/' , 'edit vim' } )
7 | n({'ep','lua require("nvim-projectconfig").edit_project_config()' , 'edit project current folder' } )
8 | n({'ec',':TabCustomOpen ~/.config/alacritty/alacritty.yml' , 'edit alacritty' } )
9 | n({'en',':TabCustomOpen ~/work/md-note/index.md' , 'edit note' } )
10 | n({'ei',':TabCustomOpen ~/.config/regolith/i3/config' , 'edit i3' } )
11 | n({'ed',':TabCustomOpen ~/dotfiles/install/env.sh' , 'edit dotfiles' } )
12 | n({'ew',':TabCustomOpen ~/.local/share/nvim/site/pack/paqs/start/wind-colors/lua/wind-colors.lua' , 'edit dotfiles' } )
13 |
14 | n({'h', 's', 'split horizontal'})
15 | n({'q', ':call wind#QfToggle()', 'toggle quick fix'})
16 | n({'v', 'v', 'split vertical'})
17 | n({'z', ':setlocal spell! spell?', 'toggle spell'})
18 |
19 | n({'s', ':HopChar2', 'jump to word'})
20 |
21 | n({'u9', 'lua import("plug.windline.animation").play()', 'run animation'})
22 | n({'um', ':MyRedir messages', 'log output message'})
23 | n({'ur', ':call ToggleResizeMode()', 'toggle resize mode'})
24 | n({'ud', ":windo diffthis", "set test command"})
25 |
26 | n({'gx', "lua import('core.nav').open_or_search(0)", 'open or search '})
27 | v({'gx', ":call v:lua.import('core.nav').open_or_search(1)",'open_or_search'})
28 | n({'gb', "lua import('core.nav').go_back()", 'go back'})
29 | n({'gk', "lua import('core.nav').goto_buff_or_qf('previous')","goto previous"})
30 | n({'gj', "lua import('core.nav').goto_buff_or_qf('next')", "goto next"})
31 |
32 |
33 | n({'', "lua Wind.load_plug('copyq').show()"})
34 | i({'', ":lua Wind.load_plug('copyq').show()"})
35 | n({'ul', "lua require('nvim-autospace').format()", desc = "format current line"})
36 |
37 | n({'f', 'lua require("spectre").open({is_insert_mode=true})'})
38 | n({'rp', "viw:lua require('spectre').open_file_search()","search current file"})
39 | v({'R', ":lua require('spectre').open_visual()", "open spectre"})
40 | n({'R', "viw:lua require('spectre').open_visual()", "open spectre"})
41 | n({'lt', ":LspTroubleOpen", "lsp open trouble"})
42 | n({';v', 'lua require("spectre").open({cwd="~/.config/nvim"})', "find nvim config"})
43 |
44 | n({'', 'lua require("Navigator").left()'})
45 | n({'', 'lua require("Navigator").right()'})
46 | n({'', 'lua require("Navigator").down()'})
47 | n({'', 'lua require("Navigator").up()'})
48 |
--------------------------------------------------------------------------------
/snippets/sh.json:
--------------------------------------------------------------------------------
1 | {
2 | "bash": {
3 | "prefix": [
4 | "bash",
5 | "#!",
6 | "shebang"
7 | ],
8 | "body": "${1|#!/bin/bash,#!/usr/bin/env bash|}\n",
9 | "description": [
10 | "Option 1:\n",
11 | "#!/bin/bash\n",
12 | "Description: Shebang Bash executor.\n",
13 | "Option 2:\n",
14 | "#!/usr/bin/env bash\n",
15 | "Description: Shell searchs for the first match of bash in the $PATH environment variable.\n",
16 | "It can be useful if you aren't aware of the absolute path or don't want to search for it.\n"
17 | ]
18 | },
19 | "echo": {
20 | "prefix": "echo",
21 | "body": "echo \"${0:message}\"",
22 | "description": "Echo a message."
23 | },
24 | "read": {
25 | "prefix": "read",
26 | "body": "read -r ${0:VAR}",
27 | "description": "Read input of ${VAR}."
28 | },
29 | "if": {
30 | "prefix": "if",
31 | "body": "if [[ ${0:condition} ]]; then\n\t${1}\nfi",
32 | "description": "An IF statement."
33 | },
34 | "elseif": {
35 | "prefix": "elseif",
36 | "body": "elif [[ ${0:condition} ]]; then\n\t${1}",
37 | "description": "Add an elseif to an if statement."
38 | },
39 | "else": {
40 | "prefix": "else",
41 | "body": "else\n\t${0:command}",
42 | "description": "else"
43 | },
44 | "for_in": {
45 | "prefix": "for_in",
46 | "body": "for ${0:VAR} in $${1:LIST}\ndo\n\techo \"$${0:VAR}\"\ndone\n",
47 | "description": "for loop in list"
48 | },
49 | "for_i": {
50 | "prefix": "for_i",
51 | "body": "for ((${0:i} = 0; ${0:i} < ${1:10}; ${0:i}++)); do\n\techo \"$${0:i}\"\ndone\n",
52 | "description": "An index-based iteration for loop."
53 | },
54 | "while": {
55 | "prefix": "while",
56 | "body": "while [[ ${1:condition} ]]; do\n\t${0}\ndone\n",
57 | "description": "A while loop by condition."
58 | },
59 | "until": {
60 | "prefix": "until",
61 | "body": "until [[ ${1:condition} ]]; do\n\t${0}\ndone\n",
62 | "description": "until loop by condition"
63 | },
64 | "function": {
65 | "prefix": "function",
66 | "body": "${1:name} ()\n{\n\t${0}\n}",
67 | "description": [
68 | "This defines a function named name.\n",
69 | "The reserved word function is optional.\n",
70 | "If the function reserved word is supplied, the parentheses are optional.\n",
71 | "1. Recommended way:\n",
72 | "name() {}\n",
73 | "2. C-like-way:\nfunction name [()] {}"
74 | ]
75 | },
76 | "case": {
77 | "prefix": "case",
78 | "body": "case \"$${0:VAR}\" in\n\t${1:1}) echo 1\n\t;;\n\t${2:2|3}) echo 2 or 3\n\t;;\n\t*) echo default\n\t;;\nesac\n",
79 | "description": [
80 | "case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac\n",
81 | "A case command first expands word, and tries to match it against each pattern in turn."
82 | ]
83 | },
84 | "break": {
85 | "prefix": "break",
86 | "body": "break ${0}",
87 | "description": [
88 | "The break command tells Bash to leave the loop straight away.\n",
89 | "Enter the break or break (n) where n=number of loops."
90 | ]
91 | },
92 | "expr": {
93 | "prefix": "expr",
94 | "body": "expr ${0:1 + 1}",
95 | "description": "Calculate numbers with Bash."
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/lua/wind/plug/windline/init.lua:
--------------------------------------------------------------------------------
1 | local windline = require('windline')
2 | local helper = require('windline.helpers')
3 | local comps = import('plug.windline.comps')
4 |
5 | local default = {
6 | filetypes = { 'default' },
7 | active = {
8 | comps.vi_mode,
9 | comps.vi_mode_sep,
10 | comps.git_status,
11 | comps.lsp_diagnos,
12 | comps.search_count,
13 | comps.space,
14 | comps.file_name,
15 | comps.wave_left,
16 | comps.divider,
17 | comps.divider,
18 | comps.wave_right,
19 | comps.alert_mode,
20 | comps.lsp_status,
21 | comps.line_col,
22 | comps.sep_second_left_black,
23 | comps.progress,
24 | },
25 | in_active = {
26 | comps.file_name_inactive,
27 | comps.divider,
28 | comps.divider,
29 | comps.line_col_inactive,
30 | comps.sep_second_left,
31 | comps.progress_inactive,
32 | },
33 | }
34 |
35 | local explorer = {
36 | filetypes = { 'fern', 'NvimTree' , 'lir'},
37 | active = {
38 | { ' ', { 'white', 'black' } },
39 | { helper.separators.slant_right, { 'black', 'MiddleBg' } },
40 | comps.divider,
41 | comps.explorer_name,
42 | comps.space,
43 | },
44 | show_in_active = true,
45 | }
46 |
47 | local quickfix = {
48 | filetypes = { 'qf', 'Trouble' },
49 | active = {
50 | { '🚦 Quickfix ', { 'white', 'black' } },
51 | { helper.separators.slant_right, { 'black', 'black_light' } },
52 | {
53 | function() return vim.fn.getqflist({title = 0}).title end,
54 | {'cyan', 'black_light'}
55 | },
56 | { ' Total : %L ', { 'cyan', 'black_light' } },
57 | { helper.separators.slant_right, { 'black_light', 'InactiveBg' } },
58 | { ' ', { 'InactiveFg', 'InactiveBg' } },
59 | comps.divider,
60 | { helper.separators.slant_right, { 'InactiveBg', 'black' } },
61 | {'🧛 ',{'white', 'black'}}
62 | },
63 | show_in_active = true,
64 | }
65 |
66 | local terminal = {
67 | filetypes = { 'toggleterm' },
68 | active = {
69 | comps.terminal_mode,
70 | comps.terminal_name,
71 | comps.divider,
72 | comps.divider,
73 | comps.line_col_inactive,
74 | comps.sep_second_left,
75 | comps.progress_inactive,
76 | },
77 | show_in_active = true,
78 | }
79 |
80 | windline.setup({
81 | theme = require('windline.themes.wind'),
82 | colors_name = function(colors)
83 |
84 | colors.LeftFg = colors.black
85 | colors.LeftBg = colors.white
86 |
87 | colors.MiddleFg = colors.black
88 | colors.MiddleBg = colors.white_light
89 |
90 | colors.RightFg = colors.black
91 | colors.RightBg = colors.white
92 |
93 | colors.wavewhite = colors.white
94 |
95 | colors.waveleft1 = colors.MiddleBg
96 | colors.waveleft2 = colors.MiddleBg
97 | colors.waveleft3 = colors.MiddleBg
98 | colors.waveleft4 = colors.MiddleBg
99 | colors.waveleft5 = colors.MiddleBg
100 |
101 | colors.waveright1 = colors.MiddleBg
102 | colors.waveright2 = colors.MiddleBg
103 | colors.waveright3 = colors.MiddleBg
104 | colors.waveright4 = colors.MiddleBg
105 | colors.waveright5 = colors.MiddleBg
106 | return colors
107 | end,
108 | tabline={},
109 | statuslines = {
110 | default,
111 | explorer,
112 | quickfix,
113 | terminal
114 | },
115 | })
116 |
--------------------------------------------------------------------------------
/ftplugin/markdown.vim:
--------------------------------------------------------------------------------
1 |
2 | if exists("b:md_current_syntax") | finish | endif
3 | let b:md_current_syntax=1
4 | let g:my_list_task_progress= ['TODO', 'FIXME', 'PROGRESS', 'CANCELED', 'DONE' ]
5 | setlocal cole=1
6 |
7 | " toggle to do in markdown
8 | function! MyTodoToggle()
9 | let l:line=getline('.')
10 | if match(l:line ,'\[ \]')!=-1
11 | execute 's/\[ \]/\[x\]/'
12 | execute "\'\'"
13 | elseif match(l:line,'\[x\]')!=-1
14 | execute 's/\[x\]/\[ \]/'
15 | execute "\'\'"
16 | elseif match(l:line,'^ *\* [^\[]')!=-1
17 | execute 's/^\( *\)\* \([^\[]\)/\1* [ ] \2/'
18 | execute "\'\'"
19 | endif
20 | endfunction
21 |
22 | function! MyTableNewRow()
23 | let l:line=getline('.')
24 | if match(l:line,'^\s\=|')!=-1
25 | let l:text=substitute(l:line,'[^|]',' ','g')
26 | let l:text=substitute(l:text,' ','','g')
27 | let l:text=substitute(l:text,'|','| ','g')
28 | normal o
29 | execute "normal! i".l:text
30 | call feedkeys("0lli")
31 | endif
32 | endfunction
33 |
34 |
35 |
36 |
37 | function! FixVimMarkdown() abort
38 |
39 | nnoremap go :Toc
40 | " nnoremap gtt :call MyListTaskProgress()
41 | nnoremap gtc :call MyTodoToggle()
42 | nnoremap t :call MyTodoToggle()
43 | nnoremap gtn :call MyTableNewRow()
44 | nnoremap gtr :Toc
45 | nnoremap gtp :call MyPandocPdf()
46 |
47 |
48 | if exists("g:wind_use_note")
49 | hi htmlH1 ctermfg=88 guifg=#9d0006 ctermbg=None gui=bold term=bold cterm=bold
50 | hi htmlH2 ctermfg=106 guifg=#fb4934 ctermbg=None gui=bold
51 | hi htmlH3 ctermfg=166 guifg=#98971a ctermbg=None gui=bold
52 | hi htmlH4 ctermfg=109 guifg=#458588 ctermbg=None gui=bold
53 | hi htmlH5 ctermfg=124 guifg=#b16286 ctermbg=None gui=bold
54 | hi mkdCodeStart ctermfg=239 guifg=#9E9E9E ctermbg=None gui=bold
55 | hi mkdCodeEnd ctermfg=239 guifg=#9E9E9E ctermbg=None gui=bold
56 | hi mkdCode ctermfg=88 guifg=#427b58 ctermbg=None cterm=bold
57 | endif
58 |
59 | syn match mkdTodo /\vTODO/ containedin=mkdListItemLine,mkdItalic
60 | syn match mkdFixMe /\vFIXME/ containedin=mkdListItemLine,mkdItalic
61 | syn match mkdProgress /\vPROGRESS/ containedin=mkdListItemLine,mkdItalic
62 | syn match mkdCanceled /\vCANCELED/ containedin=mkdListItemLine,mkdItalic
63 | syn match mkdDone /\vDONE/ containedin=mkdListItemLine,mkdItalic
64 |
65 | hi mkdTodo ctermfg=106 guifg=#fe8019 gui=bold
66 | hi mkdFixMe ctermfg=106 guifg=#cc241d gui=bold
67 | hi mkdProgress ctermfg=106 guifg=#83a598 gui=bold
68 | hi mkdCancled ctermfg=106 guifg=#fabd2f gui=bold
69 | hi mkdDone ctermfg=106 guifg=#00C853 gui=bold
70 |
71 | syntax match mkdCheckBox /\[\ \]/ conceal cchar= containedin=mkdListItemLine,mkdItalic
72 | syntax match mkdCheckBox /\[x\]/ conceal cchar= containedin=mkdListItemLine,mkdItalic
73 | " Plugin indentline will override it
74 | hi Conceal guifg=#427b58 ctermfg=88
75 | hi htmlItalic gui=italic
76 |
77 | setlocal shiftwidth=2
78 | setlocal formatoptions=tron
79 | " it will allow auto insert *+- in comment after newline
80 | setlocal comments=b:*,b:+,b:-
81 |
82 | endfunction
83 |
84 | function! MyPandocPdf()
85 | execute "!pandoc ". expand("%:p") ." -o " .expand("%:p:s?\.md$?\.pdf?")." --from markdown --template eisvogel --listings"
86 | endfunction
87 |
88 | " fix markdown table algin
89 | function! FixMdTable()abort
90 | let l:line=getline('.')
91 | if match(l:line ,'^|')!=-1
92 | execute ":TableFormat"
93 | endif
94 | endfunction
95 |
96 |
--------------------------------------------------------------------------------
/plugin/wind.vim:
--------------------------------------------------------------------------------
1 | function! wind#open() abort
2 | " Linux/BSD
3 | if executable('xdg-open')
4 | return 'xdg-open'
5 | endif
6 | " MacOS
7 | if executable('open')
8 | return 'open'
9 | endif
10 | " Windows
11 | return 'explorer'
12 | endfunction
13 |
14 | "check current cursor is end of line"
15 | function! wind#IsEndOfLine() abort
16 | let l:allowWordReg = '[a-zA-Z0-9]'
17 | let l:line = getline('.')
18 | let l:pos = getcurpos()
19 | let l:charIndex = l:pos[2]
20 | let l:char=""
21 | while l:charIndex 0
34 | let l:count = l:count * v:prevcount
35 | endif
36 | let pos = getcurpos()[1]
37 | execute "normal! gv"
38 | let start = getpos("'<")[1]
39 | let end = getpos("'>")[1]
40 | if l:count == 1
41 | let resultline = end + 1
42 | elseif l:count ==-1
43 | let resultline = start - 2
44 | elseif l:count>0
45 | let resultline = pos + l:count
46 | else
47 | let resultline = pos + l:count-1
48 | endif
49 | try
50 | execute "normal! :m ".resultline."\gv"
51 | catch
52 | endtry
53 | endfunction
54 |
55 |
56 | function! wind#QfClose() abort
57 | for i in range(1, winnr('$'))
58 | let bnum = winbufnr(i)
59 | if getbufvar(bnum, '&buftype') == 'quickfix'
60 | cclose
61 | lclose
62 | return 1
63 | endif
64 | endfor
65 | return 0
66 | endfunction
67 |
68 | " save and quit use it with 'set confim' setting
69 | " auto close quick fix first
70 | function! wind#SuperQuit() abort
71 | if match(expand("%"), "^octo\:\/")>-1
72 | execute ":bd"
73 | return
74 | endif
75 | if match(expand("%"), "^fugitive\:\/\/")>-1 || match(expand("%"), "COMMIT_EDITMSG$")>-1
76 | call wind#QfClose()
77 | execute ":bd"
78 | return
79 | endif
80 | if wind#QfClose() == 1
81 | return
82 | end
83 | let l:blist = getbufinfo({'bufloaded': 1, 'buflisted': 1})
84 | " check to vim command mode
85 | if &buftype == 'nofile' || &buftype =='help'
86 | if &filetype =='vim'
87 | execute ":close"
88 | else
89 | execute ":bd"
90 | endif
91 | return
92 | end
93 | if &buftype == 'terminal' || &filetype =~? '^fern'
94 | execute ":q"
95 | return
96 | endif
97 |
98 | let l:bufnr = bufnr('%')
99 | " neu hien thi o 1 buffer khac thi close
100 | let l:windows = win_findbuf(l:bufnr)
101 | try
102 | if len(l:windows)>1
103 | close
104 | return
105 | end
106 | catch
107 | return
108 | endtry
109 | " check is the last buffer open then close vim
110 | let l:bufCount = 0
111 | for buf in getbufinfo({'buflisted':1})
112 | if get(g:, 'wind_auto_close', 0) == 1
113 | if len(buf.name)>2 && buf.changed == 1
114 | let l:bufCount = l:bufCount + 1
115 | endif
116 | else
117 | if len(buf.name)>2 || buf.changed == 1
118 | let l:bufCount = l:bufCount + 1
119 | endif
120 | endif
121 | endfor
122 | if l:bufCount >= 1
123 | execute ":bd"
124 | else
125 | execute ":q"
126 | endif
127 | endfunction
128 |
129 | " Toggle quickfix window.
130 | function! wind#QfToggle()
131 | if wind#QfClose() == 1| return| end
132 | copen
133 | endfunction
134 |
135 |
136 | augroup resCur
137 | autocmd!
138 | au BufReadPost *
139 | \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
140 | \ | exe "normal! g`\""
141 | \ | exe "normal! zz"
142 | \ | endif
143 | augroup END
144 |
--------------------------------------------------------------------------------
/lua/wind/plug/copyq.lua:
--------------------------------------------------------------------------------
1 | -- use Telescopt to get text from copyq
2 | --
3 | local actions = require('telescope.actions')
4 | local action_state = require('telescope.actions.state')
5 | local finders = require('telescope.finders')
6 | local pickers = require('telescope.pickers')
7 | local sorters = require('telescope.sorters')
8 | local themes=require('telescope.themes')
9 |
10 | local M={}
11 | local popup = require('popup')
12 | local conf = require('telescope.config').values
13 | local utils = require('telescope.utils')
14 | local log = require('telescope.log')
15 |
16 | M.msgLoadingPopup = function(msg, cmd, complete_fn)
17 | local row = math.floor((vim.o.lines-5) / 2)
18 | local width = math.floor(vim.o.columns / 1.5)
19 | local col = math.floor((vim.o.columns - width) / 2)
20 | for _ = 1, (width-#msg)/2, 1 do
21 | msg = " "..msg
22 | end
23 | local prompt_win, prompt_opts = popup.create(msg, {
24 | border ={},
25 | borderchars = conf.borderchars ,
26 | height = 5,
27 | col = col,
28 | line = row,
29 | width = width,
30 | })
31 | vim.api.nvim_win_set_option(prompt_win, 'winhl', 'Normal:TelescopeNormal')
32 | vim.api.nvim_win_set_option(prompt_win, 'winblend', 0)
33 | local prompt_border_win = prompt_opts.border and prompt_opts.border.win_id
34 | if prompt_border_win then vim.api.nvim_win_set_option(prompt_border_win, 'winhl', 'Normal:TelescopePromptBorder') end
35 | vim.defer_fn(vim.schedule_wrap(function()
36 | local results = utils.get_os_command_output(cmd)
37 | if not pcall(vim.api.nvim_win_close, prompt_win, true) then
38 | log.trace("Unable to close window: ", "copyq", "/", prompt_win)
39 | end
40 | complete_fn(results)
41 | end),10)
42 | end
43 |
44 | M.show = function()
45 | local max=100
46 | local opts = {}
47 | local separator=[[|||]]
48 | local cmd = {'copyq', 'separator', "\n"..separator, 'read'}
49 | for i = 0, max, 1 do
50 | table.insert(cmd, "" .. i)
51 | end
52 | M.msgLoadingPopup("Loading copyq ", cmd, function (results)
53 | local list = {}
54 | local item = {
55 | key = '',
56 | display = '',
57 | line = 1,
58 | text = ''
59 | }
60 | for _, value in pairs(results) do
61 | if string.match(value, "^" .. separator) ~= nil then
62 | if string.len(item.key) > 1 then
63 | table.insert(list, item)
64 | end
65 | local text=value:sub(#separator + 1, string.len(value) );
66 | item = {
67 | line = 0,
68 | display = text,
69 | key = text,
70 | text = text ,
71 | }
72 | else
73 | if item.key == '' and string.len(value) > 2 then
74 | item.key = value
75 | item.display = value
76 | item.line = 0
77 | end
78 | item.line = item.line + 1
79 | if item.line > 1 then
80 | item.display = item.key .. string.format(" [[%s lines]]", item.line)
81 | end
82 | item.text = item.text .. "\n" .. value
83 | end
84 | end
85 | table.insert(list, item)
86 | opts = themes.get_dropdown(opts)
87 | opts.previewer = false
88 | opts.width = nil
89 | pickers.new(opts,{
90 | prompt_title = 'Copyq',
91 | finder = finders.new_table {
92 | results = list,
93 | entry_maker = M.make_entry(),
94 | },
95 | sorter = sorters.get_generic_fuzzy_sorter(),
96 | attach_mappings = function()
97 | actions.select_default:replace(function (prompt_bufnr)
98 | local entry = action_state.get_selected_entry()
99 | actions.close(prompt_bufnr)
100 | if vim.api.nvim_buf_get_option(vim.api.nvim_get_current_buf(), "modifiable") then
101 | lines = {}
102 | for s in entry.value:gmatch("[^\r\n]+") do
103 | table.insert(lines, s)
104 | end
105 | vim.api.nvim_put(lines,'c',true ,true)
106 | end
107 | end
108 | )
109 | return true
110 | end,
111 | }):find()
112 | end)
113 | end
114 | M.make_entry=function()
115 | return function(entry)
116 | return{
117 | valid = true,
118 | value = entry.text,
119 | ordinal = entry.key,
120 | display = entry.display
121 | }
122 | end
123 | end
124 |
125 | return M
126 |
--------------------------------------------------------------------------------
/lua/wind/core/wind.lua:
--------------------------------------------------------------------------------
1 | -- global utils
2 | local M = {}
3 | _G.Wind = _G.Wind or M
4 | M.is_dev = false
5 | M.root='wind'
6 | M.func = {} -- global func for keymap
7 | M.state = {}-- global state
8 | local home = os.getenv('HOME')
9 | local path_sep = M.is_windows and '\\' or '/'
10 | local os_name = vim.loop.os_uname().sysname
11 | vim.g.wind_os_name = os_name
12 |
13 | local function load_variables ()
14 | M.is_mac = os_name == 'Darwin'
15 | M.is_linux = os_name == 'Linux'
16 | M.is_windows = os_name == 'Windows'
17 | M.vim_path = vim.fn.stdpath('config')
18 | M.cache_dir = home .. path_sep .. '.vim' .. path_sep .. '.cache' .. path_sep
19 | M.path_sep = path_sep
20 | M.home = home
21 | end
22 |
23 | M.check_big_file = function()
24 | local big_file_size = 100
25 | local fname = vim.fn.expand('%:p:f')
26 | if fname then
27 | local fsize = vim.fn.getfsize(fname) or 1
28 | if fsize ==-2 or fsize > big_file_size * 1024 then
29 | Wind.state.is_open_big_file = true
30 | return true
31 | end
32 | end
33 | return false
34 | end
35 | -- load custom lsp
36 | M.load_lsp = function (langs)
37 | if type(langs) == 'string' then langs = {langs} end
38 | for _, lang in pairs(langs) do
39 | Wind.load_plug('lsp.lsp').load_lsp(lang)
40 | end
41 | end
42 |
43 | M.load_theme = function(theme_name)
44 | if vim.g.theme_name == theme_name then return end
45 | vim.g.theme_name = theme_name
46 | import('general.setting').load_theme(theme_name, true)
47 | end
48 |
49 | M.load_plug = function (plug)
50 | if string.match(plug, '%.vim$') then
51 | import(string.format('%s/plug/%s', Wind.vim_path, plug))
52 | else
53 | return import('plug.' .. plug)
54 | end
55 | end
56 |
57 | -- https://github.com/nvim-lua/plenary.nvim/blob/master/lua/plenary/reload.lua
58 | local function reload_module(module_name, starts_with_only)
59 | -- TODO: Might need to handle cpath / compiled lua packages? Not sure.
60 | local matcher
61 | if not starts_with_only then
62 | matcher = function(pack)
63 | return string.find(pack, module_name, 1, true)
64 | end
65 | else
66 | matcher = function(pack)
67 | return string.find(pack, '^' .. module_name)
68 | end
69 | end
70 |
71 | for pack, _ in pairs(package.loaded) do
72 | if matcher(pack) then
73 | package.loaded[pack] = nil
74 | end
75 | end
76 | end
77 |
78 | _G.P = function (a)
79 | print(vim.inspect(a))
80 | end
81 |
82 | _G.R = function(name)
83 | reload_module(name)
84 | return require(name)
85 | end
86 |
87 | M.import_vim = function(path)
88 | vim.cmd("source" .. path )
89 | end
90 |
91 | M.import_lua = function(path)
92 | vim.cmd("luafile ".. path)
93 | end
94 |
95 | _G.import = function (path)
96 | if string.match(path, '%.vim$') then
97 | local err, detail = pcall(M.import_vim, path)
98 | if not err then
99 | print("Import vim error: " .. path)
100 | vim.api.nvim_err_writeln(vim.inspect(detail))
101 | end
102 | return
103 | end
104 | if string.match(path, '%.lua$') then
105 | local err, detail = pcall(M.import_lua, path)
106 | if not err then
107 | print("Import lua error: " .. path)
108 | vim.api.nvim_err_writeln(vim.inspect(detail))
109 | end
110 | return
111 | end
112 |
113 | path = string.format("%s.%s", M.root, path)
114 |
115 | if M.is_dev then
116 | return R(path)
117 | else
118 | local check, detail = pcall(require,path)
119 | if check then
120 | return detail
121 | else
122 | print("Import module error: " .. path)
123 | vim.api.nvim_err_writeln(debug.traceback(detail))
124 | -- vim.api.nvim_err_writeln(detail)
125 | end
126 | end
127 | end
128 |
129 |
130 | M.live_reload = function(name)
131 | if _G._require == nil then
132 | print('live reload : ' .. name)
133 | _G.__is_log = true
134 | _G._require = require
135 | _G.require = function(path)
136 | if string.find(path,string.format('^%s[^_]*$',name)) ~= nil then
137 | reload_module(path)
138 | end
139 | return _G._require(path)
140 | end
141 | end
142 | end
143 |
144 | load_variables()
145 |
146 | return M
147 |
--------------------------------------------------------------------------------
/lua/wind/plugins.lua:
--------------------------------------------------------------------------------
1 | -- vim: foldmethod=marker sw=2 formatoptions-=o foldlevel=0
2 |
3 | if vim.g.wind_use_plugin == 0 then return end
4 |
5 | local plug = import('core.plug')
6 | local Plug = plug.Plug
7 |
8 |
9 | -- some config for plugin if it use with packadd
10 | Wind.load_plug('_start')
11 |
12 | -- Basic: {{{
13 | Plug 'nvim-lua/popup.nvim'
14 | Plug 'nvim-lua/plenary.nvim'
15 | Plug 'editorconfig/editorconfig-vim'
16 | Plug 'numToStr/Navigator.nvim'
17 | Plug {'windwp/windline.nvim', config = 'windline'}
18 | Plug {'windwp/nvim-projectconfig' , config = 'project-config'}
19 | ---}}}
20 |
21 |
22 | -- Git: {{{
23 | Plug {'tpope/vim-fugitive' , config = 'gitopen.vim'}
24 | Plug {'rhysd/git-messenger.vim' , on = 'GitMessenger'}
25 | Plug {'junegunn/gv.vim' , on = 'GV' ,}
26 | Plug 'rhysd/conflict-marker.vim'
27 | Plug {'lewis6991/gitsigns.nvim', config = 'gitsigns'}
28 | -- }}}
29 |
30 | -- Lsp: {{{
31 |
32 | Plug {'neovim/nvim-lspconfig', config = 'lsp.setup'}
33 |
34 | Plug {'hrsh7th/nvim-compe', config = 'compe'}
35 | Plug {'hrsh7th/vim-vsnip', event = "InsertEnter"}
36 | Plug {'hrsh7th/vim-vsnip-integ', event = "InsertEnter"}
37 | Plug {'mhartington/formatter.nvim', config = 'formatter' , key = "f"}
38 |
39 | -- }}}
40 | --
41 | -- Telescope:{{{
42 | Plug {'nvim-telescope/telescope.nvim', config = 'telescope'}
43 | Plug 'nvim-telescope/telescope-fzy-native.nvim'
44 | Plug 'nvim-telescope/telescope-github.nvim'
45 | Plug 'nvim-telescope/telescope-media-files.nvim'
46 | -- }}}
47 |
48 | -- Treesitter: {{{
49 | local use_ts = vim.g.wind_use_treesitter == 1
50 |
51 | Plug {'nvim-treesitter/nvim-treesitter', config = 'treesitter', cond = use_ts}
52 | Plug {'nvim-treesitter/playground', on = 'TSPlaygroundToggle', cond = use_ts}
53 | Plug {'windwp/nvim-ts-autotag', cond = use_ts}
54 |
55 | -- }}}
56 |
57 | -- Theme: {{{
58 |
59 | Plug 'windwp/wind-colors'
60 | Plug {'morhetz/gruvbox', opt = false}
61 | -- }}}
62 |
63 | -- File: {{{
64 | local use_icon = vim.g.wind_use_icon == 1
65 | Plug {'vifm/vifm.vim', on = 'Vifm', }
66 | Plug {'lambdalisue/fern.vim', config = 'fern.vim', key = {"", "F"}}
67 | Plug {'windwp/fern-renderer-nerdfont.vim', branch = 'devicon', cond = use_icon, manual = true }
68 | Plug {'lambdalisue/glyph-palette.vim', cond = use_icon, manual = true}
69 |
70 | -- Plug {'tamago324/lir.nvim', config = 'lir'}
71 | Plug {'kyazdani42/nvim-web-devicons', config = 'web-devicons', cond = use_icon}
72 | -- }}}
73 |
74 |
75 | -- statusline {{{
76 |
77 | Plug {'vimpostor/vim-tpipeline', cond = vim.g.wind_tmux_line == 1}
78 | --}}}
79 |
80 |
81 | -- Filetype {{{
82 | Plug {'neoclide/jsonc.vim' , ft = 'json'}
83 | Plug {'plasticboy/vim-markdown' , ft = 'markdown'}
84 | Plug {'leafOfTree/vim-svelte-plugin' , ft = 'svelte'}
85 | Plug {'fatih/vim-go' , ft = 'go'}
86 | -- }}}
87 |
88 | -- Others: {{{
89 |
90 | Plug {'windwp/nvim-autopairs', config = 'autopairs', event = "InsertEnter"}
91 | Plug {'windwp/nvim-autospace', event = "BufRead"}
92 | Plug {'windwp/nvim-spectre', config = 'spectre'}
93 | Plug {'ojroques/vim-oscyank', config = 'oscyank', on = "OSCYank"}
94 | Plug {'mizlan/iswap.nvim', config = 'iswap', on = 'ISwapWith'}
95 | Plug 'tpope/vim-commentary'
96 | Plug 'tpope/vim-repeat'
97 |
98 | Plug 'norcalli/nvim-colorizer.lua'
99 | Plug {'AndrewRadev/switch.vim', on = 'Switch'} -- toggle between true or false
100 | Plug {'voldikss/vim-floaterm', before = 'vim-floaterm.vim', on = "FloatermToggle"}
101 | Plug {'mg979/vim-visual-multi', before = 'vim-visual-multi.vim', key = ""}
102 | Plug {'skywind3000/asyncrun.vim', on="AsyncRun" }
103 | Plug {'pwntester/octo.nvim' , config = 'octo' , on = "Octo"}
104 | Plug {'folke/lsp-trouble.nvim', config = 'lsp-trouble' , on = 'LspTroubleOpen'}
105 | Plug {'sindrets/diffview.nvim', on = 'DiffviewOpen'}
106 | Plug {'folke/which-key.nvim', config = 'which-key'}
107 |
108 | Plug 'godlygeek/tabular' --" Markdown Tables
109 | Plug {'mbbill/undotree', on="UndotreeShow"} --" undo tree
110 | Plug 'djoshea/vim-autoread' --" auto update after save outside vim
111 | Plug {'machakann/vim-sandwich', event = "BufRead"}
112 | Plug 'obxhdx/vim-auto-highlight' --" highlight current world
113 |
114 | Plug {'lukas-reineke/indent-blankline.nvim', cond = vim.g.wind_use_indent == 1, config = "indent-blankline"}
115 | -- better match pairs and it can disable on insert mode
116 | Plug {'andymass/vim-matchup', config = 'matchup'}
117 | Plug {'hrsh7th/vim-eft', config = 'eft'} -- hight light character on ft key
118 | -- Plug {'dstein64/vim-startuptime' }
119 |
120 | -- }}}
121 |
122 |
123 | plug.load_config()
124 |
125 | Wind.load_plug('_end')
126 |
--------------------------------------------------------------------------------
/plug/fern.vim:
--------------------------------------------------------------------------------
1 | " https://github.com/lambdalisue/fern.vim/blob/master/doc/fern.txt
2 | " Disable netrw.
3 | packadd fern-renderer-nerdfont.vim
4 | packadd glyph-palette.vim
5 |
6 | let g:fern#renderer = "nerdfont"
7 | augroup my-fern-hijack
8 | autocmd!
9 | autocmd BufEnter * ++nested call s:hijack_directory()
10 | augroup END
11 |
12 | function! s:hijack_directory() abort
13 | let path = expand('%:p')
14 | if !isdirectory(path)
15 | return
16 | endif
17 | bwipeout %
18 | execute printf('Fern %s', fnameescape(path))
19 | endfunction
20 |
21 | " Custom settings and mappings.
22 | let g:fern#disable_default_mappings = 1
23 | let g:fern#default_hidden=1
24 | let g:fern#autoclose=1
25 | let g:fern#hide_cursor=1
26 |
27 | let g:fern#keepalt_on_edit=1
28 | let g:fern#disable_drawer_auto_winfixwidth=0
29 |
30 | noremap F :let g:fern#autoclose=0:let g:fern#open_buffer=bufnr('%'):keepalt Fern %:h -reveal=%:p
31 | noremap :let g:fern#autoclose=1 Fern . -drawer -reveal=% -toggle =
32 |
33 | function! s:closeFern(target) abort
34 | if a:target == "split"
35 | execute "normal \(fern-action-open:split)"
36 | elseif a:target== "vsplit"
37 | execute "normal \(fern-action-open:vsplit)"
38 | else
39 | execute "normal \(fern-action-open)"
40 | endif
41 | if g:fern#autoclose ==0
42 | execute "FernDo close -drawer -stay"
43 | endif
44 | endfunction
45 |
46 | function! s:DownloadFile() abort
47 | execute "normal \(fern-action-yank:path)"
48 | let l:text=getreg('+')
49 | echom " . l:text: ".l:text
50 | execute "AsyncRunSilent cpdragon " . l:text
51 | endfunction
52 |
53 | function! s:quitFern() abort
54 | execute ":buffer " . g:fern#open_buffer
55 | endfunction
56 |
57 | function! FernInit() abort
58 | nmap (fern-my-open-and-close) :call closeFern("")
59 | nmap (fern-my-open-and-close:split) :call closeFern("split")
60 | nmap (fern-my-open-and-close:vsplit) :call closeFern("vsplit")
61 | nmap
62 | \ (fern-my-open-expand-collapse)
63 | \ fern#smart#leaf(
64 | \ "\(fern-my-open-and-close)",
65 | \ "\(fern-action-expand)",
66 | \ "\(fern-action-collapse)",
67 | \ )
68 | nmap l (fern-my-open-expand-collapse)
69 | nmap h (fern-action-collapse)
70 | nmap (fern-my-open-expand-collapse)
71 | nmap <2-LeftMouse> (fern-my-open-expand-collapse)
72 | nmap u
73 | nmap n (fern-action-new-path)
74 | " nnoremap n n
75 | nmap dd (fern-action-remove)
76 | nmap yn (fern-action-yank:label)
77 | nmap yf (fern-action-yank:path)
78 |
79 | nmap cm (fern-action-clipboard-move)
80 | nmap cp (fern-action-clipboard-paste)
81 | nmap