vim tips for D development

simendsjo simendsjo at gmail.com
Mon Feb 20 01:11:26 PST 2012


On Sun, 19 Feb 2012 23:02:21 +0100, Kiith-Sa <42 at theanswer.com> wrote:

> On Sunday, 19 February 2012 at 20:09:58 UTC, simendsjo wrote:
>> On Sun, 19 Feb 2012 17:00:37 +0100, Kiith-Sa <42 at theanswer.com> wrote:
>>
>>
>> Thanks. supertab and autoComplPop seems really nice.
>>
>> A couple of other stuff to add to the list:
>> surround, delimitMate
>> and "smart semicolon" in .vimrc: inoremap <leader>; <C-o>A;<cr>
>>
>> It would be great if you could share your snippet file even if it's  
>> quite specific for your projects. Would be great even if only serving  
>> as an example.
>
> I removed project-specific stuff and uploaded it to GitHub:
>
> https://github.com/kiith-sa/D-SnipMate
>

Thanks! I see we have added much of the same stuff. I was hoping you had  
found a way to avoid all the duplication, which I see you haven't  
unfortunally.
I have stuff like the following in my file.
absolutely horrible duplication

# TRY/CATCH/FINALLY
snippet tn
	throw new ${1}Exception(${2:"error"});
	${3}
snippet try
	try
	{
		${1:static assert(false);}
	}
snippet catch
	catch(${1}Exception ${2:ex})
	{
		${3:static assert(false, "$1Exception not handled");}
	}
snippet finally
	finally
	{
		${1:static assert(false, "finally not implemented.");}
	}
snippet tc
	try
		${1:static assert(false)};
	catch(${2}Exception ${3:ex})
		${4:static assert(false)};
	${5}
snippet tcb
	try
	{
		${1:static assert(false);}
	}
	catch(${2}Exception ${3:ex})
	{
		${4:static assert(false);}
	}
	${5}
snippet tf
	try
		${1:static assert(false)};
	finally
		${2:static assert(false)};
	${3}
snippet tcf
	try
		${1:static assert(false)};
	catch(${2}Exception ${3:ex})
		${4:static assert(false)};
	finally
		${5:static assert(false)};
	${6}
snippet tcfb
	try
	{
		${1:static assert(false);}
	}
	catch(${2}Exception ${3:ex})
	{
		${4:static assert(false);}
	}
	finally
	{
		${5:static assert(false);}
	}


More information about the Digitalmars-d-learn mailing list