From: Jannik ZANDER Date: Wed, 1 Aug 2018 20:46:09 +0000 (+0200) Subject: Add vim-javascript X-Git-Url: https://git.zndr.dk/?a=commitdiff_plain;h=5db8d29b808fb9d279aa9698b7ff542bdf5dbadb;p=dotfiles.git Add vim-javascript --- diff --git a/.config/mimeapps.list b/.config/mimeapps.list index 5d002bb..b0f58bf 100644 --- a/.config/mimeapps.list +++ b/.config/mimeapps.list @@ -244,3 +244,5 @@ x-scheme-handler/http=firefox.desktop; x-scheme-handler/https=firefox.desktop; text/html=firefox.desktop; x-scheme-handler/sms=org.gnome.Shell.Extensions.GSConnect.desktop; +inode/directory=meld.desktop; +application/javascript=gvim.desktop; diff --git a/.gitmodules b/.gitmodules index 372e317..cd54ecf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -58,3 +58,6 @@ [submodule ".vim/pack/github/opt/pick.vim"] path = .vim/pack/github/opt/pick.vim url = https://github.com/calleerlandsson/pick.vim.git +[submodule ".vim/pack/github/opt/vim-javascript"] + path = .vim/pack/github/opt/vim-javascript + url = https://github.com/pangloss/vim-javascript diff --git a/.vim/pack/github/opt/gtags-cscope/plugin/gtags-cscope.vim b/.vim/pack/github/opt/gtags-cscope/plugin/gtags-cscope.vim new file mode 100644 index 0000000..3b6ab11 --- /dev/null +++ b/.vim/pack/github/opt/gtags-cscope/plugin/gtags-cscope.vim @@ -0,0 +1,273 @@ +" File: gtags-cscope.vim +" Author: Tama Communications Corporation +" Version: 0.4.1 +" Last Modified: September 10, 2014 +" +" Copyright and license +" --------------------- +" Copyright (c) 2010, 2011 Tama Communications Corporation +" +" This file is part of GNU GLOBAL. +" +" This program is free software: you can redistribute it and/or modify +" it under the terms of the GNU General Public License as published by +" the Free Software Foundation, either version 3 of the License, or +" (at your option) any later version. +" +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this program. If not, see . +" +" Overview +" -------- +" The gtags-cscope.vim plugin script integrates the GNU GLOBAL source code tagging system +" with Vim using cscope interface. +" +" Installation +" ------------ +" Drop the file in your plugin directory or source it from your vimrc. +" To use this script, you need the GNU GLOBAL-5.8 or later installed +" in your machine. +" +" Usage +" ----- +" First of all, you must execute gtags(1) at the root of source directory +" to make tag files. Assuming that your source directory is '/var/src', +" it is neccessary to execute the following commands. +" +" [Load vim] +" $ cd /var/src +" $ gtags +" $ vim +" [Load gtags-cscope] +" :GtagsCscope (in vim command line) +" +" Basic command +" ------------- +" Then you can use cs commands except for the 'd'(2) command. +" Profitable commands are assigned to keys like follows: +" +" explanation command +" ---------------------------------------------------------- +" Find symbol :cs find 0 or s +" Find definition :cs find 1 or g +" Find functions called by this function (not implemented) +" Find reference :cs find 3 or c +" Find text string :cs find 4 or t +" Find egrep pattern :cs find 6 or e +" Find path :cs find 7 or f +" Find include file :cs find 8 or i +" +" You can move tag list using: +" Go to the next tag :tn +" Go to the previous tag :tp +" Pop tag stack :pop +" +" About the other tag command, you can see the help like this: +" +" :h tagsrch +" +" Enhancing command +" ----------------- +" You can use the context jump function. To use this function, put the cursor +" on a word and type . +" If you can use mouse then please double click on the left button. +" To pop tag, please type 'g' and click on the right button. +" +" Configure +" --------- +" You can use the following variables in $HOME/.vimrc. +" +" To use the default key/mouse mapping: +" let GtagsCscope_Auto_Map = 1 +" To ignore letter case when searching: +" let GtagsCscope_Ignore_Case = 1 +" To use absolute path name: +" let GtagsCscope_Absolute_Path = 1 +" To deterring interruption: +" let GtagsCscope_Keep_Alive = 1 +" If you hope auto loading: +" let GtagsCscope_Auto_Load = 1 +" To use 'vim -t ', ':tag' and '' +" set cscopetag +" +if exists("loaded_gtags_cscope") + finish +endif +if !has("cscope") + echohl WarningMsg | + \ echomsg 'Gtags-cscope: ' . 'This vim does not include cscope support.' | + \ echohl None + finish +endif +" +" global command name +" +let s:global_command = $GTAGSGLOBAL +if s:global_command == '' + let s:global_command = "global" +endif +if !exists("GtagsCscope_Auto_Load") + let GtagsCscope_Auto_Load = 0 +endif +if !exists("GtagsCscope_Auto_Map") + let GtagsCscope_Auto_Map = 0 +endif +if !exists("GtagsCscope_Use_Old_Key_Map") + let GtagsCscope_Use_Old_Key_Map = 0 +endif +if !exists("GtagsCscope_Quiet") + let GtagsCscope_Quiet = 0 +endif +if !exists("GtagsCscope_Ignore_Case") + let GtagsCscope_Ignore_Case = 0 +endif +if !exists("GtagsCscope_Absolute_Path") + let GtagsCscope_Absolute_Path = 0 +endif +if !exists("GtagsCscope_Keep_Alive") + let GtagsCscope_Keep_Alive = 0 +endif + +" +" Display error message. +" +function! s:Error(msg) + if (g:GtagsCscope_Quiet == 0) + echohl WarningMsg | + \ echomsg 'Gtags-cscope: ' . a:msg | + \ echohl None + endif +endfunction + +function! s:GtagsCscope_GtagsRoot() + let cmd = s:global_command . " -pq" + let cmd_output = system(cmd) + if v:shell_error != 0 + if v:shell_error == 3 + call s:Error('GTAGS not found.') + else + call s:Error('global command failed. command line: ' . cmd) + endif + return '' + endif + return strpart(cmd_output, 0, strlen(cmd_output) - 1) +endfunction + +function! s:GtagsCscope() + " + " Get gtagsroot directory. + " + let gtagsroot = s:GtagsCscope_GtagsRoot() + if gtagsroot == '' + return + endif + " + " Load gtags-cscope. + " + set csprg=gtags-cscope + let s:command = "cs add " . gtagsroot . "/GTAGS" + let s:option = '' + if g:GtagsCscope_Ignore_Case == 1 + let s:option = s:option . 'C' + endif + if g:GtagsCscope_Absolute_Path == 1 + let s:option = s:option . 'a' + endif + if g:GtagsCscope_Keep_Alive == 1 + let s:option = s:option . 'i' + endif + if s:option != '' + let s:command = s:command . ' . -' . s:option + endif + set nocscopeverbose + exe s:command + set cscopeverbose + " + " Key mapping + " + if g:GtagsCscope_Auto_Map == 1 + if g:GtagsCscope_Use_Old_Key_Map == 1 + " normal command + :nmap s :cs find s =expand("") + :nmap t :cs find g =expand("") + :nmap r :cs find c =expand("") + :nmap g :cs find e =expand("") + :nmap P :cs find f + " Using 'CTRL-spacebar', the result is displayed in new horizontal window. + :nmap s :scs find s =expand("") + :nmap t :scs find g =expand("") + :nmap r :scs find c =expand("") + :nmap g :scs find e =expand("") + :nmap P :scs find f + " Hitting CTRL-space *twice*, the result is displayed in new vertical window. + :nmap s :vert scs find s =expand("") + :nmap t :vert scs find g =expand("") + :nmap r :vert scs find c =expand("") + :nmap g :vert scs find e =expand("") + :nmap P :vert scs find f + else + " + " The following key mappings are derived from 'cscope_maps.vim'. + " (The 'd' command is not implemented in gtags-cscope.) + " + " normal command + :nmap s :cs find s =expand("") + :nmap g :cs find g =expand("") + :nmap c :cs find c =expand("") + :nmap t :cs find t =expand("") + :nmap e :cs find e =expand("") + :nmap f :cs find f =expand("") + :nmap i :cs find i =expand("") + ":nmap d :cs find d =expand("") + " Using 'CTRL-spacebar', the result is displayed in new horizontal window. + :nmap s :scs find s =expand("") + :nmap g :scs find g =expand("") + :nmap c :scs find c =expand("") + :nmap t :scs find t =expand("") + :nmap e :scs find e =expand("") + :nmap f :scs find f =expand("") + :nmap i :scs find i =expand("") + ":nmap d :scs find d =expand("") + " Hitting CTRL-space *twice*, the result is displayed in new vertical window. + :nmap s :vert scs find s =expand("") + :nmap g :vert scs find g =expand("") + :nmap c :vert scs find c =expand("") + :nmap t :vert scs find t =expand("") + :nmap e :vert scs find e =expand("") + :nmap f :vert scs find f =expand("") + :nmap i :vert scs find i =expand("") + ":nmap d :vert scs find d =expand("") + endif + " tag command + :nmap :tn + :nmap :tp + :nmap :cn + :nmap :cp + " Context search. See the --from-here option of global(1). + :nmap :cs find d =expand(""):=line('.'):% + :nmap <2-LeftMouse> :cs find d =expand(""):=line('.'):% + :nmap g :cs find d =expand(""):=line('.'):% + :nmap :cs find d =expand(""):=line('.'):% + " The following mappings are unnecessary, because you can use the default mapping. + ":nmap g + ":nmap + " Short cut key + :nmap :cs find + :nmap :scs find + :nmap :vert scs find + :nmap :copen + :nmap :cs find d =expand(""):=line('.'):% + :nmap :cclose + endif +endfunction + +if g:GtagsCscope_Auto_Load == 1 + call s:GtagsCscope() +endif +command! -nargs=0 GtagsCscope call s:GtagsCscope() +let loaded_gtags_cscope = 1 diff --git a/.vim/pack/github/opt/vim-javascript b/.vim/pack/github/opt/vim-javascript new file mode 160000 index 0000000..39e332a --- /dev/null +++ b/.vim/pack/github/opt/vim-javascript @@ -0,0 +1 @@ +Subproject commit 39e332a3c36c0115e1eab85c34cf121b7585869d diff --git a/.vim/pack/gnu/opt/gtags-cscope/plugin/gtags-cscope.vim b/.vim/pack/gnu/opt/gtags-cscope/plugin/gtags-cscope.vim deleted file mode 100644 index 3b6ab11..0000000 --- a/.vim/pack/gnu/opt/gtags-cscope/plugin/gtags-cscope.vim +++ /dev/null @@ -1,273 +0,0 @@ -" File: gtags-cscope.vim -" Author: Tama Communications Corporation -" Version: 0.4.1 -" Last Modified: September 10, 2014 -" -" Copyright and license -" --------------------- -" Copyright (c) 2010, 2011 Tama Communications Corporation -" -" This file is part of GNU GLOBAL. -" -" This program is free software: you can redistribute it and/or modify -" it under the terms of the GNU General Public License as published by -" the Free Software Foundation, either version 3 of the License, or -" (at your option) any later version. -" -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. -" -" You should have received a copy of the GNU General Public License -" along with this program. If not, see . -" -" Overview -" -------- -" The gtags-cscope.vim plugin script integrates the GNU GLOBAL source code tagging system -" with Vim using cscope interface. -" -" Installation -" ------------ -" Drop the file in your plugin directory or source it from your vimrc. -" To use this script, you need the GNU GLOBAL-5.8 or later installed -" in your machine. -" -" Usage -" ----- -" First of all, you must execute gtags(1) at the root of source directory -" to make tag files. Assuming that your source directory is '/var/src', -" it is neccessary to execute the following commands. -" -" [Load vim] -" $ cd /var/src -" $ gtags -" $ vim -" [Load gtags-cscope] -" :GtagsCscope (in vim command line) -" -" Basic command -" ------------- -" Then you can use cs commands except for the 'd'(2) command. -" Profitable commands are assigned to keys like follows: -" -" explanation command -" ---------------------------------------------------------- -" Find symbol :cs find 0 or s -" Find definition :cs find 1 or g -" Find functions called by this function (not implemented) -" Find reference :cs find 3 or c -" Find text string :cs find 4 or t -" Find egrep pattern :cs find 6 or e -" Find path :cs find 7 or f -" Find include file :cs find 8 or i -" -" You can move tag list using: -" Go to the next tag :tn -" Go to the previous tag :tp -" Pop tag stack :pop -" -" About the other tag command, you can see the help like this: -" -" :h tagsrch -" -" Enhancing command -" ----------------- -" You can use the context jump function. To use this function, put the cursor -" on a word and type . -" If you can use mouse then please double click on the left button. -" To pop tag, please type 'g' and click on the right button. -" -" Configure -" --------- -" You can use the following variables in $HOME/.vimrc. -" -" To use the default key/mouse mapping: -" let GtagsCscope_Auto_Map = 1 -" To ignore letter case when searching: -" let GtagsCscope_Ignore_Case = 1 -" To use absolute path name: -" let GtagsCscope_Absolute_Path = 1 -" To deterring interruption: -" let GtagsCscope_Keep_Alive = 1 -" If you hope auto loading: -" let GtagsCscope_Auto_Load = 1 -" To use 'vim -t ', ':tag' and '' -" set cscopetag -" -if exists("loaded_gtags_cscope") - finish -endif -if !has("cscope") - echohl WarningMsg | - \ echomsg 'Gtags-cscope: ' . 'This vim does not include cscope support.' | - \ echohl None - finish -endif -" -" global command name -" -let s:global_command = $GTAGSGLOBAL -if s:global_command == '' - let s:global_command = "global" -endif -if !exists("GtagsCscope_Auto_Load") - let GtagsCscope_Auto_Load = 0 -endif -if !exists("GtagsCscope_Auto_Map") - let GtagsCscope_Auto_Map = 0 -endif -if !exists("GtagsCscope_Use_Old_Key_Map") - let GtagsCscope_Use_Old_Key_Map = 0 -endif -if !exists("GtagsCscope_Quiet") - let GtagsCscope_Quiet = 0 -endif -if !exists("GtagsCscope_Ignore_Case") - let GtagsCscope_Ignore_Case = 0 -endif -if !exists("GtagsCscope_Absolute_Path") - let GtagsCscope_Absolute_Path = 0 -endif -if !exists("GtagsCscope_Keep_Alive") - let GtagsCscope_Keep_Alive = 0 -endif - -" -" Display error message. -" -function! s:Error(msg) - if (g:GtagsCscope_Quiet == 0) - echohl WarningMsg | - \ echomsg 'Gtags-cscope: ' . a:msg | - \ echohl None - endif -endfunction - -function! s:GtagsCscope_GtagsRoot() - let cmd = s:global_command . " -pq" - let cmd_output = system(cmd) - if v:shell_error != 0 - if v:shell_error == 3 - call s:Error('GTAGS not found.') - else - call s:Error('global command failed. command line: ' . cmd) - endif - return '' - endif - return strpart(cmd_output, 0, strlen(cmd_output) - 1) -endfunction - -function! s:GtagsCscope() - " - " Get gtagsroot directory. - " - let gtagsroot = s:GtagsCscope_GtagsRoot() - if gtagsroot == '' - return - endif - " - " Load gtags-cscope. - " - set csprg=gtags-cscope - let s:command = "cs add " . gtagsroot . "/GTAGS" - let s:option = '' - if g:GtagsCscope_Ignore_Case == 1 - let s:option = s:option . 'C' - endif - if g:GtagsCscope_Absolute_Path == 1 - let s:option = s:option . 'a' - endif - if g:GtagsCscope_Keep_Alive == 1 - let s:option = s:option . 'i' - endif - if s:option != '' - let s:command = s:command . ' . -' . s:option - endif - set nocscopeverbose - exe s:command - set cscopeverbose - " - " Key mapping - " - if g:GtagsCscope_Auto_Map == 1 - if g:GtagsCscope_Use_Old_Key_Map == 1 - " normal command - :nmap s :cs find s =expand("") - :nmap t :cs find g =expand("") - :nmap r :cs find c =expand("") - :nmap g :cs find e =expand("") - :nmap P :cs find f - " Using 'CTRL-spacebar', the result is displayed in new horizontal window. - :nmap s :scs find s =expand("") - :nmap t :scs find g =expand("") - :nmap r :scs find c =expand("") - :nmap g :scs find e =expand("") - :nmap P :scs find f - " Hitting CTRL-space *twice*, the result is displayed in new vertical window. - :nmap s :vert scs find s =expand("") - :nmap t :vert scs find g =expand("") - :nmap r :vert scs find c =expand("") - :nmap g :vert scs find e =expand("") - :nmap P :vert scs find f - else - " - " The following key mappings are derived from 'cscope_maps.vim'. - " (The 'd' command is not implemented in gtags-cscope.) - " - " normal command - :nmap s :cs find s =expand("") - :nmap g :cs find g =expand("") - :nmap c :cs find c =expand("") - :nmap t :cs find t =expand("") - :nmap e :cs find e =expand("") - :nmap f :cs find f =expand("") - :nmap i :cs find i =expand("") - ":nmap d :cs find d =expand("") - " Using 'CTRL-spacebar', the result is displayed in new horizontal window. - :nmap s :scs find s =expand("") - :nmap g :scs find g =expand("") - :nmap c :scs find c =expand("") - :nmap t :scs find t =expand("") - :nmap e :scs find e =expand("") - :nmap f :scs find f =expand("") - :nmap i :scs find i =expand("") - ":nmap d :scs find d =expand("") - " Hitting CTRL-space *twice*, the result is displayed in new vertical window. - :nmap s :vert scs find s =expand("") - :nmap g :vert scs find g =expand("") - :nmap c :vert scs find c =expand("") - :nmap t :vert scs find t =expand("") - :nmap e :vert scs find e =expand("") - :nmap f :vert scs find f =expand("") - :nmap i :vert scs find i =expand("") - ":nmap d :vert scs find d =expand("") - endif - " tag command - :nmap :tn - :nmap :tp - :nmap :cn - :nmap :cp - " Context search. See the --from-here option of global(1). - :nmap :cs find d =expand(""):=line('.'):% - :nmap <2-LeftMouse> :cs find d =expand(""):=line('.'):% - :nmap g :cs find d =expand(""):=line('.'):% - :nmap :cs find d =expand(""):=line('.'):% - " The following mappings are unnecessary, because you can use the default mapping. - ":nmap g - ":nmap - " Short cut key - :nmap :cs find - :nmap :scs find - :nmap :vert scs find - :nmap :copen - :nmap :cs find d =expand(""):=line('.'):% - :nmap :cclose - endif -endfunction - -if g:GtagsCscope_Auto_Load == 1 - call s:GtagsCscope() -endif -command! -nargs=0 GtagsCscope call s:GtagsCscope() -let loaded_gtags_cscope = 1 diff --git a/.vim/vimrc b/.vim/vimrc index 735d2e3..a77c5a9 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -352,7 +352,6 @@ let g:completor_clang_tidy_binary = '/usr/bin/run-clang-tidy' let g:validator_c_checkers = ['clang-tidy'] let g:validator_cpp_checkers = ['clang-tidy'] - " Pandoc packadd vim-pandoc packadd vim-pandoc-syntax @@ -364,6 +363,9 @@ nnoremap b :call PickBuffer() nnoremap ] :call PickTag() let g:pick_height = 10 +" javascript +packadd vim-javascript + packloadall silent! helptags ALL