vim filetype plugin conflict with session - session

Problem
When I restore from a session, It'll be impossible for to load my filetype plugin.
For example, I have an arduino filetype plugin of ~/.vim/ftplugin/arduino.vim, and the content is like this.
SyntasticToggleMode
call feedkeys("\<CR>")
nnoremap <leader>s :w<cr>:ArduinoVerify<cr>
nnoremap M :ArduinoUpload<cr>
I create an arduino file named test.ino to do some coding.
Every thing seems pretty smooth.
The filetype plugin is loaded properly.
Then I close vim with the following commands.
:mksession!
:wviminfo viminfo
:qa
Now there is a session file named Session.vim.
Then I open vim again, and it automatically load the session because I have something like this in my .vimrc.
filetype indent plugin on
if filereadable("Session.vim")
source Session.vim
endif
if filereadable("viminfo")
rviminfo viminfo
endif
Now something went wrong, the key mapping in my arduino filetype plugin is not working.
Also it prints some error message like this.
Error detected while processing /home/lotp/.vim/ftplugin/arduino.vim:
line 1:
E492: Not an editor command: SyntasticToggleMode"sketch_dec06a.ino" "sketch_dec06a.ino" 12L, 150C
E492: Not an editor command: SyntasticToggleMode
IndeedSyntasticToggleMode is a valid vim command belonging to a vim plugin named syntastic.
Question
Is there a solution to solve this problem?
By this I mean using the session and filetype plugin feather simultaneously.

A partial answer:
The plugins are not loaded directly in .vimrc if you use a plugin manager. Their paths are just appended to 'runtimepath', and they are sourced later in the initialisation process.
You can try to add (i.e. in .vimrc) your own custom path to runtimepath, AFTER the end of the plugin initialisation. (i.e., for Vundle, after this line: call vundle#end()) Then add a vim file in your_custom_path/plugin where you put your code to source the session file.
I didn't check all the infos I gave, so sorry for mistakes, but hope it gives you some ideas.
See :h startup, :h 'runtimepath'

Finally I work around this problem by using an vim plugin.
That's somekind of improved version of the built in vim session system
It's called vim-session

Related

Vim Vundle installation on windows: unknown function vundle#begin

I am a beginner with Vim and I am trying to install Vundle for plugin management. However I keep getting the same error when I open gVim:
Error detected while processing C:\Users\jacob\Vim\_vimrc:
line 5:
E117: Unknown function: vundle#begin
line 7:
E492: Not an editor command: Plugin 'VundleVim/Vundle.vim'
line 9:
E117: Unknown function: vundle#end
I am working on windows 10 and this is how my _vimrc file looks like:
set nocompatible
filetype off
set rtp+=$HOME/.vim/bundle/Vundle.vim/
call vundle#begin('$HOME/.vim/bundle/')
Plugin 'VundleVim/Vundle.vim'
call vundle#end() " required
filetype plugin indent on " required
Perhaps a bit on the late side, but I also received the same error.
After diagnosing what has happened I came to the following problem and solution:
The problem is that using GIT to clone the files, this downloades the Vundle directory to the filepath: ~/vimfiles/bundle/Vundle.vim to the Windows home directory. the final filepath on Windows would then look like: C:\Users\User1~\vimfiles\bundle\Vundle.vim . However the _vimrc files is located under the directory C:\Users\User1\
The sollution is to copy the folder "vimfiles" to the user1 directory (exchange user1 for your own username). The final filepath for the Vundle files should then be C:\Users\User1\vimfiles\bundle\Vundle.vim .
Looks like you missed some steps of the installation, that would clone the Vundle git repository under the $HOME/.vim/bundle directory, creating a Vundle.vim subdirectory there which would have an autoload/vundle.vim which is where functions such as vundle#begin would be searched.
See the Quick Start guide for further instructions. In particular for your case, there's also a link to a quite detailed Windows setup document with many details on how to get the components you need to install Vundle.
You might also want to consider vim-plug as an alternative to Vundle. It's newer and actively maintained, while at the same time using a similar model to Vundle, supporting a similar set of commands and using similar configuration directives. It's also much easier to install, also on Windows. (It only needs a single file to be downloaded.)

Code analysis VB6 Project with CodeSmart via command line

im using CodeSmart 3.4.6.297 to get code metrics from my vb6 projects.
now i want to include codesmart in my build-process using TeamCity.
i know that codesmart can be user in the command line. this works for me. i have my command line.xml file:
<sourcemonitor_commands>
<write_log>true</write_log>
<command>
<project_file>Path to xyz.smproj</project_file>
<project_language>VB</project_language>
<modified_complexity>true</modified_complexity>
<file_extensions>*.cs,*.Designer.cs,*.frm</file_extensions>
<source_directory>Path to Project</source_directory>
<include_subdirectories>true</include_subdirectories>
<checkpoint_name>Baseline</checkpoint_name>
</command>
</sourcemonitor_commands>
which generates a projectXYZ.smproj file.
My question now is...
how do i export data (code metrics like lines of code) from this smproj file using a console command?
i can get code metrics when i open my projectXYZ.smproj file in the codesmart IDE and exporting data using the menue "file...export Checkpoint details" but i need this in a console command
Any ideas?
Greetings
SLimke
Got it myself. had to add an export area to the command block
<export>
<export_file>PathToProject\Checkpoint1.xml</export_file>
<export_type>2 (checkpoint details as XML)</export_type>
<export_option>1 (do not use any of the options set in the Options dialog)</export_option>
</export>

Make Geany recognize additional file extensions

My default Geany installation on Debian does not recognize some file types out of the box. How can I add extensions, using the same syntax highlighting as other known extensions for simplicity's sake?
In the current case, I'd like Geany to open all .aspx files with the same highlighting as .html files.
Use inside the menu Tools->Configuration files->filetype_extensions.conf. This will allow you to configure the filetypes based on suffix for your user.
Just add new extensions in /usr/local/share/geany/filetype_extensions.conf
I had trouble accomplishing this without help from here.
Go here to read documentation about this topic.
From the Geany menu, go to:
Tools > Configuration Files > filetype_extensions.conf
Go to this line and un-comment it:
#~ [Extensions]
So that it just reads:
[Extensions]
I was needing to add .mjs as an additional extension for javascript. So, for me, I also uncommented this line:
#~ Javascript=*.js;
And changed it to:
Javascript=*.js;*.mjs;
After this, I saved the file.
Now when I opened files having a .mjs file extension, they automatically have Javascript Syntax Highlighting.
I made some suggestions to improve this expeirience here.

Trouble installing Vim plugins on Mac Lion

I have unsuccessfully been trying to install some plugins for VIM for sometime. I have mostly been following the information in this reference. I've basically just been dropping the plugin files in various directories hoping something works, nothing has yet. I have a .vim directory at the following path:
/Users/{my_user_name}/.vim
I have tried adding my files to the directory above as well as a directory inside it called plugins. Can anyone suggest what I might be doing wrong?
When I enter
:help 'rtp'
I get
Unix: "$HOME/.vim,
$VIM/vimfiles,
$VIMRUNTIME,
$VIM/vimfiles/after,
$HOME/.vim/after"
Amiga: "home:vimfiles,
$VIM/vimfiles,
$VIMRUNTIME,
$VIM/vimfiles/after,
home:vimfiles/after"
PC, OS/2: "$HOME/vimfiles,
$VIM/vimfiles,
$VIMRUNTIME,
$VIM/vimfiles/after,
$HOME/vimfiles/after"
Macintosh: "$VIM:vimfiles,
$VIMRUNTIME,
$VIM:vimfiles:after"
The correct location is in a plugin subdirectory (not the plural plugins):
/Users/{my_user_name}/.vim/plugin/*.vim
You can check your actually used path with
:set rtp?
The trailing ? means query value, don't set. (:help rtp is just the general documentation, not what's actually used.)
The useful :scriptnames command will tell you what actually got sourced.
Note that all these instructions are valid for plain *.vim plugin scripts; some plugins are also distributed as (*.zip, or *.tar.gz) archives, or the Vim-specific Vimball (*.vba, *.vmb), which typically contain the subdirectory structure already.
For an hypothetical single-file plugin:
~/.vim/plugin/plugin.vim
For an hypothetical multi-file plugin:
~/.vim/autoload/plugin.vim
~/.vim/plugin/plugin.vim
~/.vim/doc/plugin.txt
If that hypothetical multi-file plugin comes with documentation, run the following command to add it to the :help index:
:helptags ~/.vim/doc
The :scriptnames shows you a list of sourced scripts.
Also, most plugins have some kind of README that details recommended installation procedures: read it.

Control Fujitsu Softune debugger

Is there a way to control the Fujitsu Softune debugger with an other application(e.g. Eclipse)? I think about sending the command mentioned in the documentation of Softune and parse the output, but also other approaches are welcome.
There is pluging for eclipse; file name is "FujitsuF2MC16_1.0.1.jar", look for it on this page:
http://www.mikrocontroller.net/topic/70413
Complile en debug in eclipse.
Hope this helps.
What do you mean by controlling the Fujitsu Softune debugger?
If what you want to do is to start a debugging session with your freshly-compiled .abs file, you can do the following.
In the Eclipse environment add a button or shortcut to call the make utility to make a debug:. Your makefile would have an entry like:
debug: $(make_vars)
# start debugger
make -f$(make_vars) -f$(make_dir)/$(cfg) cfg="$(cfg)" debug_session
In the make entry for debug_session you put something like:
echo UPDATING SOFTUNE-3 PROJECT FOR DEBUGGING;\
$(subst \,/,$(DIR_SOFTUNE_WORKBENCH))/bin/Fs907s.exe softune/E7x_proj.wsp 2>/dev/null;
I hope this was useful.

Resources