Showing entries 1 to 5
Displaying posts with tag: vim (reset)
Add Gedit Plugins

Fedora comes with vim and gedit installed but the gedit installation is bare bones. You can update gedit to include supplemental Plug-ins with the following yum command as the root user:

yum install -y gedit-plugins

It generates the following log file:

Loaded plugins: langpacks, refresh-packagekit
mysql-connectors-community                                  | 2.5 kB  00:00     
mysql-tools-community                                       | 2.5 kB  00:00     
mysql56-community                                           | 2.5 kB  00:00     
pgdg93                                                      | 3.6 kB  00:00     
updates/20/x86_64/metalink                                  |  14 kB  00:00     
updates                                                     | 4.9 kB  00:00 …
[Read more]
Executing MySQL queries within VIM

I haven’t been using vim for very long, but I’ve gotten over the initial learning curve of getting used to the different editing modes. With some help from the guys in #vim on, I managed to get this gem:

map <C-d> :call SwitchDB()<CR>
:function SwitchDB()
: let g:current_db = input("Database > ")

map <C-m> :call Doquery()<CR>
:function Doquery()
: if !exists("g:current_db")
: call SwitchDB()
: endif
: let query_string = input(g:current_db . " > " )
: if query_string != ""
: exe "!mysql " . g:current_db . " -e \"" . escape(query_string, '"') . "\""
: endif

Control-m to execute a query. Control-d to switch databases. It’ll prompt you the first time.

How To Add A File Extension To vim Syntax Highlighting

Today I was asked a question about defining custom extensions for vim syntax highlighting such that, for example, vim would know that example.lmx is actually of type xml and apply xml syntax highlighting to it. I know vim already automatically does it not just based on extension but by looking for certain strings inside the text, like <?xml but what if my file doesn't have such strings?

After digging around I found the solution. Add the following to ~/.vimrc (the vim configuration file):

syntax on
filetype on
au BufNewFile,BufRead *.lmx set filetype=xml

After applying it, my .lmx file is highlighted:

[Read more]
Trip to Zurich

I spent Thursday and Friday in Zurich, Switzerland visiting my friends Marcus and Caitlin and attending the Google Open Source Jam.

On Thursday, I arrived in the early afternoon in Zurich. Getting to Zurich from Siegburg is easy and takes less than five hours as there is a direct ICE connection to Basel and from there it is just one more stop with an …

[Read more]
MySQL syntax highlighting in Vim

I didn't know such a thing exists.

kostja@bodhi:/usr/share/vim/vim70/syntax> ls -al mysql.vim 
-rw-r--r-- 1 root root 16078 2006-05-24 20:16 mysql.vim

kostja@bodhi:/usr/share/vim/vim70/syntax> head -7 mysql.vim 
" Vim syntax file
" Language:     mysql
" Maintainer:   Kenneth J. Pronovici <>
" Last Change:  $Date: 2004/06/13 20:12:39 $
" Filenames:    *.mysql
" URL:
" Note:         The definitions below are taken from the mysql user manual as of April 2002, for version 3.23

To enable it in the editor:

:set filetype=mysql

Or, in your .vimrc to highlight all .sql and .test files:

if has("autocmd")
        autocmd BufRead *.sql set filetype=mysql      
        autocmd BufRead *.test set filetype=mysql
Showing entries 1 to 5